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

Katarina Behrens bubli at bubli.org
Fri Apr 26 13:35:02 PDT 2013


 sd/UIConfig_simpress.mk                     |    1 
 sd/source/ui/dlg/custsdlg.cxx               |   98 ++++++-------
 sd/source/ui/inc/custsdlg.hxx               |   18 +-
 sd/uiconfig/simpress/ui/customslideshows.ui |  208 ++++++++++++++++++++++++++++
 4 files changed, 266 insertions(+), 59 deletions(-)

New commits:
commit efc4761686b9c566d9a45fb9ab3984d7704603ba
Author: Katarina Behrens <bubli at bubli.org>
Date:   Fri Apr 26 22:15:35 2013 +0200

    Fixed crash on deleting custom slide show
    
    Create a custom slide show in Impress, attempt to delete it
    -> crash
    STL vector::erase returns an iterator pointing to the next element
    i.e. not the element we want to remove, evtl. invalid end iterator
    
    Change-Id: Ie3758fc1ae5fc5f2a934cd8bed3de4e84a0b841b

diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index 8eedbf1..8019f43 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -165,7 +165,8 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
         sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();
         if( nPos != LISTBOX_ENTRY_NOTFOUND )
         {
-            delete *pCustomShowList->erase( pCustomShowList->begin() + nPos );
+            delete (*pCustomShowList)[nPos];
+            pCustomShowList->erase( pCustomShowList->begin() + nPos );
             m_pLbCustomShows->RemoveEntry( nPos );
             m_pLbCustomShows->SelectEntryPos( nPos == 0 ? nPos : nPos - 1 );
             bModified = sal_True;
commit 2b37775048b69edff81cd4f73b39bd9445b60878
Author: Katarina Behrens <bubli at bubli.org>
Date:   Fri Apr 26 22:13:12 2013 +0200

    Converted custom slide shows dialog to .ui
    
    Change-Id: Ica0361a45a00f45fd4767d5de37bd839567a469d

diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index b134d89..a90886a 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
 	sd/uiconfig/simpress/ui/presentationdialog \
 	sd/uiconfig/simpress/ui/printeroptions \
 	sd/uiconfig/simpress/ui/photoalbum \
+	sd/uiconfig/simpress/ui/customslideshows \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index 31f6140..8eedbf1 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -39,34 +39,31 @@
 
 SdCustomShowDlg::SdCustomShowDlg( Window* pWindow,
                             SdDrawDocument& rDrawDoc ) :
-    ModalDialog     ( pWindow, SdResId( DLG_CUSTOMSHOW ) ),
-
-    aLbCustomShows  ( this, SdResId( LB_CUSTOMSHOWS ) ),
-    aCbxUseCustomShow( this, SdResId( CBX_USE_CUSTOMSHOW ) ),
-    aBtnNew         ( this, SdResId( BTN_NEW ) ),
-    aBtnEdit        ( this, SdResId( BTN_EDIT ) ),
-    aBtnRemove      ( this, SdResId( BTN_REMOVE ) ),
-    aBtnCopy        ( this, SdResId( BTN_COPY ) ),
-    aBtnHelp        ( this, SdResId( BTN_HELP ) ),
-    aBtnStartShow   ( this, SdResId( BTN_STARTSHOW ) ),
-    aBtnOK          ( this, SdResId( BTN_OK ) ),
-
+    ModalDialog     ( pWindow, "CustomSlideShows", "modules/simpress/ui/customslideshows.ui" ),
     rDoc            ( rDrawDoc ),
     pCustomShowList ( NULL ),
     pCustomShow     ( NULL ),
     bModified       ( sal_False )
 {
-    FreeResource();
+    get( m_pBtnNew, "new" );
+    get( m_pBtnEdit, "edit" );
+    get( m_pBtnRemove, "delete" );
+    get( m_pBtnCopy, "copy" );
+    get( m_pBtnHelp, "help" );
+    get( m_pBtnStartShow, "startshow" );
+    get( m_pBtnOK, "ok" );
+    get( m_pLbCustomShows, "customshowlist");
+    get( m_pCbxUseCustomShow, "usecustomshows" );
 
     Link aLink( LINK( this, SdCustomShowDlg, ClickButtonHdl ) );
-    aBtnNew.SetClickHdl( aLink );
-    aBtnEdit.SetClickHdl( aLink );
-    aBtnRemove.SetClickHdl( aLink );
-    aBtnCopy.SetClickHdl( aLink );
-    aCbxUseCustomShow.SetClickHdl( aLink );
-    aLbCustomShows.SetSelectHdl( aLink );
+    m_pBtnNew->SetClickHdl( aLink );
+    m_pBtnEdit->SetClickHdl( aLink );
+    m_pBtnRemove->SetClickHdl( aLink );
+    m_pBtnCopy->SetClickHdl( aLink );
+    m_pCbxUseCustomShow->SetClickHdl( aLink );
+    m_pLbCustomShows->SetSelectHdl( aLink );
 
-    aBtnStartShow.SetClickHdl( LINK( this, SdCustomShowDlg, StartShowHdl ) ); // for test
+    m_pBtnStartShow->SetClickHdl( LINK( this, SdCustomShowDlg, StartShowHdl ) ); // for test
 
     // get CustomShow list of docs
     pCustomShowList = rDoc.GetCustomShowList();
@@ -78,13 +75,13 @@ SdCustomShowDlg::SdCustomShowDlg( Window* pWindow,
              pCustomShow != NULL;
              pCustomShow = pCustomShowList->Next() )
         {
-            aLbCustomShows.InsertEntry( pCustomShow->GetName() );
+            m_pLbCustomShows->InsertEntry( pCustomShow->GetName() );
         }
-        aLbCustomShows.SelectEntryPos( (sal_uInt16)nPosToSelect );
+        m_pLbCustomShows->SelectEntryPos( (sal_uInt16)nPosToSelect );
         pCustomShowList->Seek( nPosToSelect );
     }
 
-    aCbxUseCustomShow.Check( pCustomShowList && rDoc.getPresentationSettings().mbCustomShow );
+    m_pCbxUseCustomShow->Check( pCustomShowList && rDoc.getPresentationSettings().mbCustomShow );
 
     CheckState();
 }
