summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRishabh Kumar <kris.kr296@gmail.com>2015-02-17 15:40:25 +0530
committerCaolán McNamara <caolanm@redhat.com>2015-03-03 10:44:23 +0000
commit070141b854c7731aa44ccf6ce446802ad8653697 (patch)
treee02bcc9af2910a8a8ba3c2628e2f4707208d0e9f
parent82d573e8bf97193c032ca9631d33fa39bbd12638 (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sd/source/ui/dlg/PhotoAlbumDialog.cxx38
-rw-r--r--sd/source/ui/dlg/PhotoAlbumDialog.hxx4
-rw-r--r--sd/uiconfig/simpress/ui/photoalbum.ui16
3 files changed, 52 insertions, 6 deletions
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index cb4889aa583e..9b7d571c8dd2 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 d97ae81c9a02..c7d12e47bcc8 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 d099d36a855d..067815944d68 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>