Difference between revisions of "Documentation/DevGuide/Drawings/Custom Slide Show"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
m
 
(8 intermediate revisions by 4 users not shown)
Line 6: Line 6:
 
|NextPage=Documentation/DevGuide/Drawings/Presentation Effects
 
|NextPage=Documentation/DevGuide/Drawings/Presentation Effects
 
}}
 
}}
{{DISPLAYTITLE:Custom Slide Show}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Drawings/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Custom Slide Show}}
 
<!--<idltopic>com.sun.star.presentation.XCustomPresentationSupplier;com.sun.star.presentation.CustomPresentationAccess</idltopic>-->
 
<!--<idltopic>com.sun.star.presentation.XCustomPresentationSupplier;com.sun.star.presentation.CustomPresentationAccess</idltopic>-->
 
Custom presentations are available at the <idl>com.sun.star.presentation.XCustomPresentationSupplier</idl> interface of the presentation document. It contains the method:
 
Custom presentations are available at the <idl>com.sun.star.presentation.XCustomPresentationSupplier</idl> interface of the presentation document. It contains the method:
 
+
<syntaxhighlight lang="idl">
 
   com::sun::star::container::XNameContainer getCustomPresentations()
 
   com::sun::star::container::XNameContainer getCustomPresentations()
 
+
</syntaxhighlight>
The method <code>getCustomPresentations()</code> returns a <idl>com.sun.star.presentation.CustomPresentationAccess</idl> service that consists of the interfaces <idl>com.sun.star.container.XNameContainer</idl> and <idl>com.sun.star.lang.XSingleServiceFactory</idl>. The standard API interface [IDL:com.sun.star.container.XNameContainer] derived from <idls>com.sun.star.container.XNameContainer</idls> obtains existing Custom Presentations ''and'' to add new custom presentations by name. It introduces the methods:
+
The method <code>getCustomPresentations()</code> returns a <idl>com.sun.star.presentation.CustomPresentationAccess</idl> service that consists of the interfaces <idl>com.sun.star.container.XNameContainer</idl> and <idl>com.sun.star.lang.XSingleServiceFactory</idl>. The standard API interface <idl>com.sun.star.container.XNameContainer</idl> derived from <idls>com.sun.star.container.XNameContainer</idls> obtains existing Custom Presentations ''and'' to add new custom presentations by name. It introduces the methods:
 
+
<syntaxhighlight lang="idl">
 
   void replaceByName( [in] string aName, [in] any aElement)
 
   void replaceByName( [in] string aName, [in] any aElement)
 
    
 
    
 
   void insertByName( [in] string aName, [in] any aElement)
 
   void insertByName( [in] string aName, [in] any aElement)
 
   void removeByName( [in] string Name)
 
   void removeByName( [in] string Name)
 
+
</syntaxhighlight>
 
To add a new <code>CustomPresentation</code>, create it using <code>createInstance()</code> at the <code>XSingleServiceFactory</code> interface of the <code>CustomPresentationAccess</code>.
 
To add a new <code>CustomPresentation</code>, create it using <code>createInstance()</code> at the <code>XSingleServiceFactory</code> interface of the <code>CustomPresentationAccess</code>.
  
 
Methods of <idl>com.sun.star.lang.XSingleServiceFactory</idl>:
 
Methods of <idl>com.sun.star.lang.XSingleServiceFactory</idl>:
 
+
<syntaxhighlight lang="idl">
 
   com::sun::star::uno::XInterface createInstance()
 
   com::sun::star::uno::XInterface createInstance()
   com::sun::star::uno::XInterface createInstanceWithArguments( [in] sequence< any aArguments >)
+
   com::sun::star::uno::XInterface createInstanceWithArguments( [in] sequence< any aArguments >)</syntaxhighlight>
  
 
The <code>CustomPresentation</code> is now created. Its content consists of a <idl>com.sun.star.presentation.CustomPresentation</idl>. From the API, it is a named container of selected presentation draw pages. Draw pages can be added to a custom presentation or removed using its interface <idl>com.sun.star.container.XIndexContainer</idl>. In addition to the methods of an <code>XIndexAccess</code>, this standard API interface supports the following operations:
 
