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

Katarina Behrens bubli at bubli.org
Thu May 2 14:57:13 PDT 2013


 sd/source/ui/dlg/custsdlg.cxx                    |  117 +++++-----
 sd/source/ui/inc/custsdlg.hxx                    |   19 -
 sd/uiconfig/simpress/ui/definecustomslideshow.ui |  260 +++++++++++++++++++++++
 3 files changed, 328 insertions(+), 68 deletions(-)

New commits:
commit 7886bbd044a5148deafa61bde731e371166299f6
Author: Katarina Behrens <bubli at bubli.org>
Date:   Thu May 2 23:50:58 2013 +0200

    Converted define custom slide show dialog to .ui
    
    Change-Id: I6bb6bcb96993d05cc225da63c56cbb7fbad83ec2

diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index dd0c95d..fabac08 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -280,34 +280,37 @@ sal_Bool SdCustomShowDlg::IsCustomShow() const
 
 SdDefineCustomShowDlg::SdDefineCustomShowDlg( Window* pWindow,
                         SdDrawDocument& rDrawDoc, SdCustomShow*& rpCS ) :
-    ModalDialog     ( pWindow, SdResId( DLG_DEFINE_CUSTOMSHOW ) ),
-
-    aFtName         ( this, SdResId( FT_NAME ) ),
-    aEdtName        ( this, SdResId( EDT_NAME ) ),
-    aFtPages        ( this, SdResId( FT_PAGES ) ),
-    aLbPages        ( this, SdResId( LB_PAGES ) ),
-    aBtnAdd         ( this, SdResId( BTN_ADD ) ),
-    aBtnRemove      ( this, SdResId( BTN_REMOVE ) ),
-    aFtCustomPages  ( this, SdResId( FT_CUSTOM_PAGES ) ),
-    aLbCustomPages  ( this, SdResId( LB_CUSTOM_PAGES ) ),
-    aBtnOK          ( this, SdResId( BTN_OK ) ),
-    aBtnCancel      ( this, SdResId( BTN_CANCEL ) ),
-    aBtnHelp        ( this, SdResId( BTN_HELP ) ),
-
+    ModalDialog     ( pWindow, "DefineCustomSlideShow", "modules/simpress/ui/definecustomslideshow.ui" ),
     rDoc            ( rDrawDoc ),
     rpCustomShow    ( rpCS ),
     bModified       ( sal_False )
 {
-    FreeResource();
+    get( m_pEdtName, "customname" );
+    get( m_pLbPages, "pages" );
+    get( m_pBtnAdd, "add" );
+    get( m_pBtnRemove, "remove" );
+    get( m_pLbCustomPages, "custompages" );
+    get( m_pBtnOK, "ok" );
+    get( m_pBtnCancel, "cancel" );
+    get( m_pBtnHelp, "help" );
 
     Link aLink = LINK( this, SdDefineCustomShowDlg, ClickButtonHdl );
-    aBtnAdd.SetClickHdl( aLink );
-    aBtnRemove.SetClickHdl( aLink );
-    aEdtName.SetModifyHdl( aLink );
-    aLbPages.SetSelectHdl( aLink ); // because of status
-    aLbCustomPages.SetSelectHdl( aLink ); // because of status
+    m_pBtnAdd->SetClickHdl( aLink );
+    m_pBtnRemove->SetClickHdl( aLink );
+    m_pEdtName->SetModifyHdl( aLink );
+    m_pLbPages->SetSelectHdl( aLink ); // because of status
+    m_pLbCustomPages->SetSelectHdl( aLink ); // because of status
 
-    aBtnOK.SetClickHdl( LINK( this, SdDefineCustomShowDlg, OKHdl ) );
+    m_pBtnOK->SetClickHdl( LINK( this, SdDefineCustomShowDlg, OKHdl ) );
+
+    // Hack: m_pLbPages used to be MultiLB. We don't have VCL builder equivalent
+    // of it yet. So enable selecting multiple items here
+    m_pLbPages->EnableMultiSelection( sal_True );
+
+    // shape 'em a bit
+    m_pLbPages->set_width_request(m_pLbPages->approximate_char_width() * 16);
+    m_pLbCustomPages->set_width_request(m_pLbPages->approximate_char_width() * 16);
+    m_pLbPages->SetDropDownLineCount(10);
 
     SdPage* pPage;
     // fill Listbox with page names of Docs
@@ -317,35 +320,35 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg( Window* pWindow,
     {
         pPage = rDoc.GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
         OUString aStr( pPage->GetName() );
-        aLbPages.InsertEntry( aStr );
+        m_pLbPages->InsertEntry( aStr );
     }
     //aLbPages.SelectEntryPos( 0 );
 
     if( rpCustomShow )
     {
         aOldName = rpCustomShow->GetName();
-        aEdtName.SetText( aOldName );
+        m_pEdtName->SetText( aOldName );
 
         // fill ListBox with CustomShow pages
         for( SdCustomShow::PageVec::iterator it = rpCustomShow->PagesVector().begin();
              it != rpCustomShow->PagesVector().end(); ++it )
         {
-            SvTreeListEntry* pEntry = aLbCustomPages.InsertEntry( (*it)->GetName() );
+            SvTreeListEntry* pEntry = m_pLbCustomPages->InsertEntry( (*it)->GetName() );
             pEntry->SetUserData( (SdPage*) (*it) );
         }
     }
     else
     {
         rpCustomShow = new SdCustomShow( &rDoc );
-        aEdtName.SetText( OUString( SdResId( STR_NEW_CUSTOMSHOW ) ) );
-        aEdtName.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
-        rpCustomShow->SetName( aEdtName.GetText() );
+        m_pEdtName->SetText( OUString( SdResId( STR_NEW_CUSTOMSHOW ) ) );
+        m_pEdtName->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+        rpCustomShow->SetName( m_pEdtName->GetText() );
     }
 
-    aLbCustomPages.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE );
-    aLbCustomPages.SetHighlightRange();
+    m_pLbCustomPages->SetDragDropMode( SV_DRAGDROP_CTRL_MOVE );
+    m_pLbCustomPages->SetHighlightRange();
 
-    aBtnOK.Enable( sal_False );
+    m_pBtnOK->Enable( sal_False );
     CheckState();
 }
 
@@ -358,14 +361,14 @@ SdDefineCustomShowDlg::~SdDefineCustomShowDlg()
  */
 void SdDefineCustomShowDlg::CheckState()
 {
-    sal_Bool bPages = aLbPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
+    sal_Bool bPages = m_pLbPages->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
     //sal_Bool bCSPages = aLbCustomPages.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
-    sal_Bool bCSPages = aLbCustomPages.FirstSelected() != NULL;
-    sal_Bool bCount = aLbCustomPages.GetEntryCount() > 0;
+    sal_Bool bCSPages = m_pLbCustomPages->FirstSelected() != NULL;
+    sal_Bool bCount = m_pLbCustomPages->GetEntryCount() > 0;
 
-    aBtnOK.Enable( bCount );
-    aBtnAdd.Enable( bPages );
-    aBtnRemove.Enable( bCSPages );
+    m_pBtnOK->Enable( bCount );
+    m_pBtnAdd->Enable( bPages );
+    m_pBtnRemove->Enable( bCSPages );
 }
 
 /**
@@ -373,24 +376,24 @@ void SdDefineCustomShowDlg::CheckState()
  */
 IMPL_LINK( SdDefineCustomShowDlg, ClickButtonHdl, void *, p )
 {
-    if( p == &aBtnAdd )
+    if( p == m_pBtnAdd )
     {
-        sal_uInt16 nCount = aLbPages.GetSelectEntryCount();
+        sal_uInt16 nCount = m_pLbPages->GetSelectEntryCount();
         if( nCount > 0 )
         {
             sal_uLong nPosCP = LIST_APPEND;
-            SvTreeListEntry* pEntry = aLbCustomPages.FirstSelected();
+            SvTreeListEntry* pEntry = m_pLbCustomPages->FirstSelected();
             if( pEntry )
-                nPosCP = aLbCustomPages.GetModel()->GetAbsPos( pEntry ) + 1L;
+                nPosCP = m_pLbCustomPages->GetModel()->GetAbsPos( pEntry ) + 1L;
 
             for( sal_uInt16 i = 0; i < nCount; i++ )
             {
-                OUString aStr = aLbPages.GetSelectEntry( i );
-                pEntry = aLbCustomPages.InsertEntry( aStr,
+                OUString aStr = m_pLbPages->GetSelectEntry( i );
+                pEntry = m_pLbCustomPages->InsertEntry( aStr,
                                             0, sal_False, nPosCP );
 
-                aLbCustomPages.Select( pEntry );
-                SdPage* pPage = rDoc.GetSdPage( (sal_uInt16) aLbPages.
+                m_pLbCustomPages->Select( pEntry );
+                SdPage* pPage = rDoc.GetSdPage( (sal_uInt16) m_pLbPages->
                                     GetSelectEntryPos( i ), PK_STANDARD );
                 pEntry->SetUserData( pPage );
 
@@ -400,21 +403,21 @@ IMPL_LINK( SdDefineCustomShowDlg, ClickButtonHdl, void *, p )
             bModified = sal_True;
         }
     }
-    else if( p == &aBtnRemove )
+    else if( p == m_pBtnRemove )
     {
         //sal_uInt16 nPos = aLbCustomPages.GetSelectEntryPos();
-        SvTreeListEntry* pEntry = aLbCustomPages.FirstSelected();
+        SvTreeListEntry* pEntry = m_pLbCustomPages->FirstSelected();
         if( pEntry )
         {
-            sal_uLong nPos = aLbCustomPages.GetModel()->GetAbsPos( pEntry );
+            sal_uLong nPos = m_pLbCustomPages->GetModel()->GetAbsPos( pEntry );
             //rpCustomShow->Remove( nPos );
             //aLbCustomPages.RemoveEntry( nPos );
-            aLbCustomPages.GetModel()->Remove( aLbCustomPages.GetModel()->GetEntryAtAbsPos( nPos ) );
+            m_pLbCustomPages->GetModel()->Remove( m_pLbCustomPages->GetModel()->GetEntryAtAbsPos( nPos ) );
 
             bModified = sal_True;
         }
     }
-    else if( p == &aEdtName )
+    else if( p == m_pEdtName )
     {
         //rpCustomShow->SetName( aEdtName.GetText() );
 
@@ -436,7 +439,7 @@ void SdDefineCustomShowDlg::CheckCustomShow()
     SvTreeListEntry* pEntry = NULL;
 
     // compare count
-    if( rpCustomShow->PagesVector().size() != aLbCustomPages.GetEntryCount() )
+    if( rpCustomShow->PagesVector().size() != m_pLbCustomPages->GetEntryCount() )
     {
         rpCustomShow->PagesVector().clear();
         bDifferent = sal_True;
@@ -446,9 +449,9 @@ void SdDefineCustomShowDlg::CheckCustomShow()
     if( !bDifferent )
     {
         SdCustomShow::PageVec::iterator it1 = rpCustomShow->PagesVector().begin();
-        pEntry = aLbCustomPages.First();
+        pEntry = m_pLbCustomPages->First();
         for( ; it1 != rpCustomShow->PagesVector().end() && pEntry != NULL && !bDifferent;
-             ++it1, pEntry = aLbCustomPages.Next( pEntry ) )
+             ++it1, pEntry = m_pLbCustomPages->Next( pEntry ) )
         {
             if( *it1 != pEntry->GetUserData() )
             {
@@ -462,9 +465,9 @@ void SdDefineCustomShowDlg::CheckCustomShow()
     if( bDifferent )
     {
         SdPage* pPage = NULL;
-        for( pEntry = aLbCustomPages.First();
+        for( pEntry = m_pLbCustomPages->First();
              pEntry != NULL;
-             pEntry = aLbCustomPages.Next( pEntry ) )
+             pEntry = m_pLbCustomPages->Next( pEntry ) )
         {
             pPage = (SdPage*) pEntry->GetUserData();
             rpCustomShow->PagesVector().push_back( pPage );
@@ -473,7 +476,7 @@ void SdDefineCustomShowDlg::CheckCustomShow()
     }
 
     // compare name and set name if necessary
-    String aStr( aEdtName.GetText() );
+    String aStr( m_pEdtName->GetText() );
     if( rpCustomShow->GetName() != aStr )
     {
         rpCustomShow->SetName( aStr );
@@ -491,7 +494,7 @@ IMPL_LINK_NOARG(SdDefineCustomShowDlg, OKHdl)
     SdCustomShowList* pCustomShowList = rDoc.GetCustomShowList();
     if( pCustomShowList )
     {
-        String aName( aEdtName.GetText() );
+        String aName( m_pEdtName->GetText() );
         SdCustomShow* pCustomShow;
 
         long nPosToSelect = pCustomShowList->GetCurPos();
@@ -516,7 +519,7 @@ IMPL_LINK_NOARG(SdDefineCustomShowDlg, OKHdl)
         WarningBox( this, WinBits( WB_OK ),
                     String( SdResId( STR_WARN_NAME_DUPLICATE ) ) ).Execute();
 
-        aEdtName.GrabFocus();
+        m_pEdtName->GrabFocus();
     }
 
     return 0;
diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx
index 06cf188..a97143b 100644
--- a/sd/source/ui/inc/custsdlg.hxx
+++ b/sd/source/ui/inc/custsdlg.hxx
@@ -71,17 +71,14 @@ public:
 class SdDefineCustomShowDlg : public ModalDialog
 {
 private:
-    FixedText       aFtName;
-    Edit            aEdtName;
-    FixedText       aFtPages;
-    MultiListBox    aLbPages;
-    PushButton      aBtnAdd;
-    PushButton      aBtnRemove;
-    FixedText       aFtCustomPages;
-    SvTreeListBox   aLbCustomPages;
-    OKButton        aBtnOK;
-    CancelButton    aBtnCancel;
-    HelpButton      aBtnHelp;
+    Edit*            m_pEdtName;
+    ListBox*         m_pLbPages;
+    PushButton*      m_pBtnAdd;
+    PushButton*      m_pBtnRemove;
+    SvTreeListBox*   m_pLbCustomPages;
+    OKButton*        m_pBtnOK;
+    CancelButton*    m_pBtnCancel;
+    HelpButton*      m_pBtnHelp;
 
     SdDrawDocument& rDoc;
     SdCustomShow*&  rpCustomShow;
diff --git a/sd/uiconfig/simpress/ui/definecustomslideshow.ui b/sd/uiconfig/simpress/ui/definecustomslideshow.ui
new file mode 100644
index 0000000..26423c8
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/definecustomslideshow.ui
@@ -0,0 +1,260 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="DefineCustomSlideShow">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="type_hint">dialog</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="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="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_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="cancel">
+                <property name="label">gtk-cancel</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_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="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_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</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="orientation">vertical</property>
+            <property name="spacing">6</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <child>
+              <object class="GtkBox" id="box3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">_Name:</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="customname">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">●</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">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">_Existing slides</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">_Selected slides</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTreeView" id="pages">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="model">liststore1</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection1">
+                        <property name="mode">multiple</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="svtlo-SvTreeListBox" id="custompages">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="valign">center</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkButton" id="add">
+                        <property name="label" translatable="yes">>></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>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="remove">
+                        <property name="label" translatable="yes"><<</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>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</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">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+      <action-widget response="0">help</action-widget>
+    </action-widgets>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list