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

Samuel Mehrbrodt s.mehrbrodt at gmail.com
Mon May 13 07:51:45 PDT 2013


 sd/source/ui/dlg/PhotoAlbumDialog.cxx |  161 +++++++---------------------------
 sd/source/ui/dlg/PhotoAlbumDialog.hxx |    4 
 sd/uiconfig/simpress/ui/photoalbum.ui |   33 +-----
 3 files changed, 45 insertions(+), 153 deletions(-)

New commits:
commit cd1034f87ae0c03d8107e2e1fd8f968c3f7075b3
Author: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
Date:   Sat May 11 22:39:16 2013 +0200

    Related fdo#35546: Remove "1 Image with Title" Layout for Photo Album Dialog
    
    There will be an option for all Slide Layouts to have a title.
    Discussed and decided here: https://wiki.documentfoundation.org/Design/Meetings/2013-05-11
    
    Change-Id: I891511d6cf8183e45b41a9358f4821f7de551836
    Reviewed-on: https://gerrit.libreoffice.org/3858
    Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>
    Tested-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>

diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index ba11647..2c49e36 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -95,111 +95,64 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
     {
         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  );
+        Reference< lang::XMultiServiceFactory > xShapeFactory( pDoc->getUnoModel(), uno::UNO_QUERY );
 
         Reference< XComponentContext > xContext(::comphelper::getProcessComponentContext());
         Reference< graphic::XGraphicProvider> xProvider(graphic::GraphicProvider::create(xContext));
 
         // get the option
         sal_uInt16 nOpt = pInsTypeCombo->GetSelectEntryPos();
-        if ( nOpt == FIT_TO_SLIDE )
+        if ( nOpt == ONE_IMAGE )
         {
             OUString sUrl;
-
             for( sal_Int16 i = 0; i < pImagesLst->GetEntryCount(); ++i )
             {
                 OUString* pData = (OUString*) pImagesLst->GetEntryData(i);
                 sUrl = *pData;
-                if (sUrl != "Text Box")
-                {
-                    Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, xDrawPages);
-                    Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
 
-                    Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl, xProvider);
+                Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, xDrawPages);
+                Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
 
-                    Image aImg(xGraphic);
-                    // Save the original size, multiplied with 100
-                    ::awt::Size aPicSize(aImg.GetSizePixel().Width()*100, aImg.GetSizePixel().Height()*100);
+                Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl, xProvider);
 
-                    Reference< drawing::XShape > xShape(
-                        xShapeFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"),
-                        uno::UNO_QUERY);
+                Image aImg(xGraphic);
+                // Save the original size, multiplied with 100
+                ::awt::Size aPicSize(aImg.GetSizePixel().Width()*100, aImg.GetSizePixel().Height()*100);
 
-                    Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
-                    xProps->setPropertyValue("Graphic", ::uno::Any(xGraphic));
+                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 aPageSize;
 
-                    xSlideProps->getPropertyValue(
-                        OUString("Width")) >>= aPageSize.Width;
-                    xSlideProps->getPropertyValue(
-                        OUString("Height")) >>= aPageSize.Height;
+                ::awt::Size aPageSize;
 
-                    ::awt::Point aPicPos;
+                xSlideProps->getPropertyValue(
+                    OUString("Width")) >>= aPageSize.Width;
+                xSlideProps->getPropertyValue(
+                    OUString("Height")) >>= aPageSize.Height;
 
-                    if(pASRCheck->IsChecked())
-                    {
-                        // Resize the image, with keeping ASR
-                        aPicSize = createASRSize(aPicSize, aPageSize);
-                    }
-                    else
-                    {
-                        aPicSize.Width = aPageSize.Width;
-                        aPicSize.Height = aPageSize.Height;
-                    }
-                    xShape->setSize(aPicSize);
-                    aPicPos.X = (aPageSize.Width - aPicSize.Width)/2;
-                    aPicPos.Y = (aPageSize.Height - aPicSize.Height)/2;
+                ::awt::Point aPicPos;
 
-                    xShape->setPosition(aPicPos);
-                    xSlide->add(xShape);
-                }
-                else // insert an empty slide, with centered text box
+                if(pASRCheck->IsChecked())
                 {
-                    appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
+                    // Resize the image, with keeping ASR
+                    aPicSize = createASRSize(aPicSize, aPageSize);
                 }
-            }
-        }
-        else if( nOpt == TITLE_ONE_IMAGE )
-        {
-            OUString sUrl;
-
-            for( sal_Int16 i = 0; i < pImagesLst->GetEntryCount(); ++i )
-            {
-                OUString* pData = (OUString*) pImagesLst->GetEntryData(i);
-                sUrl = *pData;
-                if ( sUrl != SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) )
+                else
                 {
+                    aPicSize.Width = aPageSize.Width;
+                    aPicSize.Height = aPageSize.Height;
+                }
 
-                    Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, xDrawPages);
-                    Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
-                    Reference< drawing::XShape > xShape = createXShapeFromUrl(sUrl, xShapeFactory, xProvider);
-
-                    ::awt::Size aPicSize(xShape->getSize());
-                    ::awt::Size aPageSize;
-
-                    xSlideProps->getPropertyValue(
-                        OUString("Width")) >>= aPageSize.Width;
-                    xSlideProps->getPropertyValue(
-                        OUString("Height")) >>= aPageSize.Height;
-
-                    ::awt::Point aPicPos;
-
-                    aPicPos.X = (aPageSize.Width - aPicSize.Width)/2;
-                    aPicPos.Y = (aPageSize.Height - aPicSize.Height)/2;
+                xShape->setSize(aPicSize);
+                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
-                {
-                    appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
-                }
+                xShape->setPosition(aPicPos);
+                xSlide->add(xShape);
             }
         }
         else if( nOpt == TWO_IMAGES )
