[Libreoffice] [GSoC 2011][svgexport] I need some help on exporting "all selected slides" task

Marco mrcekets at gmail.com
Wed Jun 8 03:16:03 PDT 2011

On Wed, 08 Jun 2011 10:44:14 +0200, Christian Lippka <cl at lippka.com> wrote:

> Hi Marco,
> Am 08.06.2011 10:29, schrieb Thorsten Behrens:
>> Marco wrote:
>>> I hoped to get some type of object or container that let me to find
>>> the selected thumbnail slides out.
>>> On the contrary the result is that the selection type is "void",
>>> that means "no selection" IMO.
>>> So I don't know how to carry on this task.
>> Hi Marco,
>> Cc-ing the list, this may be of public interest - for the moment, I
>> suggest you simply export *all* slides. Christian, off the top of
>> your head, is there a way to retrieve the current selection from the
>> Slidesorter via UNO?
> There is a SdUnoSlideView::getSelection implementation that puts all  
> selected slides as XDrawPage reference in a
> sequence so chances are good it does what you are looking for.
> The open question is how to get the correct XSelectionSupplier to call  
> getSelection on. I would hope that it is
> the obvious one, xModel->getCurrentController(). But Andrés view  
> hierarchy may be more complex than that.
> But it also depends if you only need this if you are actual in the slide  
> sorter view. If you need this from the slide panel
> than this may be more complicate. Feel free to ask about that specific  
> if you can't figure that out for yourself.

Hi Christian,
thanks for your quick reply.
Yes, the problem is how to get the correct XSelectionSupplier.
The present code find the current showed slide out:

         uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance(  
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM "com.sun.star.frame.Desktop"  
)) ), uno::UNO_QUERY);
         if( xDesktop.is() )
             uno::Reference< frame::XFrame > xFrame(  
xDesktop->getCurrentFrame() );

             if( xFrame.is() )
                 uno::Reference< frame::XController > xController(  
xFrame->getController() );

                 if( xController.is() )
                     uno::Reference< drawing::XDrawView > xDrawView(  
xController, uno::UNO_QUERY );
                     if( xDrawView.is() )
                         uno::Reference< drawing::XDrawPage > xDrawPage(  
xDrawView->getCurrentPage() );

                         if( xDrawPage.is() )
                             uno::Reference< beans::XPropertySet >(  
xDrawPage, uno::UNO_QUERY )->
                                 getPropertyValue( ::rtl::OUString(  
RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) >>= nCurrentPageNumber;

I tried to get a XSelectionSupplier interface from the xController object  

                     uno::Reference< view::XSelectionSupplier >  
xSelectionSupplier( xController, uno::UNO_QUERY );
                     if( xSelectionSupplier.is() )
                     	::com::sun::star::uno::Any aSelection =  
                     	OUString sTypeName = aSelection.getValueTypeName();
                     	OSL_TRACE("Selection Type: '%s'\n",   
OUStringToOString( sTypeName, RTL_TEXTENCODING_UTF8 ).getStr());
                     	OSL_TRACE ("xSelectionSupplier.is() == false");

but as I said aSelection internal type seems to be "void"
So from which controller should I get the XSelectionSupplier interface ?
You talk about an xModel object where should I get it from ?
I thought that I should get the frame/component representing the Slide  
sorter panel,
but I don't know how to do that, too.
Correctly you ask me where I am (that is which component/frame has the  
focus) when
I need this selection, well the answer is: inside the document export  
dialog, and
I guess that this makes all things more complex.


Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

More information about the LibreOffice mailing list