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/3858

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/58/3858/1

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
---
M sd/source/ui/dlg/PhotoAlbumDialog.cxx
M sd/source/ui/dlg/PhotoAlbumDialog.hxx
M sd/uiconfig/simpress/ui/photoalbum.ui
3 files changed, 54 insertions(+), 162 deletions(-)



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 @@
     {
         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);
+
+                Image aImg(xGraphic);
+                // Save the original size, multiplied with 100
+                ::awt::Size aPicSize(aImg.GetSizePixel().Width()*100, 
aImg.GetSizePixel().Height()*100);
+
+                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::Point aPicPos;
+
+                if(pASRCheck->IsChecked())
                 {
-                    Reference< drawing::XDrawPage > xSlide = appendNewSlide(AUTOLAYOUT_NONE, 
xDrawPages);
-                    Reference< beans::XPropertySet > xSlideProps( xSlide, uno::UNO_QUERY );
-
-                    Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl, 
xProvider);
-
-                    Image aImg(xGraphic);
-                    // Save the original size, multiplied with 100
-                    ::awt::Size aPicSize(aImg.GetSizePixel().Width()*100, 
aImg.GetSizePixel().Height()*100);
-
-                    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::Point aPicPos;
-
-                    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;
-
-                    xShape->setPosition(aPicPos);
-                    xSlide->add(xShape);
+                    // Resize the image, with keeping ASR
+                    aPicSize = createASRSize(aPicSize, aPageSize);
                 }
-                else // insert an empty slide, with centered text box
+                else
                 {
-                    appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
+                    aPicSize.Width = aPageSize.Width;
+                    aPicSize.Height = aPageSize.Height;
                 }
-            }
-        }
-        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) )
-                {
+                xShape->setSize(aPicSize);
+                aPicPos.X = (aPageSize.Width - aPicSize.Width)/2;
+                aPicPos.Y = (aPageSize.Height - aPicSize.Height)/2;
 
-                    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);
-                    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 @@
                 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 @@
                     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 @@
                 pData = (OUString*) pD4;
                 sUrl4 = pData ? OUString(*pData) : "";
 
-                if( sUrl1 == SD_RESSTR(STR_PHOTO_ALBUM_TEXTBOX) ) // create a Text Box
+                if( !sUrl1.isEmpty() )
                 {
-                    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
-                {
-
                     Reference< graphic::XGraphic > xGraphic = createXGraphicFromUrl(sUrl1, 
xProvider);
 
                     Image aImg(xGraphic);
@@ -397,14 +331,7 @@
                     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 @@
                     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 @@
                     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 @@
     FixedImage*     pImg;
 
     ListBox*    pInsTypeCombo;
-
     CheckBox*   pASRCheck;
 
     SdDrawDocument* pDoc;
@@ -96,8 +95,7 @@
 
     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,20 +333,11 @@
         <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>
         <col id="0" translatable="yes">4 Images</col>
       </row>
     </data>
-  </object>
-  <object class="GtkListStore" id="liststore1">
-    <columns>
-      <!-- column-name Filename -->
-      <column type="gchararray"/>
-    </columns>
   </object>
 </interface>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I891511d6cf8183e45b41a9358f4821f7de551836
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Samuel Mehrbrodt <s.mehrbrodt@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.