Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3335

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/35/3335/1

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).

Change-Id: I7eb844bf2382a44481435cfaa8f498e29c56bd69
---
M sd/source/ui/dlg/PhotoAlbumDialog.cxx
M sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
M sd/source/ui/view/outlnvs2.cxx
3 files changed, 68 insertions(+), 23 deletions(-)



diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index a2445a5..00a9e06 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -99,19 +99,25 @@
         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(OUString("Photoalbum\n"));
+        if(nSlideCount == 1)
+        {
+            // we have created an empty presentation (probably)
+            Reference< drawing::XDrawPage > xTitleSlide = appendNewSlide(AUTOLAYOUT_TITLE, 
xDrawPages);
 
-        SdrObject* pTextObj = pFirstSlide->GetPresObj(PRESOBJ_TEXT, 0);
-        SvxShapeText* pTextShape = new SvxShapeText(pTextObj);
-        pTextShape->SetShapeType("com.sun.star.presentation.TextShape");
-        pTextShape->setString(OUString("Author: ") + aUserOptions.GetFullName());
+            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(OUString("Photoalbum\n"));
+
+            SdrObject* pTextObj = pFirstSlide->GetPresObj(PRESOBJ_TEXT, 0);
+            SvxShapeText* pTextShape = new SvxShapeText(pTextObj);
+            pTextShape->SetShapeType("com.sun.star.presentation.TextShape");
+            pTextShape->setString(OUString("Author: ") + aUserOptions.GetFullName());
+        }
 
         Reference< XComponentContext > xContext(::comphelper::getProcessComponentContext());
         Reference< graphic::XGraphicProvider> 
xProvider(graphic::GraphicProvider::create(xContext));
@@ -121,10 +127,10 @@
         if ( sOpt == "Fit to slide")
         {
             OUString sUrl;
-            OUString* pData;
+
             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")
                 {
@@ -175,16 +181,17 @@
                 {
                     appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
                 }
+                delete pData;
+                pData = NULL;
             }
-            delete pData;
         }
         else if( sOpt == "1 image with title" )
         {
             OUString sUrl;
-            OUString* pData;
+
             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" )
                 {
@@ -217,17 +224,19 @@
                 {
                     appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
                 }
+                delete pData;
+                pData = NULL;
             }
-            delete pData;
         }
         else if( sOpt == "2 images" )
         {
             OUString sUrl1("");
             OUString sUrl2("");
-            OUString* pData;
 
             for( sal_Int32 i = 0; i < pImagesLst->GetEntryCount(); i+=2 )
             {
+                OUString* pData;
+
                 // create the slide
                 Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, 
xDrawPages);
                 Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
@@ -328,9 +337,9 @@
                     xShape->setPosition(aPicPos);
                     xSlide->add(xShape);
                 }
-
+                delete pData;
+                pData = NULL;
             }
-            delete pData;
         }
         else if( sOpt == "4 images" )
         {
@@ -338,10 +347,10 @@
             OUString sUrl2("");
             OUString sUrl3("");
             OUString sUrl4("");
-            OUString* pData;
 
             for( sal_Int32 i = 0; i < pImagesLst->GetEntryCount(); i+=4 )
             {
+                OUString* pData;
                 // create the slide
                 Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, 
xDrawPages);
                 Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
@@ -535,8 +544,9 @@
                     xShape->setPosition(aPicPos);
                     xSlide->add(xShape);
                 }
+                delete pData;
+                pData = NULL;
             }
-            delete pData;
         }
         else
         {
@@ -591,7 +601,7 @@
             // Write out configuration
             try
             {
-                Reference< XInterface > xCfg = ::comphelper::ConfigurationHelper::openConfig(
+                xCfg = ::comphelper::ConfigurationHelper::openConfig(
                     ::comphelper::getProcessComponentContext(),
                     OUString("/org.openoffice.Office.Impress/"),
                     ::comphelper::ConfigurationHelper::E_STANDARD);
@@ -895,6 +905,7 @@
     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 4817f42..3d0b58e 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 @@
         }
         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 a514bb2..939d6dd 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -297,6 +297,23 @@
             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())

-- 
To view, visit https://gerrit.libreoffice.org/3335
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7eb844bf2382a44481435cfaa8f498e29c56bd69
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Gergő Mocsi <gmocsi91@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.