[Libreoffice-commits] .: toolkit/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 14 00:50:15 PDT 2012
toolkit/source/controls/tabpagecontainer.cxx | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
New commits:
commit 1e826e71e78f9f6609dc93e3f1d81eb4e418f4d6
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Mon Sep 3 15:38:51 2012 -0500
gridfixes: #i117549# create/loadTabPage
use a GeometryControlModel only if the parent model is one, too
Change-Id: I8cf7bb8cf721b6f841ddfbb7e02475c6e2c6741a
Reviewed-on: https://gerrit.libreoffice.org/550
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx
index 0175ecc..59a0335 100644
--- a/toolkit/source/controls/tabpagecontainer.cxx
+++ b/toolkit/source/controls/tabpagecontainer.cxx
@@ -107,15 +107,21 @@ Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTabPageContaine
namespace
{
Reference< XTabPageModel > lcl_createTabPageModel( ::comphelper::ComponentContext const & i_context,
- Sequence< Any > const & i_initArguments )
+ Sequence< Any > const & i_initArguments, Reference< XPropertySet > const & i_parentModel )
{
try
{
- Reference< XTabPageModel > const xTabPageModel(
- *( new OGeometryControlModel< UnoControlTabPageModel >( i_context.getLegacyServiceFactory() ) ),
- UNO_QUERY_THROW
- );
+ Reference< XPropertySet > const xParentDelegator( i_parentModel, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > const xPSI( xParentDelegator->getPropertySetInfo() );
+ bool const isGeometryControlModel = xPSI.is() && xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) );
+ Reference< XInterface > xInstance;
+ if ( isGeometryControlModel )
+ xInstance = *( new OGeometryControlModel< UnoControlTabPageModel >( i_context.getLegacyServiceFactory() ) );
+ else
+ xInstance = *( new UnoControlTabPageModel( i_context.getLegacyServiceFactory() ) );
+
+ Reference< XTabPageModel > const xTabPageModel( xInstance, UNO_QUERY_THROW );
Reference< XInitialization > const xInit( xTabPageModel, UNO_QUERY_THROW );
xInit->initialize( i_initArguments );
@@ -137,7 +143,7 @@ Reference< XTabPageModel > SAL_CALL UnoControlTabPageContainerModel::createTabPa
{
Sequence< Any > aInitArgs(1);
aInitArgs[0] <<= i_tabPageID;
- return lcl_createTabPageModel( maContext, aInitArgs );
+ return lcl_createTabPageModel( maContext, aInitArgs, this );
}
Reference< XTabPageModel > SAL_CALL UnoControlTabPageContainerModel::loadTabPage( ::sal_Int16 i_tabPageID, const ::rtl::OUString& i_resourceURL ) throw (RuntimeException)
@@ -145,7 +151,7 @@ Reference< XTabPageModel > SAL_CALL UnoControlTabPageContainerModel::loadTabPage
Sequence< Any > aInitArgs(2);
aInitArgs[0] <<= i_tabPageID;
aInitArgs[1] <<= i_resourceURL;
- return lcl_createTabPageModel( maContext, aInitArgs );
+ return lcl_createTabPageModel( maContext, aInitArgs, this );
}
void SAL_CALL UnoControlTabPageContainerModel::insertByIndex( ::sal_Int32 nIndex, const com::sun::star::uno::Any& aElement) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException)
More information about the Libreoffice-commits
mailing list