@@ -231,13 +184,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                 pData = (OUString*) pD2;
                 sUrl2 = pData ? OUString(*pData) : "";
 
-                if( sUrl1 == SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) ) // create a Text Box
-                {
-                    SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD);
-                    pSlide->CreatePresObj(PRESOBJ_TEXT, sal_False, Rectangle(Point(100,100), Point(aPageSize.Width/2-100, aPageSize.Height-100)), sal_True);
-                }
-                else if( sUrl1.isEmpty()){} // nothing to do
-                else
+                if( !sUrl1.isEmpty() )
                 {
 
                     Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl1, xProvider);
@@ -273,13 +220,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                     xSlide->add(xShape);
                 }
 
-                if( sUrl2 == SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) ) // create a Text Box
-                {
-                    SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD);
-                    pSlide->CreatePresObj(PRESOBJ_TEXT, sal_False, Rectangle(Point(aPageSize.Width/2 + 100,100), Point(aPageSize.Width-100, aPageSize.Height-100)), sal_True);
-                }
-                else if( sUrl2.isEmpty()){} // nothing to do
-                else
+                if( !sUrl2.isEmpty() )
                 {
                     Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl2, xProvider);
 
@@ -356,15 +297,8 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                 pData = (OUString*) pD4;
                 sUrl4 = pData ? OUString(*pData) : "";
 
-                if( sUrl1 == SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) ) // create a Text Box
-                {
-                    SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD);
-                    pSlide->CreatePresObj(PRESOBJ_TEXT, sal_False, Rectangle(Point(100,100), Point(aPageSize.Width/2-100, aPageSize.Height/2-100)), sal_True);
-                }
-                else if( sUrl1.isEmpty()){} // nothing to do
-                else
+                if( !sUrl1.isEmpty() )
                 {
-
                     Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl1, xProvider);
 
                     Image aImg(xGraphic);
@@ -397,14 +331,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                     xShape->setPosition(aPicPos);
                     xSlide->add(xShape);
                 }
-
-                if( sUrl2 == SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) ) // create a Text Box
-                {
-                    SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD);
-                    pSlide->CreatePresObj(PRESOBJ_TEXT, sal_False, Rectangle(Point(aPageSize.Width/2 + 100,100), Point(aPageSize.Width-100, aPageSize.Height/2-100)), sal_True);
-                }
-                else if( sUrl2.isEmpty()){} // nothing to do
-                else
+                if( !sUrl2.isEmpty() )
                 {
                     Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl2, xProvider);
 
@@ -438,14 +365,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                     xShape->setPosition(aPicPos);
                     xSlide->add(xShape);
                 }
-
-                if( sUrl3 == SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) ) // create a Text Box
-                {
-                    SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD);
-                    pSlide->CreatePresObj(PRESOBJ_TEXT, sal_False, Rectangle(Point(100,aPageSize.Height/2-100), Point(aPageSize.Width/2-100, aPageSize.Height-100)), sal_True);
-                }
-                else if( sUrl3.isEmpty()){} // nothing to do
-                else
+                if( !sUrl3.isEmpty() )
                 {
 
                     Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl3, xProvider);
@@ -481,14 +401,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                     xShape->setPosition(aPicPos);
                     xSlide->add(xShape);
                 }
-
-                if( sUrl4 == SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) ) // create a Text Box
-                {
-                    SdPage* pSlide = pDoc->GetSdPage( pDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD);
-                    pSlide->CreatePresObj(PRESOBJ_TEXT, sal_False, Rectangle(Point(aPageSize.Width/2 + 100,aPageSize.Height/2 - 100), Point(aPageSize.Width-100, aPageSize.Height-100)), sal_True);
-                }
-                else if( sUrl4.isEmpty()){} // nothing to do
-                else
+                if( !sUrl4.isEmpty() )
                 {
                     Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl4, xProvider);
 
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.hxx b/sd/source/ui/dlg/PhotoAlbumDialog.hxx
index d49ec34..302a007 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.hxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.hxx
@@ -63,7 +63,6 @@ private:
     FixedImage*     pImg;
 
     ListBox*    pInsTypeCombo;
-
     CheckBox*   pASRCheck;
 
     SdDrawDocument* pDoc;
@@ -96,8 +95,7 @@ private:
 
     enum SlideImageLayout
     {
-        FIT_TO_SLIDE=0,
-        TITLE_ONE_IMAGE,
+        ONE_IMAGE=0,
         TWO_IMAGES,
         FOUR_IMAGES
     };
diff --git a/sd/uiconfig/simpress/ui/photoalbum.ui b/sd/uiconfig/simpress/ui/photoalbum.ui
index d1e7a6c..b5ea76d 100644
--- a/sd/uiconfig/simpress/ui/photoalbum.ui
+++ b/sd/uiconfig/simpress/ui/photoalbum.ui
@@ -232,22 +232,6 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label4">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Album Layout</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
                   <object class="GtkBox" id="box5">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
@@ -309,7 +293,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">4</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
               </object>
@@ -333,6 +317,12 @@
       <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 -->
@@ -343,9 +333,6 @@
         <col id="0" translatable="yes">1 Image</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>
@@ -353,10 +340,4 @@
       </row>
     </data>
   </object>
-  <object class="GtkListStore" id="liststore1">
-    <columns>
-      <!-- column-name Filename -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
 </interface>


More information about the Libreoffice-commits mailing list