Kaydet (Commit) d99f5296 authored tarafından Gergő Mocsi's avatar Gergő Mocsi Kaydeden (comit) Andras Timar

Create Photo Album implementation

UI tweaks: dialog window open in all modes (Normal, Outline, Slide Sorter, ..).
Fixed some pointer issues in function CreateHdl).
Functionality: Title slide gets inserted only when we have one slide in the
presentation (having > 1, I assume that we don't have an empty presentation).

Conflicts:

	sd/source/ui/dlg/PhotoAlbumDialog.cxx

Change-Id: I7eb844bf2382a44481435cfaa8f498e29c56bd69
üst 5acb6ad0
......@@ -102,19 +102,25 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
Reference< lang::XMultiServiceFactory > xShapeFactory( pDoc->getUnoModel(), uno::UNO_QUERY );
// Create the title slide
Reference< drawing::XDrawPage > xTitleSlide = appendNewSlide(AUTOLAYOUT_TITLE, xDrawPages);
const sal_Int32 nSlideCount = pDoc->GetSdPageCount(PK_STANDARD);
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());
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));
......@@ -124,10 +130,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
if ( sOpt == "Fit to slide")
{
OUString sUrl;
OUString* pData = NULL;
for( sal_Int16 i = 0; i < pImagesLst->GetEntryCount(); ++i )
{
pData = (OUString*) pImagesLst->GetEntryData(i);
OUString* pData = (OUString*) pImagesLst->GetEntryData(i);
sUrl = *pData;
if (sUrl != "Text Box")
{
......@@ -178,16 +184,17 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
{
appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
}
delete pData;
pData = NULL;
}
delete pData;
}
else if( sOpt == "1 image with title" )
{
OUString sUrl;
OUString* pData = NULL;
for( sal_Int16 i = 0; i < pImagesLst->GetEntryCount(); ++i )
{
pData = (OUString*) pImagesLst->GetEntryData(i);
OUString* pData = (OUString*) pImagesLst->GetEntryData(i);
sUrl = *pData;
if ( sUrl != "Text Box" )
{
......@@ -220,17 +227,19 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
{
appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
}
delete pData;
pData = NULL;
}
delete pData;
}
else if( sOpt == "2 images" )
{
OUString sUrl1("");
OUString sUrl2("");
OUString* pData = NULL;
for( sal_Int32 i = 0; i < pImagesLst->GetEntryCount(); i+=2 )
{
OUString* pData = NULL;
// create the slide
Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, xDrawPages);
Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
......@@ -331,9 +340,9 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
xShape->setPosition(aPicPos);
xSlide->add(xShape);
}
delete pData;
pData = NULL;
}
delete pData;
}
else if( sOpt == "4 images" )
{
......@@ -341,10 +350,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
OUString sUrl2("");
OUString sUrl3("");
OUString sUrl4("");
OUString* pData = NULL;
for( sal_Int32 i = 0; i < pImagesLst->GetEntryCount(); i+=4 )
{
OUString* pData = NULL;
// create the slide
Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, xDrawPages);
Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
......@@ -538,8 +547,9 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
xShape->setPosition(aPicPos);
xSlide->add(xShape);
}
delete pData;
pData = NULL;
}
delete pData;
}
else
{
......@@ -560,9 +570,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl)
);
// Read configuration
OUString sUrl(".");
Reference< XInterface > xCfg;
try
{
Reference< XInterface > xCfg = ::comphelper::ConfigurationHelper::openConfig(
xCfg = ::comphelper::ConfigurationHelper::openConfig(
::comphelper::getProcessComponentContext(),
OUString("/org.openoffice.Office.Impress/"),
::comphelper::ConfigurationHelper::E_READONLY);
......@@ -593,18 +604,18 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl)
// Write out configuration
try
{
Reference< XInterface > xCfgWriter = ::comphelper::ConfigurationHelper::openConfig(
xCfg = ::comphelper::ConfigurationHelper::openConfig(
::comphelper::getProcessComponentContext(),
OUString("/org.openoffice.Office.Impress/"),
::comphelper::ConfigurationHelper::E_STANDARD);
::comphelper::ConfigurationHelper::writeRelativeKey(
xCfgWriter,
xCfg,
OUString("Pictures"),
OUString("Path"),
uno::makeAny(sUrl));
::comphelper::ConfigurationHelper::flush(xCfgWriter);
::comphelper::ConfigurationHelper::flush(xCfg);
}
catch(const Exception&)
{
......@@ -897,6 +908,7 @@ Reference< graphic::XGraphic> SdPhotoAlbumDialog::createXGraphicFromUrl(const OU
Reference< graphic::XGraphicProvider> xProvider
)
{
// The same as above, except this returns an XGraphic from the image URL
::comphelper::NamedValueCollection aMediaProperties;
aMediaProperties.put( "URL", OUString( sUrl ) );
Reference< graphic::XGraphic> xGraphic =
......
......@@ -66,6 +66,7 @@
#include "glob.hrc"
#include "unmodpg.hxx"
#include "DrawViewShell.hxx"
#include "sdabstdlg.hxx"
#include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx>
......@@ -263,6 +264,22 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
}
break;
case SID_PHOTOALBUM:
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
VclAbstractDialog* pDlg = pFact ? pFact->CreateSdPhotoAlbumDialog(
mrSlideSorter.GetContentWindow().get(),
pDocument) : 0;
if (pDlg)
{
pDlg->Execute();
delete pDlg;
}
rRequest.Done ();
}
break;
default:
break;
}
......
......@@ -295,6 +295,23 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
Cancel();
}
break;
case SID_PHOTOALBUM:
{
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
VclAbstractDialog* pDlg = pFact ? pFact->CreateSdPhotoAlbumDialog(
GetActiveWindow(),
GetDoc()) : 0;
if (pDlg)
{
pDlg->Execute();
delete pDlg;
}
Cancel();
rReq.Ignore ();
}
break;
}
if(HasCurrentFunction())
......
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