diff options
author | Pedro Giffuni <pfg@apache.org> | 2011-10-12 18:03:14 +0000 |
---|---|---|
committer | Pedro Giffuni <pfg@apache.org> | 2011-10-12 18:03:14 +0000 |
commit | 53cfc042a21cacaaeef41716f957d2e72656a8ea (patch) | |
tree | 04751cf93706719781abc25255365b81e77111a0 /svx | |
parent | 9cea27147e49284b95e0365c3c54e1cc9b88d0d2 (diff) |
i80184 - can't add SVG draw documents to gallery via API
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/unogallery/unogaltheme.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx index 1145be7e3f5e..bc05de2a1c86 100644 --- a/svx/source/unogallery/unogaltheme.cxx +++ b/svx/source/unogallery/unogaltheme.cxx @@ -36,6 +36,9 @@ #include "svx/gallery1.hxx" #include "svx/galmisc.hxx" #include <svx/fmmodel.hxx> +#include <svx/svdpage.hxx> +#include <svx/unopage.hxx> +#include <svl/itempool.hxx> #include <rtl/uuid.h> #include <vos/mutex.hxx> #ifndef _SV_SVAPP_HXX_ @@ -327,6 +330,34 @@ void SAL_CALL GalleryTheme::update( ) if( mpTheme->InsertModel( *static_cast< FmFormModel* >( pModel->GetDoc() ), nIndex ) ) nRet = nIndex; } + else if (!pModel) + { + try + { + uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( Drawing, uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XDrawPage > xPage( xDrawPages->getByIndex( 0 ), uno::UNO_QUERY_THROW ); + SvxDrawPage* pUnoPage = xPage.is() ? SvxDrawPage::getImplementation( xPage ) : NULL; + SdrModel* pOrigModel = pUnoPage ? pUnoPage->GetSdrPage()->GetModel() : NULL; + SdrPage* pOrigPage = pUnoPage ? pUnoPage->GetSdrPage() : NULL; + + if (pOrigPage && pOrigModel) + { + FmFormModel* pTmpModel = new FmFormModel(&pOrigModel->GetItemPool()); + SdrPage* pNewPage = pOrigPage->Clone(); + pTmpModel->InsertPage(pNewPage, 0); + + uno::Reference< lang::XComponent > xDrawing( new GalleryDrawingModel( pTmpModel ) ); + pTmpModel->setUnoModel( uno::Reference< uno::XInterface >::query( xDrawing ) ); + + nRet = insertDrawingByIndex( xDrawing, nIndex ); + return nRet; + } + } + catch (...) + { + } + } } return nRet; |