summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorGergő Mocsi <gmocsi91@gmail.com>2013-04-07 11:25:23 +0200
committerAndras Timar <atimar@suse.com>2013-04-12 03:39:54 -0700
commitd99f529676e78895996d50064dbcb0dc1b2ad986 (patch)
tree0327d6520cd963880f72b7321783c75b8ed9e3f3 /sd
parent5acb6ad0fede608bc77a5430bb67b72c2244f383 (diff)
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
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/dlg/PhotoAlbumDialog.cxx66
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx17
-rw-r--r--sd/source/ui/view/outlnvs2.cxx17
3 files changed, 73 insertions, 27 deletions
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 374b30532097..b5e7ee3423a1 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -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 =
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index bdf802bcacb6..a07ef14b017e 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -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;
}
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index d98589a1e3cd..612476ea5db0 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -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())