@@ -95,14 +92,14 @@ SdCustomShowDlg::~SdCustomShowDlg()
 
 void SdCustomShowDlg::CheckState()
 {
-    sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+    sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();
 
     sal_Bool bEnable = nPos != LISTBOX_ENTRY_NOTFOUND;
-    aBtnEdit.Enable( bEnable );
-    aBtnRemove.Enable( bEnable );
-    aBtnCopy.Enable( bEnable );
-    aCbxUseCustomShow.Enable( bEnable );
-    aBtnStartShow.Enable( true );
+    m_pBtnEdit->Enable( bEnable );
+    m_pBtnRemove->Enable( bEnable );
+    m_pBtnCopy->Enable( bEnable );
+    m_pCbxUseCustomShow->Enable( bEnable );
+    m_pBtnStartShow->Enable( true );
 
     if( bEnable )
         pCustomShowList->Seek( nPos );
@@ -114,7 +111,7 @@ void SdCustomShowDlg::CheckState()
 IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
 {
     // new CustomShow
-    if( p == &aBtnNew )
+    if( p == m_pBtnNew )
     {
         pCustomShow = NULL;
         SdDefineCustomShowDlg aDlg( this, rDoc, pCustomShow );
@@ -127,8 +124,8 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
 
                 pCustomShowList->push_back( pCustomShow );
                 pCustomShowList->Last();
-                aLbCustomShows.InsertEntry( pCustomShow->GetName() );
-                aLbCustomShows.SelectEntry( pCustomShow->GetName() );
+                m_pLbCustomShows->InsertEntry( pCustomShow->GetName() );
+                m_pLbCustomShows->SelectEntry( pCustomShow->GetName() );
             }
 
             if( aDlg.IsModified() )
@@ -138,9 +135,9 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
             DELETEZ( pCustomShow );
     }
     // edit CustomShow
-    else if( p == &aBtnEdit )
+    else if( p == m_pBtnEdit )
     {
-        sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+        sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();
         if( nPos != LISTBOX_ENTRY_NOTFOUND )
         {
             DBG_ASSERT( pCustomShowList, "pCustomShowList does not exist" );
@@ -153,9 +150,9 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
                 {
                     (*pCustomShowList)[nPos] = pCustomShow;
                     pCustomShowList->Seek( nPos );
-                    aLbCustomShows.RemoveEntry( nPos );
-                    aLbCustomShows.InsertEntry( pCustomShow->GetName(), nPos );
-                    aLbCustomShows.SelectEntryPos( nPos );
+                    m_pLbCustomShows->RemoveEntry( nPos );
+                    m_pLbCustomShows->InsertEntry( pCustomShow->GetName(), nPos );
+                    m_pLbCustomShows->SelectEntryPos( nPos );
                 }
                 if( aDlg.IsModified() )
                     bModified = sal_True;
@@ -163,21 +160,21 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
         }
     }
     // delete CustomShow
-    else if( p == &aBtnRemove )
+    else if( p == m_pBtnRemove )
     {
-        sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+        sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();
         if( nPos != LISTBOX_ENTRY_NOTFOUND )
         {
             delete *pCustomShowList->erase( pCustomShowList->begin() + nPos );
-            aLbCustomShows.RemoveEntry( nPos );
-            aLbCustomShows.SelectEntryPos( nPos == 0 ? nPos : nPos - 1 );
+            m_pLbCustomShows->RemoveEntry( nPos );
+            m_pLbCustomShows->SelectEntryPos( nPos == 0 ? nPos : nPos - 1 );
             bModified = sal_True;
         }
     }
     // copy CustomShow
-    else if( p == &aBtnCopy )
+    else if( p == m_pBtnCopy )
     {
-        sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+        sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();
         if( nPos != LISTBOX_ENTRY_NOTFOUND )
         {
             SdCustomShow* pShow = new SdCustomShow( *(*pCustomShowList)[nPos] );
@@ -227,22 +224,22 @@ IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
 
             pCustomShowList->push_back( pShow );
             pCustomShowList->Last();
-            aLbCustomShows.InsertEntry( pShow->GetName() );
-            aLbCustomShows.SelectEntry( pShow->GetName() );
+            m_pLbCustomShows->InsertEntry( pShow->GetName() );
+            m_pLbCustomShows->SelectEntry( pShow->GetName() );
 
 
             bModified = sal_True;
         }
     }
-    else if( p == &aLbCustomShows )
+    else if( p == m_pLbCustomShows )
     {
-        sal_uInt16 nPos = aLbCustomShows.GetSelectEntryPos();
+        sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();
         if( nPos != LISTBOX_ENTRY_NOTFOUND )
             pCustomShowList->Seek( nPos );
 
         bModified = sal_True;
     }
-    else if( p == &aCbxUseCustomShow )
+    else if( p == m_pCbxUseCustomShow )
     {
         bModified = sal_True;
     }
@@ -267,7 +264,7 @@ IMPL_LINK_NOARG(SdCustomShowDlg, StartShowHdl)
  */
 sal_Bool SdCustomShowDlg::IsCustomShow() const
 {
-    return( aCbxUseCustomShow.IsEnabled() && aCbxUseCustomShow.IsChecked() );
+    return( m_pCbxUseCustomShow->IsEnabled() && m_pCbxUseCustomShow->IsChecked() );
 }
 
 
diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx
index 76ff0e5..06cf188 100644
--- a/sd/source/ui/inc/custsdlg.hxx
+++ b/sd/source/ui/inc/custsdlg.hxx
@@ -37,15 +37,15 @@ class SdCustomShowList;
 class SdCustomShowDlg : public ModalDialog
 {
 private:
-    ListBox         aLbCustomShows;
-    CheckBox        aCbxUseCustomShow;
-    PushButton      aBtnNew;
-    PushButton      aBtnEdit;
-    PushButton      aBtnRemove;
-    PushButton      aBtnCopy;
-    HelpButton      aBtnHelp;
-    PushButton      aBtnStartShow;
-    OKButton        aBtnOK;
+    ListBox*         m_pLbCustomShows;
+    CheckBox*        m_pCbxUseCustomShow;
+    PushButton*      m_pBtnNew;
+    PushButton*      m_pBtnEdit;
+    PushButton*      m_pBtnRemove;
+    PushButton*      m_pBtnCopy;
+    HelpButton*      m_pBtnHelp;
+    PushButton*      m_pBtnStartShow;
+    OKButton*        m_pBtnOK;
 
     SdDrawDocument& rDoc;
     SdCustomShowList* pCustomShowList;
diff --git a/sd/uiconfig/simpress/ui/customslideshows.ui b/sd/uiconfig/simpress/ui/customslideshows.ui
new file mode 100644
index 0000000..1621058
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/customslideshows.ui
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkListStore" id="liststore1"/>
+  <object class="GtkDialog" id="CustomSlideShows">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="type_hint">dialog</property>
+    <property name="title" translatable="yes">Custom Slide Shows</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="layout_style">start</property>
+            <child>
+              <object class="GtkButton" id="new">
+                <property name="label">gtk-new</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="use_stock">True</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="edit">
+                <property name="label">gtk-edit</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_underline">True</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>
+            <child>
+              <object class="GtkButton" id="delete">
+                <property name="label">gtk-delete</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_underline">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="copy">
+                <property name="label" translatable="yes">Cop_y</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_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</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_underline">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="startshow">
+                <property name="label" translatable="yes">_Start</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_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">5</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</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_underline">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">6</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="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkTreeView" id="customshowlist">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="model">liststore1</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="treeview-selection2"/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="usecustomshows">
+                <property name="label" translatable="yes">_Use Custom Slide Show</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">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="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">button1</action-widget>
+      <action-widget response="0">button2</action-widget>
+      <action-widget response="0">button3</action-widget>
+      <action-widget response="0">button4</action-widget>
+      <action-widget response="0">button5</action-widget>
+      <action-widget response="0">button6</action-widget>
+      <action-widget response="0">button7</action-widget>
+    </action-widgets>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list