Author: arielch
Date: Mon May 27 05:46:18 2013
New Revision: 1486519

URL: http://svn.apache.org/r1486519
Log:
css::frame::XStatusbarController: add missing interface

Added ::com::sun::star::lang::XComponent. IDL documentation taken from
http://wiki.openoffice.org/wiki/Framework/Tutorial/Statusbar_Controller#Status_bar_controller_service

Modified:
    openoffice/trunk/main/framework/inc/uielement/statusbarmanager.hxx
    openoffice/trunk/main/framework/source/uielement/statusbarmanager.cxx
    openoffice/trunk/main/offapi/com/sun/star/frame/XStatusbarController.idl
    openoffice/trunk/main/svtools/inc/svtools/statusbarcontroller.hxx

Modified: openoffice/trunk/main/framework/inc/uielement/statusbarmanager.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/framework/inc/uielement/statusbarmanager.hxx?rev=1486519&r1=1486518&r2=1486519&view=diff
==============================================================================
--- openoffice/trunk/main/framework/inc/uielement/statusbarmanager.hxx 
(original)
+++ openoffice/trunk/main/framework/inc/uielement/statusbarmanager.hxx Mon May 
27 05:46:18 2013
@@ -1,5 +1,5 @@
 /**************************************************************
- * 
+ *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -7,38 +7,28 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- * 
+ *
  *************************************************************/
 
-
-
 #ifndef __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
 #define __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
 
-//_________________________________________________________________________________________________________________
-//     my own includes
-//_________________________________________________________________________________________________________________
-
 #include <threadhelp/threadhelpbase.hxx>
 #include <macros/generic.hxx>
 #include <macros/xinterface.hxx>
 #include <macros/xtypeprovider.hxx>
 #include <stdtypes.h>
 
-//_________________________________________________________________________________________________________________
-//     interface includes
-//_________________________________________________________________________________________________________________
 #include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
 #include <com/sun/star/frame/XStatusbarController.hpp>
 #include <com/sun/star/frame/XUIControllerFactory.hpp>
 #include <com/sun/star/ui/XUIConfiguration.hpp>
@@ -46,9 +36,6 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 
-//_________________________________________________________________________________________________________________
-//     other includes
-//_________________________________________________________________________________________________________________
 #include <rtl/ustring.hxx>
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
@@ -118,7 +105,7 @@ class StatusBarManager : public ::com::s
         void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL 
::com::sun::star::frame::XStatusbarController::*_pMethod )(const 
::com::sun::star::awt::MouseEvent&));
 
     protected:
-        typedef std::map< sal_uInt16, ::com::sun::star::uno::Reference< 
com::sun::star::frame::XStatusListener > > StatusBarControllerMap;
+        typedef std::map< sal_uInt16, ::com::sun::star::uno::Reference< 
com::sun::star::frame::XStatusbarController > > StatusBarControllerMap;
 
         sal_Bool                                                               
                         m_bDisposed : 1,
                                                                                
                         m_bFrameActionRegistered : 1,

Modified: openoffice/trunk/main/framework/source/uielement/statusbarmanager.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/framework/source/uielement/statusbarmanager.cxx?rev=1486519&r1=1486518&r2=1486519&view=diff
==============================================================================
--- openoffice/trunk/main/framework/source/uielement/statusbarmanager.cxx 
(original)
+++ openoffice/trunk/main/framework/source/uielement/statusbarmanager.cxx Mon 
May 27 05:46:18 2013
@@ -43,15 +43,13 @@
 #include <helper/mischelper.hxx>
 
 #include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
 #include <com/sun/star/frame/StatusbarControllerFactory.hpp>
-#include <com/sun/star/util/XUpdatable.hpp>
 #include <com/sun/star/ui/ItemStyle.hpp>
 #include <com/sun/star/ui/ItemType.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/awt/Command.hpp>
-#include <com/sun/star/ui/XStatusbarItem.hdl>
+#include <com/sun/star/ui/XStatusbarItem.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 
 #include <toolkit/helper/vclunohelper.hxx>
@@ -97,9 +95,8 @@ struct lcl_UpdateController : public std
     {
         try
         {
-            uno::Reference< util::XUpdatable > xUpdatable( rElement.second, 
uno::UNO_QUERY );
-            if ( xUpdatable.is() )
-                xUpdatable->update();
+            if ( rElement.second.is() )
+                rElement.second->update();
         }
         catch ( uno::Exception& )
         {
@@ -114,9 +111,8 @@ struct lcl_RemoveController : public std
     {
         try
         {
-            uno::Reference< lang::XComponent > xComponent( rElement.second, 
uno::UNO_QUERY );
-            if ( xComponent.is() )
-                xComponent->dispose();
+            if ( rElement.second.is() )
+                rElement.second->dispose();
         }
         catch ( uno::Exception& )
         {
@@ -382,59 +378,64 @@ void StatusBarManager::CreateControllers
         if ( nId == 0 )
             continue;
 
-        rtl::OUString                            aCommandURL( 
m_pStatusBar->GetItemCommand( nId ));
-        sal_Bool                                 bInit( sal_True );
-        uno::Reference< frame::XStatusListener > xController;
+        rtl::OUString aCommandURL( m_pStatusBar->GetItemCommand( nId ));
+        sal_Bool bInit( sal_True );
+        uno::Reference< frame::XStatusbarController > xController;
         AddonStatusbarItemData *pItemData = static_cast< 
AddonStatusbarItemData *>( m_pStatusBar->GetItemData( nId ) );
         uno::Reference< ui::XStatusbarItem > xStatusbarItem(
             static_cast< cppu::OWeakObject *>( new StatusbarItem( 
m_pStatusBar, pItemData, nId, aCommandURL ) ),
             uno::UNO_QUERY );
 
-        svt::StatusbarController* pController( 0 );
+        beans::PropertyValue aPropValue;
+        std::vector< uno::Any > aPropVector;
+
+        aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"CommandURL" ));
+        aPropValue.Value    <<= aCommandURL;
+        aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+        aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"ModuleIdentifier" ));
+        aPropValue.Value    <<= m_aModuleIdentifier;
+        aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+        aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"Frame" ));
+        aPropValue.Value    <<= m_xFrame;
+        aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+        // TODO remove this
+        aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"ServiceManager" ));
+        aPropValue.Value    <<= m_xServiceManager;
+        aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+        aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"ParentWindow" ));
+        aPropValue.Value    <<= xStatusbarWindow;
+        aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+        // TODO still needing with the css::ui::XStatusbarItem?
+        aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"Identifier" ));
+        aPropValue.Value    <<= nId;
+        aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+        aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"StatusbarItem" ));
+        aPropValue.Value    <<= xStatusbarItem;
+        aPropVector.push_back( uno::makeAny( aPropValue ) );
+
+        uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( 
aPropVector ) );
 
         // 1º) UNO Statusbar controllers, registered in Controllers.xcu
         if ( m_xStatusbarControllerFactory.is() &&
              m_xStatusbarControllerFactory->hasController( aCommandURL, 
m_aModuleIdentifier ))
         {
-            beans::PropertyValue aPropValue;
-            std::vector< uno::Any > aPropVector;
-
-            aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"ModuleIdentifier" ));
-            aPropValue.Value    = uno::makeAny( m_aModuleIdentifier );
-            aPropVector.push_back( uno::makeAny( aPropValue ) );
-
-            aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"Frame" ));
-            aPropValue.Value    = uno::makeAny( m_xFrame );
-            aPropVector.push_back( uno::makeAny( aPropValue ) );
-
-            // TODO remove this
-            aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"ServiceManager" ));
-            aPropValue.Value    = uno::makeAny( m_xServiceManager );
-            aPropVector.push_back( uno::makeAny( aPropValue ) );
-
-            aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"ParentWindow" ));
-            aPropValue.Value    = uno::makeAny( xStatusbarWindow );
-            aPropVector.push_back( uno::makeAny( aPropValue ) );
-
-            // TODO still needing with the css::ui::XStatusbarItem?
-            aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"Identifier" ));
-            aPropValue.Value    = uno::makeAny( nId );
-            aPropVector.push_back( uno::makeAny( aPropValue ) );
-
-            aPropValue.Name     = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"StatusbarItem" ));
-            aPropValue.Value    <<= xStatusbarItem;
-            aPropVector.push_back( uno::makeAny( aPropValue ) );
-
-            uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( 
aPropVector ) );
-            xController = uno::Reference< frame::XStatusListener >(
+            xController = uno::Reference< frame::XStatusbarController >(
                             
m_xStatusbarControllerFactory->createInstanceWithArgumentsAndContext(
                                 aCommandURL, aArgs, xComponentContext ),
                             uno::UNO_QUERY );
             bInit = sal_False; // Initialization is done through the factory 
service
         }
-  
+
         if ( !xController.is() )
         {
+            svt::StatusbarController* pController( 0 );
+
             // 2º) Old SFX2 Statusbar controllers
             pController = CreateStatusBarController( m_xFrame, m_pStatusBar, 
nId, aCommandURL );
             if ( !pController )
@@ -455,40 +456,15 @@ void StatusBarManager::CreateControllers
             }
 
             if ( pController )
-                xController = uno::Reference< frame::XStatusListener >( 
+                xController = uno::Reference< frame::XStatusbarController >(
                                 static_cast< ::cppu::OWeakObject *>( 
pController ), 
                                 uno::UNO_QUERY );
         }
 
         m_aControllerMap[nId] = xController;
-        uno::Reference< lang::XInitialization > xInit( xController, 
uno::UNO_QUERY );
-
-        if ( xInit.is() )
+        if ( bInit )
         {
-            if ( bInit )
-            {
-                beans::PropertyValue aPropValue;
-                uno::Sequence< uno::Any > aArgs( 6 );
-                aPropValue.Name     = rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
-                aPropValue.Value    = uno::makeAny( m_xFrame );
-                aArgs[0] = uno::makeAny( aPropValue );
-                aPropValue.Name     = rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "CommandURL" ));
-                aPropValue.Value    = uno::makeAny( aCommandURL );
-                aArgs[1] = uno::makeAny( aPropValue );
-                aPropValue.Name     = rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" ));
-                aPropValue.Value    = uno::makeAny( m_xServiceManager );
-                aArgs[2] = uno::makeAny( aPropValue );
-                aPropValue.Name     = rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ));
-                aPropValue.Value    = uno::makeAny( xStatusbarWindow );
-                aArgs[3] = uno::makeAny( aPropValue );
-                aPropValue.Name     = rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "Identifier" ));
-                aPropValue.Value    = uno::makeAny( nId );
-                aArgs[4] = uno::makeAny( aPropValue );
-                aPropValue.Name     = rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" ));
-                aPropValue.Value    <<= xStatusbarItem;
-                aArgs[5] = uno::makeAny( aPropValue );
-                xInit->initialize( aArgs );
-            }
+            xController->initialize( aArgs );
         }
     }
 
@@ -673,7 +649,7 @@ void StatusBarManager::UserDraw( const U
     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
     if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
     {
-        uno::Reference< frame::XStatusbarController > xController( it->second, 
uno::UNO_QUERY );
+        uno::Reference< frame::XStatusbarController > xController( it->second 
);
         if ( xController.is() && rUDEvt.GetDevice() )
         {
             uno::Reference< awt::XGraphics > xGraphics =
@@ -703,7 +679,7 @@ void StatusBarManager::Command( const Co
         StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId 
);
         if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
         {
-            uno::Reference< frame::XStatusbarController > xController( 
it->second, uno::UNO_QUERY );
+            uno::Reference< frame::XStatusbarController > xController( 
it->second );
             if ( xController.is() )
             {
                 awt::Point aPos;
@@ -732,7 +708,7 @@ void StatusBarManager::MouseButton( cons
         StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId 
);
         if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
         {
-            uno::Reference< frame::XStatusbarController > xController( 
it->second, uno::UNO_QUERY );
+            uno::Reference< frame::XStatusbarController > xController( 
it->second );
             if ( xController.is() )
             {
                 ::com::sun::star::awt::MouseEvent aMouseEvent;
@@ -769,7 +745,7 @@ IMPL_LINK( StatusBarManager, Click, Stat
     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
     if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
     {
-        uno::Reference< frame::XStatusbarController > xController( it->second, 
uno::UNO_QUERY );
+        uno::Reference< frame::XStatusbarController > xController( it->second 
);
         if ( xController.is() )
         {
             const Point aVCLPos = m_pStatusBar->GetPointerPosPixel();
@@ -792,7 +768,7 @@ IMPL_LINK( StatusBarManager, DoubleClick
     StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
     if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
     {
-        uno::Reference< frame::XStatusbarController > xController( it->second, 
uno::UNO_QUERY );
+        uno::Reference< frame::XStatusbarController > xController( it->second 
);
         if ( xController.is() )
         {
             const Point aVCLPos = m_pStatusBar->GetPointerPosPixel();

Modified: 
openoffice/trunk/main/offapi/com/sun/star/frame/XStatusbarController.idl
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/offapi/com/sun/star/frame/XStatusbarController.idl?rev=1486519&r1=1486518&r2=1486519&view=diff
==============================================================================
--- openoffice/trunk/main/offapi/com/sun/star/frame/XStatusbarController.idl 
(original)
+++ openoffice/trunk/main/offapi/com/sun/star/frame/XStatusbarController.idl 
Mon May 27 05:46:18 2013
@@ -27,6 +27,7 @@
 #include <com/sun/star/awt/Rectangle.idl>
 #include <com/sun/star/awt/XGraphics.idl>
 #include <com/sun/star/frame/XStatusListener.idl>
+#include <com/sun/star/lang/XComponent.idl>
 #include <com/sun/star/lang/XInitialization.idl>
 #include <com/sun/star/util/XUpdatable.idl>
 
@@ -50,6 +51,14 @@ module com {  module sun {  module star 
 */
 interface XStatusbarController
 {
+    /** used to control the life-time of the component
+
+        Used by a status bar implementation to control the life-time of
+        a status bar controller. The status bar is the only instance which
+        is allowed to dispose the component.
+     */
+    interface com::sun::star::lang::XComponent;
+
     /** used to initialize a component with required arguments.
 
         <p>A status bar controller is initialized with <b>five</b> additional

Modified: openoffice/trunk/main/svtools/inc/svtools/statusbarcontroller.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svtools/inc/svtools/statusbarcontroller.hxx?rev=1486519&r1=1486518&r2=1486519&view=diff
==============================================================================
--- openoffice/trunk/main/svtools/inc/svtools/statusbarcontroller.hxx (original)
+++ openoffice/trunk/main/svtools/inc/svtools/statusbarcontroller.hxx Mon May 
27 05:46:18 2013
@@ -48,7 +48,6 @@ namespace svt
 
 class SVT_DLLPUBLIC StatusbarController :
                             public 
::com::sun::star::frame::XStatusbarController,
-                            public ::com::sun::star::lang::XComponent,
                             public ::comphelper::OBaseMutex,
                             public ::cppu::OWeakObject
 {


Reply via email to