Hide and show slides from custom dialog

Guillermo Molleda Jimena gmolleda at us.es
Mon Jul 1 03:45:34 PDT 2013


Hi, I am trying add a functionality for hide or show the slides included 
in a custom user presentation (menu Slide show - Custom slide show...).

Objective: to print a custom in PDF, hiding the rest of slides and 
presenting only those chosen.
Can anyone help?
I think it's something important for teachers with different students, 
the same base but different levels slide.

I have added the buttons "Show" and "Hide" to 
/libreoffice/sd/uiconfig/ui/customslideshows.ui with Glade:
terminal:
$ export GLADE_CATALOG_SEARCH_PATH=~/.../libreoffice/install/share/glade
$ glade

I add size for put two buttons: Show and Hide, code buttons:
----------------------------------code buttons in 
.../libreoffice/sd/uiconfig/ui/customslideshows.ui------------------------
<child>
<object class="GtkButton" id="show">
<property name="label" translatable="yes">Sho_w</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">7</property>
</packing>
</child>
<child>
<object class="GtkButton" id="hide">
<property name="label" translatable="yes">_Hide</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">8</property>
</packing>
</child>
----------------------------------END code buttons in 
.../libreoffice/sd/uiconfig/ui/customslideshows.ui------------------------
In 
/home/deb/Descargas/libreoffice/libreoffice/sd/source/ui/inc/custdlg.hxx 
I add:
-------------- Change custdlg.hxx -------------
class SdCustomShowDlg : public ModalDialog
{
private:
     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;
+    PushButton*      m_pBtnShow;
+    PushButton*      m_pBtnHide;
--------------END Change custdlg.hxx -------------

In .../libreoffice/sd/source/ui/dlg/custdlg.cxx

I add in constructor:
     get( m_pBtnStartShow, "startshow" );
     get( m_pBtnOK, "ok" );
+    get( m_pBtnShow, "show" );
+    get( m_pBtnHide, "hide" );
     get( m_pLbCustomShows, "customshowlist");
...
     m_pCbxUseCustomShow->SetClickHdl( aLink );
     m_pLbCustomShows->SetSelectHdl( aLink );
+    m_pBtnShow->SetClickHdl( aLink );
+    m_pBtnHide->SetClickHdl( aLink );

     m_pBtnStartShow->SetClickHdl( LINK( this, SdCustomShowDlg, 
StartShowHdl ) ); // for test

In function CheckState I add:
void SdCustomShowDlg::CheckState()
{
     sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();

     sal_Bool bEnable = nPos != LISTBOX_ENTRY_NOTFOUND;
     m_pBtnEdit->Enable( bEnable );
     m_pBtnRemove->Enable( bEnable );
     m_pBtnCopy->Enable( bEnable );
     m_pCbxUseCustomShow->Enable( bEnable );
     m_pBtnStartShow->Enable( true );
+    m_pBtnShow->Enable( bEnable );
+    m_pBtnHide->Enable( bEnable );

     if( bEnable )
         pCustomShowList->Seek( nPos );
}

Now the hard part:
/**
  * ButtonHdl()
  */
IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, void *, p )
{
... the buttons source implementation ...
     // show CustomShow
     else if( p == m_pBtnShow ) // or else if( p == m_pBtnShow || p == 
m_pBtnHide )
     {
         sal_uInt16 nPos = m_pLbCustomShows->GetSelectEntryPos();
         sal_Bool bDifferent = sal_False;
         if( nPos != LISTBOX_ENTRY_NOTFOUND )
         {
             DBG_ASSERT( pCustomShowList, "pCustomShowList does not 
exist" );
             pCustomShow = (*pCustomShowList)[ nPos ];
             bDifferent = sal_True;
             for( pCustomShow = (SdCustomShow*) pCustomShowList->First();
                      pCustomShow != NULL && bDifferent;
                      pCustomShow = (SdCustomShow*) 
pCustomShowList->Next() )
                 {
// What code will I put here?
if (p == m_pBtnShow )
    { HERE
    }
else
    { HERE
    }
                  //if( aStr == OUString( pCustomShow->GetName() ) )
                     //    bDifferent = sal_False;
                 }
         }

     }

Is right the actual code? (loop, ...)

I have seen code for hide or show the slides in 
/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
HIDE:
case SID_HIDE_SLIDE:
     ChangeSlideExclusionState(model::SharedPageDescriptor(), true);
SHOW:
case SID_SHOW_SLIDE
     ChangeSlideExclusionState(model::SharedPageDescriptor(), false);

Or for selections in 
/core/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
     234 void SelectionManager::SelectionHasChanged (const bool 
bMakeSelectionVisible)

But I don't know how do it.

Best regards.








-- 

El inglés, francés, alemán o chino mandarín son muy ineficientes para su aprendizaje como segundo idioma (mejor tercero) y fuente de grandes movimientos de divisas de países pobres hacia los más ricos. Igual que aprendes a escribir primero trazos y no directamente las letras, es mejor para el cerebro aprender primero una lengua regular y planificada.

*****************************************************
	      Guillermo Molleda Jimena

         Departamento de Economía Financiera y
               Dirección de Operaciones
	   Facultad de Turismo y Finanzas
	       Universidad de Sevilla

	   Avda. San Francisco Javier s/n
	           41018 Sevilla
     Tfno: 954 55 16 55     Fax: 954 55 75 70
E-mail: gmolleda at us.es http://personal.us.es/gmolleda
*****************************************************



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3745 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130701/6d89a87b/attachment.bin>


More information about the LibreOffice mailing list