summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2013-04-24 19:09:04 +0000
committerAriel Constenla-Haile <arielch@apache.org>2013-04-24 19:09:04 +0000
commit1eb66b9730e16f1dd1be426c7d0901b41c300b34 (patch)
tree28e24275a6c0349edfdb2de1f93f85453ae44c25 /sdext
parent452d3dfb0eea34aee17d9613e5566fea3be178f1 (diff)
i121873 - Add option to disable starting the Presenter Screen together with the presentation
Notes
ignore: de-extension-ize Presentation Minimizer
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/presenter/PresenterScreen.cxx84
1 files changed, 54 insertions, 30 deletions
diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx
index d4f13d76f289..99fa57b52f5d 100644
--- a/sdext/source/presenter/PresenterScreen.cxx
+++ b/sdext/source/presenter/PresenterScreen.cxx
@@ -60,6 +60,25 @@ using ::rtl::OUString;
namespace sdext { namespace presenter {
namespace {
+
+ static sal_Bool lcl_IsPresenterEnabled(
+ const css::uno::Reference< css::uno::XComponentContext > &rxContext )
+ {
+ sal_Bool bEnabled( sal_True );
+ PresenterConfigurationAccess aConfig(
+ rxContext,
+ A2S( "/org.openoffice.Office.Impress" ),
+ PresenterConfigurationAccess::READ_ONLY );
+ if ( aConfig.IsValid() )
+ {
+ sal_Bool bVal( sal_False );
+ if ( ( aConfig.GetConfigurationNode(
+ A2S( "Misc/Start/PresenterScreen" )) >>= bVal ) )
+ bEnabled = bVal;
+ }
+ return bEnabled;
+ }
+
typedef ::cppu::WeakComponentImplHelper1 <
css::document::XEventListener
> PresenterScreenListenerInterfaceBase;
@@ -168,7 +187,7 @@ Any SAL_CALL PresenterScreenJob::execute(
const beans::NamedValue* p = Arguments.getConstArray();
for (i=0; i<c; ++i)
{
- if (p[i].Name.equalsAscii("Environment"))
+ if (p[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Environment")))
{
p[i].Value >>= lEnv;
break;
@@ -180,7 +199,7 @@ Any SAL_CALL PresenterScreenJob::execute(
p = lEnv.getConstArray();
for (i=0; i<c; ++i)
{
- if (p[i].Name.equalsAscii("Model"))
+ if (p[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Model")))
{
p[i].Value >>= xModel;
break;
@@ -188,14 +207,15 @@ Any SAL_CALL PresenterScreenJob::execute(
}
Reference< XServiceInfo > xInfo( xModel, UNO_QUERY );
- if( xInfo.is() && xInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
- {
- // Create a new listener that waits for the full screen presentation
- // to start and to end. It takes care of its own lifetime.
- ::rtl::Reference<PresenterScreenListener> pListener (
- new PresenterScreenListener(mxComponentContext, xModel));
- pListener->Initialize();
- }
+ if( !xInfo.is() || !xInfo->supportsService(
+ A2S( "com.sun.star.presentation.PresentationDocument" ) ) )
+ return Any();
+
+ // Create a new listener that waits for the full screen presentation
+ // to start and to end. It takes care of its own lifetime.
+ ::rtl::Reference<PresenterScreenListener> pListener (
+ new PresenterScreenListener(mxComponentContext, xModel));
+ pListener->Initialize();
return Any();
}
@@ -304,8 +324,7 @@ void PresenterScreenListener::ThrowIfDisposed (void) const throw (
if (rBHelper.bDisposed || rBHelper.bInDispose)
{
throw lang::DisposedException (
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "PresenterScreenListener object has already been disposed")),
+ A2S("PresenterScreenListener object has already been disposed"),
const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
}
}
@@ -388,6 +407,11 @@ void PresenterScreen::InitializePresenterScreen (void)
try
{
Reference<XComponentContext> xContext (mxContextWeak);
+
+ // Check if disabled by configuration
+ if (!lcl_IsPresenterEnabled(xContext) )
+ return;
+
mpPaneContainer =
new PresenterPaneContainer(Reference<XComponentContext>(xContext));
@@ -541,11 +565,11 @@ sal_Int32 PresenterScreen::GetScreenNumber (
// is set.
PresenterConfigurationAccess aConfiguration (
xContext,
- OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"),
+ A2S("/org.openoffice.Office.PresenterScreen/"),
PresenterConfigurationAccess::READ_ONLY);
bool bStartAlways (false);
if (aConfiguration.GetConfigurationNode(
- OUString::createFromAscii("Presenter/StartAlways")) >>= bStartAlways)
+ A2S("Presenter/StartAlways")) >>= bStartAlways)
{
if (bStartAlways)
return nScreenNumber;
@@ -704,13 +728,13 @@ void PresenterScreen::SetupConfiguration (
{
PresenterConfigurationAccess aConfiguration (
rxContext,
- OUString::createFromAscii("org.openoffice.Office.PresenterScreen"),
+ A2S("org.openoffice.Office.PresenterScreen"),
PresenterConfigurationAccess::READ_ONLY);
maViewDescriptors.clear();
ProcessViewDescriptions(aConfiguration);
- OUString sLayoutName (OUString::createFromAscii("DefaultLayout"));
+ OUString sLayoutName (RTL_CONSTASCII_USTRINGPARAM("DefaultLayout"));
aConfiguration.GetConfigurationNode(
- OUString::createFromAscii("Presenter/CurrentLayout")) >>= sLayoutName;
+ A2S("Presenter/CurrentLayout")) >>= sLayoutName;
ProcessLayout(aConfiguration, sLayoutName, rxContext, rxAnchorId);
}
catch (RuntimeException&)
@@ -731,14 +755,14 @@ void PresenterScreen::ProcessLayout (
{
Reference<container::XHierarchicalNameAccess> xLayoutNode (
rConfiguration.GetConfigurationNode(
- OUString::createFromAscii("Presenter/Layouts/")+rsLayoutName),
+ A2S("Presenter/Layouts/") + rsLayoutName),
UNO_QUERY_THROW);
// Read the parent layout first, if one is referenced.
OUString sParentLayout;
rConfiguration.GetConfigurationNode(
xLayoutNode,
- OUString::createFromAscii("ParentLayout")) >>= sParentLayout;
+ A2S("ParentLayout")) >>= sParentLayout;
if (sParentLayout.getLength() > 0)
{
// Prevent infinite recursion.
@@ -750,16 +774,16 @@ void PresenterScreen::ProcessLayout (
Reference<container::XNameAccess> xList (
rConfiguration.GetConfigurationNode(
xLayoutNode,
- OUString::createFromAscii("Layout")),
+ A2S("Layout")),
UNO_QUERY_THROW);
::std::vector<rtl::OUString> aProperties (6);
- aProperties[0] = OUString::createFromAscii("PaneURL");
- aProperties[1] = OUString::createFromAscii("ViewURL");
- aProperties[2] = OUString::createFromAscii("RelativeX");
- aProperties[3] = OUString::createFromAscii("RelativeY");
- aProperties[4] = OUString::createFromAscii("RelativeWidth");
- aProperties[5] = OUString::createFromAscii("RelativeHeight");
+ aProperties[0] = A2S("PaneURL");
+ aProperties[1] = A2S("ViewURL");
+ aProperties[2] = A2S("RelativeX");
+ aProperties[3] = A2S("RelativeY");
+ aProperties[4] = A2S("RelativeWidth");
+ aProperties[5] = A2S("RelativeHeight");
mnComponentIndex = 1;
PresenterConfigurationAccess::ForAll(
xList,
@@ -788,10 +812,10 @@ void PresenterScreen::ProcessViewDescriptions (
UNO_QUERY_THROW);
::std::vector<rtl::OUString> aProperties (4);
- aProperties[0] = OUString::createFromAscii("ViewURL");
- aProperties[1] = OUString::createFromAscii("Title");
- aProperties[2] = OUString::createFromAscii("AccessibleTitle");
- aProperties[3] = OUString::createFromAscii("IsOpaque");
+ aProperties[0] = A2S("ViewURL");
+ aProperties[1] = A2S("Title");
+ aProperties[2] = A2S("AccessibleTitle");
+ aProperties[3] = A2S("IsOpaque");
mnComponentIndex = 1;
PresenterConfigurationAccess::ForAll(
xViewDescriptionsNode,