[Libreoffice-commits] core.git: 2 commits - framework/inc framework/source include/svtools offapi/com sw/source
Michael Stahl
mstahl at redhat.com
Fri May 31 03:45:30 PDT 2013
framework/inc/uielement/statusbarmanager.hxx | 3
framework/source/uielement/statusbarmanager.cxx | 122 ++++++++-------------
include/svtools/statusbarcontroller.hxx | 1
offapi/com/sun/star/frame/XStatusbarController.idl | 9 +
sw/source/core/unocore/unoframe.cxx | 5
5 files changed, 63 insertions(+), 77 deletions(-)
New commits:
commit f5e8f5b0b5410d29b5cb1fb6fbbd8bf3c48a0201
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri May 31 12:34:35 2013 +0200
sw: SwXFrame: fix gradient import problem:
BaseFrameProperties_Impl::FillBaseProperties: It may happen that
checkForUniqueItem returns an item with a name that already exists, if
the same gradient appears multiple times; don't crash with unhandled
ElementExistException then.
(can be reproduced with test3.docx from fdo#41466)
(regression from 1a3c90a292c7fc9060604151de9dc51eecf5b6a7)
Change-Id: Iace7af4c5679c1c7e978525fa31abf884038567c
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d3d5ed5..0273a1e 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -267,7 +267,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe
uno::Reference<frame::XModel> xModel(pDoc->GetDocShell()->GetModel());
uno::Reference<lang::XMultiServiceFactory> xServiceFact(xModel, uno::UNO_QUERY);
uno::Reference< container::XNameContainer > xGradients(xServiceFact->createInstance("com.sun.star.drawing.GradientTable"), uno::UNO_QUERY);
- xGradients->insertByName(pItem->GetName(), *pFillGradient);
+ if (!xGradients->hasByName(pItem->GetName()))
+ {
+ xGradients->insertByName(pItem->GetName(), *pFillGradient);
+ }
delete pItem;
}
commit d0508f79c15a5d789f5e6af214d78ce89e05071d
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Mon May 27 05:46:18 2013 +0000
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
(cherry picked from commit f3dc398e002926792a0c6160691d46eb75cad236)
Conflicts:
framework/inc/uielement/statusbarmanager.hxx
framework/source/uielement/statusbarmanager.cxx
Change-Id: Id2d768250632b12b834602a33a4e9923cec9bd3f
diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx
index 71bfc34..b469ad7 100644
--- a/framework/inc/uielement/statusbarmanager.hxx
+++ b/framework/inc/uielement/statusbarmanager.hxx
@@ -27,7 +27,6 @@
#include <stdtypes.h>
#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>
@@ -104,7 +103,7 @@ class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener
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,
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 2b096a5..5a86dd6 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -37,9 +37,7 @@
#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>
@@ -81,9 +79,8 @@ struct lcl_UpdateController : public std::unary_function< typename MAP::value_ty
{
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& )
{
@@ -98,9 +95,8 @@ struct lcl_RemoveController : public std::unary_function< typename MAP::value_ty
{
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& )
{
@@ -361,51 +357,54 @@ void StatusBarManager::CreateControllers()
if ( nId == 0 )
continue;
- OUString aCommandURL( m_pStatusBar->GetItemCommand( nId ));
- sal_Bool bInit( sal_True );
- uno::Reference< frame::XStatusListener > xController;
+ 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;
- // 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( "CommandURL" ));
+ aPropValue.Value <<= aCommandURL;
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
- aPropValue.Name = OUString( "ModuleIdentifier" );
- aPropValue.Value = uno::makeAny( m_aModuleIdentifier );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
+ aPropValue.Name = OUString( "ModuleIdentifier" );
+ aPropValue.Value <<= m_aModuleIdentifier;
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
- aPropValue.Name = OUString( "Frame" );
- aPropValue.Value = uno::makeAny( m_xFrame );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
+ aPropValue.Name = OUString( "Frame" );
+ aPropValue.Value <<= m_xFrame;
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
- // TODO remove this
- aPropValue.Name = OUString( "ServiceManager" );
- aPropValue.Value = uno::makeAny( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW) );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
+ // TODO remove this
+ aPropValue.Name = OUString( "ServiceManager" );
+ aPropValue.Value = uno::makeAny( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW) );
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
- aPropValue.Name = OUString( "ParentWindow" );
- aPropValue.Value = uno::makeAny( xStatusbarWindow );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
+ aPropValue.Name = OUString( "ParentWindow" );
+ aPropValue.Value <<= xStatusbarWindow;
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
- // TODO still needing with the css::ui::XStatusbarItem?
- aPropValue.Name = OUString( "Identifier" );
- aPropValue.Value = uno::makeAny( nId );
- aPropVector.push_back( uno::makeAny( aPropValue ) );
+ // TODO still needing with the css::ui::XStatusbarItem?
+ aPropValue.Name = OUString( "Identifier" );
+ aPropValue.Value <<= nId;
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
- aPropValue.Name = OUString( "StatusbarItem" );
- aPropValue.Value <<= xStatusbarItem;
- aPropVector.push_back( uno::makeAny( aPropValue ) );
+ aPropValue.Name = OUString( "StatusbarItem" );
+ aPropValue.Value <<= xStatusbarItem;
+ aPropVector.push_back( uno::makeAny( aPropValue ) );
- uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) );
- xController = uno::Reference< frame::XStatusListener >(
+ 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 ))
+ {
+ xController = uno::Reference< frame::XStatusbarController >(
m_xStatusbarControllerFactory->createInstanceWithArgumentsAndContext(
aCommandURL, aArgs, m_xContext ),
uno::UNO_QUERY );
@@ -414,6 +413,8 @@ void StatusBarManager::CreateControllers()
if ( !xController.is() )
{
+ svt::StatusbarController* pController( 0 );
+
// 2º) Old SFX2 Statusbar controllers
pController = CreateStatusBarController( m_xFrame, m_pStatusBar, nId, aCommandURL );
if ( !pController )
@@ -434,40 +435,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 = OUString( "Frame" );
- aPropValue.Value = uno::makeAny( m_xFrame );
- aArgs[0] = uno::makeAny( aPropValue );
- aPropValue.Name = OUString( "CommandURL" );
- aPropValue.Value = uno::makeAny( aCommandURL );
- aArgs[1] = uno::makeAny( aPropValue );
- aPropValue.Name = OUString( "ServiceManager" );
- aPropValue.Value = uno::makeAny( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW) );
- aArgs[2] = uno::makeAny( aPropValue );
- aPropValue.Name = OUString( "ParentWindow" );
- aPropValue.Value = uno::makeAny( xStatusbarWindow );
- aArgs[3] = uno::makeAny( aPropValue );
- aPropValue.Name = OUString( "Identifier" );
- aPropValue.Value = uno::makeAny( nId );
- aArgs[4] = uno::makeAny( aPropValue );
- aPropValue.Name = OUString( "StatusbarItem" );
- aPropValue.Value <<= xStatusbarItem;
- aArgs[5] = uno::makeAny( aPropValue );
- xInit->initialize( aArgs );
- }
+ xController->initialize( aArgs );
}
}
@@ -651,7 +627,7 @@ void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt )
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 =
@@ -681,7 +657,7 @@ void StatusBarManager::Command( const CommandEvent& rEvt )
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;
@@ -710,7 +686,7 @@ void StatusBarManager::MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL
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;
@@ -747,7 +723,7 @@ IMPL_LINK_NOARG(StatusBarManager, Click)
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();
@@ -770,7 +746,7 @@ IMPL_LINK_NOARG(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();
diff --git a/include/svtools/statusbarcontroller.hxx b/include/svtools/statusbarcontroller.hxx
index 3b0f5bd..c794bc0 100644
--- a/include/svtools/statusbarcontroller.hxx
+++ b/include/svtools/statusbarcontroller.hxx
@@ -41,7 +41,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
{
diff --git a/offapi/com/sun/star/frame/XStatusbarController.idl b/offapi/com/sun/star/frame/XStatusbarController.idl
index 190e047..6f2b141 100644
--- a/offapi/com/sun/star/frame/XStatusbarController.idl
+++ b/offapi/com/sun/star/frame/XStatusbarController.idl
@@ -24,6 +24,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>
@@ -47,6 +48,14 @@ module com { module sun { module star { module frame {
*/
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
More information about the Libreoffice-commits
mailing list