[Libreoffice-commits] core.git: 2 commits - sd/source

Andras Timar atimar at suse.com
Fri Apr 12 03:39:21 PDT 2013


 sd/source/ui/app/strings.src                           |    5 +
 sd/source/ui/dlg/PhotoAlbumDialog.cxx                  |   70 +++++++++--------
 sd/source/ui/inc/strings.hrc                           |    1 
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |   17 ++++
 sd/source/ui/view/outlnvs2.cxx                         |   17 ++++
 5 files changed, 81 insertions(+), 29 deletions(-)

New commits:
commit e7808c250f1b82ca9566fc12c4d7de33c58fcb1b
Author: Andras Timar <atimar at suse.com>
Date:   Fri Apr 12 03:32:48 2013 -0700

    make Photo Album warning string localizable
    
    Change-Id: Ib57d76313732fed18d1d3b91b27df33d60dabf2b

diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src
index bc96afb..a91003d 100644
--- a/sd/source/ui/app/strings.src
+++ b/sd/source/ui/app/strings.src
@@ -1278,4 +1278,9 @@ String STR_PHOTO_ALBUM_AUTHOR
      Text [ en-US ] = "Author:" ;
 };
 
+String STR_PHOTO_ALBUM_EMPTY_WARNING
+{
+     Text [ en-US ] = "Please add images to the album." ;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index b5e7ee3..4beabeb 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -92,8 +92,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
 {
     if (pImagesLst->GetEntryCount() == 0)
     {
-        InfoBox aInfo(this, OUString("Please add images to the album."));
-        aInfo.Execute();
+        WarningBox aWarning(this, WB_OK, SD_RESSTR(STR_PHOTO_ALBUM_EMPTY_WARNING));
+        aWarning.Execute();
     }
     else
     {
diff --git a/sd/source/ui/inc/strings.hrc b/sd/source/ui/inc/strings.hrc
index c3d8268..9281678 100644
--- a/sd/source/ui/inc/strings.hrc
+++ b/sd/source/ui/inc/strings.hrc
@@ -417,6 +417,7 @@
 
 #define STR_PHOTO_ALBUM_TITLE                           (RID_APP_START+729)
 #define STR_PHOTO_ALBUM_AUTHOR                          (RID_APP_START+730)
+#define STR_PHOTO_ALBUM_EMPTY_WARNING                   (RID_APP_START+731)
 
 /******************************************************************************
 * The ids in glob.hrc start at RID_APP_START+750!
commit d99f529676e78895996d50064dbcb0dc1b2ad986
Author: Gergő Mocsi <gmocsi91 at gmail.com>
Date:   Sun Apr 7 11:25:23 2013 +0200

    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

diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 374b305..b5e7ee3 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 bdf802b..a07ef14 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 d98589a..612476e 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())


More information about the Libreoffice-commits mailing list