Kaydet (Commit) 070141b8 authored tarafından Rishabh Kumar's avatar Rishabh Kumar Kaydeden (comit) Caolán McNamara

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/14517Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 82d573e8
......@@ -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
)
......
......@@ -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);
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment