diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2013-05-07 05:39:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-01 16:47:03 +0100 |
commit | b9ebdadf5a6ebf22b4df7589d86dd8fdfb675b1e (patch) | |
tree | 78792de2fda38e4fc2b2e5ba9b79fcdb4e517830 /sd | |
parent | bc51be7e7f2fc55456e1ce7dcdc70e6a15c53c0e (diff) |
Resolves: fdo#66027 #i122116# Remove GalleryExplorer member functions
(cherry picked from commit e94681fb47e3c5bdba486cd8feca92705d44840d)
Conflicts:
sc/source/ui/app/typemap.cxx
sc/source/ui/view/galwrap.cxx
sc/source/ui/view/makefile.mk
sc/source/ui/view/tabvwsh9.cxx
sd/source/ui/view/drviews9.cxx
svx/Package_inc.mk
svx/inc/GalleryControl.hxx
svx/inc/galbrws2.hxx
svx/inc/svx/galbrws.hxx
svx/inc/svx/gallery.hxx
svx/source/gallery2/GalleryControl.cxx
svx/source/gallery2/galbrws.cxx
svx/source/gallery2/galbrws2.cxx
svx/source/gallery2/galexpl.cxx
sw/source/ui/shells/basesh.cxx
Change-Id: I49c2b99ca551f058b852c0e5e28cc2fe8c205031
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/typemap.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationDialog.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/animations/SlideTransitionPane.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews9.cxx | 199 |
4 files changed, 102 insertions, 102 deletions
diff --git a/sd/source/core/typemap.cxx b/sd/source/core/typemap.cxx index cc029fca554c..0eabb4167144 100644 --- a/sd/source/core/typemap.cxx +++ b/sd/source/core/typemap.cxx @@ -98,6 +98,7 @@ #include <svx/xflftrit.hxx> #include <svx/xlinjoit.hxx> #include <svx/AffineMatrixItem.hxx> +#include <svx/galleryitem.hxx> #define SFX_TYPEMAP #include "sdslots.hxx" diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 8a861c2006e5..6f1ca05b0511 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -1751,7 +1751,7 @@ void CustomAnimationEffectTabPage::openSoundFileDialog() if( nPos < 0 ) // not in Soundliste { // try to insert in Gallery - if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) ) + if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile ) ) { clearSoundListBox(); fillSoundListBox(); diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index bcb4af23999c..eb638b7f50d1 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -964,7 +964,7 @@ void SlideTransitionPane::openSoundFileDialog() else // not in sound list { // try to insert into gallery - if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) ) + if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile ) ) { updateSoundList(); bValidSoundFile = lcl_findSoundInList( maSoundList, aFile, nPos ); diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index b69db95ada57..b6ccd5e3909a 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -57,6 +57,9 @@ #include "sdresid.hxx" #include "fupoor.hxx" +#include <svx/galleryitem.hxx> +#include <com/sun/star/gallery/GalleryItemType.hpp> + namespace sd { @@ -68,125 +71,121 @@ void DrawViewShell::ExecGallery(SfxRequest& rReq) const SfxItemSet* pArgs = rReq.GetArgs(); - if ( pArgs ) - { - const sal_uInt32 nFormats = ( (SfxUInt32Item&) pArgs->Get( SID_GALLERY_FORMATS ) ).GetValue(); - GalleryExplorer* pGal = SVX_GALLERY(); + SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, sal_False ); + if ( !pGalleryItem ) + return; - if ( pGal ) + GetDocSh()->SetWaitCursor( sal_True ); + + sal_Int8 nType( pGalleryItem->GetType() ); + // insert graphic + if (nType == com::sun::star::gallery::GalleryItemType::GRAPHIC) + { + Graphic aGraphic( pGalleryItem->GetGraphic() ); + + // reduce size if necessary + Window aWindow (GetActiveWindow()); + aWindow.SetMapMode(aGraphic.GetPrefMapMode()); + Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize()); + aWindow.SetMapMode( MapMode(MAP_100TH_MM) ); + Size aSize = aWindow.PixelToLogic(aSizePix); + + // constrain size to page size if necessary + SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage(); + Size aPageSize = pPage->GetSize(); + aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder(); + aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder(); + + + // Falls Grafik zu gross, wird die Grafik + // in die Seite eingepasst + if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width() > aPageSize.Width() ) ) && + aSize.Height() && aPageSize.Height() ) { - GetDocSh()->SetWaitCursor( sal_True ); + float fGrfWH = (float)aSize.Width() / + (float)aSize.Height(); + float fWinWH = (float)aPageSize.Width() / + (float)aPageSize.Height(); - // insert graphic - if (nFormats & SGA_FORMAT_GRAPHIC) + // constrain size to page size if necessary + if ((fGrfWH != 0.F) && (fGrfWH < fWinWH)) { - Graphic aGraphic = pGal->GetGraphic(); - - // reduce size if necessary - Window aWindow (GetActiveWindow()); - aWindow.SetMapMode(aGraphic.GetPrefMapMode()); - Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize()); - aWindow.SetMapMode( MapMode(MAP_100TH_MM) ); - Size aSize = aWindow.PixelToLogic(aSizePix); - - // constrain size to page size if necessary - SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage(); - Size aPageSize = pPage->GetSize(); - aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder(); - aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder(); - - - // if the graphic is to big, we fit it into the page - if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width() > aPageSize.Width() ) ) && - aSize.Height() && aPageSize.Height() ) - { - float fGrfWH = (float)aSize.Width() / - (float)aSize.Height(); - float fWinWH = (float)aPageSize.Width() / - (float)aPageSize.Height(); + aSize.Width() = (long)(aPageSize.Height() * fGrfWH); + aSize.Height()= aPageSize.Height(); + } + else + { + aSize.Width() = aPageSize.Width(); + aSize.Height()= (long)(aPageSize.Width() / fGrfWH); + } + } - // adjust graphic to page size (scales) - if ((fGrfWH != 0.F) && (fGrfWH < fWinWH)) - { - aSize.Width() = (long)(aPageSize.Height() * fGrfWH); - aSize.Height()= aPageSize.Height(); - } - else - { - aSize.Width() = aPageSize.Width(); - aSize.Height()= (long)(aPageSize.Width() / fGrfWH); - } - } + // set output rectangle for graphic + Point aPnt ((aPageSize.Width() - aSize.Width()) / 2, + (aPageSize.Height() - aSize.Height()) / 2); + aPnt += Point(pPage->GetLftBorder(), pPage->GetUppBorder()); + Rectangle aRect (aPnt, aSize); + SdrGrafObj* pGrafObj = NULL; - // set output rectangle for graphic - Point aPnt ((aPageSize.Width() - aSize.Width()) / 2, - (aPageSize.Height() - aSize.Height()) / 2); - aPnt += Point(pPage->GetLftBorder(), pPage->GetUppBorder()); - Rectangle aRect (aPnt, aSize); + sal_Bool bInsertNewObject = sal_True; - SdrGrafObj* pGrafObj = NULL; + if ( mpDrawView->AreObjectsMarked() ) + { + // is there a empty graphic object? + const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); - sal_Bool bInsertNewObject = sal_True; + if (rMarkList.GetMarkCount() == 1) + { + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObj = pMark->GetMarkedSdrObj(); - if ( mpDrawView->AreObjectsMarked() ) + if (pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF) { - // is there a empty graphic object? - const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); + pGrafObj = (SdrGrafObj*) pObj; - if (rMarkList.GetMarkCount() == 1) + if( pGrafObj->IsEmptyPresObj() ) { - SdrMark* pMark = rMarkList.GetMark(0); - SdrObject* pObj = pMark->GetMarkedSdrObj(); - - if (pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF) - { - pGrafObj = (SdrGrafObj*) pObj; - - if( pGrafObj->IsEmptyPresObj() ) - { - // the empty graphic object gets a new graphic - bInsertNewObject = sal_False; - - SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pGrafObj->Clone(); - pNewGrafObj->SetEmptyPresObj(sal_False); - pNewGrafObj->SetOutlinerParaObject(NULL); - pNewGrafObj->SetGraphic(aGraphic); - - String aStr(mpDrawView->GetDescriptionOfMarkedObjects()); - aStr += sal_Unicode(' '); - aStr += String(SdResId(STR_UNDO_REPLACE)); - mpDrawView->BegUndo(aStr); - SdrPageView* pPV = mpDrawView->GetSdrPageView(); - mpDrawView->ReplaceObjectAtView(pGrafObj, *pPV, pNewGrafObj); - mpDrawView->EndUndo(); - } - } + // the empty graphic object gets a new graphic + bInsertNewObject = sal_False; + + SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pGrafObj->Clone(); + pNewGrafObj->SetEmptyPresObj(sal_False); + pNewGrafObj->SetOutlinerParaObject(NULL); + pNewGrafObj->SetGraphic(aGraphic); + + String aStr(mpDrawView->GetDescriptionOfMarkedObjects()); + aStr += sal_Unicode(' '); + aStr += String(SdResId(STR_UNDO_REPLACE)); + mpDrawView->BegUndo(aStr); + SdrPageView* pPV = mpDrawView->GetSdrPageView(); + mpDrawView->ReplaceObjectAtView(pGrafObj, *pPV, pNewGrafObj); + mpDrawView->EndUndo(); } } - - - if( bInsertNewObject ) - { - pGrafObj = new SdrGrafObj(aGraphic, aRect); - SdrPageView* pPV = mpDrawView->GetSdrPageView(); - mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SDRINSERT_SETDEFLAYER); - } - - // should we just use a link? - if( pGrafObj && pGal->IsLinkage() ) - pGrafObj->SetGraphicLink( pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ), pGal->GetFilterName() ); - } - // insert sound - else if( nFormats & SGA_FORMAT_SOUND ) - { - const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) ); - GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L ); } + } + - GetDocSh()->SetWaitCursor( sal_False ); + if( bInsertNewObject ) + { + pGrafObj = new SdrGrafObj(aGraphic, aRect); + SdrPageView* pPV = mpDrawView->GetSdrPageView(); + mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SDRINSERT_SETDEFLAYER); } + + // Soll nur ein Link benutzt werden? + if( pGrafObj && pGalleryItem->IsLink() ) + pGrafObj->SetGraphicLink( pGalleryItem->GetURL(), pGalleryItem->GetFilterName() ); } + // insert sound + else if( nType == com::sun::star::gallery::GalleryItemType::MEDIA ) + { + const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() ); + GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L ); + } + + GetDocSh()->SetWaitCursor( sal_False ); } |