The <code>CustomPresentation</code> is now created. Its content consists of a <idl>com.sun.star.presentation.CustomPresentation</idl>. From the API, it is a named container of selected presentation draw pages. Draw pages can be added to a custom presentation or removed using its interface <idl>com.sun.star.container.XIndexContainer</idl>. In addition to the methods of an <code>XIndexAccess</code>, this standard API interface supports the following operations:
  
 
Methods introduced by <code>com.sun.star.container.XIndexContainer</code>:
 
Methods introduced by <code>com.sun.star.container.XIndexContainer</code>:
 
+
<syntaxhighlight lang="idl">
 
   void replaceByIndex( [in] long Index, [in] any Element)
 
   void replaceByIndex( [in] long Index, [in] any Element)
 
   void insertByIndex( [in] long Index, [in] any Element)
 
   void insertByIndex( [in] long Index, [in] any Element)
   void removeByIndex( [in] long Index)
+
   void removeByIndex( [in] long Index)</syntaxhighlight>
  
 
The name of a <code>CustomPresentation</code> is read and written using the interface <idl>com.sun.star.container.XNamed</idl>:
 
The name of a <code>CustomPresentation</code> is read and written using the interface <idl>com.sun.star.container.XNamed</idl>:
  
 
Methods of <code>XNamed</code>:
 
Methods of <code>XNamed</code>:
 
+
<syntaxhighlight lang="idl">
 
   string getName()
 
   string getName()
   void setName( [in] string aName)
+
   void setName( [in] string aName)</syntaxhighlight>
  
 
A custom show is a collection of slides in a user-defined order that can be executed as a presentation. It is also possible to use a slide twice or skip slides. For instance, it is possible to create a short version of a presentation and a long version within the same document. The number of custom shows is unlimited.
 
A custom show is a collection of slides in a user-defined order that can be executed as a presentation. It is also possible to use a slide twice or skip slides. For instance, it is possible to create a short version of a presentation and a long version within the same document. The number of custom shows is unlimited.
Line 45: Line 46:
 
The next example demonstrates how to create two custom shows and set one of them as an active presentation.  
 
The next example demonstrates how to create two custom shows and set one of them as an active presentation.  
 
<!--[SOURCE:Drawing/CustomShowDemo.java]-->
 
<!--[SOURCE:Drawing/CustomShowDemo.java]-->
 
+
<syntaxhighlight lang="java">
 
   XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier)UnoRuntime.queryInterface(
 
   XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier)UnoRuntime.queryInterface(
 
       XDrawPagesSupplier.class, xComponent);
 
       XDrawPagesSupplier.class, xComponent);
Line 98: Line 99:
 
   XPropertySet xPresPropSet = (XPropertySet)UnoRuntime.queryInterface(
 
   XPropertySet xPresPropSet = (XPropertySet)UnoRuntime.queryInterface(
 
       XPropertySet.class, xPresentation);
 
       XPropertySet.class, xPresentation);
   xPresPropSet.setPropertyValue("CustomShow", "ShortVersion");
+
   xPresPropSet.setPropertyValue("CustomShow", "ShortVersion");</syntaxhighlight>
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Drawing Documents and Presentation Documents]]
+
 
 +
[[Category:Documentation/Developer's Guide/Drawing Documents and Presentation Documents]]

Latest revision as of 14:50, 17 May 2022



Custom presentations are available at the com.sun.star.presentation.XCustomPresentationSupplier interface of the presentation document. It contains the method:

  com::sun::star::container::XNameContainer getCustomPresentations()

The method getCustomPresentations() returns a com.sun.star.presentation.CustomPresentationAccess service that consists of the interfaces com.sun.star.container.XNameContainer and com.sun.star.lang.XSingleServiceFactory. The standard API interface com.sun.star.container.XNameContainer derived from XNameContainer obtains existing Custom Presentations and to add new custom presentations by name. It introduces the methods:

  void replaceByName( [in] string aName, [in] any aElement)
 
  void insertByName( [in] string aName, [in] any aElement)
  void removeByName( [in] string Name)

To add a new CustomPresentation, create it using createInstance() at the XSingleServiceFactory interface of the CustomPresentationAccess.

Methods of com.sun.star.lang.XSingleServiceFactory:

  com::sun::star::uno::XInterface createInstance()
  com::sun::star::uno::XInterface createInstanceWithArguments( [in] sequence< any aArguments >)

The CustomPresentation is now created. Its content consists of a com.sun.star.presentation.CustomPresentation. From the API, it is a named container of selected presentation draw pages. Draw pages can be added to a custom presentation or removed using its interface com.sun.star.container.XIndexContainer. In addition to the methods of an XIndexAccess, this standard API interface supports the following operations:

Methods introduced by com.sun.star.container.XIndexContainer:

  void replaceByIndex( [in] long Index, [in] any Element)
  void insertByIndex( [in] long Index, [in] any Element)
  void removeByIndex( [in] long Index)

The name of a CustomPresentation is read and written using the interface com.sun.star.container.XNamed:

Methods of XNamed:

  string getName()
  void setName( [in] string aName)

A custom show is a collection of slides in a user-defined order that can be executed as a presentation. It is also possible to use a slide twice or skip slides. For instance, it is possible to create a short version of a presentation and a long version within the same document. The number of custom shows is unlimited.

The next example demonstrates how to create two custom shows and set one of them as an active presentation.

  XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier)UnoRuntime.queryInterface(
      XDrawPagesSupplier.class, xComponent);
  XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
  // take care that this document has ten pages
  while (xDrawPages.getCount() < 10)
      xDrawPages.insertNewByIndex(0);
  // assign a name to each page
  String aNameArray[] = {"Introduction", "page one", "page two", "page three", "page four",
                         "page five", "page six", "page seven", "page eight", "page nine"};
  int i;
  for (i = 0; i < 10; i++) {
      XNamed xPageName = (XNamed)UnoRuntime.queryInterface(XNamed.class, xDrawPages.getByIndex(i));
      xPageName.setName(aNameArray[i]);
  }
  /* create two custom shows, one will play slide 6 to 10 and is named "ShortVersion"
     the other one will play slide 2 til 10 and is named "LongVersion"
   */
  XCustomPresentationSupplier xCustPresSupplier = (XCustomPresentationSupplier)
      UnoRuntime.queryInterface(XCustomPresentationSupplier.class, xComponent);
  /* the following container is a container for further container
     which concludes the list of pages that are to play within a custom show
   */
  XNameContainer xNameContainer = xCustPresSupplier.getCustomPresentations();
  XSingleServiceFactory xFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(
      XSingleServiceFactory.class, xNameContainer);
  Object xObj;
  XIndexContainer xContainer;
  /* instanciate an IndexContainer that will take
     a list of draw pages for the first custom show
   */
  xObj = xFactory.createInstance();
  xContainer = (XIndexContainer)
      UnoRuntime.queryInterface(XIndexContainer.class, xObj);
  for (i = 5; i < 10; i++)
      xContainer.insertByIndex(xContainer.getCount(), xDrawPages.getByIndex(i));
  xNameContainer.insertByName("ShortVersion", xContainer);
  /* instanciate an IndexContainer that will take
     a list of draw page for a second custom show
   */
  xObj = xFactory.createInstance();
  xContainer = (XindexContainer)UnoRuntime.queryInterface(XIndexContainer.class, xObj);
  for (i = 1; i < 10; i++)
      xContainer.insertByIndex(xContainer.getCount(), xDrawPages.getByIndex(i));
  xNameContainer.insertByName("LongVersion", xContainer);
  /* which custom show is to use
     can been set in the presentation settings
   */
  XPresentationSupplier xPresSupplier = (XPresentationSupplier)UnoRuntime.queryInterface(
      XPresentationSupplier.class, xComponent);
  XPresentation xPresentation = xPresSupplier.getPresentation();
  XPropertySet xPresPropSet = (XPropertySet)UnoRuntime.queryInterface(
      XPropertySet.class, xPresentation);
  xPresPropSet.setPropertyValue("CustomShow", "ShortVersion");
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages