summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-09-03 15:38:51 -0500
committerMiklos Vajna <vmiklos@suse.cz>2012-09-14 07:49:52 +0000
commit1e826e71e78f9f6609dc93e3f1d81eb4e418f4d6 (patch)
tree4ef7fac872a65c5b1abf881cefe46692095a0240 /toolkit
parentdd0431a537ea6f042dcb476000e230fe144c6114 (diff)
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@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx
index 0175ecca79eb..59a03359eac9 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)