31 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
69 return "com.sun.star.comp.gallery.GalleryTheme";
79 return {
"com.sun.star.gallery.GalleryTheme" };
84 static const uno::Sequence
aTypes {
96 return css::uno::Sequence<sal_Int8>();
110 return( (
mpTheme !=
nullptr ) && (
mpTheme->GetObjectCount() > 0 ) );
129 if( ( nIndex < 0 ) || ( nIndex >=
getCount() ) )
131 throw lang::IndexOutOfBoundsException();
136 aRet <<= uno::Reference< gallery::XGalleryItem >(
new GalleryItem( *
this, *pObj ) );
162 mpTheme->Actualize( aDummyLink );
168 const OUString& rURL, ::sal_Int32 nIndex )
179 nIndex = std::clamp( nIndex, sal_Int32(0),
getCount() );
181 if( ( aURL.
GetProtocol() != INetProtocol::NotValid ) &&
mpTheme->InsertURL( aURL, nIndex ) )
186 nRet =
mpTheme->maGalleryObjectCollection.searchPosWithObject( pObj );
199 const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 nIndex )
208 const Graphic aGraphic( rxGraphic );
210 nIndex = std::clamp( nIndex, sal_Int32(0),
getCount() );
212 if(
mpTheme->InsertGraphic( aGraphic, nIndex ) )
225 const uno::Reference< lang::XComponent >& Drawing, sal_Int32 nIndex )
232 GalleryDrawingModel* pModel = comphelper::getFromUnoTunnel<GalleryDrawingModel>( Drawing );
234 if( pModel && dynamic_cast<const FmFormModel*>(pModel->
GetDoc()) )
237 nIndex = std::clamp( nIndex, sal_Int32(0),
getCount() );
239 if(
mpTheme->InsertModel( *static_cast< FmFormModel* >( pModel->
GetDoc() ), nIndex ) )
248 uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( Drawing, uno::UNO_QUERY_THROW );
249 uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_SET_THROW );
250 uno::Reference< drawing::XDrawPage > xPage( xDrawPages->getByIndex( 0 ), uno::UNO_QUERY_THROW );
251 SvxDrawPage* pUnoPage = xPage.is() ? comphelper::getFromUnoTunnel<SvxDrawPage>( xPage ) :
nullptr;
252 SdrModel* pOrigModel = pUnoPage ? &pUnoPage->GetSdrPage()->getSdrModelFromSdrPage() :
nullptr;
253 SdrPage* pOrigPage = pUnoPage ? pUnoPage->GetSdrPage() :
nullptr;
255 if (pOrigPage && pOrigModel)
263 pTmpModel->
setUnoModel( uno::Reference< uno::XInterface >::query( xDrawing ) );
285 if( ( nIndex < 0 ) || ( nIndex >=
getCount() ) )
286 throw lang::IndexOutOfBoundsException();
287 mpTheme->RemoveObject( nIndex );
297 switch( rGalleryHint.
GetType() )
334 if( !pObj || ( (*aIter)->implGetObject() == pObj ) )
336 (*aIter)->implSetInvalid();
virtual void SAL_CALL removeByIndex(::sal_Int32 Index) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual rtl::Reference< SdrPage > CloneSdrPage(SdrModel &rTargetModel) const
virtual ::sal_Int32 SAL_CALL insertGraphicByIndex(const css::uno::Reference< css::graphic::XGraphic > &Graphic,::sal_Int32 Index) override
GalleryItemVector maItemVector
virtual ~GalleryTheme() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasElements() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
void implReleaseItems(GalleryObject const *pObj)
static Gallery * GetGalleryInstance()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL update() override
void setUnoModel(const css::uno::Reference< css::uno::XInterface > &xModel)
GalleryHintType GetType() const
virtual ::sal_Int32 SAL_CALL getCount() override
#define DBG_ASSERT(sCon, aError)
css::uno::Type const & get()
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void implDeregisterGalleryItem(::unogallery::GalleryItem &rItem)
SdrModel * GetDoc() const
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
void ReleaseTheme(GalleryTheme *pTheme, SfxListener &rListener)
virtual OUString SAL_CALL getName() override
virtual css::uno::Type SAL_CALL getElementType() override
INetProtocol GetProtocol() const
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual OUString SAL_CALL getImplementationName() override
GalleryTheme(std::u16string_view rThemeName)
void implRegisterGalleryItem(::unogallery::GalleryItem &rItem)
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
virtual ::sal_Int32 SAL_CALL insertDrawingByIndex(const css::uno::Reference< css::lang::XComponent > &Drawing,::sal_Int32 Index) override
GalleryTheme * AcquireTheme(std::u16string_view rThemeName, SfxListener &rListener)
virtual ::sal_Int32 SAL_CALL insertURLByIndex(const OUString &URL,::sal_Int32 Index) override