diff options
Diffstat (limited to 'svx')
44 files changed, 588 insertions, 575 deletions
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx index f347bf204ddb..3ae7a57633ac 100644 --- a/svx/inc/galbrws2.hxx +++ b/svx/inc/galbrws2.hxx @@ -147,14 +147,14 @@ private: public: - static String GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags ); + static OUString GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags ); public: GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery ); ~GalleryBrowser2(); - void SelectTheme( const String& rThemeName ); + void SelectTheme( const OUString& rThemeName ); GalleryBrowserMode GetMode() const { return meMode; } void SetMode( GalleryBrowserMode eMode ); @@ -164,7 +164,7 @@ public: void Travel( GalleryBrowserTravel eTravel ); INetURLObject GetURL() const; - String GetFilterName() const; + OUString GetFilterName() const; Graphic GetGraphic() const; sal_Int8 AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt ); diff --git a/svx/inc/galobj.hxx b/svx/inc/galobj.hxx index 8712b718cd54..cacf7be3e47d 100644 --- a/svx/inc/galobj.hxx +++ b/svx/inc/galobj.hxx @@ -60,12 +60,12 @@ protected: BitmapEx aThumbBmp; // Allow transparence to survive GDIMetaFile aThumbMtf; INetURLObject aURL; - String aUserName; - String aTitle; + OUString aUserName; + OUString aTitle; sal_Bool bIsValid; sal_Bool bIsThumbBmp; - virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; + virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const; virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); sal_Bool CreateThumb( const Graphic& rGraphic ); @@ -83,8 +83,8 @@ public: sal_Bool IsValid() const { return bIsValid; } sal_Bool IsThumbBitmap() const { return bIsThumbBmp; } - const String GetTitle() const; - void SetTitle( const String& rTitle ); + const OUString GetTitle() const; + void SetTitle( const OUString& rTitle ); friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj ); friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj ); @@ -98,7 +98,7 @@ private: GalSoundType eSoundType; - virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; + virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const; virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); virtual sal_uInt16 GetVersion() const { return 6; } @@ -124,7 +124,7 @@ private: sal_Bool CreateThumb( const FmFormModel& rModel ); - virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; + virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const; virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); virtual sal_uInt16 GetVersion() const { return 5; } @@ -145,7 +145,7 @@ private: void Init( const Graphic& rGraphic, const INetURLObject& rURL ); - virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; + virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const; virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); virtual sal_uInt16 GetVersion() const { return 5; } @@ -154,7 +154,7 @@ public: SgaObjectBmp(); SgaObjectBmp( const INetURLObject& rURL ); - SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat ); + SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormat ); virtual ~SgaObjectBmp() {}; virtual SgaObjKind GetObjKind() const { return SGA_OBJ_BMP; } @@ -169,7 +169,7 @@ private: public: SgaObjectAnim(); - SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName ); + SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName ); virtual ~SgaObjectAnim() {}; @@ -185,7 +185,7 @@ private: public: SgaObjectINet(); - SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName ); + SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName ); virtual ~SgaObjectINet() {}; diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx index bcc79e91a9cc..32b2f7e1b3cd 100644 --- a/svx/source/core/extedit.cxx +++ b/svx/source/core/extedit.cxx @@ -77,11 +77,11 @@ void ExternalToolEdit::threadWorker(void* pThreadData) xSystemShellExecute->execute( pData->m_aFileName, OUString(), SystemShellExecuteFlags::URIS_ONLY ); } -void ExternalToolEdit::Edit( GraphicObject* pGraphicObject ) +void ExternalToolEdit::Edit( rtl::Reference<GraphicObject>& rGraphicObject ) { //Get the graphic from the GraphicObject - m_pGraphicObject = pGraphicObject; - const Graphic aGraphic = pGraphicObject->GetGraphic(); + m_rGraphicObject = rGraphicObject; + const Graphic aGraphic = rGraphicObject->GetGraphic(); //get the Preferred File Extension for this graphic OUString fExtension; @@ -102,15 +102,15 @@ void ExternalToolEdit::Edit( GraphicObject* pGraphicObject ) GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); sal_uInt16 nFilter(rGraphicFilter.GetExportFormatNumber(fExtension)); - String aFilter(rGraphicFilter.GetExportFormatShortName(nFilter)); - String sPath(aTempFileName); + OUString aFilter(rGraphicFilter.GetExportFormatShortName(nFilter)); + OUString sPath(aTempFileName); // Write the Graphic to the file now XOutBitmap::WriteGraphic(aGraphic, sPath, aFilter, XOUTBMP_USE_NATIVE_IF_POSSIBLE | XOUTBMP_DONT_EXPAND_FILENAME); // There is a possiblity that sPath extnesion might have been changed if the // provided extension is not writable - m_aFileName = OUString(sPath); + m_aFileName = sPath; //Create a thread diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index 571fcbebba5f..4b7c38aae520 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -185,11 +185,9 @@ OUString GraphicHelper::ExportGraphic( const Graphic& rGraphic, const OUString& { nFilter = GRFILTER_FORMAT_DONTKNOW; } - OUString aFilter( rGraphicFilter.GetExportFormatShortName( nFilter ) ); + OUString sFilter( rGraphicFilter.GetExportFormatShortName( nFilter ) ); - String aFilterString( aFilter ); - String aPathString( sPath ); - XOutBitmap::WriteGraphic( rGraphic, aPathString, aFilterString, + XOutBitmap::WriteGraphic( rGraphic, sPath, sFilter, XOUTBMP_DONT_EXPAND_FILENAME | XOUTBMP_DONT_ADD_EXTENSION | XOUTBMP_USE_NATIVE_IF_POSSIBLE ); diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index c6bc3971ec7f..6961c5d34120 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -2191,13 +2191,13 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC { if ( nColorCount || rObj.GetBrightness() != 1.0 ) { - Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap()); + Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject()->GetGraphic().GetBitmapEx().GetBitmap()); aBitmap.Adjust( static_cast< short > ( GetLuminanceChange( std::min(nColorIndex, nColorCount-1)))); - rObj.SetMergedItem(XFillBitmapItem(String(), Graphic(aBitmap))); + rObj.SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(aBitmap))); } break; diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 010b037e7df5..ca10436985ee 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -495,7 +495,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con if ( bFillBmpTile ) { const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP); - aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); + aFillBmp = rBmpItm.GetGraphicObject()->GetGraphic().GetBitmapEx(); Size aLogicalSize = aFillBmp.GetPrefSize(); if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL ) aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM ); @@ -505,14 +505,14 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con aLogicalSize.Height() *= 5; aFillBmp.SetPrefSize( aLogicalSize ); aFillBmp.SetPrefMapMode( MAP_100TH_MM ); - p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); + p3DObj->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aFillBmp)))); } else { if ( aSnapRect != aBoundRect ) { const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP); - aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); + aFillBmp = rBmpItm.GetGraphicObject()->GetGraphic().GetBitmapEx(); Size aBmpSize( aFillBmp.GetSizePixel() ); double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth(); double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight(); @@ -523,7 +523,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con (sal_Int32)( aBmpSize.Height() * fYScale ) ); Rectangle aCropRect( aPt, aSize ); aFillBmp.Crop( aCropRect ); - p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); + p3DObj->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aFillBmp)))); } } pScene->Insert3DObj( p3DObj ); @@ -546,7 +546,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con if ( ( aLocalFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() ) { - p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); + p3DObj->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aFillBmp)))); } } else if ( aLocalFillStyle == XFILL_NONE ) diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index efc480ad4d1c..5320d685f0a6 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -41,7 +41,7 @@ using namespace com::sun::star::beans; CompressGraphicsDialog::CompressGraphicsDialog( Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings ) : ModalDialog ( pParent, "CompressGraphicDialog", "svx/ui/compressgraphicdialog.ui" ), m_pGraphicObj ( pGraphicObj ), - m_aGraphic ( pGraphicObj->GetGraphicObject().GetGraphic() ), + m_aGraphic ( pGraphicObj->GetGraphicObject()->GetGraphic() ), m_aViewSize100mm ( pGraphicObj->GetLogicRect().GetSize() ), m_rBindings ( rBindings ), m_dResolution ( 96.0 ) diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 76ba1b741635..2a5ab7eeddd7 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1366,7 +1366,7 @@ void BitmapLB::Fill( const XBitmapListRef &pList ) for(long i(0); i < nCount; i++) { pEntry = pList->GetBitmap(i); - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); + maBitmapEx = pEntry->GetGraphicObject()->GetGraphic().GetBitmapEx(); formatBitmapExToSize(maBitmapEx, aSize); InsertEntry(pEntry->GetName(), maBitmapEx); } @@ -1379,7 +1379,7 @@ void BitmapLB::Fill( const XBitmapListRef &pList ) void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry) { - maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + maBitmapEx = rEntry.GetGraphicObject()->GetGraphic().GetBitmapEx(); if(!maBitmapEx.IsEmpty()) { @@ -1399,7 +1399,7 @@ void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry) void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos) { RemoveEntry(nPos); - maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + maBitmapEx = rEntry.GetGraphicObject()->GetGraphic().GetBitmapEx(); if(!maBitmapEx.IsEmpty()) { @@ -1431,7 +1431,7 @@ void FillAttrLB::Fill( const XBitmapListRef &pList ) for(long i(0); i < nCount; i++) { pEntry = pList->GetBitmap( i ); - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); + maBitmapEx = pEntry->GetGraphicObject()->GetGraphic().GetBitmapEx(); formatBitmapExToSize(maBitmapEx, aSize); ListBox::InsertEntry(pEntry->GetName(), maBitmapEx); } diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx index 74ad3d111547..d06911db8344 100644 --- a/svx/source/dialog/grfflt.cxx +++ b/svx/source/dialog/grfflt.cxx @@ -33,9 +33,9 @@ // - SvxGraphicFilter - // -------------------- -sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject ) +sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, rtl::Reference<GraphicObject>* pFilterObject ) { - const Graphic& rGraphic = rFilterObject.GetGraphic(); + const Graphic& rGraphic = (*pFilterObject)->GetGraphic(); sal_uIntPtr nRet = SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE; if( rGraphic.GetType() == GRAPHIC_BITMAP ) @@ -273,7 +273,7 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj if( aGraphic.GetType() != GRAPHIC_NONE ) { - rFilterObject.SetGraphic( aGraphic ); + *pFilterObject = GraphicObject::Create(*pFilterObject, aGraphic ); nRet = SVX_GRAPHICFILTER_ERRCODE_NONE; } } diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index e2d816e3b91f..cbe54b5e485e 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -293,7 +293,7 @@ void GalleryBrowser1::ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec) // ----------------------------------------------------------------------------- -void GalleryBrowser1::ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew ) +void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew ) { DBG_ASSERT(!mpThemePropsDlgItemSet, "mpThemePropsDlgItemSet already set!"); mpThemePropsDlgItemSet = new SfxItemSet( SFX_APP()->GetPool() ); @@ -326,19 +326,17 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog if( nRet == RET_OK ) { - String aName( mpExchangeData->pTheme->GetName() ); + OUString aName( mpExchangeData->pTheme->GetName() ); - if( mpExchangeData->aEditedTitle.Len() && aName != mpExchangeData->aEditedTitle ) + if( !mpExchangeData->aEditedTitle.isEmpty() && aName != mpExchangeData->aEditedTitle ) { - const String aOldName( aName ); - String aTitle( mpExchangeData->aEditedTitle ); + const OUString aOldName( aName ); + OUString aTitle( mpExchangeData->aEditedTitle ); sal_uInt16 nCount = 0; while( mpGallery->HasTheme( aTitle ) && ( nCount++ < 16000 ) ) { - aTitle = mpExchangeData->aEditedTitle; - aTitle += ' '; - aTitle += OUString::number( nCount ); + aTitle = mpExchangeData->aEditedTitle + " " + OUString::number( nCount ); } mpGallery->RenameTheme( aOldName, aTitle ); @@ -351,7 +349,7 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog } } - String aThemeName( mpExchangeData->pTheme->GetName() ); + OUString aThemeName( mpExchangeData->pTheme->GetName() ); mpGallery->ReleaseTheme( mpExchangeData->pTheme, *this ); if ( bCreateNew && ( nRet != RET_OK ) ) @@ -423,7 +421,7 @@ void GalleryBrowser1::ImplExecute( sal_uInt16 nId ) case( MN_RENAME ): { GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); - const String aOldName( pTheme->GetName() ); + const OUString aOldName( pTheme->GetName() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialogdiet fail!"); @@ -432,18 +430,16 @@ void GalleryBrowser1::ImplExecute( sal_uInt16 nId ) if( aDlg->Execute() == RET_OK ) { - const String aNewName( aDlg->GetTitle() ); + const OUString aNewName( aDlg->GetTitle() ); - if( aNewName.Len() && ( aNewName != aOldName ) ) + if( !aNewName.isEmpty() && ( aNewName != aOldName ) ) { - String aName( aNewName ); + OUString aName( aNewName ); sal_uInt16 nCount = 0; while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) ) { - aName = aNewName; - aName += ' '; - aName += OUString::number( nCount ); + aName = aNewName + " " + OUString::number( nCount ); } mpGallery->RenameTheme( aOldName, aName ); @@ -690,15 +686,13 @@ IMPL_LINK_NOARG(GalleryBrowser1, SelectThemeHdl) IMPL_LINK_NOARG(GalleryBrowser1, ClickNewThemeHdl) { - String aNewTheme( GAL_RESSTR(RID_SVXSTR_GALLERY_NEWTHEME) ); - String aName( aNewTheme ); + OUString aNewTheme( GAL_RESSTR(RID_SVXSTR_GALLERY_NEWTHEME) ); + OUString aName( aNewTheme ); sal_uIntPtr nCount = 0; while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) ) { - aName = aNewTheme; - aName += ' '; - aName += OUString::number( nCount ); + aName = aNewTheme + " " + OUString::number( nCount ); } if( !mpGallery->HasTheme( aName ) && mpGallery->CreateTheme( aName ) ) diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx index 8c667c1f8026..3bc0126026b3 100644 --- a/svx/source/gallery2/galbrws1.hxx +++ b/svx/source/gallery2/galbrws1.hxx @@ -103,7 +103,7 @@ private: void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData ); void ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec); void ImplExecute( sal_uInt16 nId ); - void ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew ); + void ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew ); void ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog, bool bCreateNew ); // Control @@ -131,9 +131,9 @@ public: const ::boost::function<void(void)>& rThemeSlectionHandler); ~GalleryBrowser1(); - void SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); } + void SelectTheme( const OUString& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); } void SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); } - String GetSelectedTheme() { return mpThemes->GetEntryCount() ? mpThemes->GetEntry( mpThemes->GetSelectEntryPos() ) : String(); } + OUString GetSelectedTheme() { return mpThemes->GetEntryCount() ? OUString(mpThemes->GetEntry( mpThemes->GetSelectEntryPos() )) : OUString(); } void ShowContextMenu(); sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow ); diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 7ac642535826..9730c90fbce1 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -62,9 +62,6 @@ #define TBX_ID_ICON 1 #define TBX_ID_LIST 2 -namespace css = ::com::sun::star; -using rtl::OUString; - GalleryBrowserMode GalleryBrowser2::meInitMode = GALLERYBROWSERMODE_ICON; struct DispatchInfo @@ -750,7 +747,7 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow ) return bRet; } -void GalleryBrowser2::SelectTheme( const String& rThemeName ) +void GalleryBrowser2::SelectTheme( const OUString& rThemeName ) { delete mpIconView, mpIconView = NULL; delete mpListView, mpListView = NULL; @@ -972,7 +969,7 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId ) void GalleryBrowser2::ImplUpdateInfoBar() { - String aInfoText; + OUString aInfoText; if( mpCurTheme ) { @@ -1211,7 +1208,7 @@ void GalleryBrowser2::Execute( sal_uInt16 nId ) if( pObj ) { - const String aOldTitle( GetItemText( *mpCurTheme, *pObj, GALLERY_ITEM_TITLE ) ); + const OUString aOldTitle( GetItemText( *mpCurTheme, *pObj, GALLERY_ITEM_TITLE ) ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) @@ -1220,13 +1217,14 @@ void GalleryBrowser2::Execute( sal_uInt16 nId ) DBG_ASSERT(aDlg, "Dialogdiet fail!"); if( aDlg->Execute() == RET_OK ) { - String aNewTitle( aDlg->GetTitle() ); + OUString aNewTitle( aDlg->GetTitle() ); - if( ( !aNewTitle.Len() && pObj->GetTitle().Len() ) || ( aNewTitle != aOldTitle ) ) + if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) ) { - if( !aNewTitle.Len() ) - aNewTitle = String( RTL_CONSTASCII_USTRINGPARAM( "__<empty>__" ) ); - + if( aNewTitle.isEmpty() ) + { + aNewTitle = OUString( "__<empty>__" ); + } pObj->SetTitle( aNewTitle ); mpCurTheme->InsertObject( *pObj ); } @@ -1274,29 +1272,29 @@ void GalleryBrowser2::Execute( sal_uInt16 nId ) } } -String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags ) +OUString GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags ) { - String aRet; + OUString aRet; INetURLObject aURL(rObj.GetURL()); if( nItemTextFlags & GALLERY_ITEM_THEMENAME ) { aRet += rTheme.GetName(); - aRet += String( RTL_CONSTASCII_USTRINGPARAM( " - " ) ); + aRet += " - "; } if( nItemTextFlags & GALLERY_ITEM_TITLE ) { - String aTitle( rObj.GetTitle() ); + OUString aTitle( rObj.GetTitle() ); - if( !aTitle.Len() ) + if( aTitle.isEmpty() ) + { aTitle = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_UNAMBIGUOUS ); - - if( !aTitle.Len() ) + } + if( aTitle.isEmpty() ) { - aTitle = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - aTitle = aTitle.GetToken( comphelper::string::getTokenCount(aTitle, '/') - 1, '/' ); + aTitle = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ).getToken( comphelper::string::getTokenCount(aTitle, '/') - 1, '/' ); } aRet += aTitle; @@ -1304,15 +1302,18 @@ String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject if( nItemTextFlags & GALLERY_ITEM_PATH ) { - const String aPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) ); + const OUString aPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) ); - if( aPath.Len() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) ) - aRet += String( RTL_CONSTASCII_USTRINGPARAM( " (" ) ); - - aRet += String(aURL.getFSysPath( INetURLObject::FSYS_DETECT )); + if( !aPath.isEmpty() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) ) + { + aRet += " (" ; + } + aRet += aURL.getFSysPath( INetURLObject::FSYS_DETECT ); - if( aPath.Len() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) ) - aRet += ')'; + if( !aPath.isEmpty() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) ) + { + aRet += ")"; + } } return aRet; @@ -1328,9 +1329,9 @@ INetURLObject GalleryBrowser2::GetURL() const return aURL; } -String GalleryBrowser2::GetFilterName() const +OUString GalleryBrowser2::GetFilterName() const { - String aFilterName; + OUString aFilterName; if( mpCurTheme && mnCurActionPos != 0xffffffff ) { diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index a96a34e02661..26e799161a0f 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -142,15 +142,19 @@ void GalleryPreview::Paint( const Rectangle& rRect ) { Window::Paint( rRect ); - if( ImplGetGraphicCenterRect( aGraphicObj.GetGraphic(), aPreviewRect ) ) + if( ImplGetGraphicCenterRect( m_rGraphicObj->GetGraphic(), aPreviewRect ) ) { const Point aPos( aPreviewRect.TopLeft() ); const Size aSize( aPreviewRect.GetSize() ); - if( aGraphicObj.IsAnimated() ) - aGraphicObj.StartAnimation( this, aPos, aSize ); + if( m_rGraphicObj->IsAnimated() ) + { + m_rGraphicObj->StartAnimation( this, aPos, aSize ); + } else - aGraphicObj.Draw( this, aPos, aSize ); + { + m_rGraphicObj->Draw( this, aPos, aSize ); + } } } @@ -329,14 +333,14 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt ) const Size aSize(rRect.GetWidth(), rRect.GetHeight()); BitmapEx aBitmapEx; Size aPreparedSize; - String aItemTextTitle; - String aItemTextPath; + OUString aItemTextTitle; + OUString aItemTextPath; mpTheme->GetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath); bool bNeedToCreate(aBitmapEx.IsEmpty()); - if(!bNeedToCreate && !aItemTextTitle.Len()) + if(!bNeedToCreate && aItemTextTitle.isEmpty()) { bNeedToCreate = true; } @@ -629,19 +633,19 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa const Size aSize(rRect.GetHeight(), rRect.GetHeight()); BitmapEx aBitmapEx; Size aPreparedSize; - String aItemTextTitle; - String aItemTextPath; + OUString aItemTextTitle; + OUString aItemTextPath; mpTheme->GetPreviewBitmapExAndStrings(mnCurRow, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath); bool bNeedToCreate(aBitmapEx.IsEmpty()); - if(!bNeedToCreate && GALLERY_BRWBOX_TITLE == nColumnId && !aItemTextTitle.Len()) + if(!bNeedToCreate && GALLERY_BRWBOX_TITLE == nColumnId && aItemTextTitle.isEmpty()) { bNeedToCreate = true; } - if(!bNeedToCreate && GALLERY_BRWBOX_PATH == nColumnId && !aItemTextPath.Len()) + if(!bNeedToCreate && GALLERY_BRWBOX_PATH == nColumnId && aItemTextPath.isEmpty()) { bNeedToCreate = true; } diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 692a67027002..d2210060f203 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -102,7 +102,7 @@ IMPL_LINK( SgaUserDataFactory, MakeUserData, SdrObjFactory*, pObjFactory ) // ------------------------ sal_uInt16 GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, - String& rFilterName, sal_Bool bShowProgress ) + OUString& rFilterName, sal_Bool bShowProgress ) { sal_uInt16 nRet = SGA_IMPORT_NONE; SfxMedium aMedium( rURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); @@ -217,27 +217,26 @@ sal_Bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageM // - GetReducedString - // -------------------- -String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen ) +OUString GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen ) { - String aReduced( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); + OUString aReduced( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - aReduced = aReduced.GetToken( comphelper::string::getTokenCount(aReduced, '/') - 1, '/' ); + aReduced = aReduced.getToken( comphelper::string::getTokenCount(aReduced, '/') - 1, '/' ); if( INET_PROT_PRIV_SOFFICE != rURL.GetProtocol() ) { sal_Unicode aDelimiter; - const String aPath( rURL.getFSysPath( INetURLObject::FSYS_DETECT, &aDelimiter ) ); - const String aName( aReduced ); + const OUString aPath( rURL.getFSysPath( INetURLObject::FSYS_DETECT, &aDelimiter ) ); + const OUString aName( aReduced ); - if( aPath.Len() > nMaxLen ) + if( aPath.getLength() > (sal_Int32)nMaxLen ) { - aReduced = aPath.Copy( 0, (sal_uInt16)( nMaxLen - aName.Len() - 4 ) ); - aReduced += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); - aReduced += aDelimiter; - aReduced += aName; + aReduced = aPath.copy( 0, ( nMaxLen - aName.getLength() - 4 ) ) + OUString("...") + OUString(aDelimiter) + aName; } else + { aReduced = aPath; + } } return aReduced; @@ -245,14 +244,14 @@ String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen ) // ----------------------------------------------------------------------------- -String GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL ) +OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL ) { - String aRet; + OUString aRet; if( rSvDrawObjURL.GetProtocol() == INET_PROT_PRIV_SOFFICE && comphelper::string::getTokenCount(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE ), '/') == 3 ) { - aRet = String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetToken( 2, '/' ); + aRet = rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE ).getToken( 2, '/' ); } return aRet; @@ -405,19 +404,19 @@ GalleryProgress::GalleryProgress( GraphicFilter* pFilter ) : if( mxProgressBar.is() ) { - String aProgressText; + OUString aProgressText; if( mpFilter ) { - aProgressText = GAL_RESSTR(RID_SVXSTR_GALLERY_FILTER); + aProgressText = OUString(GAL_RESSTR(RID_SVXSTR_GALLERY_FILTER)); // mpFilter->SetUpdatePercentHdl( LINK( this, GalleryProgress, Update ) ); // sj: progress wasn't working up from SO7 at all // // so I am removing this. The gallery progress should // // be changed to use the XStatusIndicator instead of XProgressMonitor } else - aProgressText = String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ); + aProgressText = "Gallery"; - xMonitor->addText( String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ), aProgressText, sal_False ) ; + xMonitor->addText( OUString( "Gallery" ), aProgressText, sal_False ) ; mxProgressBar->setRange( 0, GALLERY_PROGRESS_RANGE ); } } @@ -447,7 +446,7 @@ GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObj mpTheme( pTheme ), meObjectKind( mpTheme->GetObjectKind( nObjectPos ) ), mnObjectPos( nObjectPos ), - mpGraphicObject( NULL ), + m_rGraphicObject( NULL ), mpImageMap( NULL ), mpURL( NULL ) { @@ -473,17 +472,19 @@ void GalleryTransferable::InitData( bool bLazy ) { if( !bLazy ) { - if( !mpGraphicObject ) + if( !m_rGraphicObject.is() ) { Graphic aGraphic; if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) ) - mpGraphicObject = new GraphicObject( aGraphic ); + { + m_rGraphicObject = GraphicObject::Create( aGraphic ); + } } if( !mxModelStream.Is() ) { - mxModelStream = new SotStorageStream( String() ); + mxModelStream = new SotStorageStream( OUString() ); mxModelStream->SetBufferSize( 16348 ); if( !mpTheme->GetModelStream( mnObjectPos, mxModelStream ) ) @@ -508,12 +509,14 @@ void GalleryTransferable::InitData( bool bLazy ) delete mpURL, mpURL = NULL; } - if( ( SGA_OBJ_SOUND != meObjectKind ) && !mpGraphicObject ) + if( ( SGA_OBJ_SOUND != meObjectKind ) && !m_rGraphicObject.is() ) { Graphic aGraphic; if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) ) - mpGraphicObject = new GraphicObject( aGraphic ); + { + m_rGraphicObject = GraphicObject::Create( aGraphic ); + } } } break; @@ -540,11 +543,11 @@ void GalleryTransferable::AddSupportedFormats() if( mpURL ) AddFormat( FORMAT_FILE ); - if( mpGraphicObject ) + if( m_rGraphicObject.is() ) { AddFormat( SOT_FORMATSTR_ID_SVXB ); - if( mpGraphicObject->GetType() == GRAPHIC_GDIMETAFILE ) + if( m_rGraphicObject->GetType() == GRAPHIC_GDIMETAFILE ) { AddFormat( FORMAT_GDIMETAFILE ); AddFormat( FORMAT_BITMAP ); @@ -580,17 +583,17 @@ sal_Bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor ) { bRet = SetString( mpURL->GetMainURL( INetURLObject::NO_DECODE ), rFlavor ); } - else if( ( SOT_FORMATSTR_ID_SVXB == nFormat ) && mpGraphicObject ) + else if( ( SOT_FORMATSTR_ID_SVXB == nFormat ) && m_rGraphicObject.is() ) { - bRet = SetGraphic( mpGraphicObject->GetGraphic(), rFlavor ); + bRet = SetGraphic( m_rGraphicObject->GetGraphic(), rFlavor ); } - else if( ( FORMAT_GDIMETAFILE == nFormat ) && mpGraphicObject ) + else if( ( FORMAT_GDIMETAFILE == nFormat ) && m_rGraphicObject.is() ) { - bRet = SetGDIMetaFile( mpGraphicObject->GetGraphic().GetGDIMetaFile(), rFlavor ); + bRet = SetGDIMetaFile( m_rGraphicObject->GetGraphic().GetGDIMetaFile(), rFlavor ); } - else if( ( FORMAT_BITMAP == nFormat ) && mpGraphicObject ) + else if( ( FORMAT_BITMAP == nFormat ) && m_rGraphicObject.is() ) { - bRet = SetBitmapEx( mpGraphicObject->GetGraphic().GetBitmapEx(), rFlavor ); + bRet = SetBitmapEx( m_rGraphicObject->GetGraphic().GetBitmapEx(), rFlavor ); } return bRet; @@ -631,7 +634,7 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction ) void GalleryTransferable::ObjectReleased() { mxModelStream.Clear(); - delete mpGraphicObject, mpGraphicObject = NULL; + m_rGraphicObject = rtl::Reference<GraphicObject>(); delete mpImageMap, mpImageMap = NULL; delete mpURL, mpURL = NULL; } diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 444c4fe56141..eca6c95e54d2 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -22,11 +22,12 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfac.hxx> #include <comphelper/classids.hxx> -#include <comphelper/string.hxx> #include <unotools/pathoptions.hxx> #include <tools/rcid.h> #include <tools/vcompat.hxx> #include <tools/helpers.hxx> +#include <tools/string.hxx> +#include <comphelper/string.hxx> #include <vcl/virdev.hxx> #include <svl/itempool.hxx> #include <svx/fmmodel.hxx> @@ -175,7 +176,7 @@ sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic ) // ------------------------------------------------------------------------ -void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const +void SgaObject::WriteData( SvStream& rOut, const OUString& rDestDir ) const { static const sal_uInt32 nInventor = COMPAT_FORMAT( 'S', 'G', 'A', '3' ); @@ -198,8 +199,8 @@ void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const else rOut << aThumbMtf; - String aURLWithoutDestDir = String(aURL.GetMainURL( INetURLObject::NO_DECODE )); - aURLWithoutDestDir.SearchAndReplace(rDestDir, String()); + OUString aURLWithoutDestDir(aURL.GetMainURL( INetURLObject::NO_DECODE )); + aURLWithoutDestDir = aURLWithoutDestDir.replaceAll(rDestDir, OUString()); write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, aURLWithoutDestDir, RTL_TEXTENCODING_UTF8); } @@ -227,18 +228,18 @@ void SgaObject::ReadData(SvStream& rIn, sal_uInt16& rReadVersion ) // ------------------------------------------------------------------------ -const String SgaObject::GetTitle() const +const OUString SgaObject::GetTitle() const { - String aReturnValue( aTitle ); + OUString aReturnValue( aTitle ); if ( !getenv( "GALLERY_SHOW_PRIVATE_TITLE" ) ) { if ( comphelper::string::getTokenCount(aReturnValue, ':') == 3 ) { - String aPrivateInd ( aReturnValue.GetToken( 0, ':' ) ); - String aResourceName( aReturnValue.GetToken( 1, ':' ) ); - sal_Int32 nResId ( aReturnValue.GetToken( 2, ':' ).ToInt32() ); - if ( aPrivateInd.EqualsAscii( "private" ) && - aResourceName.Len() && ( nResId > 0 ) && ( nResId < 0x10000 ) ) + OUString aPrivateInd ( aReturnValue.getToken( 0, ':' ) ); + OUString aResourceName( aReturnValue.getToken( 1, ':' ) ); + sal_Int32 nResId ( aReturnValue.getToken( 2, ':' ).toInt32() ); + if ( aPrivateInd == "private" && + !aResourceName.isEmpty() && ( nResId > 0 ) && ( nResId < 0x10000 ) ) { OString aMgrName(OUStringToOString(aResourceName, RTL_TEXTENCODING_UTF8)); ResMgr* pResMgr = ResMgr::CreateResMgr( aMgrName.getStr(), @@ -261,7 +262,7 @@ const String SgaObject::GetTitle() const // ------------------------------------------------------------------------ -void SgaObject::SetTitle( const String& rTitle ) +void SgaObject::SetTitle( const OUString& rTitle ) { aTitle = rTitle; } @@ -270,7 +271,7 @@ void SgaObject::SetTitle( const String& rTitle ) SvStream& operator<<( SvStream& rOut, const SgaObject& rObj ) { - rObj.WriteData( rOut, String() ); + rObj.WriteData( rOut, OUString() ); return rOut; } @@ -299,7 +300,7 @@ SgaObjectBmp::SgaObjectBmp() SgaObjectBmp::SgaObjectBmp( const INetURLObject& rURL ) { Graphic aGraphic; - String aFilter; + OUString aFilter; if ( SGA_IMPORT_NONE != GalleryGraphicImport( rURL, aGraphic, aFilter ) ) Init( aGraphic, rURL ); @@ -307,7 +308,7 @@ SgaObjectBmp::SgaObjectBmp( const INetURLObject& rURL ) // ------------------------------------------------------------------------ -SgaObjectBmp::SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& ) +SgaObjectBmp::SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& ) { if( FileExists( rURL ) ) Init( rGraphic, rURL ); @@ -323,7 +324,7 @@ void SgaObjectBmp::Init( const Graphic& rGraphic, const INetURLObject& rURL ) // ------------------------------------------------------------------------ -void SgaObjectBmp::WriteData( SvStream& rOut, const String& rDestDir ) const +void SgaObjectBmp::WriteData( SvStream& rOut, const OUString& rDestDir ) const { // Version setzen SgaObject::WriteData( rOut, rDestDir ); @@ -410,7 +411,7 @@ BitmapEx SgaObjectSound::GetThumbBmp() const // ------------------------------------------------------------------------ -void SgaObjectSound::WriteData( SvStream& rOut, const String& rDestDir ) const +void SgaObjectSound::WriteData( SvStream& rOut, const OUString& rDestDir ) const { SgaObject::WriteData( rOut, rDestDir ); rOut << (sal_uInt16) eSoundType; @@ -446,7 +447,7 @@ SgaObjectAnim::SgaObjectAnim() SgaObjectAnim::SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, - const String& ) + const OUString& ) { aURL = rURL; bIsValid = CreateThumb( rGraphic ); @@ -462,7 +463,7 @@ SgaObjectINet::SgaObjectINet() // ------------------------------------------------------------------------ -SgaObjectINet::SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName ) : +SgaObjectINet::SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName ) : SgaObjectAnim ( rGraphic, rURL, rFormatName ) { } @@ -491,7 +492,7 @@ SvxGalleryDrawModel::SvxGalleryDrawModel() { DBG_CTOR(SvxGalleryDrawModel,NULL); - const String sFactoryURL(RTL_CONSTASCII_USTRINGPARAM("sdraw")); + const OUString sFactoryURL("sdraw"); mxDoc = SfxObjectShell::CreateObjectByFactoryName( sFactoryURL ); @@ -599,7 +600,7 @@ sal_Bool SgaObjectSvDraw::CreateThumb( const FmFormModel& rModel ) // ------------------------------------------------------------------------ -void SgaObjectSvDraw::WriteData( SvStream& rOut, const String& rDestDir ) const +void SgaObjectSvDraw::WriteData( SvStream& rOut, const OUString& rDestDir ) const { SgaObject::WriteData( rOut, rDestDir ); write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, aTitle, RTL_TEXTENCODING_UTF8); diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index b44df0206c4f..3a170812a9a6 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -259,13 +259,13 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt INetURLObject aInfoFileURL( GetParent()->GetUserURL() ); INetURLObject aNewURL; sal_uInt32 nNextNumber = 1999; - sal_Char const* pExt = NULL; + OUString sExt; sal_Bool bExists; - aDir.Append( String( RTL_CONSTASCII_USTRINGPARAM( "dragdrop" ) ) ); + aDir.Append( OUString("dragdrop" ) ); CreateDir( aDir ); - aInfoFileURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( "sdddndx1" ) ) ); + aInfoFileURL.Append( OUString( "sdddndx1" ) ); // read next possible number if( FileExists( aInfoFileURL ) ) @@ -284,19 +284,19 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt { switch( nFormat ) { - case( CVT_BMP ): pExt = ".bmp"; break; - case( CVT_GIF ): pExt = ".gif"; break; - case( CVT_JPG ): pExt = ".jpg"; break; - case( CVT_MET ): pExt = ".met"; break; - case( CVT_PCT ): pExt = ".pct"; break; - case( CVT_PNG ): pExt = ".png"; break; - case( CVT_SVM ): pExt = ".svm"; break; - case( CVT_TIF ): pExt = ".tif"; break; - case( CVT_WMF ): pExt = ".wmf"; break; - case( CVT_EMF ): pExt = ".emf"; break; + case( CVT_BMP ): sExt = ".bmp"; break; + case( CVT_GIF ): sExt = ".gif"; break; + case( CVT_JPG ): sExt = ".jpg"; break; + case( CVT_MET ): sExt = ".met"; break; + case( CVT_PCT ): sExt = ".pct"; break; + case( CVT_PNG ): sExt = ".png"; break; + case( CVT_SVM ): sExt = ".svm"; break; + case( CVT_TIF ): sExt = ".tif"; break; + case( CVT_WMF ): sExt = ".wmf"; break; + case( CVT_EMF ): sExt = ".emf"; break; default: - pExt = ".grf"; + sExt = ".grf"; break; } } @@ -306,25 +306,23 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt // get URL if( SGA_OBJ_SVDRAW == eObjKind ) { - String aFileName( RTL_CONSTASCII_USTRINGPARAM( "gallery/svdraw/dd" ) ); + OUString aFileName( "gallery/svdraw/dd" ); aNewURL = INetURLObject( aFileName += OUString::number( ++nNextNumber % 99999999 ), INET_PROT_PRIV_SOFFICE ); bExists = sal_False; for ( size_t i = 0, n = aObjectList.size(); i < n; ++i ) + { if ( aObjectList[ i ]->aURL == aNewURL ) { bExists = sal_True; break; } + } } else { - String aFileName( RTL_CONSTASCII_USTRINGPARAM( "dd" ) ); - - aFileName += OUString::number( ++nNextNumber % 999999 ); - aFileName += String( pExt, RTL_TEXTENCODING_ASCII_US ); - + OUString aFileName("dd" + OUString::number( ++nNextNumber % 999999 ) + sExt); aNewURL = aDir; aNewURL.Append( aFileName ); @@ -409,7 +407,7 @@ bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertPos ) GalleryObject aNewEntry; // update title of new object if necessary - if( !rObj.GetTitle().Len() ) + if( rObj.GetTitle().isEmpty() ) { SgaObject* pOldObj = ImplReadSgaObject( pFoundEntry ); @@ -419,9 +417,10 @@ bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertPos ) delete pOldObj; } } - else if( rObj.GetTitle() == String( RTL_CONSTASCII_USTRINGPARAM( "__<empty>__" ) ) ) - ( (SgaObject&) rObj ).SetTitle( String() ); - + else if( rObj.GetTitle() == "__<empty>__" ) + { + ( (SgaObject&) rObj ).SetTitle( OUString() ); + } ImplWriteSgaObject( rObj, nInsertPos, &aNewEntry ); pFoundEntry->nOffset = aNewEntry.nOffset; } @@ -444,7 +443,7 @@ SgaObject* GalleryTheme::AcquireObject( size_t nPos ) // ------------------------------------------------------------------------ -void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, String& rTitle, String& rPath) const +void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const { const GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : NULL; @@ -463,7 +462,7 @@ void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBit // ------------------------------------------------------------------------ -void GalleryTheme::SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const String& rTitle, const String& rPath) +void GalleryTheme::SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath) { GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : NULL; @@ -555,7 +554,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg if( !IsReadOnly() ) { Graphic aGraphic; - String aFormat; + OUString aFormat; GalleryObject* pEntry; const size_t nCount = aObjectList.size(); @@ -617,7 +616,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg { if ( aSvDrawStorageRef.Is() ) { - const String aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) ); + const OUString aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) ); SvStorageStreamRef pIStm = aSvDrawStorageRef->OpenSotStream( aStmName, STREAM_READ ); if( pIStm && !pIStm->GetError() ) @@ -739,7 +738,7 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, sa if( pIStm ) { - String aThemeName; + OUString aThemeName; sal_uInt16 nVersion; sal_Bool bThemeNameFromResource = sal_False; @@ -835,7 +834,7 @@ sal_Bool GalleryTheme::GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, sal_Bool case( SGA_OBJ_ANIM ): case( SGA_OBJ_INET ): { - String aFilterDummy; + OUString aFilterDummy; bRet = ( GalleryGraphicImport( aURL, rGraphic, aFilterDummy, bProgress ) != SGA_IMPORT_NONE ); } break; @@ -986,7 +985,7 @@ sal_Bool GalleryTheme::GetModel( sal_uIntPtr nPos, SdrModel& rModel, sal_Bool ) if( xStor.Is() ) { - const String aStmName( GetSvDrawStreamNameFromURL( aURL ) ); + const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) ); SvStorageStreamRef xIStm( xStor->OpenSotStream( aStmName, STREAM_READ ) ); if( xIStm.Is() && !xIStm->GetError() ) @@ -1011,7 +1010,7 @@ sal_Bool GalleryTheme::InsertModel( const FmFormModel& rModel, sal_uIntPtr nInse if( xStor.Is() ) { - const String aStmName( GetSvDrawStreamNameFromURL( aURL ) ); + const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) ); SvStorageStreamRef xOStm( xStor->OpenSotStream( aStmName, STREAM_WRITE | STREAM_TRUNC ) ); if( xOStm.Is() && !xOStm->GetError() ) @@ -1062,7 +1061,7 @@ sal_Bool GalleryTheme::GetModelStream( sal_uIntPtr nPos, SotStorageStreamRef& rx if( xStor.Is() ) { - const String aStmName( GetSvDrawStreamNameFromURL( aURL ) ); + const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) ); SvStorageStreamRef xIStm( xStor->OpenSotStream( aStmName, STREAM_READ ) ); if( xIStm.Is() && !xIStm->GetError() ) @@ -1111,7 +1110,7 @@ sal_Bool GalleryTheme::InsertModelStream( const SotStorageStreamRef& rxModelStre if( xStor.Is() ) { - const String aStmName( GetSvDrawStreamNameFromURL( aURL ) ); + const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) ); SvStorageStreamRef xOStm( xStor->OpenSotStream( aStmName, STREAM_WRITE | STREAM_TRUNC ) ); if( xOStm.Is() && !xOStm->GetError() ) @@ -1158,7 +1157,7 @@ sal_Bool GalleryTheme::GetURL( sal_uIntPtr nPos, INetURLObject& rURL, sal_Bool ) sal_Bool GalleryTheme::InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos ) { Graphic aGraphic; - String aFormat; + OUString aFormat; SgaObject* pNewObj = NULL; const sal_uInt16 nImportRet = GalleryGraphicImport( rURL, aGraphic, aFormat ); sal_Bool bRet = sal_False; @@ -1373,7 +1372,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const for( sal_uInt32 i = 0; i < nCount; i++ ) { const GalleryObject* pObj = ImplGetGalleryObject( i ); - String aPath; + OUString aPath; if( SGA_OBJ_SVDRAW == pObj->eObjKind ) { @@ -1383,35 +1382,40 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const else { aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ); - bRel = ( ( aPath.Erase( sal::static_int_cast< xub_StrLen >( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ) ) == String(aRelURL1.GetMainURL( INetURLObject::NO_DECODE ) )); + bRel = aPath.copy( 0, aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) == aRelURL1.GetMainURL( INetURLObject::NO_DECODE ); if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 ) ) ) { - aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ); - aPath = aPath.Erase( 0, sal::static_int_cast< xub_StrLen >( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ); + aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).copy(aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ); } else { aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ); - bRel = ( ( aPath.Erase( sal::static_int_cast< xub_StrLen >( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ) ) == String(aRelURL2.GetMainURL( INetURLObject::NO_DECODE ) )); + bRel = aPath.copy(0, aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength()) == aRelURL2.GetMainURL( INetURLObject::NO_DECODE ); - if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 ) ) ) + if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 ))) { - aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ); - aPath = aPath.Erase( 0, sal::static_int_cast< xub_StrLen >( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ); + aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).copy(aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() ); } else + { aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ); + } } } - if ( m_aDestDir.Len() > 0 ) + if ( !m_aDestDir.isEmpty()) { - if ( aPath.SearchAndReplace(m_aDestDir, String()) != STRING_NOTFOUND ) + if ( aPath.indexOf(m_aDestDir) < 0 ) + { + aPath = aPath.replaceAll(m_aDestDir, OUString()); bRel = m_bDestDirRelative; + } else + { SAL_WARN( "svx", "failed to replace destdir of '" << m_aDestDir << "' in '" << aPath << "'"); + } } rOStm << bRel; diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 05e709db15ba..2ecd15e88d99 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -87,7 +87,7 @@ namespace sdr const GraphicAttr& rLocalGrafInfo) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - GraphicObject aEmptyGraphicObject; + rtl::Reference<GraphicObject> aEmptyGraphicObject = GraphicObject::Create(); GraphicAttr aEmptyGraphicAttr; // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts @@ -132,7 +132,7 @@ namespace sdr aSmallerMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) * aSmallerMatrix; - const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + const rtl::Reference<GraphicObject> rGraphicObject = GetGrafObject().GetGraphicObject(false); const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( aSmallerMatrix, drawinglayer::attribute::SdrLineFillShadowTextAttribute(), @@ -150,7 +150,7 @@ namespace sdr const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - GraphicObject aEmptyGraphicObject; + rtl::Reference<GraphicObject> aEmptyGraphicObject = GraphicObject::Create(); GraphicAttr aEmptyGraphicAttr; // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts @@ -367,7 +367,7 @@ namespace sdr aObjectRange.getMinX(), aObjectRange.getMinY())); // get the current, unchenged graphic obect from SdrGrafObj - const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + const rtl::Reference<GraphicObject> rGraphicObject = GetGrafObject().GetGraphicObject(false); if(visualisationUsesPresObj()) { @@ -418,14 +418,14 @@ namespace sdr return false; // draft when swapped out - const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + const rtl::Reference<GraphicObject> rGraphicObject = GetGrafObject().GetGraphicObject(false); static bool bAllowReplacements(true); - if(rGraphicObject.IsSwappedOut() && bAllowReplacements) + if(rGraphicObject->IsSwappedOut() && bAllowReplacements) return true; // draft when no graphic - if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType()) + if(GRAPHIC_NONE == rGraphicObject->GetType() || GRAPHIC_DEFAULT == rGraphicObject->GetType()) return true; return false; diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index fcfba853bdf4..9adbf2af2f0f 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -612,7 +612,7 @@ namespace drawinglayer attribute::SdrFillGraphicAttribute createNewSdrFillGraphicAttribute(const SfxItemSet& rSet) { - Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject().GetGraphic()); + Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject()->GetGraphic()); if(!(GRAPHIC_BITMAP == aGraphic.GetType() || GRAPHIC_GDIMETAFILE == aGraphic.GetType())) { diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 44ed09dd7fd9..8e14ddd600b4 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -127,12 +127,12 @@ namespace drawinglayer SdrGrafPrimitive2D::SdrGrafPrimitive2D( const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, - const GraphicObject& rGraphicObject, + const rtl::Reference<GraphicObject>& rGraphicObject, const GraphicAttr& rGraphicAttr) : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maSdrLFSTAttribute(rSdrLFSTAttribute), - maGraphicObject(rGraphicObject), + m_rGraphicObject(rGraphicObject), maGraphicAttr(rGraphicAttr) { // reset some values from GraphicAttr which are part of transformation already @@ -157,7 +157,7 @@ namespace drawinglayer bool SdrGrafPrimitive2D::isTransparent() const { return ((0L != getGraphicAttr().GetTransparency()) - || (getGraphicObject().IsTransparent())); + || (getGraphicObject()->IsTransparent())); } // provide unique ID diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 4e141844cc67..18f1c16e4109 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -61,7 +61,7 @@ namespace drawinglayer #endif if(GRAPHIC_NONE != aGraphic.GetType()) { - const GraphicObject aGraphicObject(aGraphic); + const rtl::Reference<GraphicObject> rGraphicObject = GraphicObject::Create(aGraphic); const GraphicAttr aGraphicAttr; drawinglayer::primitive2d::Primitive2DSequence xOLEContent; @@ -98,7 +98,7 @@ namespace drawinglayer const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( new drawinglayer::primitive2d::GraphicPrimitive2D( aInnerObjectMatrix, - aGraphicObject, + rGraphicObject, aGraphicAttr)); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); } @@ -109,7 +109,7 @@ namespace drawinglayer const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( new drawinglayer::primitive2d::GraphicPrimitive2D( getObjectTransform(), - aGraphicObject, + rGraphicObject, aGraphicAttr)); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); } diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 288a85ad0112..4d029fac0ead 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -675,13 +675,16 @@ sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIn const SvxBrushItem* pBrsh = aFmt.GetBrush(); const Graphic* pGrf = 0; if ( pBrsh ) + { pGrf = pBrsh->GetGraphic(); + } else + { return sal_False; - + } if ( pGrf ) { - const String* pGrfName = pBrsh->GetGraphicLink(); + const OUString* pGrfName = pBrsh->GetGraphicLink(); //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; if ( pGrfName ) @@ -689,12 +692,13 @@ sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIn //pEntry->sDescription = sEmpty; pEntry->nGallaryIndex = (sal_uInt16)0xFFFF; pEntry->bIsCustomized = sal_True; - String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); - String aReplace = OUString("%LIST_NUM"); - String sNUM = OUString::number( nIndex + 1 ); - aStrFromRES.SearchAndReplace(aReplace,sNUM); + OUString aStrFromRES = OUString(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + OUString aReplace = OUString("%LIST_NUM"); + OUString sNUM = OUString::number( nIndex + 1 ); + aStrFromRES = aStrFromRES.replaceAll(aReplace, sNUM); pEntry->sDescription = aStrFromRES; - }else + } + else { return sal_False; } @@ -1080,13 +1084,15 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s else return sal_False; - String sEmpty; + OUString sEmpty; if ( pGrf ) { - const String* pGrfName = pBrsh->GetGraphicLink(); + const OUString* pGrfName = pBrsh->GetGraphicLink(); GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); if ( pGrfName ) + { pEntry->sGrfName = *pGrfName; + } GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); if ( mGrfTMgr ) { @@ -1099,9 +1105,9 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s { pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); - String aReplace = OUString("%LIST_NUM"); - String sNUM = OUString::number( nIndex + 1 ); - sEmpty.SearchAndReplace(aReplace,sNUM); + OUString aReplace = OUString("%LIST_NUM"); + OUString sNUM = OUString::number( nIndex + 1 ); + sEmpty = sEmpty.replaceAll(aReplace, sNUM); //pEntry->pGrfObj = pGrf; pEntry->pGrfObj = new Graphic(*pGrf); pEntry->aSize = aFmt.GetGraphicSize(); @@ -1158,7 +1164,7 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s else return sal_False; - const String* pGrfName = 0; + const OUString* pGrfName = 0; if ( pGrf ) { pGrfName = pBrsh->GetGraphicLink(); diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 2255d58ad9a8..d55375180344 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -3693,14 +3693,14 @@ bool SdrDragCrop::EndSdrDrag(bool bCopy) if( !pObj || (pObj->GetGraphicType() == GRAPHIC_NONE) || (pObj->GetGraphicType() == GRAPHIC_DEFAULT) ) return false; - const GraphicObject& rGraphicObject = pObj->GetGraphicObject(); + const rtl::Reference<GraphicObject> rGraphicObject = pObj->GetGraphicObject(); const MapMode aMapMode100thmm(MAP_100TH_MM); - Size aGraphicSize(rGraphicObject.GetPrefSize()); + Size aGraphicSize(rGraphicObject->GetPrefSize()); - if( MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit() ) + if( MAP_PIXEL == rGraphicObject->GetPrefMapMode().GetMapUnit() ) aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm ); else - aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm); + aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject->GetPrefMapMode(), aMapMode100thmm); if( aGraphicSize.A() == 0 || aGraphicSize.B() == 0 ) return false; diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index 4caca9417a72..8164ac3bfc51 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -321,7 +321,7 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol) } case XFILL_BITMAP: { - Bitmap aBitmap(((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap()); + Bitmap aBitmap(((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetGraphicObject()->GetGraphic().GetBitmapEx().GetBitmap()); const Size aSize(aBitmap.GetSizePixel()); const sal_uInt32 nWidth = aSize.Width(); const sal_uInt32 nHeight = aSize.Height(); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index a6e27ff3380f..4be240fe4f25 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -599,7 +599,7 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale) aClipSize); pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP)); - pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap))); + pObj->SetMergedItem(XFillBitmapItem(String(), GraphicObject::Create(aClippedBitmap))); pObj->SetMergedItem(XFillBmpTileItem(false)); pObj->SetMergedItem(XFillBmpStretchItem(true)); } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 34f514901e57..d7328fdf7948 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -2493,7 +2493,7 @@ void SdrCropViewHdl::CreateB2dIAObject() const drawinglayer::primitive2d::Primitive2DReference aGraphic( new drawinglayer::primitive2d::GraphicPrimitive2D( aCroppedTransform, - maGraphic)); + GraphicObject::Create(maGraphic))); // prepare outline polygon for whole graphic const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index cefe73b1cf8b..6b8086734ee3 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -691,7 +691,7 @@ void SdrMarkView::SetMarkHandles() { // get crop scale const basegfx::B2DVector aCropScaleFactor( - pSdrGrafObj->GetGraphicObject().calculateCropScaling( + pSdrGrafObj->GetGraphicObject()->calculateCropScaling( aScale.getX(), aScale.getY(), rCrop.GetLeft(), @@ -708,7 +708,7 @@ void SdrMarkView::SetMarkHandles() aHdl.AddHdl( new SdrCropViewHdl( aMatrix, - pSdrGrafObj->GetGraphicObject().GetGraphic(), + pSdrGrafObj->GetGraphicObject()->GetGraphic(), fCropLeft, fCropTop, fCropRight, diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 3de2a643bf50..80a1ef051dae 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -342,8 +342,8 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS // bitmap and transparency like shadow if(bBitmapFillUsed) { - GraphicObject aGraphicObject(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetGraphicObject()); - const BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx()); + rtl::Reference<GraphicObject> rGraphicObject = (((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetGraphicObject()); + const BitmapEx aBitmapEx(rGraphicObject->GetGraphic().GetBitmapEx()); Bitmap aBitmap(aBitmapEx.GetBitmap()); if(!aBitmap.IsEmpty()) @@ -379,21 +379,21 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS { if(aBitmapEx.IsAlpha()) { - aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha()))); + rGraphicObject = GraphicObject::Create(rGraphicObject, Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha()))); } else { - aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask()))); + rGraphicObject = GraphicObject::Create(rGraphicObject, Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask()))); } } else { - aGraphicObject.SetGraphic(Graphic(aDestBitmap)); + rGraphicObject = GraphicObject::Create(rGraphicObject, Graphic(aDestBitmap)); } } } - aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), aGraphicObject)); + aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), rGraphicObject)); aTempSet.Put(XFillTransparenceItem(nShadowTransparence)); } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 5f1ee9ad8331..de4ec1f59f2b 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -281,9 +281,9 @@ void SdrGrafObj::onGraphicChanged() String aTitle; String aDesc; - if(pGraphic) + if(m_rGraphicObject.is()) { - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData(); if(rSvgDataPtr.get()) { @@ -331,9 +331,9 @@ SdrGrafObj::SdrGrafObj() pGraphicLink ( NULL ), bMirrored ( false ) { - pGraphic = new GraphicObject; - mpReplacementGraphic = 0; - pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); + m_rGraphicObject = GraphicObject::Create(); + m_rReplacementGraphic = rtl::Reference<GraphicObject>(); + m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); onGraphicChanged(); // #i118485# Shear allowed and possible now @@ -355,9 +355,9 @@ SdrGrafObj::SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect) pGraphicLink ( NULL ), bMirrored ( false ) { - pGraphic = new GraphicObject( rGrf ); - mpReplacementGraphic = 0; - pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); + m_rGraphicObject = GraphicObject::Create( rGrf ); + m_rReplacementGraphic = rtl::Reference<GraphicObject>(); + m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); onGraphicChanged(); // #i118485# Shear allowed and possible now @@ -379,9 +379,9 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf ) pGraphicLink ( NULL ), bMirrored ( false ) { - pGraphic = new GraphicObject( rGrf ); - mpReplacementGraphic = 0; - pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); + m_rGraphicObject = GraphicObject::Create( rGrf ); + m_rReplacementGraphic = rtl::Reference<GraphicObject>(); + m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); onGraphicChanged(); // #i118485# Shear allowed and possible now @@ -400,55 +400,51 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf ) SdrGrafObj::~SdrGrafObj() { - delete pGraphic; - delete mpReplacementGraphic; ImpLinkAbmeldung(); } -void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj ) +void SdrGrafObj::SetGraphicObject( const rtl::Reference<GraphicObject>& rGrfObj ) { - *pGraphic = rGrfObj; - delete mpReplacementGraphic; - mpReplacementGraphic = 0; - pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); - pGraphic->SetUserData(); + m_rGraphicObject = rGrfObj; + m_rReplacementGraphic = rtl::Reference<GraphicObject>(); + m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); + m_rGraphicObject->SetUserData(); mbIsPreview = false; SetChanged(); BroadcastObjectChange(); onGraphicChanged(); } -const GraphicObject& SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const +const rtl::Reference<GraphicObject> SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const { if(bForceSwapIn) { ForceSwapIn(); } - return *pGraphic; + return m_rGraphicObject; } -const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const +const rtl::Reference<GraphicObject> SdrGrafObj::GetReplacementGraphicObject() const { - if(!mpReplacementGraphic && pGraphic) + if(!m_rReplacementGraphic.is() && m_rGraphicObject.is()) { - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData(); if(rSvgDataPtr.get()) { - const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement()); + const_cast< SdrGrafObj* >(this)->m_rReplacementGraphic = GraphicObject::Create(rSvgDataPtr->getReplacement()); } } - return mpReplacementGraphic; + return m_rReplacementGraphic; } void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf ) { - pGraphic->SetGraphic( rGrf ); - delete mpReplacementGraphic; - mpReplacementGraphic = 0; - pGraphic->SetUserData(); + m_rGraphicObject = GraphicObject::Create(m_rGraphicObject, rGrf ); + m_rReplacementGraphic = rtl::Reference<GraphicObject>(); + m_rGraphicObject->SetUserData(); mbIsPreview = false; onGraphicChanged(); } @@ -463,7 +459,7 @@ void SdrGrafObj::SetGraphic( const Graphic& rGrf ) const Graphic& SdrGrafObj::GetGraphic() const { ForceSwapIn(); - return pGraphic->GetGraphic(); + return m_rGraphicObject->GetGraphic(); } Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const @@ -503,59 +499,59 @@ Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const } // Delegate to moved code in GraphicObject - return GetGraphicObject().GetTransformedGraphic( aDestSize, aDestMap, aActAttr ); + return GetGraphicObject()->GetTransformedGraphic( aDestSize, aDestMap, aActAttr ); } GraphicType SdrGrafObj::GetGraphicType() const { - return pGraphic->GetType(); + return m_rGraphicObject->GetType(); } bool SdrGrafObj::IsAnimated() const { - return pGraphic->IsAnimated(); + return m_rGraphicObject->IsAnimated(); } bool SdrGrafObj::IsEPS() const { - return pGraphic->IsEPS(); + return m_rGraphicObject->IsEPS(); } bool SdrGrafObj::IsSwappedOut() const { - return mbIsPreview ? true : pGraphic->IsSwappedOut(); + return mbIsPreview ? true : m_rGraphicObject->IsSwappedOut(); } const MapMode& SdrGrafObj::GetGrafPrefMapMode() const { - return pGraphic->GetPrefMapMode(); + return m_rGraphicObject->GetPrefMapMode(); } const Size& SdrGrafObj::GetGrafPrefSize() const { - return pGraphic->GetPrefSize(); + return m_rGraphicObject->GetPrefSize(); } -void SdrGrafObj::SetGrafStreamURL( const String& rGraphicStreamURL ) +void SdrGrafObj::SetGrafStreamURL( const OUString& rGraphicStreamURL ) { mbIsPreview = false; - if( !rGraphicStreamURL.Len() ) + if( rGraphicStreamURL.isEmpty() ) { - pGraphic->SetUserData(); + m_rGraphicObject->SetUserData(); } else if( pModel->IsSwapGraphics() ) { - pGraphic->SetUserData( rGraphicStreamURL ); + m_rGraphicObject->SetUserData( rGraphicStreamURL ); // set state of graphic object to 'swapped out' - if( pGraphic->GetType() == GRAPHIC_NONE ) - pGraphic->SetSwapState(); + if( m_rGraphicObject->GetType() == GRAPHIC_NONE ) + m_rGraphicObject->SetSwapState(); } } String SdrGrafObj::GetGrafStreamURL() const { - return pGraphic->GetUserData(); + return m_rGraphicObject->GetUserData(); } void SdrGrafObj::ForceSwapIn() const @@ -563,33 +559,33 @@ void SdrGrafObj::ForceSwapIn() const if( mbIsPreview ) { // removing preview graphic - const String aUserData( pGraphic->GetUserData() ); + const OUString aUserData( m_rGraphicObject->GetUserData() ); Graphic aEmpty; - pGraphic->SetGraphic( aEmpty ); - pGraphic->SetUserData( aUserData ); - pGraphic->SetSwapState(); + m_rGraphicObject = GraphicObject::Create(m_rGraphicObject, aEmpty ); + m_rGraphicObject->SetUserData( aUserData ); + m_rGraphicObject->SetSwapState(); const_cast< SdrGrafObj* >( this )->mbIsPreview = false; } - if ( pGraphicLink && pGraphic->IsSwappedOut() ) + if ( pGraphicLink && m_rGraphicObject->IsSwappedOut() ) ImpUpdateGraphicLink( false ); else - pGraphic->FireSwapInRequest(); + m_rGraphicObject->FireSwapInRequest(); - if( pGraphic->IsSwappedOut() || - ( pGraphic->GetType() == GRAPHIC_NONE ) || - ( pGraphic->GetType() == GRAPHIC_DEFAULT ) ) + if( m_rGraphicObject->IsSwappedOut() || + ( m_rGraphicObject->GetType() == GRAPHIC_NONE ) || + ( m_rGraphicObject->GetType() == GRAPHIC_DEFAULT ) ) { Graphic aDefaultGraphic; aDefaultGraphic.SetDefaultType(); - pGraphic->SetGraphic( aDefaultGraphic ); + m_rGraphicObject = GraphicObject::Create( m_rGraphicObject, aDefaultGraphic ); } } void SdrGrafObj::ForceSwapOut() const { - pGraphic->FireSwapOutRequest(); + m_rGraphicObject->FireSwapOutRequest(); } void SdrGrafObj::ImpLinkAnmeldung() @@ -620,16 +616,16 @@ void SdrGrafObj::ImpLinkAbmeldung() } } -void SdrGrafObj::SetGraphicLink(const OUString& rFileName, const String& rFilterName) +void SdrGrafObj::SetGraphicLink(const OUString& rFileName, const OUString& rFilterName) { ImpLinkAbmeldung(); aFileName = rFileName; aFilterName = rFilterName; ImpLinkAnmeldung(); - pGraphic->SetUserData(); + m_rGraphicObject->SetUserData(); // A linked graphic is per definition swapped out (has to be loaded) - pGraphic->SetSwapState(); + m_rGraphicObject->SetSwapState(); } void SdrGrafObj::ReleaseGraphicLink() @@ -656,7 +652,7 @@ const OUString& SdrGrafObj::GetFilterName() const void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const { - bool bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj; + bool bNoPresGrf = ( m_rGraphicObject->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj; rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 || aGeo.nDrehWink % 18000 == 0 || @@ -715,10 +711,10 @@ void SdrGrafObj::ImpSetLinkedGraphic( const Graphic& rGraphic ) OUString SdrGrafObj::TakeObjNameSingul() const { - if (!pGraphic) + if (!m_rGraphicObject.is()) return OUString(); - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData(); OUStringBuffer sName; @@ -728,11 +724,11 @@ OUString SdrGrafObj::TakeObjNameSingul() const } else { - switch( pGraphic->GetType() ) + switch( m_rGraphicObject->GetType() ) { case GRAPHIC_BITMAP: { - const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? + const sal_uInt16 nId = ( ( m_rGraphicObject->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) : ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) ); @@ -768,10 +764,10 @@ OUString SdrGrafObj::TakeObjNameSingul() const OUString SdrGrafObj::TakeObjNamePlural() const { - if(!pGraphic) + if(!m_rGraphicObject.is()) return OUString(); - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData(); OUStringBuffer sName; @@ -781,11 +777,11 @@ OUString SdrGrafObj::TakeObjNamePlural() const } else { - switch( pGraphic->GetType() ) + switch( m_rGraphicObject->GetType() ) { case GRAPHIC_BITMAP: { - const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? + const sal_uInt16 nId = ( ( m_rGraphicObject->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) : ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) ); @@ -847,7 +843,7 @@ SdrGrafObj& SdrGrafObj::operator=( const SdrGrafObj& rObj ) return *this; SdrRectObj::operator=( rObj ); - pGraphic->SetGraphic( rObj.GetGraphic(), &rObj.GetGraphicObject() ); + m_rGraphicObject = GraphicObject::Create(rObj.GetGraphicObject()); aFileName = rObj.aFileName; aFilterName = rObj.aFilterName; bMirrored = rObj.bMirrored; @@ -962,8 +958,8 @@ void SdrGrafObj::SetPage( SdrPage* pNewPage ) if( bRemove ) { // No SwapIn necessary here, because if something's not loaded, it can't be animated either. - if( pGraphic->IsAnimated()) - pGraphic->StopAnimation(); + if( m_rGraphicObject->IsAnimated()) + m_rGraphicObject->StopAnimation(); if( pGraphicLink != NULL ) ImpLinkAbmeldung(); @@ -1001,10 +997,10 @@ void SdrGrafObj::SetModel( SdrModel* pNewModel ) if( bChg ) { - if( pGraphic->HasUserData() ) + if( m_rGraphicObject->HasUserData() ) { ForceSwapIn(); - pGraphic->SetUserData(); + m_rGraphicObject->SetUserData(); } if( pGraphicLink != NULL ) @@ -1025,7 +1021,7 @@ void SdrGrafObj::StartAnimation( OutputDevice* /*pOutDev*/, const Point& /*rPoin bool SdrGrafObj::HasGDIMetaFile() const { - return( pGraphic->GetType() == GRAPHIC_GDIMETAFILE ); + return( m_rGraphicObject->GetType() == GRAPHIC_GDIMETAFILE ); } bool SdrGrafObj::isEmbeddedSvg() const @@ -1180,7 +1176,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText ) cons aSet.Put(XFillStyleItem(XFILL_BITMAP)); const BitmapEx aBitmapEx(GetTransformedGraphic().GetBitmapEx()); - aSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx))); + aSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(aBitmapEx))); aSet.Put(XFillBmpTileItem(false)); pRetval->SetMergedItemSet(aSet); @@ -1240,11 +1236,11 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly ) { Size aSize; Size aMaxSize( rMaxRect.GetSize() ); - if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) - aSize = Application::GetDefaultDevice()->PixelToLogic( pGraphic->GetPrefSize(), MAP_100TH_MM ); + if ( m_rGraphicObject->GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) + aSize = Application::GetDefaultDevice()->PixelToLogic( m_rGraphicObject->GetPrefSize(), MAP_100TH_MM ); else - aSize = OutputDevice::LogicToLogic( pGraphic->GetPrefSize(), - pGraphic->GetPrefMapMode(), + aSize = OutputDevice::LogicToLogic( m_rGraphicObject->GetPrefSize(), + m_rGraphicObject->GetPrefMapMode(), MapMode( MAP_100TH_MM ) ); if( aSize.Height() != 0 && aSize.Width() != 0 ) @@ -1292,7 +1288,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) if( pO->IsInSwapOut() ) { - if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && pGraphic->GetSizeBytes() > 20480 ) + if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && m_rGraphicObject->GetSizeBytes() > 20480 ) { // test if this object is visualized from someone // ## test only if there are VOCs other than the preview renderer @@ -1300,7 +1296,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) { const sal_uIntPtr nSwapMode = pModel->GetSwapGraphicsMode(); - if( ( pGraphic->HasUserData() || pGraphicLink ) && + if( ( m_rGraphicObject->HasUserData() || pGraphicLink ) && ( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) ) { pRet = GRFMGR_AUTOSWAPSTREAM_LINK; @@ -1308,7 +1304,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) else if( nSwapMode & SDR_SWAPGRAPHICSMODE_TEMP ) { pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; - pGraphic->SetUserData(); + m_rGraphicObject->SetUserData(); } // #i102380# @@ -1326,10 +1322,10 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) // can be loaded from the original document stream later if( pModel != NULL ) { - if( pGraphic->HasUserData() ) + if( m_rGraphicObject->HasUserData() ) { ::comphelper::LifecycleProxy proxy; - OUString aUserData = pGraphic->GetUserData(); + OUString aUserData = m_rGraphicObject->GetUserData(); uno::Reference<io::XInputStream> const xStream( pModel->GetDocumentStream(aUserData, proxy)); @@ -1364,10 +1360,10 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) aGraphic, aUserData, *pStream, GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData)) { - const String aNewUserData( pGraphic->GetUserData() ); + const String aNewUserData( m_rGraphicObject->GetUserData() ); - pGraphic->SetGraphic( aGraphic ); - pGraphic->SetUserData( aNewUserData ); + m_rGraphicObject = GraphicObject::Create(m_rGraphicObject, aGraphic ); + m_rGraphicObject->SetUserData( aNewUserData ); // Graphic successfully swapped in. pRet = GRFMGR_AUTOSWAPSTREAM_LOADED; @@ -1409,11 +1405,11 @@ Reference< XInputStream > SdrGrafObj::getInputStream() if( pModel ) { // can be loaded from the original document stream later - if( pGraphic->HasUserData() ) + if( m_rGraphicObject->HasUserData() ) { ::comphelper::LifecycleProxy proxy; xStream.set( - pModel->GetDocumentStream(pGraphic->GetUserData(), proxy)); + pModel->GetDocumentStream(m_rGraphicObject->GetUserData(), proxy)); // fdo#46340: this may look completely insane, and it is, // but it also prevents a crash: the LifecycleProxy will go out // of scope, but the xStream must be returned; the UcbStreamHelper @@ -1423,7 +1419,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream() utl::UcbStreamHelper::CreateStream(xStream); xStream.set(new utl::OInputStreamWrapper(pStream, true)); } - else if( pGraphic && GetGraphic().IsLink() ) + else if( m_rGraphicObject.is() && GetGraphic().IsLink() ) { Graphic aGraphic( GetGraphic() ); GfxLink aLink( aGraphic.GetLink() ); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index b97bf73733af..511667cd41d0 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -674,8 +674,8 @@ class SdrOle2ObjImpl { public: // TODO/LATER: do we really need this pointer? - GraphicObject* pGraphicObject; - String aPersistName; // name of object in persist + rtl::Reference<GraphicObject> m_rGraphicObject; + OUString aPersistName; // name of object in persist SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call // New local var to avoid repeated loading if load of OLE2 fails @@ -683,10 +683,10 @@ public: bool mbConnected; SdrEmbedObjectLink* mpObjectLink; - String maLinkURL; + OUString maLinkURL; SdrOle2ObjImpl() - : pGraphicObject( NULL ) + : m_rGraphicObject( NULL ) , pLightClient ( NULL ) // init to start situation, loading did not fail , mbLoadingOLEObjectFailed( false ) @@ -780,7 +780,7 @@ void SdrOle2Obj::Init() mpImpl = new SdrOle2ObjImpl; pModifyListener = NULL; pGraphic=NULL; - mpImpl->pGraphicObject=NULL; + mpImpl->m_rGraphicObject = rtl::Reference<GraphicObject>(); mpImpl->pLightClient = 0; xObjRef.Lock( sal_True ); @@ -798,8 +798,6 @@ SdrOle2Obj::~SdrOle2Obj() delete pGraphic; - delete mpImpl->pGraphicObject; - if(pModifyListener) { pModifyListener->invalidate(); @@ -843,14 +841,16 @@ void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf) { delete pGraphic; pGraphic = NULL; - delete mpImpl->pGraphicObject; - mpImpl->pGraphicObject = NULL; } - if (pGrf!=NULL) + if (pGrf != NULL) { pGraphic = new Graphic(*pGrf); - mpImpl->pGraphicObject = new GraphicObject( *pGraphic ); + mpImpl->m_rGraphicObject = GraphicObject::Create( *pGraphic ); + } + else + { + mpImpl->m_rGraphicObject = rtl::Reference<GraphicObject>(); } SetChanged(); @@ -1042,7 +1042,7 @@ void SdrOle2Obj::Reconnect_Impl() void SdrOle2Obj::Connect_Impl() { - if( pModel && mpImpl->aPersistName.Len() ) + if( pModel && !mpImpl->aPersistName.isEmpty() ) { try { @@ -1176,7 +1176,7 @@ void SdrOle2Obj::Disconnect() void SdrOle2Obj::RemoveListeners_Impl() { - if( xObjRef.is() && mpImpl->aPersistName.Len() ) + if( xObjRef.is() && !mpImpl->aPersistName.isEmpty() ) { try { @@ -1207,7 +1207,7 @@ void SdrOle2Obj::Disconnect_Impl() { try { - if ( pModel && mpImpl->aPersistName.Len() ) + if ( pModel && !mpImpl->aPersistName.isEmpty() ) { if( pModel->IsInDestruction() ) { @@ -1337,7 +1337,7 @@ SdrObject* SdrOle2Obj::createSdrGrafObjReplacement(bool bAddText, bool /* bUseHC // bitmap fill pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP)); - pClone->SetMergedItem(XFillBitmapItem(String(), GetEmptyOLEReplacementGraphic())); + pClone->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(GetEmptyOLEReplacementGraphic()))); pClone->SetMergedItem(XFillBmpTileItem(false)); pClone->SetMergedItem(XFillBmpStretchItem(false)); @@ -1548,7 +1548,7 @@ void SdrOle2Obj::SetPersistName( const String& rPersistName ) void SdrOle2Obj::AbandonObject() { - mpImpl->aPersistName.Erase(); + mpImpl->aPersistName = ""; mpImpl->mbLoadingOLEObjectFailed = false; SetObjRef(0); } @@ -1649,11 +1649,10 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj) if( pGraphic ) { delete pGraphic; - delete mpImpl->pGraphicObject; } pGraphic = new Graphic( *rOle2Obj.pGraphic ); - mpImpl->pGraphicObject = new GraphicObject( *pGraphic ); + mpImpl->m_rGraphicObject = GraphicObject::Create( *pGraphic ); } if( pModel && rObj.GetModel() && !IsEmptyPresObj() ) @@ -1998,7 +1997,7 @@ sal_Bool SdrOle2Obj::Unload() void SdrOle2Obj::GetObjRef_Impl() { - if ( !xObjRef.is() && mpImpl->aPersistName.Len() && pModel && pModel->GetPersist() ) + if ( !xObjRef.is() && !mpImpl->aPersistName.isEmpty() && pModel && pModel->GetPersist() ) { // Only try loading if it did not went wrong up to now if(!mpImpl->mbLoadingOLEObjectFailed) diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index ededdfd1eff3..b3af2a35bfa5 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -669,8 +669,8 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XP uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw() { OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX); - const GraphicObject& rGraphicObject(((XBitmapEntry*)pEntry)->GetGraphicObject()); - aURL += OStringToOUString(rGraphicObject.GetUniqueID(), RTL_TEXTENCODING_ASCII_US); + const rtl::Reference<GraphicObject> rGraphicObject = ((XBitmapEntry*)pEntry)->GetGraphicObject(); + aURL += OStringToOUString(rGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); uno::Any aAny; aAny <<= aURL; @@ -683,10 +683,9 @@ XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno:: if(!(rAny >>= aURL)) return NULL; - const GraphicObject aGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL)); - const String aName(rName); + const rtl::Reference<GraphicObject> rGrafObj = GraphicObject::CreateGraphicObjectFromURL(aURL); - return new XBitmapEntry(aGrafObj, aName); + return new XBitmapEntry(rGrafObj, rName); } // XElementAccess diff --git a/svx/source/unodraw/unobtabl.cxx b/svx/source/unodraw/unobtabl.cxx index 398ebc9cc621..6d5dba233b15 100644 --- a/svx/source/unodraw/unobtabl.cxx +++ b/svx/source/unodraw/unobtabl.cxx @@ -69,7 +69,7 @@ bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem ); if( pBitmapItem ) { - const Graphic& rGraphic = pBitmapItem->GetGraphicObject().GetGraphic(); + const Graphic& rGraphic = pBitmapItem->GetGraphicObject()->GetGraphic(); return rGraphic.GetSizeBytes() > 0; } diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index d2ecf6b8516c..ba8e843f169e 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -1513,7 +1513,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ); String aTmpStr(aURL); OString aUniqueID(OUStringToOString(aTmpStr, RTL_TEXTENCODING_UTF8)); - GraphicObject aGrafObj(aUniqueID); + rtl::Reference<GraphicObject> rGrafObj = GraphicObject::Create(aUniqueID); // #101808# since loading a graphic can cause a reschedule of the office // it is possible that our shape is removed while where in this @@ -1521,7 +1521,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte if( mpObj.is() ) { static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink(); - static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj ); + static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( rGrafObj ); } } else if( !aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) ) @@ -1649,9 +1649,9 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte else { sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut(); - const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true); + const rtl::Reference<GraphicObject> rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true); OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX); - aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US); + aURL += OStringToOUString(rGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); rValue <<= aURL; if ( bSwapped ) static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut(); @@ -1661,12 +1661,12 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte case OWN_ATTR_REPLACEMENTGRAFURL: { - const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject(); + const rtl::Reference<GraphicObject> rGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject(); - if(pGrafObj) + if(rGrafObj.is()) { OUString aURL(UNO_NAME_GRAPHOBJ_URLPREFIX); - aURL += OStringToOUString(pGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); + aURL += OStringToOUString(rGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); rValue <<= aURL; } diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 768896d9da36..af19e73e7a39 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -147,8 +147,8 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro OUString aURL; if( rValue >>= aURL ) { - GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) ); - static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &aGrafObj.GetGraphic() ); + rtl::Reference<GraphicObject> rGrafObj = GraphicObject::CreateGraphicObjectFromURL( aURL ); + static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &rGrafObj->GetGraphic() ); return true; } break; @@ -161,8 +161,8 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() ); if( pOle ) { - GraphicObject aGrafObj( xGraphic ); - const Graphic aGraphic( aGrafObj.GetGraphic() ); + rtl::Reference<GraphicObject> rGrafObj = GraphicObject::Create( xGraphic ); + const Graphic aGraphic( rGrafObj->GetGraphic() ); pOle->SetGraphicToObj( aGraphic, OUString() ); } return true; @@ -334,14 +334,13 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro // if there isn't already a preview graphic set, check if we need to generate // one if model says so if( pGraphic == NULL && !pOle->IsEmptyPresObj() && mpModel->IsSaveOLEPreview() ) - pGraphic = pOle->GetGraphic(); + pGraphic = pOle->GetGraphic(); /* FIXME: that sound wrong pGraphic is already = to pOle->GetGraphic() */ if( pGraphic ) { - GraphicObject aObj( *pGraphic ); + rtl::Reference<GraphicObject> rObj = GraphicObject::Create( *pGraphic ); aURL = OUString( UNO_NAME_GRAPHOBJ_URLPREFIX); - aURL += OStringToOUString(aObj.GetUniqueID(), - RTL_TEXTENCODING_ASCII_US); + aURL += OStringToOUString(rObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); } } rValue <<= aURL; diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 99d5548b1c0a..355bfe0ae311 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -96,17 +96,17 @@ public: SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId ) { - GraphicObject aGrfObject( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) ); + rtl::Reference<GraphicObject> rGrfObject = GraphicObject::Create( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) ); maTmp.EnableKillingFile(); - if( aGrfObject.GetType() != GRAPHIC_NONE ) + if( rGrfObject->GetType() != GRAPHIC_NONE ) { SvStream* pStm = ::utl::UcbStreamHelper::CreateStream( maTmp.GetURL(), STREAM_WRITE | STREAM_TRUNC ); if( pStm ) { - Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() ); + Graphic aGraphic( (Graphic&) rGrfObject->GetGraphic() ); const GfxLink aGfxLink( aGraphic.GetLink() ); sal_Bool bRet = sal_False; @@ -120,14 +120,14 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId ) if( aGraphic.GetType() == GRAPHIC_BITMAP ) { GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); - String aFormat; + OUString aFormat; if( aGraphic.IsAnimated() ) - aFormat = String( "gif" ); + aFormat = "gif"; else - aFormat = String( "png" ); + aFormat = "png"; - bRet = ( rFilter.ExportGraphic( aGraphic, String(), *pStm, rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 ); + bRet = ( rFilter.ExportGraphic( aGraphic, OUString(), *pStm, rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 ); } else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE ) { @@ -210,7 +210,7 @@ private: ::utl::TempFile* mpTmp; SvStream* mpOStm; Reference< XOutputStream > mxStmWrapper; - GraphicObject maGrfObj; + rtl::Reference<GraphicObject> m_rGrfObj; sal_Bool mbClosed; // not available @@ -223,7 +223,7 @@ public: virtual ~SvXMLGraphicOutputStream(); bool Exists() const { return mxStmWrapper.is(); } - const GraphicObject& GetGraphicObject(); + const rtl::Reference<GraphicObject> GetGraphicObject(); }; SvXMLGraphicOutputStream::SvXMLGraphicOutputStream() : @@ -274,9 +274,9 @@ void SAL_CALL SvXMLGraphicOutputStream::closeOutput() mbClosed = sal_True; } -const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() +const rtl::Reference<GraphicObject> SvXMLGraphicOutputStream::GetGraphicObject() { - if( mbClosed && ( maGrfObj.GetType() == GRAPHIC_NONE ) && mpOStm ) + if( mbClosed && ( m_rGrfObj->GetType() == GRAPHIC_NONE ) && mpOStm ) { Graphic aGraphic; @@ -334,15 +334,15 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() } } - maGrfObj = aGraphic; - if( maGrfObj.GetType() != GRAPHIC_NONE ) + m_rGrfObj = GraphicObject::Create(aGraphic); + if( m_rGrfObj->GetType() != GRAPHIC_NONE ) { delete mpOStm, mpOStm = NULL; delete mpTmp, mpTmp = NULL; } } - return maGrfObj; + return m_rGrfObj; } SvXMLGraphicHelper::SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode ) : @@ -507,15 +507,15 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageNa const OUString& rGraphicId, bool bUseGfxLink ) { - GraphicObject aGrfObject( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) ); + rtl::Reference<GraphicObject> rGrfObject = GraphicObject::Create( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) ); sal_Bool bRet = sal_False; - if( aGrfObject.GetType() != GRAPHIC_NONE ) + if( rGrfObject->GetType() != GRAPHIC_NONE ) { SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName, sal_False ) ); if( aStream.xStream.is() ) { - Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() ); + Graphic aGraphic( (Graphic&) rGrfObject->GetGraphic() ); const GfxLink aGfxLink( aGraphic.GetLink() ); const OUString aMimeType( ImplGetGraphicMimeType( rPictureStreamName ) ); uno::Any aAny; @@ -609,93 +609,101 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt if( GRAPHICHELPER_MODE_READ == meCreateMode ) { - const GraphicObject aObj( ImplReadGraphic( aPictureStorageName, aPictureStreamName ) ); + const rtl::Reference<GraphicObject> rObj = GraphicObject::Create(ImplReadGraphic( aPictureStorageName, aPictureStreamName )); - if( aObj.GetType() != GRAPHIC_NONE ) + if( rObj->GetType() != GRAPHIC_NONE ) { - maGrfObjs.push_back( aObj ); + maGrfObjs.push_back( rObj ); OUString aBaseURL( XML_GRAPHICOBJECT_URL_BASE ); rURLPair.second = aBaseURL; - rURLPair.second += OStringToOUString(aObj.GetUniqueID(), + rURLPair.second += OStringToOUString(rObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); } else - rURLPair.second = String(); + { + rURLPair.second = OUString(); + } } else { - const String aGraphicObjectId( aPictureStreamName ); + const OUString aGraphicObjectId( aPictureStreamName ); const OString aAsciiObjectID(OUStringToOString(aGraphicObjectId, RTL_TEXTENCODING_ASCII_US)); - const GraphicObject aGrfObject( aAsciiObjectID ); - if( aGrfObject.GetType() != GRAPHIC_NONE ) + const rtl::Reference<GraphicObject> rGrfObject = GraphicObject::Create( aAsciiObjectID ); + if( rGrfObject->GetType() != GRAPHIC_NONE ) { - String aStreamName( aGraphicObjectId ); - Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() ); - const GfxLink aGfxLink( aGraphic.GetLink() ); - String aExtension; - bool bUseGfxLink( true ); + OUString aStreamName( aGraphicObjectId ); + Graphic aGraphic( (Graphic&) rGrfObject->GetGraphic() ); + const GfxLink aGfxLink( aGraphic.GetLink() ); + OUString aExtension; + bool bUseGfxLink( true ); if( aGfxLink.GetDataSize() ) { switch( aGfxLink.GetType() ) { - case( GFX_LINK_TYPE_EPS_BUFFER ): aExtension = String( ".eps" ); break; - case( GFX_LINK_TYPE_NATIVE_GIF ): aExtension = String( ".gif" ); break; - case( GFX_LINK_TYPE_NATIVE_JPG ): aExtension = String( ".jpg" ); break; - case( GFX_LINK_TYPE_NATIVE_PNG ): aExtension = String( ".png" ); break; - case( GFX_LINK_TYPE_NATIVE_TIF ): aExtension = String( ".tif" ); break; - case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( ".wmf" ); break; - case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( ".met" ); break; - case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( ".pct" ); break; - case( GFX_LINK_TYPE_NATIVE_SVG ): - // backward-compat kludge: since no released OOo - // version to date can handle svg properly, wrap it up - // into an svm. slight catch22 here, since strict ODF - // conformance _recommends_ svg - then again, most old - // ODF consumers are believed to be OOo - if( SvtSaveOptions().GetODFDefaultVersion() <= SvtSaveOptions::ODFVER_012 ) - { - bUseGfxLink = false; - aExtension = String( ".svm" ); - } - else - aExtension = String( ".svg" ); - break; + case GFX_LINK_TYPE_EPS_BUFFER: aExtension = ".eps"; break; + case GFX_LINK_TYPE_NATIVE_GIF: aExtension = ".gif"; break; + case GFX_LINK_TYPE_NATIVE_JPG: aExtension = ".jpg"; break; + case GFX_LINK_TYPE_NATIVE_PNG: aExtension = ".png"; break; + case GFX_LINK_TYPE_NATIVE_TIF: aExtension = ".tif"; break; + case GFX_LINK_TYPE_NATIVE_WMF: aExtension = ".wmf"; break; + case GFX_LINK_TYPE_NATIVE_MET: aExtension = ".met"; break; + case GFX_LINK_TYPE_NATIVE_PCT: aExtension = ".pct"; break; + case GFX_LINK_TYPE_NATIVE_SVG: + // backward-compat kludge: since no released OOo + // version to date can handle svg properly, wrap it up + // into an svm. slight catch22 here, since strict ODF + // conformance _recommends_ svg - then again, most old + // ODF consumers are believed to be OOo + if( SvtSaveOptions().GetODFDefaultVersion() <= SvtSaveOptions::ODFVER_012 ) + { + bUseGfxLink = false; + aExtension = ".svm"; + } + else + aExtension = ".svg"; + break; - default: - aExtension = String( ".grf" ); + default: + aExtension = ".grf"; break; } } else { - if( aGrfObject.GetType() == GRAPHIC_BITMAP ) + if( rGrfObject->GetType() == GRAPHIC_BITMAP ) { - if( aGrfObject.IsAnimated() ) - aExtension = String( ".gif" ); + if( rGrfObject->IsAnimated() ) + { + aExtension = ".gif"; + } else - aExtension = String( ".png" ); + { + aExtension = ".png"; + } } - else if( aGrfObject.GetType() == GRAPHIC_GDIMETAFILE ) + else if( rGrfObject->GetType() == GRAPHIC_GDIMETAFILE ) { // SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() ); if ( ImplCheckForEPS( rMtf ) ) - aExtension = String( ".eps" ); + { + aExtension = ".eps"; + } else - aExtension = String( ".svm" ); + { + aExtension = ".svm"; + } } } OUString aURLEntry; - const String sPictures( "Pictures/" ); + const OUString sPictures( "Pictures/" ); if ( !rRequestedFileName.isEmpty() ) { - aURLEntry = sPictures; - aURLEntry += rRequestedFileName; - aURLEntry += aExtension; + aURLEntry = sPictures + rRequestedFileName + aExtension; URLPairVector::const_iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() ); for ( ; aIter != aEnd; ++aIter ) @@ -704,24 +712,25 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt break; } if ( aIter == aEnd ) + { aStreamName = rRequestedFileName; + } } aStreamName += aExtension; - if( mbDirect && aStreamName.Len() ) + if( mbDirect && !aStreamName.isEmpty() ) + { ImplWriteGraphic( aPictureStorageName, aStreamName, aGraphicObjectId, bUseGfxLink ); - - rURLPair.second = sPictures; - rURLPair.second += aStreamName; + } + rURLPair.second = sPictures + aStreamName; } #if OSL_DEBUG_LEVEL > 0 else { - OStringBuffer sMessage( - RTL_CONSTASCII_STRINGPARAM("graphic object with ID '")); + OStringBuffer sMessage("graphic object with ID '"); sMessage.append(aAsciiObjectID). - append(RTL_CONSTASCII_STRINGPARAM("' has an unknown type")); + append("' has an unknown type"); OSL_ENSURE( false, sMessage.getStr() ); } #endif @@ -868,9 +877,8 @@ OUString SAL_CALL SvXMLGraphicHelper::resolveOutputStream( const Reference< XOut if( pOStm ) { - const GraphicObject& rGrfObj = pOStm->GetGraphicObject(); - const OUString aId(OStringToOUString( - rGrfObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US)); + const rtl::Reference<GraphicObject> rGrfObj = pOStm->GetGraphicObject(); + const OUString aId(OStringToOUString(rGrfObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US)); if( !aId.isEmpty() ) { diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index bad053361de9..680cfa3cceb4 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -114,15 +114,15 @@ Graphic XOutBitmap::MirrorGraphic( const Graphic& rGraphic, const sal_uIntPtr nM return aRetGraphic; } -sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName, - const String& rFilterName, const sal_uIntPtr nFlags, - const Size* pMtfSize_100TH_MM ) +sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, + const OUString& rFilterName, const sal_uIntPtr nFlags, + const Size* pMtfSize_100TH_MM ) { if( rGraphic.GetType() != GRAPHIC_NONE ) { INetURLObject aURL( rFileName ); Graphic aGraphic; - String aExt; + OUString aExt; GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); sal_uInt16 nErr = GRFILTER_FILTERERROR, nFilter = GRFILTER_FORMAT_NOTFOUND; sal_Bool bTransparent = rGraphic.IsTransparent(), bAnimated = rGraphic.IsAnimated(); @@ -132,13 +132,13 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName, // calculate correct file name if( !( nFlags & XOUTBMP_DONT_EXPAND_FILENAME ) ) { - String aName( aURL.getBase() ); - aName += '_'; - aName += String(aURL.getExtension()); - aName += '_'; - String aStr( OUString::number( rGraphic.GetChecksum(), 16 ) ); - if ( aStr.GetChar(0) == '-' ) - aStr.SetChar(0,'m'); + OUString aName( aURL.getBase() + "_" + aURL.getExtension() + "_" ); + + OUString aStr( OUString::number( rGraphic.GetChecksum(), 16 ) ); + if ( aStr[0] == '-' ) + { + aStr = "m" + aStr.copy(1); + } aName += aStr; aURL.setBase( aName ); } @@ -148,7 +148,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName, if(aSvgDataPtr.get() && aSvgDataPtr->getSvgDataArrayLength() - && rFilterName.EqualsIgnoreCaseAscii("svg")) + && rFilterName.equalsIgnoreAsciiCase("svg")) { if(!(nFlags & XOUTBMP_DONT_ADD_EXTENSION)) { @@ -191,7 +191,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName, break; } - if( aExt.Len() ) + if( !aExt.isEmpty() ) { if( 0 == (nFlags & XOUTBMP_DONT_ADD_EXTENSION)) aURL.setExtension( aExt ); diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index e3b50dd6ccf4..6851418953a2 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -242,8 +242,8 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn { case XATTR_FILLBITMAP: { - const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject()); - const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject()); + const rtl::Reference<GraphicObject> rGraphicObjectA = ((XFillBitmapItem*)pCheckItem)->GetGraphicObject(); + const rtl::Reference<GraphicObject> rGraphicObjectB = ((XBitmapEntry*)pEntry)->GetGraphicObject(); bFound = (rGraphicObjectA == rGraphicObjectB); break; diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 78e56e87eea2..25b976e9f2f1 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -50,7 +50,7 @@ using namespace ::com::sun::star; XOBitmap::XOBitmap( const Bitmap& rBmp ) : eType ( XBITMAP_IMPORT ), - aGraphicObject ( rBmp ), + m_rGraphicObject ( GraphicObject::Create(rBmp) ), pPixelArray ( NULL ), bGraphicDirty ( sal_False ) { @@ -66,7 +66,7 @@ XOBitmap::XOBitmap( const XOBitmap& rXBmp ) : pPixelArray ( NULL ) { eType = rXBmp.eType; - aGraphicObject = rXBmp.aGraphicObject; + m_rGraphicObject = rXBmp.m_rGraphicObject; aArraySize = rXBmp.aArraySize; aPixelColor = rXBmp.aPixelColor; aBckgrColor = rXBmp.aBckgrColor; @@ -104,7 +104,7 @@ XOBitmap::~XOBitmap() XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp ) { eType = rXBmp.eType; - aGraphicObject = rXBmp.aGraphicObject; + m_rGraphicObject = rXBmp.m_rGraphicObject; aArraySize = rXBmp.aArraySize; aPixelColor = rXBmp.aPixelColor; aBckgrColor = rXBmp.aBckgrColor; @@ -132,7 +132,7 @@ XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp ) int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const { if( eType != rXOBitmap.eType || - aGraphicObject != rXOBitmap.aGraphicObject || + m_rGraphicObject != rXOBitmap.m_rGraphicObject || aArraySize != rXOBitmap.aArraySize || aPixelColor != rXOBitmap.aPixelColor || aBckgrColor != rXOBitmap.aBckgrColor || @@ -161,7 +161,7 @@ int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const Bitmap XOBitmap::GetBitmap() const { - return GetGraphicObject().GetGraphic().GetBitmap(); + return GetGraphicObject()->GetGraphic().GetBitmap(); } /************************************************************************* @@ -170,12 +170,12 @@ Bitmap XOBitmap::GetBitmap() const |* *************************************************************************/ -const GraphicObject& XOBitmap::GetGraphicObject() const +const rtl::Reference<GraphicObject> XOBitmap::GetGraphicObject() const { if( bGraphicDirty ) ( (XOBitmap*) this )->Array2Bitmap(); - return aGraphicObject; + return m_rGraphicObject; } /************************************************************************* @@ -253,7 +253,7 @@ void XOBitmap::Array2Bitmap() } } - aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) ); + m_rGraphicObject = GraphicObject::Create( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) ); bGraphicDirty = sal_False; } @@ -264,9 +264,9 @@ TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex); ////////////////////////////////////////////////////////////////////////////// -XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rGraphicObject) +XFillBitmapItem::XFillBitmapItem(const XubString& rName, const rtl::Reference<GraphicObject>& rGraphicObject) : NameOrIndex(XATTR_FILLBITMAP, rName), - maGraphicObject(rGraphicObject) + m_rGraphicObject(rGraphicObject) { } @@ -274,7 +274,7 @@ XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rG XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem) : NameOrIndex(rItem), - maGraphicObject(rItem.maGraphicObject) + m_rGraphicObject(rItem.m_rGraphicObject) { } @@ -359,7 +359,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer) Bitmap aBmp; ReadDIB(aBmp, rIn, true); - maGraphicObject = Graphic(aBmp); + m_rGraphicObject = GraphicObject::Create(Graphic(aBmp)); } else if(1 == nVer) { @@ -373,7 +373,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer) Bitmap aBmp; ReadDIB(aBmp, rIn, true); - maGraphicObject = Graphic(aBmp); + m_rGraphicObject = GraphicObject::Create(Graphic(aBmp)); } else if(XBITMAP_8X8 == iTmp) { @@ -392,7 +392,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer) const Bitmap aBitmap(createHistorical8x8FromArray(aArray, aColorPix, aColorBack)); - maGraphicObject = Graphic(aBitmap); + m_rGraphicObject = GraphicObject::Create(Graphic(aBitmap)); } } else if(2 == nVer) @@ -400,16 +400,16 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer) BitmapEx aBmpEx; ReadDIBBitmapEx(aBmpEx, rIn); - maGraphicObject = Graphic(aBmpEx); + m_rGraphicObject = GraphicObject::Create(Graphic(aBmpEx)); } } } ////////////////////////////////////////////////////////////////////////////// -XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/, const GraphicObject& rGraphicObject) +XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/, const rtl::Reference<GraphicObject>& rGraphicObject) : NameOrIndex( XATTR_FILLBITMAP, -1), - maGraphicObject(rGraphicObject) + m_rGraphicObject(rGraphicObject) { } @@ -425,7 +425,7 @@ SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const { return (NameOrIndex::operator==(rItem) - && maGraphicObject == ((const XFillBitmapItem&)rItem).maGraphicObject); + && m_rGraphicObject == ((const XFillBitmapItem&)rItem).m_rGraphicObject); } ////////////////////////////////////////////////////////////////////////////// @@ -443,7 +443,7 @@ SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) cons if(!IsIndex()) { - WriteDIBBitmapEx(maGraphicObject.GetGraphic().GetBitmapEx(), rOut); + WriteDIBBitmapEx(m_rGraphicObject->GetGraphic().GetBitmapEx(), rOut); } return rOut; @@ -451,16 +451,16 @@ SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) cons ////////////////////////////////////////////////////////////////////////////// -const GraphicObject& XFillBitmapItem::GetGraphicObject() const +const rtl::Reference<GraphicObject> XFillBitmapItem::GetGraphicObject() const { - return maGraphicObject; + return m_rGraphicObject; } ////////////////////////////////////////////////////////////////////////////// -void XFillBitmapItem::SetGraphicObject(const GraphicObject& rGraphicObject) +void XFillBitmapItem::SetGraphicObject(const rtl::Reference<GraphicObject>& rGraphicObject) { - maGraphicObject = rGraphicObject; + m_rGraphicObject = rGraphicObject; } ////////////////////////////////////////////////////////////////////////////// @@ -520,24 +520,28 @@ bool XFillBitmapItem::QueryValue(::com::sun::star::uno::Any& rVal, sal_uInt8 nMe if( nMemberId == MID_GRAFURL || nMemberId == 0 ) { - aURL = OUString( - UNO_NAME_GRAPHOBJ_URLPREFIX); - aURL += OStringToOUString( - GetGraphicObject().GetUniqueID(), - RTL_TEXTENCODING_ASCII_US); + aURL = OUString( UNO_NAME_GRAPHOBJ_URLPREFIX); + aURL += OStringToOUString( GetGraphicObject()->GetUniqueID(), + RTL_TEXTENCODING_ASCII_US); } if( nMemberId == MID_BITMAP || nMemberId == 0 ) { - xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject().GetGraphic().GetBitmapEx())); + xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject()->GetGraphic().GetBitmapEx())); } if( nMemberId == MID_NAME ) + { rVal <<= aApiName; + } else if( nMemberId == MID_GRAFURL ) + { rVal <<= aURL; + } else if( nMemberId == MID_BITMAP ) + { rVal <<= xBmp; + } else { // member-id 0 => complete item (e.g. for toolbars) @@ -606,10 +610,10 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt } if( bSetURL ) { - maGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL); + m_rGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL); // #121194# Prefer GraphicObject over bitmap object if both are provided - if(bSetBitmap && GRAPHIC_NONE != maGraphicObject.GetType()) + if(bSetBitmap && GRAPHIC_NONE != m_rGraphicObject->GetType()) { bSetBitmap = false; } @@ -618,11 +622,11 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt { if(xBmp.is()) { - maGraphicObject = Graphic(VCLUnoHelper::GetBitmap(xBmp)); + m_rGraphicObject = GraphicObject::Create(VCLUnoHelper::GetBitmap(xBmp)); } else if(xGraphic.is()) { - maGraphicObject = Graphic(xGraphic); + m_rGraphicObject = GraphicObject::Create(xGraphic); } } @@ -633,10 +637,10 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt sal_Bool XFillBitmapItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ) { - const GraphicObject& aGraphicObjectA(((XFillBitmapItem*)p1)->GetGraphicObject()); - const GraphicObject& aGraphicObjectB(((XFillBitmapItem*)p2)->GetGraphicObject()); + const rtl::Reference<GraphicObject> rGraphicObjectA = (((XFillBitmapItem*)p1)->GetGraphicObject()); + const rtl::Reference<GraphicObject> rGraphicObjectB = (((XFillBitmapItem*)p2)->GetGraphicObject()); - return aGraphicObjectA == aGraphicObjectB; + return rGraphicObjectA == rGraphicObjectB; } ////////////////////////////////////////////////////////////////////////////// @@ -654,7 +658,7 @@ XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const // if the given name is not valid, replace it! if( aUniqueName != GetName() ) { - return new XFillBitmapItem(aUniqueName, maGraphicObject); + return new XFillBitmapItem(aUniqueName, m_rGraphicObject); } } diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 5f1124eb15cb..7d239210150c 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -71,36 +71,36 @@ XOutdevItemPool::XOutdevItemPool( mppLocalPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem; mppLocalPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(this,aNullDash); mppLocalPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem; - mppLocalPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol); - mppLocalPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(this,aNullPol); - mppLocalPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem (this,aNullPol); + mppLocalPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr, aNullLineCol); + mppLocalPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(this, aNullPol); + mppLocalPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem(this, aNullPol); mppLocalPoolDefaults[XATTR_LINESTARTWIDTH -XATTR_START] = new XLineStartWidthItem; mppLocalPoolDefaults[XATTR_LINEENDWIDTH -XATTR_START] = new XLineEndWidthItem; mppLocalPoolDefaults[XATTR_LINESTARTCENTER -XATTR_START] = new XLineStartCenterItem; mppLocalPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem; mppLocalPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem; - mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem; + mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem; mppLocalPoolDefaults[XATTR_LINECAP -XATTR_START] = new XLineCapItem; - mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem; - mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol); - mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(aNullGrad); - mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (this,aNullHatch); - mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this, aNullGraphic); - mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem; - mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem; - mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem; - mppLocalPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem; - mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem; - mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem; - mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem; - mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX -XATTR_START] = new XFillBmpTileOffsetXItem; - mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY -XATTR_START] = new XFillBmpTileOffsetYItem; - mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem; - mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem; - mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem; - mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, sal_False ); - mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol); - mppLocalPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem; + mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem; + mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem(aNullStr, aNullFillCol); + mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(aNullGrad); + mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem(this, aNullHatch); + mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem(this, GraphicObject::Create(aNullGraphic)); + mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem; + mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem; + mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem; + mppLocalPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem; + mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem; + mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem; + mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem; + mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX-XATTR_START] = new XFillBmpTileOffsetXItem; + mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY-XATTR_START] = new XFillBmpTileOffsetYItem; + mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem; + mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem; + mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem; + mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE-XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, sal_False ); + mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol); + mppLocalPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem; mppLocalPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem; mppLocalPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem; mppLocalPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem; @@ -108,7 +108,7 @@ XOutdevItemPool::XOutdevItemPool( mppLocalPoolDefaults[XATTR_FORMTXTMIRROR -XATTR_START] = new XFormTextMirrorItem; mppLocalPoolDefaults[XATTR_FORMTXTOUTLINE -XATTR_START] = new XFormTextOutlineItem; mppLocalPoolDefaults[XATTR_FORMTXTSHADOW -XATTR_START] = new XFormTextShadowItem; - mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol); + mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr, aNullShadowCol); mppLocalPoolDefaults[XATTR_FORMTXTSHDWXVAL -XATTR_START] = new XFormTextShadowXValItem; mppLocalPoolDefaults[XATTR_FORMTXTSHDWYVAL -XATTR_START] = new XFormTextShadowYValItem; mppLocalPoolDefaults[XATTR_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem; diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx index 961c501b3356..282b287ee328 100644 --- a/svx/source/xoutdev/xtabbtmp.cxx +++ b/svx/source/xoutdev/xtabbtmp.cxx @@ -49,40 +49,40 @@ uno::Reference< container::XNameContainer > XBitmapList::createInstance() bool XBitmapList::Create() { - String aStr(SVX_RESSTR(RID_SVXSTR_BITMAP)); + OUString aStr(SVX_RESSTR(RID_SVXSTR_BITMAP)); + OUString aTmp; sal_uInt16 aArray[64]; Bitmap aBitmap; - const xub_StrLen nLen(aStr.Len() - 1); memset(aArray, 0, sizeof(aArray)); // white/white bitmap - aStr.AppendAscii(" 1"); + aTmp = aStr + " 1"; aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); + Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp)); // black/white bitmap aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1; aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1; - aStr.SetChar(nLen, sal_Unicode('2')); + aTmp = aStr + " 2"; aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); + Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp)); // lightred/white bitmap aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1; aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1; - aStr.SetChar(nLen, sal_Unicode('3')); + aTmp = aStr + " 3"; aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); + Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp)); // lightblue/white bitmap aArray[24] = 1; aArray[25] = 1; aArray[26] = 1; aArray[29] = 1; aArray[30] = 1; aArray[31] = 1; - aStr.SetChar(nLen, sal_Unicode('4')); + aTmp = aStr + " 4"; aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); + Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp)); - return sal_True; + return true; } Bitmap XBitmapList::CreateBitmapForUI( long /*nIndex*/ ) diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index 0da58d45486b..ec3f089b2880 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -33,7 +33,7 @@ using namespace com::sun::star; -XDashList::XDashList(const String& rPath) +XDashList::XDashList(const OUString& rPath) : XPropertyList(XDASH_LIST, rPath) , maBitmapSolidLine() , maStringSolidLine() @@ -68,16 +68,14 @@ uno::Reference< container::XNameContainer > XDashList::createInstance() bool XDashList::Create() { - XubString aStr(SVX_RESSTR(RID_SVXSTR_LINESTYLE)); - xub_StrLen nLen; - - aStr.AppendAscii(" 1"); - nLen = aStr.Len() - 1; - Insert(new XDashEntry(XDash(XDASH_RECT,1, 50,1, 50, 50),aStr)); - aStr.SetChar(nLen, sal_Unicode('2')); - Insert(new XDashEntry(XDash(XDASH_RECT,1,500,1,500,500),aStr)); - aStr.SetChar(nLen, sal_Unicode('3')); - Insert(new XDashEntry(XDash(XDASH_RECT,2, 50,3,250,120),aStr)); + OUString aStr(SVX_RESSTR(RID_SVXSTR_LINESTYLE)); + OUString aTmp; + aTmp = aStr + " 1"; + Insert(new XDashEntry(XDash(XDASH_RECT,1, 50,1, 50, 50),aTmp)); + aTmp = aStr + " 2"; + Insert(new XDashEntry(XDash(XDASH_RECT,1,500,1,500,500),aTmp)); + aTmp = aStr + " 3"; + Insert(new XDashEntry(XDash(XDASH_RECT,2, 50,3,250,120),aTmp)); return true; } @@ -202,9 +200,9 @@ Bitmap XDashList::GetBitmapForUISolidLine() const return maBitmapSolidLine; } -String XDashList::GetStringForUiSolidLine() const +OUString XDashList::GetStringForUiSolidLine() const { - if(!maStringSolidLine.Len()) + if(maStringSolidLine.isEmpty()) { const_cast< XDashList* >(this)->maStringSolidLine = ResId(RID_SVXSTR_SOLID, DIALOG_MGR()).toString(); } @@ -212,9 +210,9 @@ String XDashList::GetStringForUiSolidLine() const return maStringSolidLine; } -String XDashList::GetStringForUiNoLine() const +OUString XDashList::GetStringForUiNoLine() const { - if(!maStringNoLine.Len()) + if(maStringNoLine.isEmpty()) { // formally was RID_SVXSTR_INVISIBLE, but tomake equal // everywhere, use RID_SVXSTR_NONE diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index 9853a0ecb410..c187b908908c 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -34,7 +34,7 @@ using namespace com::sun::star; -XGradientList::XGradientList( const String& rPath ) +XGradientList::XGradientList( const OUString& rPath ) : XPropertyList( XGRADIENT_LIST, rPath ) { } diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index 111907284342..c32c1d0288a4 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -34,7 +34,7 @@ using namespace ::com::sun::star; using namespace ::rtl; -XHatchList::XHatchList(const String& rPath) +XHatchList::XHatchList(const OUString& rPath) : XPropertyList( XHATCH_LIST, rPath ) { } diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 5fd2d5e558e5..0333278c2f60 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -40,7 +40,7 @@ Color RGB_Color( ColorData nColorName ) ////////////////////////////////////////////////////////////////////////////// // class XColorEntry -XColorEntry::XColorEntry(const Color& rColor, const String& rName) +XColorEntry::XColorEntry(const Color& rColor, const OUString& rName) : XPropertyEntry(rName), aColor(rColor) { @@ -55,7 +55,7 @@ aColor(rOther.aColor) ////////////////////////////////////////////////////////////////////////////// // class XLineEndEntry -XLineEndEntry::XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName) +XLineEndEntry::XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const OUString& rName) : XPropertyEntry(rName), aB2DPolyPolygon(rB2DPolyPolygon) { @@ -70,7 +70,7 @@ XLineEndEntry::XLineEndEntry(const XLineEndEntry& rOther) ////////////////////////////////////////////////////////////////////////////// // class XDashEntry -XDashEntry::XDashEntry(const XDash& rDash, const String& rName) +XDashEntry::XDashEntry(const XDash& rDash, const OUString& rName) : XPropertyEntry(rName), aDash(rDash) { @@ -85,7 +85,7 @@ aDash(rOther.aDash) ////////////////////////////////////////////////////////////////////////////// // class XHatchEntry -XHatchEntry::XHatchEntry(const XHatch& rHatch, const String& rName) +XHatchEntry::XHatchEntry(const XHatch& rHatch, const OUString& rName) : XPropertyEntry(rName), aHatch(rHatch) { @@ -100,7 +100,7 @@ XHatchEntry::XHatchEntry(const XHatchEntry& rOther) ////////////////////////////////////////////////////////////////////////////// // class XGradientEntry -XGradientEntry::XGradientEntry(const XGradient& rGradient, const String& rName) +XGradientEntry::XGradientEntry(const XGradient& rGradient, const OUString& rName) : XPropertyEntry(rName), aGradient(rGradient) { @@ -115,28 +115,27 @@ XGradientEntry::XGradientEntry(const XGradientEntry& rOther) ////////////////////////////////////////////////////////////////////////////// // class XBitmapEntry -XBitmapEntry::XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName) +XBitmapEntry::XBitmapEntry(const rtl::Reference<GraphicObject>& rGraphicObject, const OUString& rName) : XPropertyEntry(rName), - maGraphicObject(rGraphicObject) + m_rGraphicObject(rGraphicObject) { } XBitmapEntry::XBitmapEntry(const XBitmapEntry& rOther) : XPropertyEntry(rOther), - maGraphicObject(rOther.maGraphicObject) + m_rGraphicObject(rOther.m_rGraphicObject) { } // static int count = 0; -XPropertyList::XPropertyList( - XPropertyListType type, - const String& rPath -) : meType ( type ), - maName ( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ), - maPath ( rPath ), - mbListDirty ( true ), - mbEmbedInDocument( false ) +XPropertyList::XPropertyList( XPropertyListType type, + const OUString& rPath) + : meType ( type ) + , maName ( "standard" ) + , maPath ( rPath ) + , mbListDirty ( true ) + , mbEmbedInDocument( false ) { // fprintf (stderr, "Create type %d count %d\n", (int)meType, count++); } @@ -170,7 +169,7 @@ XPropertyEntry* XPropertyList::Get( long nIndex ) const return ( (size_t)nIndex < maList.size() ) ? maList[ nIndex ] : NULL; } -long XPropertyList::GetIndex(const XubString& rName) const +long XPropertyList::GetIndex(const OUString& rName) const { if( mbListDirty ) { @@ -231,9 +230,9 @@ XPropertyEntry* XPropertyList::Remove( long nIndex ) return pEntry; } -void XPropertyList::SetName( const String& rString ) +void XPropertyList::SetName( const OUString& rString ) { - if(rString.Len()) + if(!rString.isEmpty()) { maName = rString; } @@ -301,7 +300,7 @@ bool XPropertyList::SaveTo( const uno::Reference< embed::XStorage > &xStorage, } XPropertyListRef XPropertyList::CreatePropertyList( XPropertyListType t, - const String& rPath ) + const OUString& rPath ) { XPropertyListRef pRet; diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index 1dae9c89c33e..4e782027f7ff 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -33,7 +33,7 @@ using namespace com::sun::star; -XLineEndList::XLineEndList( const String& rPath ) +XLineEndList::XLineEndList( const OUString& rPath ) : XPropertyList( XLINE_END_LIST, rPath ) { } |