diff options
author | Gergő Mocsi <gmocsi91@gmail.com> | 2013-03-07 11:57:04 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2013-03-20 11:46:43 +0000 |
commit | 7ef3b46fd5bdfb3a87e9b0a840287fdb6ff4734b (patch) | |
tree | 0c9f908a4d834d024e1d7b91650bca28d899e6e7 /sd | |
parent | 917b57001351d839fc091eab8ea4a97a0e77914e (diff) |
fdo#35546, implementing 'Create Photo Album' function
Create a slideshow from a series of image files.
Created the dialog window (called photoalbum.ui).
Image preview is working.
Options "Fit to slide" and "1 image and title" are implemented.
Added a title page with the author's full name.
TODO: 2 images / 4 images per slide
i18n of messages
UI tweaks
Change-Id: I14b337187dc5d373fcd28489098fda813b5fd5f6
Reviewed-on: https://gerrit.libreoffice.org/2582
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/Library_sdui.mk | 4 | ||||
-rw-r--r-- | sd/UI_simpress.mk | 1 | ||||
-rw-r--r-- | sd/inc/app.hrc | 2 | ||||
-rw-r--r-- | sd/inc/sdabstdlg.hxx | 2 | ||||
-rw-r--r-- | sd/inc/sdcommands.h | 1 | ||||
-rw-r--r-- | sd/sdi/SlideSorterController.sdi | 4 | ||||
-rw-r--r-- | sd/sdi/drviewsh.sdi | 4 | ||||
-rw-r--r-- | sd/sdi/outlnvsh.sdi | 4 | ||||
-rw-r--r-- | sd/sdi/sdraw.sdi | 24 | ||||
-rw-r--r-- | sd/source/ui/dlg/PhotoAlbumDialog.cxx | 378 | ||||
-rw-r--r-- | sd/source/ui/dlg/PhotoAlbumDialog.hxx | 74 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/drviews6.cxx | 13 | ||||
-rw-r--r-- | sd/uiconfig/simpress/menubar/menubar.xml | 2 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/photoalbum.ui | 440 |
16 files changed, 961 insertions, 2 deletions
diff --git a/sd/Library_sdui.mk b/sd/Library_sdui.mk index 601fb2a7077f..0501234d6b9b 100644 --- a/sd/Library_sdui.mk +++ b/sd/Library_sdui.mk @@ -62,6 +62,9 @@ $(eval $(call gb_Library_use_libraries,sdui,\ cppuhelper \ editeng \ i18nisolang1 \ + fwk \ + fwl \ + fwe \ sal \ sd \ sfx \ @@ -106,6 +109,7 @@ $(eval $(call gb_Library_add_exception_objects,sdui,\ sd/source/ui/dlg/tpaction \ sd/source/ui/dlg/tpoption \ sd/source/ui/dlg/vectdlg \ + sd/source/ui/dlg/PhotoAlbumDialog \ )) # $(WORKDIR)/inc/sd/sddll0.hxx : diff --git a/sd/UI_simpress.mk b/sd/UI_simpress.mk index 2caf77c3e237..d6cf6e08c1bc 100644 --- a/sd/UI_simpress.mk +++ b/sd/UI_simpress.mk @@ -12,6 +12,7 @@ $(eval $(call gb_UI_UI,modules/simpress)) $(eval $(call gb_UI_add_uifiles,modules/simpress,\ sd/uiconfig/simpress/ui/presentationdialog \ sd/uiconfig/simpress/ui/printeroptions \ + sd/uiconfig/simpress/ui/photoalbum \ )) # vim: set noet sw=4 ts=4: diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index a0a10872611a..5dc3b3d091ff 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -214,7 +214,6 @@ #define SID_LINE_ARROW_SQUARE (SID_SD_START+177) #define SID_LINE_SQUARE_ARROW (SID_SD_START+178) // and even more... - #define ID_VAL_ENDINTENS (SID_SD_START+197) #define ID_VAL_STARTINTENS (SID_SD_START+198) #define ID_VAL_BORDER (SID_SD_START+199) @@ -356,6 +355,7 @@ #define SID_CUSTOM_ANIMATION_SCHEMES_PANEL (SID_SD_START+333) #define SID_SLIDE_TRANSITIONS_PANEL (SID_SD_START+334) // free +#define SID_PHOTOALBUM (SID_SD_START+336) #define SID_REMOTE_DLG (SID_SD_START+337) #define SID_CONNECTION_DLG (SID_SD_START+338) #define SID_PRESENTATION_DLG (SID_SD_START+339) diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx index b3cde08b122b..4051149257d1 100644 --- a/sd/inc/sdabstdlg.hxx +++ b/sd/inc/sdabstdlg.hxx @@ -213,6 +213,8 @@ public: virtual CreateTabPage GetSdOptionsMiscTabPageCreatorFunc() = 0; virtual CreateTabPage GetSdOptionsSnapTabPageCreatorFunc() = 0; + virtual VclAbstractDialog* CreateSdPhotoAlbumDialog( ::Window* pWindow, SdDrawDocument* pDoc) = 0; + protected: ~SdAbstractDialogFactory() {} }; diff --git a/sd/inc/sdcommands.h b/sd/inc/sdcommands.h index 32a065f54585..daecfe819ffc 100644 --- a/sd/inc/sdcommands.h +++ b/sd/inc/sdcommands.h @@ -116,6 +116,7 @@ #define CMD_SID_TP_SHOW_LARGE_PREVIEW ".uno:TaskPaneShowLargePreview" #define CMD_SID_TP_EDIT_MASTER ".uno:TaskPaneEditMaster" #define CMD_SID_INSERTPAGE_LAYOUT_MENU ".uno:TaskPaneInsertPage" +#define CMD_SID_PHOTOALBUM ".uno:PhotoAlbumDialog" #endif diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi index 85a0d801fd81..d1af8d0fdab8 100644 --- a/sd/sdi/SlideSorterController.sdi +++ b/sd/sdi/SlideSorterController.sdi @@ -294,6 +294,10 @@ interface SlideSorterView ExecMethod = FuTemporary; StateMethod = GetMenuState; ] + SID_PHOTOALBUM + [ + ExecMethod = FuTemporary ; + ] } shell SlideSorterController diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi index 5c1e2c3c197c..d4aab0e52965 100644 --- a/sd/sdi/drviewsh.sdi +++ b/sd/sdi/drviewsh.sdi @@ -213,6 +213,10 @@ interface ImpressEditView : DrawView ExecMethod = ExecuteAnnotation; StateMethod = GetAnnotationState; ] + SID_PHOTOALBUM + [ + ExecMethod = FuTemporary ; + ] } shell DrawViewShell diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi index 68c3b52278c9..9d2db2b11e47 100644 --- a/sd/sdi/outlnvsh.sdi +++ b/sd/sdi/outlnvsh.sdi @@ -527,6 +527,10 @@ interface OutlineView ExecMethod = Execute ; StateMethod = GetMenuState ; ] + SID_PHOTOALBUM + [ + ExecMethod = FuTemporary; + ] } shell OutlineViewShell diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi index d59d62d8df49..83b4d04d67a0 100644 --- a/sd/sdi/sdraw.sdi +++ b/sd/sdi/sdraw.sdi @@ -7227,3 +7227,27 @@ SfxVoidItem TaskPaneShowPanel SID_SHOW_TOOL_PANEL ( ToolBoxConfig = FALSE, GroupId = GID_VIEW; ] +//-------------------------------------------------------------------------- +SfxVoidItem PhotoAlbumDialog SID_PHOTOALBUM +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerItem; + Synchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_OPTIONS; +] diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx new file mode 100644 index 000000000000..03ccd070a3c4 --- /dev/null +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -0,0 +1,378 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ +#include "PhotoAlbumDialog.hxx" + +#include <com/sun/star/graphic/GraphicProvider.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> + +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/drawing/XMasterPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> + +#include <sfx2/filedlghelper.hxx> +#include <tools/urlobj.hxx> + +#include <unotools/pathoptions.hxx> +#include <unotools/useroptions.hxx> +#include <unotools/ucbstreamhelper.hxx> + +#include <vcl/msgbox.hxx> + + + + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::presentation; + +namespace sd +{ + +SdPhotoAlbumDialog::SdPhotoAlbumDialog(Window* pWindow, SdDrawDocument* pActDoc) +: ModalDialog(pWindow, "PhotoAlbumCreatorDialog", "modules/simpress/ui/photoalbum.ui"), + pDoc(pActDoc) +{ + get(pCancelBtn, "cancel_btn"); + get(pCreateBtn, "create_btn"); + + get(pFileBtn, "file_btn"); + get(pTextBtn, "textbox_btn"); + get(pUpBtn, "up_btn"); + get(pDownBtn, "down_btn"); + get(pRemoveBtn, "rem_btn"); + + get(pImagesLst, "images_tree"); + get(pImg, "preview_img"); + + get(pInsTypeCombo, "opt_combo"); + + pCancelBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, CancelHdl)); + pCreateBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, CreateHdl)); + + pFileBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, FileHdl)); + pTextBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, TextHdl)); + pUpBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, UpHdl)); + pDownBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, DownHdl)); + pRemoveBtn->SetClickHdl(LINK(this, SdPhotoAlbumDialog, RemoveHdl)); + + pImagesLst->SetSelectHdl(LINK(this, SdPhotoAlbumDialog, SelectHdl)); + mpGraphicFilter = new GraphicFilter; + +} + +SdPhotoAlbumDialog::~SdPhotoAlbumDialog() +{ +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, CancelHdl) +{ + EndDialog(0); + return 0; +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl) +{ + if (pImagesLst->GetEntryCount() == 0) + { + InfoBox aInfo(this, OUString("Please add images to the album.")); + aInfo.Execute(); + } + else + { + Reference< drawing::XDrawPagesSupplier > xDPS( pDoc->getUnoModel(), uno::UNO_QUERY ); + Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), uno::UNO_QUERY ); + Reference< lang::XMultiServiceFactory > xShapeFactory( pDoc->getUnoModel(), uno::UNO_QUERY ); + + // insert text to the first slide + SdPage* pFirstSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD); + pFirstSlide->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True); + + 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") + { + setFirstSlide(pFirstSlide); + for( sal_Int16 i = 0; i < pImagesLst->GetEntryCount(); ++i ) + { + OUString sUrl = pImagesLst->GetEntry( i ); + if (sUrl != "Text Box") + { + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", OUString( sUrl ) ); + + Reference< graphic::XGraphic> xGraphic = + xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); + + Reference< drawing::XDrawPage > xSlide; + Reference< container::XIndexAccess > xIndexAccess( xDrawPages, uno::UNO_QUERY ); + xSlide = xDrawPages->insertNewByIndex( xIndexAccess->getCount() ); + SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD); + pSlide->SetAutoLayout(AUTOLAYOUT_NONE, sal_True); + + Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY ); + + Reference< drawing::XShape > xShape( + xShapeFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), + uno::UNO_QUERY + ); + + Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY ); + xProps->setPropertyValue("Graphic", ::uno::Any(xGraphic)); + + ::awt::Size aPicSize = xShape->getSize(); + ::awt::Size aPageSize; + + xSlideProps->getPropertyValue( + OUString("Width")) >>= aPageSize.Width; + xSlideProps->getPropertyValue( + OUString("Height")) >>= aPageSize.Height; + aPicSize.Width = aPageSize.Width; + aPicSize.Height = aPageSize.Height; + ::awt::Point aPicPos; + + aPicPos.X = (aPageSize.Width - aPicSize.Width)/2; + aPicPos.Y = (aPageSize.Height - aPicSize.Height)/2; + xShape->setSize(aPicSize); + xShape->setPosition(aPicPos); + xSlide->add(xShape); + } + else // insert an empty slide, with centered text box + { + Reference< drawing::XDrawPage > xSlide; + Reference< container::XIndexAccess > xIndexAccess( xDrawPages, uno::UNO_QUERY ); + xSlide = xDrawPages->insertNewByIndex( xIndexAccess->getCount() ); + SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD); + pSlide->SetAutoLayout(AUTOLAYOUT_ONLY_TEXT, sal_True); + } + } + } + else if( sOpt == "1 image with title" ) + { + setFirstSlide(pFirstSlide); + for( sal_Int16 i = 0; i < pImagesLst->GetEntryCount(); ++i ) + { + OUString sUrl = pImagesLst->GetEntry( i ); + if ( sUrl != "Text Box" ) + { + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", OUString( sUrl ) ); + + Reference< graphic::XGraphic> xGraphic = + xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); + + Reference< drawing::XDrawPage > xSlide; + Reference< container::XIndexAccess > xIndexAccess( xDrawPages, uno::UNO_QUERY ); + xSlide = xDrawPages->insertNewByIndex( xIndexAccess->getCount() ); + + Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY ); + + Reference< drawing::XShape > xShape( + xShapeFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), + uno::UNO_QUERY + ); + + Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY ); + xProps->setPropertyValue("Graphic", ::uno::Any(xGraphic)); + + ::awt::Size aPicSize = xShape->getSize(); + ::awt::Size aPageSize; + + xSlideProps->getPropertyValue( + OUString("Width")) >>= aPageSize.Width; + xSlideProps->getPropertyValue( + OUString("Height")) >>= aPageSize.Height; + aPicSize.Width = aPageSize.Width/2; + aPicSize.Height = aPageSize.Height/2; + ::awt::Point aPicPos; + + aPicPos.X = (aPageSize.Width - aPicSize.Width)/2; + aPicPos.Y = (aPageSize.Height - aPicSize.Height)/2; + + xShape->setSize(aPicSize); + xShape->setPosition(aPicPos); + xSlide->add(xShape); + + SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD); + pSlide->SetAutoLayout(AUTOLAYOUT_TITLE_CONTENT, sal_True); + } + else // insert an empty slide, with centered text box + { + Reference< drawing::XDrawPage > xSlide; + Reference< container::XIndexAccess > xIndexAccess( xDrawPages, uno::UNO_QUERY ); + xSlide = xDrawPages->insertNewByIndex( xIndexAccess->getCount() ); + SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD); + pSlide->SetAutoLayout(AUTOLAYOUT_ONLY_TEXT, sal_True); + } + } + } + else + { + InfoBox aInfo(this, OUString("Function is not implemented!")); + aInfo.Execute(); + } + EndDialog(0); + } + return 0; +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl) +{ + ::sfx2::FileDialogHelper aDlg( + css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, + SFXWB_GRAPHIC | SFXWB_MULTISELECTION + ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( aDlg.Execute() == ERRCODE_NONE ) + { + Sequence< OUString > aFilesArr = aDlg.GetSelectedFiles(); + if( aFilesArr.getLength() ) + { + for ( sal_Int32 i = 0; i < aFilesArr.getLength(); ++i ) + { + pImagesLst->InsertEntry( aFilesArr[i] ); + } + } + } + return 0; +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, TextHdl) +{ + sal_uInt16 nInsertPos = pImagesLst->GetSelectEntryPos() + 1; + pImagesLst->InsertEntry( OUString("Text Box"), nInsertPos); + return 0; +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, UpHdl) +{ + if (pImagesLst->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND + && pImagesLst->GetSelectEntryPos() != 0) + { + OUString sActEntry( pImagesLst->GetEntry(pImagesLst->GetSelectEntryPos()) ); + sal_uInt16 nActPos = pImagesLst->GetSelectEntryPos(); + OUString sUpperEntry( pImagesLst->GetEntry(nActPos - 1) ); + + pImagesLst->RemoveEntry( sActEntry ); + pImagesLst->RemoveEntry( sUpperEntry ); + + pImagesLst->InsertEntry( sActEntry, nActPos - 1 ); + pImagesLst->InsertEntry( sUpperEntry, nActPos ); + pImagesLst->SelectEntryPos(nActPos - 1); + } + return 0; +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, DownHdl) +{ + sal_uInt16 nActPos = pImagesLst->GetSelectEntryPos(); + if (pImagesLst->GetEntry(nActPos + 1) != OUString("") ) + { + OUString sActEntry( pImagesLst->GetEntry(pImagesLst->GetSelectEntryPos()) ); + OUString sDownEntry( pImagesLst->GetEntry(nActPos + 1) ); + + pImagesLst->RemoveEntry( sActEntry ); + pImagesLst->RemoveEntry( sDownEntry ); + + pImagesLst->InsertEntry( sDownEntry, nActPos ); + pImagesLst->InsertEntry( sActEntry, nActPos + 1 ); + + pImagesLst->SelectEntryPos(nActPos + 1); + } + return 0; +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, RemoveHdl) +{ + pImagesLst->RemoveEntry( pImagesLst->GetSelectEntryPos() ); + return 0; +} + +IMPL_LINK_NOARG(SdPhotoAlbumDialog, SelectHdl) +{ + OUString sImgUrl( pImagesLst->GetEntry(pImagesLst->GetSelectEntryPos()) ); + if (sImgUrl != OUString("Text Box") ) + { + GraphicFilter aCurFilter; + Graphic aGraphic; + INetURLObject aURLObj( sImgUrl ); + + sal_uInt16 nFilter = GRFILTER_FORMAT_DONTKNOW; + + if ( aURLObj.HasError() || INET_PROT_NOT_VALID == aURLObj.GetProtocol() ) + { + aURLObj.SetSmartProtocol( INET_PROT_FILE ); + aURLObj.SetSmartURL( sImgUrl ); + } + + sal_uInt32 nFilterImportFlags = GRFILTER_I_FLAGS_SET_LOGSIZE_FOR_JPEG; + // remote? + if ( INET_PROT_FILE != aURLObj.GetProtocol() ) + { + SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( sImgUrl, STREAM_READ ); + + if( pStream ) + mpGraphicFilter->ImportGraphic( aGraphic, sImgUrl, *pStream, nFilter, NULL, nFilterImportFlags ); + else + mpGraphicFilter->ImportGraphic( aGraphic, aURLObj, nFilter, NULL, nFilterImportFlags ); + delete pStream; + } + else + { + mpGraphicFilter->ImportGraphic( aGraphic, aURLObj, nFilter, NULL, nFilterImportFlags ); + } + + Bitmap aBmp = aGraphic.GetBitmap(); + sal_Int32 nBmpWidth = aBmp.GetSizePixel().Width(); + sal_Int32 nBmpHeight = aBmp.GetSizePixel().Height(); + sal_Int32 nPrevWidth = 150; + sal_Int32 nPrewHeight = 150; + + double nXRatio = (double) nPrevWidth / nBmpWidth; + double nYRatio = (double) nPrewHeight / nBmpHeight; + if ( nXRatio < nYRatio ) + aBmp.Scale( nXRatio, nXRatio ); + else + aBmp.Scale( nYRatio, nYRatio ); + + aBmp.Convert( BMP_CONVERSION_24BIT ); + pImg->SetImage( aBmp ); + } + else + { + pImg->SetImage(Image()); + } + return 0; +} + +void SdPhotoAlbumDialog::setFirstSlide(SdPage* pFirstSlide) +{ + SdrTextObj* pTitleObj; // title + pTitleObj = dynamic_cast< SdrTextObj* >(pFirstSlide->GetPresObj(PRESOBJ_TITLE)); + pFirstSlide->SetObjText(pTitleObj, NULL, PRESOBJ_TITLE, OUString("Photoalbum")); + + SdrTextObj* pAuthorObj; // author's full name + pAuthorObj = dynamic_cast< SdrTextObj* >(pFirstSlide->GetPresObj(PRESOBJ_TEXT)); + + SvtUserOptions aUserOptions; + pFirstSlide->SetObjText(pAuthorObj, NULL, PRESOBJ_TEXT, OUString("Author: ") + aUserOptions.GetFullName()); +} + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.hxx b/sd/source/ui/dlg/PhotoAlbumDialog.hxx new file mode 100644 index 000000000000..cf70fc803c4b --- /dev/null +++ b/sd/source/ui/dlg/PhotoAlbumDialog.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ + +#ifndef _SD_PHOTOALBUMDIALOG_HXX +#define _SD_PHOTOALBUMDIALOG_HXX + +#include "tools/link.hxx" +#include "sdpage.hxx" +#include "pres.hxx" +#include "drawdoc.hxx" + +#include <vcl/lstbox.hxx> +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/field.hxx> +#include <vcl/graphicfilter.hxx> +#include <svx/svdotext.hxx> + +class SdrTextObj; +class SdDrawDocument; +class SdPage; + +namespace sd +{ + +class SdPhotoAlbumDialog : public ModalDialog +{ +public: + SdPhotoAlbumDialog(Window* pWindow, SdDrawDocument* pActDoc); + ~SdPhotoAlbumDialog(); + +private: + CancelButton* pCancelBtn; + PushButton* pCreateBtn; + + PushButton* pFileBtn; + PushButton* pTextBtn; + PushButton* pUpBtn; + PushButton* pDownBtn; + PushButton* pRemoveBtn; + + ListBox* pImagesLst; + FixedImage* pImg; + + ListBox* pInsTypeCombo; + + SdDrawDocument* pDoc; + GraphicFilter* mpGraphicFilter; + + DECL_LINK(CancelHdl, void*); + DECL_LINK(CreateHdl, void*); + + DECL_LINK(FileHdl, void*); + DECL_LINK(TextHdl, void*); + DECL_LINK(UpHdl, void*); + DECL_LINK(DownHdl, void*); + DECL_LINK(RemoveHdl, void*); + + DECL_LINK(SelectHdl, void*); + + void setFirstSlide(SdPage* pFirstSlide); +}; + +} + +#endif // _SD_PHOTOALBUMDIALOG_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 5084268d7592..cebe96a0d004 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -51,6 +51,7 @@ #include "pubdlg.hxx" #include "masterlayoutdlg.hxx" #include "headerfooterdlg.hxx" +#include "PhotoAlbumDialog.hxx" IMPL_ABSTDLG_BASE(SdVclAbstractDialog_Impl); IMPL_ABSTDLG_BASE(AbstractCopyDlg_Impl); @@ -578,5 +579,9 @@ AbstractHeaderFooterDialog* SdAbstractDialogFactory_Impl::CreateHeaderFooterDial return new AbstractHeaderFooterDialog_Impl( new ::sd::HeaderFooterDialog( (::sd::ViewShell*)pViewShell, pParent, pDoc, pCurrentPage )); } +VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateSdPhotoAlbumDialog( ::Window* pWindow, SdDrawDocument* pDoc ) +{ + return new SdVclAbstractDialog_Impl( new ::sd::SdPhotoAlbumDialog( pWindow, pDoc ) ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 287f7a299a81..21a0f2c1dcc7 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -244,8 +244,8 @@ class AbstractHeaderFooterDialog_Impl :public AbstractHeaderFooterDialog virtual void Apply( TabPage* pPage ); virtual void Cancel( TabPage* pPage ); }; - //------------------------------------------------------------------------ + //AbstractDialogFactory_Impl implementations class SdAbstractDialogFactory_Impl : public SdAbstractDialogFactory { @@ -277,6 +277,8 @@ public: virtual AbstractSdVectorizeDlg* CreateSdVectorizeDlg( ::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell ); virtual AbstractSdPublishingDlg* CreateSdPublishingDlg( ::Window* pWindow, DocumentType eDocType); + virtual VclAbstractDialog* CreateSdPhotoAlbumDialog( ::Window* pWindow, SdDrawDocument* pDoc); + virtual VclAbstractDialog* CreateMasterLayoutDialog( ::Window* pParent, SdDrawDocument* pDoc, SdPage* ); // add for MasterLayoutDialog @@ -291,6 +293,7 @@ public: virtual CreateTabPage GetSdPrintOptionsTabPageCreatorFunc(); virtual CreateTabPage GetSdOptionsMiscTabPageCreatorFunc(); virtual CreateTabPage GetSdOptionsSnapTabPageCreatorFunc(); + }; #endif diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index 5116d1b53c05..573190b01f2b 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -685,6 +685,19 @@ void DrawViewShell::FuTemp04(SfxRequest& rReq) } break; + case SID_PHOTOALBUM: + { + SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); + VclAbstractDialog* pDlg = pFact ? pFact->CreateSdPhotoAlbumDialog(GetActiveWindow(), + GetDoc() + ) : 0; + if (pDlg) + { + pDlg->Execute(); + } + } + break; + default: { DBG_ASSERT( 0, "Slot without function" ); diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index 9fd07b1ea8b9..fc8047cc6171 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -215,6 +215,8 @@ <menu:menuitem menu:id=".uno:InsertObjectFloatingFrame"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:ImportFromFile"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:PhotoAlbumDialog"/> </menu:menupopup> </menu:menu> <menu:menu menu:id=".uno:FormatMenu"> diff --git a/sd/uiconfig/simpress/ui/photoalbum.ui b/sd/uiconfig/simpress/ui/photoalbum.ui new file mode 100644 index 000000000000..e88b2cb38d2e --- /dev/null +++ b/sd/uiconfig/simpress/ui/photoalbum.ui @@ -0,0 +1,440 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="PhotoAlbumCreatorDialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Photo Album Creator</property> + <property name="resizable">False</property> + <property name="window_position">center</property> + <property name="type_hint">dialog</property> + <property name="has_resize_grip">False</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="create_btn"> + <property name="label" translatable="yes">Create</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel_btn"> + <property name="label">gtk-cancel</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">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> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">5</property> + <property name="row_homogeneous">True</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkImage" id="preview_img"> + <property name="width_request">150</property> + <property name="height_request">150</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-missing-image</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Preview:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">3</property> + <property name="column_spacing">3</property> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Images:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButtonBox" id="buttonbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="up_btn"> + <property name="label" translatable="yes">Up</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="down_btn"> + <property name="label" translatable="yes">Down</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="rem_btn"> + <property name="label" translatable="yes">Remove</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="width_request">100</property> + <property name="height_request">85</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="images_tree"> + <property name="width_request">150</property> + <property name="height_request">84</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="model">liststore1</property> + <property name="search_column">0</property> + <property name="enable_grid_lines">both</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection"/> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">3</property> + <property name="column_spacing">3</property> + <child> + <object class="GtkButton" id="file_btn"> + <property name="label" translatable="yes">File/Folder</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="textbox_btn"> + <property name="label" translatable="yes">New Text Box</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert from:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert text:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Album Content</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">5</property> + <child> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Picture layout:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="opt_combo"> + <property name="width_request">160</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="model">liststore2</property> + <property name="active">0</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Album Layout</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">create_btn</action-widget> + <action-widget response="0">cancel_btn</action-widget> + </action-widgets> + </object> + <object class="GtkListStore" id="liststore1"> + <columns> + <!-- column-name Filename --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkListStore" id="liststore2"> + <columns> + <!-- column-name Property --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Fit to slide</col> + </row> + <row> + <col id="0" translatable="yes">1 image with title</col> + </row> + <row> + <col id="0" translatable="yes">2 images</col> + </row> + <row> + <col id="0" translatable="yes">4 images</col> + </row> + </data> + </object> +</interface> |