sd/source/ui/dlg/PhotoAlbumDialog.cxx | 38 ++++++++++++++++++++++++++++++---- sd/source/ui/dlg/PhotoAlbumDialog.hxx | 4 +-- sd/uiconfig/simpress/ui/photoalbum.ui | 16 ++++++++++++++ 3 files changed, 52 insertions(+), 6 deletions(-)
New commits: commit 070141b854c7731aa44ccf6ce446802ad8653697 Author: Rishabh Kumar <kris.kr...@gmail.com> Date: Tue Feb 17 15:40:25 2015 +0530 tdf#64573: Add captions to Photo Album Creates a rectangular text area with following attributes- Color-Black Transparency-20% Alignment-Bottom Default Text-Click to add Title Change-Id: Ifb75c57fd19d41635fd4e397cbfe2b8a65975eb6 Reviewed-on: https://gerrit.libreoffice.org/14517 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index cb4889a..9b7d571 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -9,7 +9,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> - +#include <svl/itemset.hxx> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -24,10 +24,11 @@ #include <unotools/useroptions.hxx> #include <unotools/ucbstreamhelper.hxx> #include <officecfg/Office/Impress.hxx> - +#include <svx/svdview.hxx> #include <vcl/msgbox.hxx> #include <svx/unoshape.hxx> - +#include <svx/xfltrit.hxx> +#include <svx/xfillit.hxx> #include "PhotoAlbumDialog.hxx" #include "strings.hrc" #include "sdresid.hxx" @@ -54,7 +55,7 @@ SdPhotoAlbumDialog::SdPhotoAlbumDialog(vcl::Window* pWindow, SdDrawDocument* pAc get(pInsTypeCombo, "opt_combo"); get(pASRCheck, "asr_check"); - + get(pCapCheck, "cap_check"); pCancelBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, CancelHdl)); pCreateBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, CreateHdl)); @@ -151,6 +152,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) xShape->setPosition(aPicPos); xSlide->add(xShape); + if(pCapCheck->IsChecked()) + createCaption( aPageSize ); } } else if( nOpt == TWO_IMAGES ) @@ -251,6 +254,9 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) xShape->setPosition(aPicPos); xSlide->add(xShape); + if(pCapCheck->IsChecked()) + createCaption( aPageSize ); + } } } @@ -431,6 +437,9 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) xShape->setPosition(aPicPos); xSlide->add(xShape); + if(pCapCheck->IsChecked()) + createCaption( aPageSize ); + } } } @@ -650,6 +659,27 @@ awt::Size SdPhotoAlbumDialog::createASRSize(const awt::Size& aPicSize, const awt return awt::Size(resizeWidth, resizeHeight); } +void SdPhotoAlbumDialog::createCaption(const awt::Size& aPageSize ) +{ + Point CapPos; + Size CapSize; + + CapSize.Width() = aPageSize.Width; + CapSize.Height() = aPageSize.Height/6; + CapPos.X() = 0; + CapPos.Y() = aPageSize.Height - CapSize.Height(); + SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD ); + Rectangle rRect(CapPos,CapSize); + SdrObject* pSdrObj = pSlide->CreatePresObj(PRESOBJ_TITLE,false,rRect); + SdrModel* pSdrModel = pDoc->AllocModel(); + SfxItemSet aSet(pSdrModel->GetItemPool() ); + aSet.Put( XFillStyleItem(drawing::FillStyle_SOLID) ); + aSet.Put( XFillColorItem( "", Color(COL_BLACK) ) ); + aSet.Put( XFillTransparenceItem( 20 ) ); + pSdrObj->SetMergedItemSetAndBroadcast(aSet); + pSlide->InsertObject(pSdrObj); +} + Reference< graphic::XGraphic> SdPhotoAlbumDialog::createXGraphicFromUrl(const OUString& sUrl, Reference< graphic::XGraphicProvider> xProvider ) diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.hxx b/sd/source/ui/dlg/PhotoAlbumDialog.hxx index d97ae81..c7d12e4 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.hxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.hxx @@ -64,7 +64,7 @@ private: ListBox* pInsTypeCombo; CheckBox* pASRCheck; - + CheckBox* pCapCheck; SdDrawDocument* pDoc; GraphicFilter* mpGraphicFilter; @@ -83,7 +83,7 @@ private: Reference< drawing::XDrawPages > xDrawPages); awt::Size createASRSize(const awt::Size& aPicSize, const awt::Size& aMaxSize); - + void createCaption(const awt::Size& aPageSize); Reference< graphic::XGraphic> createXGraphicFromUrl(const OUString& sUrl, Reference< graphic::XGraphicProvider> xProvider); diff --git a/sd/uiconfig/simpress/ui/photoalbum.ui b/sd/uiconfig/simpress/ui/photoalbum.ui index d099d36..0678159 100644 --- a/sd/uiconfig/simpress/ui/photoalbum.ui +++ b/sd/uiconfig/simpress/ui/photoalbum.ui @@ -358,6 +358,22 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="cap_check"> + <property name="label" translatable="yes">Add caption to each slide</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits