PresenterScreen.cxx (494ddcdc) PresenterScreen.cxx (2da1a64c)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 46 unchanged lines hidden (view full) ---

55using namespace ::com::sun::star::drawing::framework;
56using ::rtl::OUString;
57
58#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
59
60namespace sdext { namespace presenter {
61
62namespace {
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 46 unchanged lines hidden (view full) ---

55using namespace ::com::sun::star::drawing::framework;
56using ::rtl::OUString;
57
58#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
59
60namespace sdext { namespace presenter {
61
62namespace {
63
64 static sal_Bool lcl_IsPresenterEnabled(
65 const css::uno::Reference< css::uno::XComponentContext > &rxContext )
66 {
67 sal_Bool bEnabled( sal_True );
68 PresenterConfigurationAccess aConfig(
69 rxContext,
70 A2S( "/org.openoffice.Office.Impress" ),
71 PresenterConfigurationAccess::READ_ONLY );
72 if ( aConfig.IsValid() )
73 {
74 sal_Bool bVal( sal_False );
75 if ( ( aConfig.GetConfigurationNode(
76 A2S( "Misc/Start/PresenterScreen" )) >>= bVal ) )
77 bEnabled = bVal;
78 }
79 return bEnabled;
80 }
81
63 typedef ::cppu::WeakComponentImplHelper1 <
64 css::document::XEventListener
65 > PresenterScreenListenerInterfaceBase;
66
67 /** One instance of a PresenterScreenListener is registered per Impress
68 document and waits for the full screen slide show to start and to
69 end.
70 */

--- 92 unchanged lines hidden (view full) ---

163{
164 Sequence< beans::NamedValue > lEnv;
165
166 sal_Int32 i = 0;
167 sal_Int32 c = Arguments.getLength();
168 const beans::NamedValue* p = Arguments.getConstArray();
169 for (i=0; i<c; ++i)
170 {
82 typedef ::cppu::WeakComponentImplHelper1 <
83 css::document::XEventListener
84 > PresenterScreenListenerInterfaceBase;
85
86 /** One instance of a PresenterScreenListener is registered per Impress
87 document and waits for the full screen slide show to start and to
88 end.
89 */

--- 92 unchanged lines hidden (view full) ---

182{
183 Sequence< beans::NamedValue > lEnv;
184
185 sal_Int32 i = 0;
186 sal_Int32 c = Arguments.getLength();
187 const beans::NamedValue* p = Arguments.getConstArray();
188 for (i=0; i<c; ++i)
189 {
171 if (p[i].Name.equalsAscii("Environment"))
190 if (p[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Environment")))
172 {
173 p[i].Value >>= lEnv;
174 break;
175 }
176 }
177
178 Reference<frame::XModel2> xModel;
179 c = lEnv.getLength();
180 p = lEnv.getConstArray();
181 for (i=0; i<c; ++i)
182 {
191 {
192 p[i].Value >>= lEnv;
193 break;
194 }
195 }
196
197 Reference<frame::XModel2> xModel;
198 c = lEnv.getLength();
199 p = lEnv.getConstArray();
200 for (i=0; i<c; ++i)
201 {
183 if (p[i].Name.equalsAscii("Model"))
202 if (p[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Model")))
184 {
185 p[i].Value >>= xModel;
186 break;
187 }
188 }
189
190 Reference< XServiceInfo > xInfo( xModel, UNO_QUERY );
203 {
204 p[i].Value >>= xModel;
205 break;
206 }
207 }
208
209 Reference< XServiceInfo > xInfo( xModel, UNO_QUERY );
191 if( xInfo.is() && xInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
192 {
193 // Create a new listener that waits for the full screen presentation
194 // to start and to end. It takes care of its own lifetime.
195 ::rtl::Reference<PresenterScreenListener> pListener (
196 new PresenterScreenListener(mxComponentContext, xModel));
197 pListener->Initialize();
198 }
210 if( !xInfo.is() || !xInfo->supportsService(
211 A2S( "com.sun.star.presentation.PresentationDocument" ) ) )
212 return Any();
199
213
214 // Create a new listener that waits for the full screen presentation
215 // to start and to end. It takes care of its own lifetime.
216 ::rtl::Reference<PresenterScreenListener> pListener (
217 new PresenterScreenListener(mxComponentContext, xModel));
218 pListener->Initialize();
219
200 return Any();
201}
202
203
204
205
206//===== PresenterScreenListener ===============================================
207

--- 91 unchanged lines hidden (view full) ---

299
300
301void PresenterScreenListener::ThrowIfDisposed (void) const throw (
302 ::com::sun::star::lang::DisposedException)
303{
304 if (rBHelper.bDisposed || rBHelper.bInDispose)
305 {
306 throw lang::DisposedException (
220 return Any();
221}
222
223
224
225
226//===== PresenterScreenListener ===============================================
227

--- 91 unchanged lines hidden (view full) ---

319
320
321void PresenterScreenListener::ThrowIfDisposed (void) const throw (
322 ::com::sun::star::lang::DisposedException)
323{
324 if (rBHelper.bDisposed || rBHelper.bInDispose)
325 {
326 throw lang::DisposedException (
307 OUString(RTL_CONSTASCII_USTRINGPARAM(
308 "PresenterScreenListener object has already been disposed")),
327 A2S("PresenterScreenListener object has already been disposed"),
309 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
310 }
311}
312
313} // end of anonymous namespace
314
315
316

--- 66 unchanged lines hidden (view full) ---

383
384//-----------------------------------------------------------------------------
385
386void PresenterScreen::InitializePresenterScreen (void)
387{
388 try
389 {
390 Reference<XComponentContext> xContext (mxContextWeak);
328 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
329 }
330}
331
332} // end of anonymous namespace
333
334
335

--- 66 unchanged lines hidden (view full) ---

402
403//-----------------------------------------------------------------------------
404
405void PresenterScreen::InitializePresenterScreen (void)
406{
407 try
408 {
409 Reference<XComponentContext> xContext (mxContextWeak);
410
411 // Check if disabled by configuration
412 if (!lcl_IsPresenterEnabled(xContext) )
413 return;
414
391 mpPaneContainer =
392 new PresenterPaneContainer(Reference<XComponentContext>(xContext));
393
394 Reference<XPresentationSupplier> xPS ( mxModel, UNO_QUERY_THROW);
395 Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
396 Reference<presentation::XSlideShowController> xSlideShowController( xPresentation->getController() );
397 mxSlideShowControllerWeak = xSlideShowController;
398

--- 137 unchanged lines hidden (view full) ---

536 if (nScreenCount < 2 || nDisplayNumber > nScreenCount)
537 {
538 // There is either only one screen or the full screen
539 // presentation spans all available screens. The presenter
540 // screen is shown only when a special flag in the configuration
541 // is set.
542 PresenterConfigurationAccess aConfiguration (
543 xContext,
415 mpPaneContainer =
416 new PresenterPaneContainer(Reference<XComponentContext>(xContext));
417
418 Reference<XPresentationSupplier> xPS ( mxModel, UNO_QUERY_THROW);
419 Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
420 Reference<presentation::XSlideShowController> xSlideShowController( xPresentation->getController() );
421 mxSlideShowControllerWeak = xSlideShowController;
422

--- 137 unchanged lines hidden (view full) ---

560 if (nScreenCount < 2 || nDisplayNumber > nScreenCount)
561 {
562 // There is either only one screen or the full screen
563 // presentation spans all available screens. The presenter
564 // screen is shown only when a special flag in the configuration
565 // is set.
566 PresenterConfigurationAccess aConfiguration (
567 xContext,
544 OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"),
568 A2S("/org.openoffice.Office.PresenterScreen/"),
545 PresenterConfigurationAccess::READ_ONLY);
546 bool bStartAlways (false);
547 if (aConfiguration.GetConfigurationNode(
569 PresenterConfigurationAccess::READ_ONLY);
570 bool bStartAlways (false);
571 if (aConfiguration.GetConfigurationNode(
548 OUString::createFromAscii("Presenter/StartAlways")) >>= bStartAlways)
572 A2S("Presenter/StartAlways")) >>= bStartAlways)
549 {
550 if (bStartAlways)
551 return nScreenNumber;
552 }
553 return -1;
554 }
555 }
556 catch (beans::UnknownPropertyException&)

--- 142 unchanged lines hidden (view full) ---

699void PresenterScreen::SetupConfiguration (
700 const Reference<XComponentContext>& rxContext,
701 const Reference<XResourceId>& rxAnchorId)
702{
703 try
704 {
705 PresenterConfigurationAccess aConfiguration (
706 rxContext,
573 {
574 if (bStartAlways)
575 return nScreenNumber;
576 }
577 return -1;
578 }
579 }
580 catch (beans::UnknownPropertyException&)

--- 142 unchanged lines hidden (view full) ---

723void PresenterScreen::SetupConfiguration (
724 const Reference<XComponentContext>& rxContext,
725 const Reference<XResourceId>& rxAnchorId)
726{
727 try
728 {
729 PresenterConfigurationAccess aConfiguration (
730 rxContext,
707 OUString::createFromAscii("org.openoffice.Office.PresenterScreen"),
731 A2S("org.openoffice.Office.PresenterScreen"),
708 PresenterConfigurationAccess::READ_ONLY);
709 maViewDescriptors.clear();
710 ProcessViewDescriptions(aConfiguration);
732 PresenterConfigurationAccess::READ_ONLY);
733 maViewDescriptors.clear();
734 ProcessViewDescriptions(aConfiguration);
711 OUString sLayoutName (OUString::createFromAscii("DefaultLayout"));
735 OUString sLayoutName (RTL_CONSTASCII_USTRINGPARAM("DefaultLayout"));
712 aConfiguration.GetConfigurationNode(
736 aConfiguration.GetConfigurationNode(
713 OUString::createFromAscii("Presenter/CurrentLayout")) >>= sLayoutName;
737 A2S("Presenter/CurrentLayout")) >>= sLayoutName;
714 ProcessLayout(aConfiguration, sLayoutName, rxContext, rxAnchorId);
715 }
716 catch (RuntimeException&)
717 {
718 }
719}
720
721

--- 4 unchanged lines hidden (view full) ---

726 const OUString& rsLayoutName,
727 const Reference<XComponentContext>& rxContext,
728 const Reference<XResourceId>& rxAnchorId)
729{
730 try
731 {
732 Reference<container::XHierarchicalNameAccess> xLayoutNode (
733 rConfiguration.GetConfigurationNode(
738 ProcessLayout(aConfiguration, sLayoutName, rxContext, rxAnchorId);
739 }
740 catch (RuntimeException&)
741 {
742 }
743}
744
745

--- 4 unchanged lines hidden (view full) ---

750 const OUString& rsLayoutName,
751 const Reference<XComponentContext>& rxContext,
752 const Reference<XResourceId>& rxAnchorId)
753{
754 try
755 {
756 Reference<container::XHierarchicalNameAccess> xLayoutNode (
757 rConfiguration.GetConfigurationNode(
734 OUString::createFromAscii("Presenter/Layouts/")+rsLayoutName),
758 A2S("Presenter/Layouts/") + rsLayoutName),
735 UNO_QUERY_THROW);
736
737 // Read the parent layout first, if one is referenced.
738 OUString sParentLayout;
739 rConfiguration.GetConfigurationNode(
740 xLayoutNode,
759 UNO_QUERY_THROW);
760
761 // Read the parent layout first, if one is referenced.
762 OUString sParentLayout;
763 rConfiguration.GetConfigurationNode(
764 xLayoutNode,
741 OUString::createFromAscii("ParentLayout")) >>= sParentLayout;
765 A2S("ParentLayout")) >>= sParentLayout;
742 if (sParentLayout.getLength() > 0)
743 {
744 // Prevent infinite recursion.
745 if (rsLayoutName != sParentLayout)
746 ProcessLayout(rConfiguration, sParentLayout, rxContext, rxAnchorId);
747 }
748
749 // Process the actual layout list.
750 Reference<container::XNameAccess> xList (
751 rConfiguration.GetConfigurationNode(
752 xLayoutNode,
766 if (sParentLayout.getLength() > 0)
767 {
768 // Prevent infinite recursion.
769 if (rsLayoutName != sParentLayout)
770 ProcessLayout(rConfiguration, sParentLayout, rxContext, rxAnchorId);
771 }
772
773 // Process the actual layout list.
774 Reference<container::XNameAccess> xList (
775 rConfiguration.GetConfigurationNode(
776 xLayoutNode,
753 OUString::createFromAscii("Layout")),
777 A2S("Layout")),
754 UNO_QUERY_THROW);
755
756 ::std::vector<rtl::OUString> aProperties (6);
778 UNO_QUERY_THROW);
779
780 ::std::vector<rtl::OUString> aProperties (6);
757 aProperties[0] = OUString::createFromAscii("PaneURL");
758 aProperties[1] = OUString::createFromAscii("ViewURL");
759 aProperties[2] = OUString::createFromAscii("RelativeX");
760 aProperties[3] = OUString::createFromAscii("RelativeY");
761 aProperties[4] = OUString::createFromAscii("RelativeWidth");
762 aProperties[5] = OUString::createFromAscii("RelativeHeight");
781 aProperties[0] = A2S("PaneURL");
782 aProperties[1] = A2S("ViewURL");
783 aProperties[2] = A2S("RelativeX");
784 aProperties[3] = A2S("RelativeY");
785 aProperties[4] = A2S("RelativeWidth");
786 aProperties[5] = A2S("RelativeHeight");
763 mnComponentIndex = 1;
764 PresenterConfigurationAccess::ForAll(
765 xList,
766 aProperties,
767 ::boost::bind(&PresenterScreen::ProcessComponent, this,
768 _1,
769 _2,
770 rxContext,

--- 12 unchanged lines hidden (view full) ---

783{
784 try
785 {
786 Reference<container::XNameAccess> xViewDescriptionsNode (
787 rConfiguration.GetConfigurationNode(A2S("Presenter/Views")),
788 UNO_QUERY_THROW);
789
790 ::std::vector<rtl::OUString> aProperties (4);
787 mnComponentIndex = 1;
788 PresenterConfigurationAccess::ForAll(
789 xList,
790 aProperties,
791 ::boost::bind(&PresenterScreen::ProcessComponent, this,
792 _1,
793 _2,
794 rxContext,

--- 12 unchanged lines hidden (view full) ---

807{
808 try
809 {
810 Reference<container::XNameAccess> xViewDescriptionsNode (
811 rConfiguration.GetConfigurationNode(A2S("Presenter/Views")),
812 UNO_QUERY_THROW);
813
814 ::std::vector<rtl::OUString> aProperties (4);
791 aProperties[0] = OUString::createFromAscii("ViewURL");
792 aProperties[1] = OUString::createFromAscii("Title");
793 aProperties[2] = OUString::createFromAscii("AccessibleTitle");
794 aProperties[3] = OUString::createFromAscii("IsOpaque");
815 aProperties[0] = A2S("ViewURL");
816 aProperties[1] = A2S("Title");
817 aProperties[2] = A2S("AccessibleTitle");
818 aProperties[3] = A2S("IsOpaque");
795 mnComponentIndex = 1;
796 PresenterConfigurationAccess::ForAll(
797 xViewDescriptionsNode,
798 aProperties,
799 ::boost::bind(&PresenterScreen::ProcessViewDescription, this, _1, _2));
800 }
801 catch (RuntimeException&)
802 {

--- 128 unchanged lines hidden ---
819 mnComponentIndex = 1;
820 PresenterConfigurationAccess::ForAll(
821 xViewDescriptionsNode,
822 aProperties,
823 ::boost::bind(&PresenterScreen::ProcessViewDescription, this, _1, _2));
824 }
825 catch (RuntimeException&)
826 {

--- 128 unchanged lines hidden ---