[Libreoffice-commits] core.git: new uno sidebar api tdf#91806

Stephan Bergmann sbergman at redhat.com
Fri Aug 21 05:46:12 PDT 2015


I'm sorry this is a little late.  But I think we're still fine, as this 
should until now only have hit master towards LO 5.1, and not any 
libreoffice-5-0 or earlier.

On 06/22/2015 06:59 AM, Laurent Godard wrote:
> commit a64999511ae654131d997eec9a3d78478cfc1c75
> Author: Laurent Godard <lgodard.libre at laposte.net>
> Date:   Thu Apr 30 16:56:14 2015 +0200
>
>      new uno sidebar api tdf#91806
>
>      the entry point is SfxBaseController::getSidebar()
>
>      the Decks and panels are now per SidebarController and not global anymore
>
>      ' macro example
>      Sub testSidebarApi
>
>      	controller =  thisComponent.currentcontroller
>      	frameIni =  thisComponent.currentcontroller.frame
>      	sidebar =  thisComponent.currentcontroller.getSidebar()
>
>      	sidebar.setVisible(true)
>
>      	frame = sidebar.getFrame()
>
>      	decks = sidebar.getdecks()
>
>      	c = decks.count
>
>      	h = decks.hasElements()
>
>      	e = decks.getElementNames()
>
>      	a =  decks.hasByName("MyDeck")
>
>      	deck = decks.getByName("MyDeck")
>      	deck.activate(true)
>
>      	t = deck.getTitle()
>      	deck.setTitle("new deck title")
>
>              deck.moveFirst()
>              deck.moveLast()
>              deck.moveUp()
>              deck.moveDown()
>
>              index = deck.getOrderIndex()
>
>      	panels = deck.getPanels()
>      	ep = panels.getElementnames()
>
>      	ap = panels.hasByName("aPanelName")
>
>      	panel = panels.getByName("aPanelName")
>      	panel.setTitle("new panel title")
>
>      	panel.collapse()
>
>      	panel.expand(true) ' expand and collapse other
>
>              index = panel.getOrderIndex()
>
>              panel.moveLast()
>              panel.moveFirst()
>              panel.moveDown()
>              panel.moveUp()
>
>      End Sub
>
>      Change-Id: I7a4b953f2277dea483bb296ba6ead35de7205ace
>      Reviewed-on: https://gerrit.libreoffice.org/15856
>      Tested-by: Jenkins <ci at libreoffice.org>
>      Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
>      Tested-by: Tomaž Vajngerl <quikee at gmail.com>
>
[...]
> diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
> index 97f4f3e..fd1b03a 100644
> --- a/offapi/UnoApi_offapi.mk
> +++ b/offapi/UnoApi_offapi.mk
> @@ -4020,6 +4020,11 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui,\
>   	XModuleUIConfigurationManagerSupplier \
>   	XSidebar \
>   	XSidebarPanel \
> +	XPanel \
> +	XPanels \
> +	XDeck \
> +	XDecks \
> +	XSidebarProvider \

Please keep the list sorted lexicographically.

>   	XStatusbarItem \
>   	XToolPanel \
>   	XUIConfiguration \
> diff --git a/offapi/com/sun/star/frame/XController2.idl b/offapi/com/sun/star/frame/XController2.idl
> index bd4eaba..400b7ae 100644
> --- a/offapi/com/sun/star/frame/XController2.idl
> +++ b/offapi/com/sun/star/frame/XController2.idl
> @@ -23,6 +23,7 @@
>   #include <com/sun/star/frame/XController.idl>
>   #include <com/sun/star/awt/XWindow.idl>
>   #include <com/sun/star/beans/PropertyValue.idl>
> +#include <com/sun/star/ui/XSidebarProvider.idl>
>
>
>   module com {  module sun {  module star {  module frame {
> @@ -60,6 +61,10 @@ interface XController2 : XController
>       */
>       [readonly, attribute] sequence< ::com::sun::star::beans::PropertyValue >
>                                                               CreationArguments;
> +
> +    /** get the sidebar if exists
> +    */
> +    ::com::sun::star::ui::XSidebarProvider getSidebar();

XController2 is unpublished, so it is probably fine to add this. 
Nevertheless, please list this at 
<https://wiki.documentfoundation.org/ReleaseNotes/5.1#API_changes>.  And 
please add a @since tag here.

>   };
>
>
> diff --git a/offapi/com/sun/star/ui/XDeck.idl b/offapi/com/sun/star/ui/XDeck.idl
> new file mode 100644
> index 0000000..53b7397
> --- /dev/null
> +++ b/offapi/com/sun/star/ui/XDeck.idl
> @@ -0,0 +1,90 @@
> +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
> +/*
> + * This file is part of the LibreOffice project.
> + *
> + * This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
> + *
> + */
> +#ifndef __com_sun_star_ui_XDeck_idl__
> +#define __com_sun_star_ui_XDeck_idl__
> +
> +#include <com/sun/star/ui/XPanels.idl>
> +
> +
> + module com {  module sun {  module star {  module ui {
> +
> +/** provides access to Desk */

What does the above mean?  And please add a @since tag here.

> +
> +interface XDeck
> +
> +{
> +    /** The deck identifier
> +    */
> +    string getId();
> +
> +    /** Get the deck title string
> +    */
> +    string getTitle();
> +
> +    /** Set the deck title string
> +
> +        @param newTitle
> +            The new title string
> +    */
> +    void setTitle( [in] string newTitle );

Is setTitle necessary and/or useful?  (At least, none of the code in 
this commit appears to use it.)

> +
> +    /** Is the deck the active one
> +    */
> +    boolean isActive();
> +
> +    /** Activate the deck and isplays its content

Typo "isplays".

> +
> +        @param bActivate
> +            The requested state for the deck
> +            <ul>
> +            <li>TRUE sets the deck as the active one</li>
> +            <li>FALSE hide the deck and defaults to the first deck of the sidebar</li>
> +            </ul>
> +    */
> +    void activate( [in] boolean bActivate );
> +
> +    /** Get the ordering index of the deck button in sidebar
> +    */
> +    long getOrderIndex();
> +
> +    /** Set the ordering index of the deck button in sidebar
> +
> +        @param newOrderIndex
> +        The new position
> +    */
> +    void setOrderIndex( [in] long newOrderIndex );

Is setOrderIndex necessary and/or useful? (At least, none of the code in 
this commit appears to use it.)  Is setOrderIndex(0) the same as 
moveFirst()?

> +
> +    /** Move deck button at first position in sidebar
> +    */
> +    void moveFirst();
> +
> +    /** Move deck button at last position in sidebar
> +    */
> +    void moveLast();
> +
> +    /** Move deck one step up in the sidebar
> +    */
> +    void moveUp();
> +
> +    /** Move deck one step down in the sidebar
> +    */
> +    void moveDown();
> +
> +    /** Panels collection attached to the deck
> +    */
> +    com::sun::star::ui::XPanels getPanels();
> +};
> +
> +
> +}; }; }; };
> +
> +#endif
> +
> +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
> \ No newline at end of file
> diff --git a/offapi/com/sun/star/ui/XDecks.idl b/offapi/com/sun/star/ui/XDecks.idl
> new file mode 100644
> index 0000000..ba7c3a7
> --- /dev/null
> +++ b/offapi/com/sun/star/ui/XDecks.idl
> @@ -0,0 +1,32 @@
> +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
> +/*
> + * This file is part of the LibreOffice project.
> + *
> + * This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
> + *
> + */
> +#ifndef __com_sun_star_ui_XDecks_idl__
> +#define __com_sun_star_ui_XDecks_idl__
> +
> +#include <com/sun/star/container/XIndexAccess.idl>
> +#include <com/sun/star/container/XNameAccess.idl>
> +
> + module com {  module sun {  module star {  module ui {
> +
> +/** provides access to Desks of a Sidebar.*/

Typo "Desks".  And please add a @since tag here.

> +
> +interface XDecks
> +
> +{
> +    interface com::sun::star::container::XIndexAccess;
> +    interface com::sun::star::container::XNameAccess;

The downside of reusing such generic interfaces is that it doesn't make 
it clear that the returned ANYs are actually of type XDeck (I assume). 
So at least document that, or, if the full set of XIndex+XNameAccess is 
not really necessary and/or useful, consider replacing this with a 
(handful of) more specific method(s).

> +};
> +
> +
> +}; }; }; };
> +
> +#endif
> +
> +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
> \ No newline at end of file
> diff --git a/offapi/com/sun/star/ui/XPanel.idl b/offapi/com/sun/star/ui/XPanel.idl
> new file mode 100644
> index 0000000..0070d23
> --- /dev/null
> +++ b/offapi/com/sun/star/ui/XPanel.idl
> @@ -0,0 +1,92 @@
> +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
> +/*
> + * This file is part of the LibreOffice project.
> + *
> + * This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
> + *
> + */
> +#ifndef __com_sun_star_ui_XPanel_idl__
> +#define __com_sun_star_ui_XPanel_idl__
> +
> +#include <com/sun/star/ui/XPanel.idl>
> +#include <com/sun/star/awt/XWindow.idl>
> +
> +
> + module com {  module sun {  module star {  module ui {
> +
> +/** provides access to Desk */

What does the above mean?  And please add a @since tag here.

There is also css.ui.XSidebarPanel; can you clarify why there's two?

> +
> +interface XPanel
> +
> +{
> +    /** The panel identifier
> +    */
> +    string getId();
> +
> +    /** Get the panel title string
> +    */
> +    string getTitle();
> +
> +    /** Set the panel title string
> +
> +        @param newTitle
> +            The new title string
> +    */
> +    void setTitle( [in] string newTitle );

Is setTitle necessary and/or useful?  (At least, none of the code in 
this commit appears to use it.)

> +
> +    /** Is the panel expanded
> +    */
> +    boolean isExpanded();
> +
> +    /** Collapse the panel to only show its title bar
> +    */
> +    void collapse ();
> +
> +    /** Expand and display the panel
> +
> +        @param bCollapseOther
> +            <ul>
> +            <li>TRUE collapse all other panels of the deck</li>
> +            <li>FALSE do not change other panels state</li>
> +            </ul>
> +    */
> +    void expand ( [in] boolean bCollapseOther );
> +
> +    /** Get the ordering index of the panel in the deck
> +    */
> +    long getOrderIndex();
> +
> +    /** Set the ordering index of the panel in the deck
> +    */
> +    void setOrderIndex( [in] long newOrderIndex );

Is setOrderIndex necessary and/or useful?  (At least, none of the code 
in this commit appears to use it.)  Is setOrderIndex(0) the same as 
moveFirst()?

> +
> +    /** Move panel as first item of the deck
> +    */
> +    void moveFirst();
> +
> +    /** Move panel as last item of the deck
> +    **/
> +    void moveLast();
> +
> +    /** Move panel one step up in the deck
> +    */
> +    void moveUp();
> +
> +    /** Move the panel one step down in the deck
> +    */
> +    void moveDown();
> +
> +    /** Get the panel dialog element
> +    */
> +    com::sun::star::awt::XWindow getDialog();
> +
> +};
> +
> +
> +}; }; }; };
> +
> +#endif
> +
> +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
> \ No newline at end of file
> diff --git a/offapi/com/sun/star/ui/XPanels.idl b/offapi/com/sun/star/ui/XPanels.idl
> new file mode 100644
> index 0000000..a2aa851
> --- /dev/null
> +++ b/offapi/com/sun/star/ui/XPanels.idl
> @@ -0,0 +1,34 @@
> +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
> +/*
> + * This file is part of the LibreOffice project.
> + *
> + * This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
> + *
> + */
> +#ifndef __com_sun_star_ui_XPanels_idl__
> +#define __com_sun_star_ui_XPanels_idl__
> +
> +#include <com/sun/star/container/XIndexAccess.idl>
> +#include <com/sun/star/container/XNameAccess.idl>
> +
> + module com {  module sun {  module star {  module ui {
> +
> +/** provides access to Panels of a Deck.*/

Please add a @since tag here.

> +
> +interface XPanels
> +
> +{
> +    interface com::sun::star::container::XIndexAccess;
> +    interface com::sun::star::container::XNameAccess;

The downside of reusing such generic interfaces is that it doesn't make 
it clear that the returned ANYs are actually of type XPanel (I assume). 
  So at least document that, or, if the full set of XIndex+XNameAccess 
is not really necessary and/or useful, consider replacing this with a 
(handful of) more specific method(s).

> +
> +    string getDeckId();
> +};
> +
> +
> +}; }; }; };
> +
> +#endif
> +
> +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
> \ No newline at end of file
> diff --git a/offapi/com/sun/star/ui/XSidebarProvider.idl b/offapi/com/sun/star/ui/XSidebarProvider.idl
> new file mode 100644
> index 0000000..370925e
> --- /dev/null
> +++ b/offapi/com/sun/star/ui/XSidebarProvider.idl
> @@ -0,0 +1,61 @@
> +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
> +/*
> + * This file is part of the LibreOffice project.
> + *
> + * This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
> + *
> + */
> +#ifndef __com_sun_star_ui_XSidebarProvider_idl__
> +#define __com_sun_star_ui_XSidebarProvider_idl__
> +
> +#include <com/sun/star/uno/XInterface.idl>
> +#include <com/sun/star/frame/XFrame.idl>
> +#include <com/sun/star/awt/XWindow2.idl>
> +
> +#include <com/sun/star/ui/XDecks.idl>
> +
> +
> +module com { module sun { module star { module ui {
> +
> +/** Interface of the sidebar

Please add a @since tag here.

> +*/
> +interface XSidebarProvider: com::sun::star::uno::XInterface
> +{
> +    /** Display the sidebar
> +
> +        @param bVisible
> +            the requested visible state
> +    */
> +    void setVisible ( [in] boolean bVisible);
> +
> +    /** Is the sidebar visible
> +    */
> +    boolean isVisible();
> +
> +    /** Get the XFrame owner
> +    */
> +    com::sun::star::frame::XFrame getFrame();
> +
> +    /* Decks collection attached to the sidebar
> +    */
> +    com::sun::star::ui::XDecks getDecks();
> +
> +    /** Decks container visibility
> +
> +        @param bVisible
> +            the requested visible state
> +            <ul>
> +            <li>FALSE collapses the deck container horizontally. Then Only shows the deck TabBar selector</li>
> +            <li>TRUE  expands the deck container and show active Deck content</li>
> +            </ul>
> +    */
> +    void showDecks([in] boolean bVisible);
> +} ;
> +
> +} ; } ; } ; } ;
> +
> +#endif
> +
> +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[...]


More information about the LibreOffice mailing list