Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3426
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/26/3426/1
Create Photo Album fix
Fixed some pointer issues in CreateHdl function.
Removed the creation of title slide.
Added an enum to access the image layout option from the code.
Change-Id: Ib91fbbf3b068453c8e66b8df1ce32e24c3828bc0
---
M sd/source/ui/app/strings.src
M sd/source/ui/dlg/PhotoAlbumDialog.cxx
M sd/source/ui/dlg/PhotoAlbumDialog.hxx
M sd/source/ui/inc/strings.hrc
4 files changed, 43 insertions(+), 64 deletions(-)
diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src
index a91003d..928e03e 100644
--- a/sd/source/ui/app/strings.src
+++ b/sd/source/ui/app/strings.src
@@ -1268,19 +1268,14 @@
Text [ en-US ] = Drag and Drop Slides ;
};
-String STR_PHOTO_ALBUM_TITLE
-{
- Text [ en-US ] = Photo Album ;
-};
-
-String STR_PHOTO_ALBUM_AUTHOR
-{
- Text [ en-US ] = Author: ;
-};
-
String STR_PHOTO_ALBUM_EMPTY_WARNING
{
Text [ en-US ] = Please add images to the album. ;
};
+String STR_PHOTO_ALBUM_TEXTBOX
+{
+Text [ en-US ] = Text Box;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 4beabeb..5d6ba1e 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -101,33 +101,12 @@
Reference drawing::XDrawPages xDrawPages( xDPS-getDrawPages(),
uno::UNO_QUERY );
Reference lang::XMultiServiceFactory xShapeFactory(
pDoc-getUnoModel(), uno::UNO_QUERY );
-// Create the title slide
-const sal_Int32 nSlideCount = pDoc-GetSdPageCount(PK_STANDARD);
-
-if(nSlideCount == 1)
-{
-// we have created an empty presentation (probably)
-Reference drawing::XDrawPage xTitleSlide =
appendNewSlide(AUTOLAYOUT_TITLE, xDrawPages);
-
-SdPage* pFirstSlide = pDoc-GetSdPage(
pDoc-GetSdPageCount(PK_STANDARD)-1, PK_STANDARD);
-SvtUserOptions aUserOptions;
-SdrObject* pTitleObj = pFirstSlide-GetPresObj(PRESOBJ_TITLE, 0);
-SvxShapeText* pTitleText = new SvxShapeText(pTitleObj);
-
pTitleText-SetShapeType(com.sun.star.presentation.TitleTextShape);
-pTitleText-setString(SD_RESSTR(STR_PHOTO_ALBUM_TITLE));
-
-SdrObject* pTextObj = pFirstSlide-GetPresObj(PRESOBJ_TEXT, 0);
-SvxShapeText* pTextShape = new SvxShapeText(pTextObj);
-pTextShape-SetShapeType(com.sun.star.presentation.TextShape);
-pTextShape-setString(SD_RESSTR(STR_PHOTO_ALBUM_AUTHOR) + +
aUserOptions.GetFullName());
-}
-
Reference XComponentContext
xContext(::comphelper::getProcessComponentContext());
Reference graphic::XGraphicProvider
xProvider(graphic::GraphicProvider::create(xContext));
// get the option
-OUString sOpt =
pInsTypeCombo-GetEntry(pInsTypeCombo-GetSelectEntryPos());
-if ( sOpt == Fit to slide)
+sal_uInt16 nOpt = pInsTypeCombo-GetSelectEntryPos();
+if ( nOpt == FIT_TO_SLIDE )
{
OUString sUrl;
@@ -184,11 +163,9 @@
{
appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
}
-delete pData;
-pData = NULL;
}
}
-else if( sOpt == 1 image with title )
+else if( nOpt == TITLE_ONE_IMAGE )
{
OUString sUrl;
@@ -196,7 +173,7 @@
{
OUString* pData = (OUString*) pImagesLst-GetEntryData(i);
sUrl = *pData;
-if ( sUrl != Text Box )
+if ( sUrl != SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) )
{
Reference drawing::XDrawPage xSlide =
appendNewSlide(AUTOLAYOUT_NONE, xDrawPages);
@@ -227,11 +204,9 @@
{
appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
}
-delete pData;
-pData = NULL;
}
}
-else if( sOpt == 2 images )
+else if( nOpt == TWO_IMAGES )
{
OUString sUrl1();
OUString sUrl2();
@@ -252,13 +227,15 @@
OUString(Height)) = aPageSize.Height;
// grab the left one
-pData = (OUString*) pImagesLst-GetEntryData(i);
+void* pD1 = pImagesLst-GetEntryData(i);
+pData = (OUString*) pD1;
sUrl1 = pData ? OUString(*pData) : ;
// grab the right one
-pData = (OUString*) pImagesLst-GetEntryData(i+1);
+void* pD2 = pImagesLst-GetEntryData(i+1);
+pData = (OUString*) pD2;
sUrl2 = pData ? OUString(*pData) : ;
-if( sUrl1 == Text Box ) //