1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10*f6e50924SAndrew Rist * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f6e50924SAndrew Rist * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19*f6e50924SAndrew Rist * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir #include "fmobj.hxx" 27cdf0e10cSrcweir #include "fmprop.hrc" 28cdf0e10cSrcweir #include "fmvwimp.hxx" 29cdf0e10cSrcweir #include "fmpgeimp.hxx" 30cdf0e10cSrcweir #include "svx/fmresids.hrc" 31cdf0e10cSrcweir #include "svx/fmview.hxx" 32cdf0e10cSrcweir #include "svx/fmglob.hxx" 33cdf0e10cSrcweir #include "svx/fmpage.hxx" 34cdf0e10cSrcweir #include "editeng/editeng.hxx" 35cdf0e10cSrcweir #include "svx/svdovirt.hxx" 36cdf0e10cSrcweir #include "svx/fmmodel.hxx" 37cdf0e10cSrcweir #include "svx/dialmgr.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir /** === begin UNO includes === **/ 40cdf0e10cSrcweir #include <com/sun/star/awt/XDevice.hpp> 41cdf0e10cSrcweir #include <com/sun/star/script/XEventAttacherManager.hpp> 42cdf0e10cSrcweir #include <com/sun/star/io/XPersistObject.hpp> 43cdf0e10cSrcweir #include <com/sun/star/awt/XControlContainer.hpp> 44cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp> 45cdf0e10cSrcweir /** === end UNO includes === **/ 46cdf0e10cSrcweir #include "svx/fmtools.hxx" 47cdf0e10cSrcweir 48cdf0e10cSrcweir #include <tools/shl.hxx> 49cdf0e10cSrcweir #include <comphelper/property.hxx> 50cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 51cdf0e10cSrcweir #include <toolkit/awt/vclxdevice.hxx> 52cdf0e10cSrcweir #include <vcl/svapp.hxx> 53cdf0e10cSrcweir #include <tools/resmgr.hxx> 54cdf0e10cSrcweir #include <tools/diagnose_ex.h> 55cdf0e10cSrcweir 56cdf0e10cSrcweir using namespace ::com::sun::star::io; 57cdf0e10cSrcweir using namespace ::com::sun::star::uno; 58cdf0e10cSrcweir using namespace ::com::sun::star::awt; 59cdf0e10cSrcweir using namespace ::com::sun::star::lang; 60cdf0e10cSrcweir using namespace ::com::sun::star::util; 61cdf0e10cSrcweir using namespace ::com::sun::star::form; 62cdf0e10cSrcweir using namespace ::com::sun::star::beans; 63cdf0e10cSrcweir using namespace ::com::sun::star::script; 64cdf0e10cSrcweir using namespace ::com::sun::star::container; 65cdf0e10cSrcweir using namespace ::svxform; 66cdf0e10cSrcweir 67cdf0e10cSrcweir TYPEINIT1(FmFormObj, SdrUnoObj); 68cdf0e10cSrcweir DBG_NAME(FmFormObj); 69cdf0e10cSrcweir //------------------------------------------------------------------ 70cdf0e10cSrcweir FmFormObj::FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType) 71cdf0e10cSrcweir :SdrUnoObj ( rModelName ) 72cdf0e10cSrcweir ,m_nPos ( -1 ) 73cdf0e10cSrcweir ,m_nType ( _nType ) 74cdf0e10cSrcweir ,m_pLastKnownRefDevice ( NULL ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir DBG_CTOR(FmFormObj, NULL); 77cdf0e10cSrcweir 78cdf0e10cSrcweir // normally, this is done in SetUnoControlModel, but if the call happened in the base class ctor, 79cdf0e10cSrcweir // then our incarnation of it was not called (since we were not constructed at this time). 80cdf0e10cSrcweir impl_checkRefDevice_nothrow( true ); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir //------------------------------------------------------------------ 84cdf0e10cSrcweir FmFormObj::FmFormObj( sal_Int32 _nType ) 85cdf0e10cSrcweir :SdrUnoObj ( String() ) 86cdf0e10cSrcweir ,m_nPos ( -1 ) 87cdf0e10cSrcweir ,m_nType ( _nType ) 88cdf0e10cSrcweir ,m_pLastKnownRefDevice ( NULL ) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir DBG_CTOR(FmFormObj, NULL); 91cdf0e10cSrcweir } 92cdf0e10cSrcweir 93cdf0e10cSrcweir //------------------------------------------------------------------ 94cdf0e10cSrcweir FmFormObj::~FmFormObj() 95cdf0e10cSrcweir { 96cdf0e10cSrcweir DBG_DTOR(FmFormObj, NULL); 97cdf0e10cSrcweir 98cdf0e10cSrcweir Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY); 99cdf0e10cSrcweir if (xHistory.is()) 100cdf0e10cSrcweir xHistory->dispose(); 101cdf0e10cSrcweir 102cdf0e10cSrcweir m_xEnvironmentHistory = NULL; 103cdf0e10cSrcweir m_aEventsHistory.realloc(0); 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir //------------------------------------------------------------------ 107cdf0e10cSrcweir void FmFormObj::SetObjEnv(const Reference< XIndexContainer > & xForm, const sal_Int32 nIdx, 108cdf0e10cSrcweir const Sequence< ScriptEventDescriptor >& rEvts) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir m_xParent = xForm; 111cdf0e10cSrcweir aEvts = rEvts; 112cdf0e10cSrcweir m_nPos = nIdx; 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir //------------------------------------------------------------------ 116cdf0e10cSrcweir void FmFormObj::ClearObjEnv() 117cdf0e10cSrcweir { 118cdf0e10cSrcweir m_xParent.clear(); 119cdf0e10cSrcweir aEvts.realloc( 0 ); 120cdf0e10cSrcweir m_nPos = -1; 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir //------------------------------------------------------------------ 124cdf0e10cSrcweir void FmFormObj::impl_checkRefDevice_nothrow( bool _force ) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() ); 127cdf0e10cSrcweir if ( !pFormModel || !pFormModel->ControlsUseRefDevice() ) 128cdf0e10cSrcweir return; 129cdf0e10cSrcweir 130cdf0e10cSrcweir OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL; 131cdf0e10cSrcweir if ( ( m_pLastKnownRefDevice == pCurrentRefDevice ) && !_force ) 132cdf0e10cSrcweir return; 133cdf0e10cSrcweir 134cdf0e10cSrcweir Reference< XControlModel > xControlModel( GetUnoControlModel() ); 135cdf0e10cSrcweir if ( !xControlModel.is() ) 136cdf0e10cSrcweir return; 137cdf0e10cSrcweir 138cdf0e10cSrcweir m_pLastKnownRefDevice = pCurrentRefDevice; 139cdf0e10cSrcweir if ( m_pLastKnownRefDevice == NULL ) 140cdf0e10cSrcweir return; 141cdf0e10cSrcweir 142cdf0e10cSrcweir try 143cdf0e10cSrcweir { 144cdf0e10cSrcweir Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW ); 145cdf0e10cSrcweir Reference< XPropertySetInfo > xPropertyInfo( xModelProps->getPropertySetInfo(), UNO_SET_THROW ); 146cdf0e10cSrcweir 147cdf0e10cSrcweir static const ::rtl::OUString sRefDevicePropName( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) ); 148cdf0e10cSrcweir if ( xPropertyInfo->hasPropertyByName( sRefDevicePropName ) ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir VCLXDevice* pUnoRefDevice = new VCLXDevice; 151cdf0e10cSrcweir pUnoRefDevice->SetOutputDevice( m_pLastKnownRefDevice ); 152cdf0e10cSrcweir Reference< XDevice > xRefDevice( pUnoRefDevice ); 153cdf0e10cSrcweir xModelProps->setPropertyValue( sRefDevicePropName, makeAny( xRefDevice ) ); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir } 156cdf0e10cSrcweir catch( const Exception& ) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir //------------------------------------------------------------------ 163cdf0e10cSrcweir void FmFormObj::impl_isolateControlModel_nothrow() 164cdf0e10cSrcweir { 165cdf0e10cSrcweir try 166cdf0e10cSrcweir { 167cdf0e10cSrcweir Reference< XChild > xControlModel( GetUnoControlModel(), UNO_QUERY ); 168cdf0e10cSrcweir if ( xControlModel.is() ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir Reference< XIndexContainer> xParent( xControlModel->getParent(), UNO_QUERY ); 171cdf0e10cSrcweir if ( xParent.is() ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir sal_Int32 nPos = getElementPos( xParent.get(), xControlModel ); 174cdf0e10cSrcweir xParent->removeByIndex( nPos ); 175cdf0e10cSrcweir } 176cdf0e10cSrcweir } 177cdf0e10cSrcweir } 178cdf0e10cSrcweir catch( const Exception& ) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 181cdf0e10cSrcweir } 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir //------------------------------------------------------------------ 185cdf0e10cSrcweir void FmFormObj::SetPage(SdrPage* _pNewPage) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir if ( GetPage() == _pNewPage ) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir SdrUnoObj::SetPage(_pNewPage); 190cdf0e10cSrcweir return; 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir FmFormPage* pOldFormPage = PTR_CAST( FmFormPage, GetPage() ); 194cdf0e10cSrcweir if ( pOldFormPage ) 195cdf0e10cSrcweir pOldFormPage->GetImpl().formObjectRemoved( *this ); 196cdf0e10cSrcweir 197cdf0e10cSrcweir FmFormPage* pNewFormPage = PTR_CAST( FmFormPage, _pNewPage ); 198cdf0e10cSrcweir if ( !pNewFormPage ) 199cdf0e10cSrcweir { // Maybe it makes sense to create an environment history here : if somebody set's our page to NULL, and we have a valid page before, 200cdf0e10cSrcweir // me may want to remember our place within the old page. For this we could create a new m_xEnvironmentHistory to store it. 201cdf0e10cSrcweir // So the next SetPage with a valid new page would restore that environment within the new page. 202cdf0e10cSrcweir // But for the original Bug (#57300#) we don't need that, so I omit it here. Maybe this will be implemented later. 203cdf0e10cSrcweir impl_isolateControlModel_nothrow(); 204cdf0e10cSrcweir SdrUnoObj::SetPage(_pNewPage); 205cdf0e10cSrcweir return; 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir Reference< XIndexContainer > xNewPageForms( pNewFormPage->GetForms( true ), UNO_QUERY ); 209cdf0e10cSrcweir Reference< XIndexContainer > xNewParent; 210cdf0e10cSrcweir Sequence< ScriptEventDescriptor> aNewEvents; 211cdf0e10cSrcweir 212cdf0e10cSrcweir // calc the new parent for my model (within the new page's forms hierarchy) 213cdf0e10cSrcweir // do we have a history ? (from :Clone) 214cdf0e10cSrcweir if ( m_xEnvironmentHistory.is() ) 215cdf0e10cSrcweir { 216cdf0e10cSrcweir // the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within _pNewPage->GetForms) 217cdf0e10cSrcweir // is the right-most element in the tree. 218cdf0e10cSrcweir Reference< XIndexContainer > xRightMostLeaf = m_xEnvironmentHistory; 219cdf0e10cSrcweir try 220cdf0e10cSrcweir { 221cdf0e10cSrcweir while ( xRightMostLeaf->getCount() ) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir xRightMostLeaf.set( 224cdf0e10cSrcweir xRightMostLeaf->getByIndex( xRightMostLeaf->getCount() - 1 ), 225cdf0e10cSrcweir UNO_QUERY_THROW 226cdf0e10cSrcweir ); 227cdf0e10cSrcweir } 228cdf0e10cSrcweir 229cdf0e10cSrcweir xNewParent.set( ensureModelEnv( xRightMostLeaf, xNewPageForms ), UNO_QUERY_THROW ); 230cdf0e10cSrcweir 231cdf0e10cSrcweir // we successfully cloned the environment in m_xEnvironmentHistory, so we can use m_aEventsHistory 232cdf0e10cSrcweir // (which describes the events of our model at the moment m_xEnvironmentHistory was created) 233cdf0e10cSrcweir aNewEvents = m_aEventsHistory; 234cdf0e10cSrcweir } 235cdf0e10cSrcweir catch( const Exception& ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 238cdf0e10cSrcweir } 239cdf0e10cSrcweir } 240cdf0e10cSrcweir 241cdf0e10cSrcweir if ( !xNewParent.is() ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir // are we a valid part of our current page forms ? 244cdf0e10cSrcweir Reference< XIndexContainer > xOldForms; 245cdf0e10cSrcweir if ( pOldFormPage ) 246cdf0e10cSrcweir xOldForms.set( pOldFormPage->GetForms(), UNO_QUERY_THROW ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir if ( xOldForms.is() ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir // search (upward from our model) for xOldForms 251cdf0e10cSrcweir Reference< XChild > xSearch( GetUnoControlModel(), UNO_QUERY ); 252cdf0e10cSrcweir while (xSearch.is()) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir if ( xSearch == xOldForms ) 255cdf0e10cSrcweir break; 256cdf0e10cSrcweir xSearch = Reference< XChild >( xSearch->getParent(), UNO_QUERY ); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir if ( xSearch.is() ) // implies xSearch == xOldForms, which means we're a valid part of our current page forms hierarchy 259cdf0e10cSrcweir { 260cdf0e10cSrcweir Reference< XChild > xMeAsChild( GetUnoControlModel(), UNO_QUERY ); 261cdf0e10cSrcweir xNewParent.set( ensureModelEnv( xMeAsChild->getParent(), xNewPageForms ), UNO_QUERY ); 262cdf0e10cSrcweir 263cdf0e10cSrcweir if ( xNewParent.is() ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir try 266cdf0e10cSrcweir { 267cdf0e10cSrcweir // transfer the events from our (model's) parent to the new (model's) parent, too 268cdf0e10cSrcweir Reference< XEventAttacherManager > xEventManager(xMeAsChild->getParent(), UNO_QUERY); 269cdf0e10cSrcweir Reference< XIndexAccess > xManagerAsIndex(xEventManager, UNO_QUERY); 270cdf0e10cSrcweir if (xManagerAsIndex.is()) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir sal_Int32 nPos = getElementPos(xManagerAsIndex, xMeAsChild); 273cdf0e10cSrcweir if (nPos >= 0) 274cdf0e10cSrcweir aNewEvents = xEventManager->getScriptEvents(nPos); 275cdf0e10cSrcweir } 276cdf0e10cSrcweir else 277cdf0e10cSrcweir aNewEvents = aEvts; 278cdf0e10cSrcweir } 279cdf0e10cSrcweir catch( const Exception& ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir } 284cdf0e10cSrcweir } 285cdf0e10cSrcweir } 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir // now set the page 289cdf0e10cSrcweir SdrUnoObj::SetPage(_pNewPage); 290cdf0e10cSrcweir 291cdf0e10cSrcweir // place my model within the new parent container 292cdf0e10cSrcweir if (xNewParent.is()) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir Reference< XFormComponent > xMeAsFormComp(GetUnoControlModel(), UNO_QUERY); 295cdf0e10cSrcweir if (xMeAsFormComp.is()) 296cdf0e10cSrcweir { 297cdf0e10cSrcweir // check if I have another parent (and remove me, if neccessary) 298cdf0e10cSrcweir Reference< XIndexContainer > xOldParent(xMeAsFormComp->getParent(), UNO_QUERY); 299cdf0e10cSrcweir if (xOldParent.is()) 300cdf0e10cSrcweir { 301cdf0e10cSrcweir sal_Int32 nPos = getElementPos(Reference< XIndexAccess > (xOldParent, UNO_QUERY), xMeAsFormComp); 302cdf0e10cSrcweir if (nPos > -1) 303cdf0e10cSrcweir xOldParent->removeByIndex(nPos); 304cdf0e10cSrcweir } 305cdf0e10cSrcweir // and insert into the new container 306cdf0e10cSrcweir xNewParent->insertByIndex(xNewParent->getCount(), makeAny(xMeAsFormComp)); 307cdf0e10cSrcweir 308cdf0e10cSrcweir // transfer the events 309cdf0e10cSrcweir if (aNewEvents.getLength()) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir try 312cdf0e10cSrcweir { 313cdf0e10cSrcweir Reference< XEventAttacherManager > xEventManager(xNewParent, UNO_QUERY); 314cdf0e10cSrcweir Reference< XIndexAccess > xManagerAsIndex(xEventManager, UNO_QUERY); 315cdf0e10cSrcweir if (xManagerAsIndex.is()) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir sal_Int32 nPos = getElementPos(xManagerAsIndex, xMeAsFormComp); 318cdf0e10cSrcweir DBG_ASSERT(nPos >= 0, "FmFormObj::SetPage : inserted but not present ?"); 319cdf0e10cSrcweir xEventManager->registerScriptEvents(nPos, aNewEvents); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir } 322cdf0e10cSrcweir catch( const Exception& ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir } 328cdf0e10cSrcweir } 329cdf0e10cSrcweir } 330cdf0e10cSrcweir 331cdf0e10cSrcweir // delete my history 332cdf0e10cSrcweir Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY); 333cdf0e10cSrcweir if (xHistory.is()) 334cdf0e10cSrcweir xHistory->dispose(); 335cdf0e10cSrcweir 336cdf0e10cSrcweir m_xEnvironmentHistory = NULL; 337cdf0e10cSrcweir m_aEventsHistory.realloc(0); 338cdf0e10cSrcweir 339cdf0e10cSrcweir if ( pNewFormPage ) 340cdf0e10cSrcweir pNewFormPage->GetImpl().formObjectInserted( *this ); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir 343cdf0e10cSrcweir //------------------------------------------------------------------ 344cdf0e10cSrcweir sal_uInt32 FmFormObj::GetObjInventor() const 345cdf0e10cSrcweir { 346cdf0e10cSrcweir return FmFormInventor; 347cdf0e10cSrcweir } 348cdf0e10cSrcweir 349cdf0e10cSrcweir //------------------------------------------------------------------ 350cdf0e10cSrcweir sal_uInt16 FmFormObj::GetObjIdentifier() const 351cdf0e10cSrcweir { 352cdf0e10cSrcweir return OBJ_UNO; 353cdf0e10cSrcweir } 354cdf0e10cSrcweir 355cdf0e10cSrcweir //------------------------------------------------------------------ 356cdf0e10cSrcweir void FmFormObj::clonedFrom(const FmFormObj* _pSource) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir DBG_ASSERT(_pSource != NULL, "FmFormObj::clonedFrom : invalid source !"); 359cdf0e10cSrcweir Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY); 360cdf0e10cSrcweir if (xHistory.is()) 361cdf0e10cSrcweir xHistory->dispose(); 362cdf0e10cSrcweir 363cdf0e10cSrcweir m_xEnvironmentHistory = NULL; 364cdf0e10cSrcweir m_aEventsHistory.realloc(0); 365cdf0e10cSrcweir 366cdf0e10cSrcweir Reference< XChild > xSourceAsChild(_pSource->GetUnoControlModel(), UNO_QUERY); 367cdf0e10cSrcweir if (!xSourceAsChild.is()) 368cdf0e10cSrcweir return; 369cdf0e10cSrcweir 370cdf0e10cSrcweir Reference< XInterface > xSourceContainer = xSourceAsChild->getParent(); 371cdf0e10cSrcweir 372cdf0e10cSrcweir m_xEnvironmentHistory = Reference< XIndexContainer >( 373cdf0e10cSrcweir ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.form.Forms")), 374cdf0e10cSrcweir UNO_QUERY); 375cdf0e10cSrcweir DBG_ASSERT(m_xEnvironmentHistory.is(), "FmFormObj::clonedFrom : could not create a forms collection !"); 376cdf0e10cSrcweir 377cdf0e10cSrcweir if (m_xEnvironmentHistory.is()) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir ensureModelEnv(xSourceContainer, m_xEnvironmentHistory); 380cdf0e10cSrcweir m_aEventsHistory = aEvts; 381cdf0e10cSrcweir // if we we're clone there was a call to operator=, so aEvts are excatly the events we need here ... 382cdf0e10cSrcweir } 383cdf0e10cSrcweir } 384cdf0e10cSrcweir 385cdf0e10cSrcweir //------------------------------------------------------------------ 386cdf0e10cSrcweir SdrObject* FmFormObj::Clone() const 387cdf0e10cSrcweir { 388cdf0e10cSrcweir SdrObject* pReturn = SdrUnoObj::Clone(); 389cdf0e10cSrcweir 390cdf0e10cSrcweir FmFormObj* pFormObject = PTR_CAST(FmFormObj, pReturn); 391cdf0e10cSrcweir DBG_ASSERT(pFormObject != NULL, "FmFormObj::Clone : invalid clone !"); 392cdf0e10cSrcweir if (pFormObject) 393cdf0e10cSrcweir pFormObject->clonedFrom(this); 394cdf0e10cSrcweir 395cdf0e10cSrcweir return pReturn; 396cdf0e10cSrcweir } 397cdf0e10cSrcweir 398cdf0e10cSrcweir //------------------------------------------------------------------ 399cdf0e10cSrcweir void FmFormObj::NbcReformatText() 400cdf0e10cSrcweir { 401cdf0e10cSrcweir impl_checkRefDevice_nothrow( false ); 402cdf0e10cSrcweir SdrUnoObj::NbcReformatText(); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir 405cdf0e10cSrcweir //------------------------------------------------------------------ 406cdf0e10cSrcweir void FmFormObj::operator= (const SdrObject& rObj) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir SdrUnoObj::operator= (rObj); 409cdf0e10cSrcweir 410cdf0e10cSrcweir FmFormObj* pFormObj = PTR_CAST(FmFormObj, &rObj); 411cdf0e10cSrcweir if (pFormObj) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir // liegt das UnoControlModel in einer Eventumgebung, 414cdf0e10cSrcweir // dann koennen noch Events zugeordnet sein 415cdf0e10cSrcweir Reference< XFormComponent > xContent(pFormObj->xUnoControlModel, UNO_QUERY); 416cdf0e10cSrcweir if (xContent.is()) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir Reference< XEventAttacherManager > xManager(xContent->getParent(), UNO_QUERY); 419cdf0e10cSrcweir Reference< XIndexAccess > xManagerAsIndex(xManager, UNO_QUERY); 420cdf0e10cSrcweir if (xManagerAsIndex.is()) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir sal_Int32 nPos = getElementPos( xManagerAsIndex, xContent ); 423cdf0e10cSrcweir if ( nPos >= 0 ) 424cdf0e10cSrcweir aEvts = xManager->getScriptEvents( nPos ); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir } 427cdf0e10cSrcweir else 428cdf0e10cSrcweir aEvts = pFormObj->aEvts; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir //------------------------------------------------------------------ 433cdf0e10cSrcweir namespace 434cdf0e10cSrcweir { 435cdf0e10cSrcweir String lcl_getFormComponentAccessPath(const Reference< XInterface >& _xElement, Reference< XInterface >& _rTopLevelElement) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir Reference< ::com::sun::star::form::XFormComponent> xChild(_xElement, UNO_QUERY); 438cdf0e10cSrcweir Reference< ::com::sun::star::container::XIndexAccess> xParent; 439cdf0e10cSrcweir if (xChild.is()) 440cdf0e10cSrcweir xParent = Reference< ::com::sun::star::container::XIndexAccess>(xChild->getParent(), UNO_QUERY); 441cdf0e10cSrcweir 442cdf0e10cSrcweir // while the current content is a form 443cdf0e10cSrcweir String sReturn; 444cdf0e10cSrcweir String sCurrentIndex; 445cdf0e10cSrcweir while (xChild.is()) 446cdf0e10cSrcweir { 447cdf0e10cSrcweir // get the content's relative pos within it's parent container 448cdf0e10cSrcweir sal_Int32 nPos = getElementPos(xParent, xChild); 449cdf0e10cSrcweir 450cdf0e10cSrcweir // prepend this current relaive pos 451cdf0e10cSrcweir sCurrentIndex = String::CreateFromInt32(nPos); 452cdf0e10cSrcweir if (sReturn.Len() != 0) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir sCurrentIndex += '\\'; 455cdf0e10cSrcweir sCurrentIndex += sReturn; 456cdf0e10cSrcweir } 457cdf0e10cSrcweir 458cdf0e10cSrcweir sReturn = sCurrentIndex; 459cdf0e10cSrcweir 460cdf0e10cSrcweir // travel up 461cdf0e10cSrcweir if (::comphelper::query_interface((Reference< XInterface >)xParent,xChild)) 462cdf0e10cSrcweir xParent = Reference< ::com::sun::star::container::XIndexAccess>(xChild->getParent(), UNO_QUERY); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir _rTopLevelElement = xParent; 466cdf0e10cSrcweir return sReturn; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir } 469cdf0e10cSrcweir 470cdf0e10cSrcweir //------------------------------------------------------------------ 471cdf0e10cSrcweir Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > & _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > _rTopLevelDestContainer) 472cdf0e10cSrcweir { 473cdf0e10cSrcweir Reference< XInterface > xTopLevelSouce; 474cdf0e10cSrcweir String sAccessPath = lcl_getFormComponentAccessPath(_rSourceContainer, xTopLevelSouce); 475cdf0e10cSrcweir if (!xTopLevelSouce.is()) 476cdf0e10cSrcweir // somthing went wrong, maybe _rSourceContainer isn't part of a valid forms hierarchy 477cdf0e10cSrcweir return Reference< XInterface > (); 478cdf0e10cSrcweir 479cdf0e10cSrcweir Reference< XIndexContainer > xDestContainer(_rTopLevelDestContainer); 480cdf0e10cSrcweir Reference< XIndexContainer > xSourceContainer(xTopLevelSouce, UNO_QUERY); 481cdf0e10cSrcweir DBG_ASSERT(xSourceContainer.is(), "FmFormObj::ensureModelEnv : the top level source is invalid !"); 482cdf0e10cSrcweir 483cdf0e10cSrcweir for (xub_StrLen i=0; i<sAccessPath.GetTokenCount('\\'); ++i) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir sal_uInt16 nIndex = (sal_uInt16)sAccessPath.GetToken(i, '\\').ToInt32(); 486cdf0e10cSrcweir 487cdf0e10cSrcweir // get the DSS of the source form (we have to find an aquivalent for) 488cdf0e10cSrcweir DBG_ASSERT(nIndex<xSourceContainer->getCount(), "FmFormObj::ensureModelEnv : invalid access path !"); 489cdf0e10cSrcweir Reference< XPropertySet > xSourceForm; 490cdf0e10cSrcweir xSourceContainer->getByIndex(nIndex) >>= xSourceForm; 491cdf0e10cSrcweir DBG_ASSERT(xSourceForm.is(), "FmFormObj::ensureModelEnv : invalid source form !"); 492cdf0e10cSrcweir 493cdf0e10cSrcweir Any aSrcCursorSource, aSrcCursorSourceType, aSrcDataSource; 494cdf0e10cSrcweir DBG_ASSERT(::comphelper::hasProperty(FM_PROP_COMMAND, xSourceForm) && ::comphelper::hasProperty(FM_PROP_COMMANDTYPE, xSourceForm) 495cdf0e10cSrcweir && ::comphelper::hasProperty(FM_PROP_DATASOURCE, xSourceForm), "FmFormObj::ensureModelEnv : invalid access path or invalid form (missing props) !"); 496cdf0e10cSrcweir // the parent access path should refer to a row set 497cdf0e10cSrcweir try 498cdf0e10cSrcweir { 499cdf0e10cSrcweir aSrcCursorSource = xSourceForm->getPropertyValue(FM_PROP_COMMAND); 500cdf0e10cSrcweir aSrcCursorSourceType = xSourceForm->getPropertyValue(FM_PROP_COMMANDTYPE); 501cdf0e10cSrcweir aSrcDataSource = xSourceForm->getPropertyValue(FM_PROP_DATASOURCE); 502cdf0e10cSrcweir } 503cdf0e10cSrcweir catch(Exception&) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir DBG_ERROR("FmFormObj::ensureModelEnv : could not retrieve a source DSS !"); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir 508cdf0e10cSrcweir 509cdf0e10cSrcweir // calc the number of (source) form siblings with the same DSS 510cdf0e10cSrcweir Reference< XPropertySet > xCurrentSourceForm, xCurrentDestForm; 511cdf0e10cSrcweir sal_Int16 nCurrentSourceIndex = 0, nCurrentDestIndex = 0; 512cdf0e10cSrcweir while (nCurrentSourceIndex <= nIndex) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir sal_Bool bEqualDSS = sal_False; 515cdf0e10cSrcweir while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bound by nIndex) 516cdf0e10cSrcweir { 517cdf0e10cSrcweir xSourceContainer->getByIndex(nCurrentSourceIndex) >>= xCurrentSourceForm; 518cdf0e10cSrcweir DBG_ASSERT(xCurrentSourceForm.is(), "FmFormObj::ensureModelEnv : invalid form ancestor (2) !"); 519cdf0e10cSrcweir bEqualDSS = sal_False; 520cdf0e10cSrcweir if (::comphelper::hasProperty(FM_PROP_DATASOURCE, xCurrentSourceForm)) 521cdf0e10cSrcweir { // it is a form 522cdf0e10cSrcweir try 523cdf0e10cSrcweir { 524cdf0e10cSrcweir if ( ::comphelper::compare(xCurrentSourceForm->getPropertyValue(FM_PROP_COMMAND), aSrcCursorSource) 525cdf0e10cSrcweir && ::comphelper::compare(xCurrentSourceForm->getPropertyValue(FM_PROP_COMMANDTYPE), aSrcCursorSourceType) 526cdf0e10cSrcweir && ::comphelper::compare(xCurrentSourceForm->getPropertyValue(FM_PROP_DATASOURCE), aSrcDataSource) 527cdf0e10cSrcweir ) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir bEqualDSS = sal_True; 530cdf0e10cSrcweir } 531cdf0e10cSrcweir } 532cdf0e10cSrcweir catch(Exception&) 533cdf0e10cSrcweir { 534cdf0e10cSrcweir DBG_ERROR("FmFormObj::ensureModelEnv : exception while getting a sibling's DSS !"); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir 537cdf0e10cSrcweir } 538cdf0e10cSrcweir ++nCurrentSourceIndex; 539cdf0e10cSrcweir } 540cdf0e10cSrcweir 541cdf0e10cSrcweir DBG_ASSERT(bEqualDSS, "FmFormObj::ensureModelEnv : found no source form !"); 542cdf0e10cSrcweir // ??? at least the nIndex-th one should have been found ??? 543cdf0e10cSrcweir 544cdf0e10cSrcweir // now search the next one with the given DSS (within the destination container) 545cdf0e10cSrcweir bEqualDSS = sal_False; 546cdf0e10cSrcweir while (!bEqualDSS && (nCurrentDestIndex < xDestContainer->getCount())) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir xDestContainer->getByIndex(nCurrentDestIndex) >>= xCurrentDestForm; 549cdf0e10cSrcweir DBG_ASSERT(xCurrentDestForm.is(), "FmFormObj::ensureModelEnv : invalid destination form !"); 550cdf0e10cSrcweir bEqualDSS = sal_False; 551cdf0e10cSrcweir if (::comphelper::hasProperty(FM_PROP_DATASOURCE, xCurrentDestForm)) 552cdf0e10cSrcweir { // it is a form 553cdf0e10cSrcweir try 554cdf0e10cSrcweir { 555cdf0e10cSrcweir if ( ::comphelper::compare(xCurrentDestForm->getPropertyValue(FM_PROP_COMMAND), aSrcCursorSource) 556cdf0e10cSrcweir && ::comphelper::compare(xCurrentDestForm->getPropertyValue(FM_PROP_COMMANDTYPE), aSrcCursorSourceType) 557cdf0e10cSrcweir && ::comphelper::compare(xCurrentDestForm->getPropertyValue(FM_PROP_DATASOURCE), aSrcDataSource) 558cdf0e10cSrcweir ) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir bEqualDSS = sal_True; 561cdf0e10cSrcweir } 562cdf0e10cSrcweir } 563cdf0e10cSrcweir catch(Exception&) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir DBG_ERROR("FmFormObj::ensureModelEnv : exception while getting a destination DSS !"); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir 568cdf0e10cSrcweir } 569cdf0e10cSrcweir ++nCurrentDestIndex; 570cdf0e10cSrcweir } 571cdf0e10cSrcweir 572cdf0e10cSrcweir if (!bEqualDSS) 573cdf0e10cSrcweir { // There is at least one more source form with the given DSS than destination forms are. 574cdf0e10cSrcweir // correct this ... 575cdf0e10cSrcweir try 576cdf0e10cSrcweir { 577cdf0e10cSrcweir // create and insert (into the destination) a copy of the form 578cdf0e10cSrcweir xCurrentDestForm.set( 579cdf0e10cSrcweir ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.form.component.DataForm" ) ), 580cdf0e10cSrcweir UNO_QUERY_THROW ); 581cdf0e10cSrcweir ::comphelper::copyProperties( xCurrentSourceForm, xCurrentDestForm ); 582cdf0e10cSrcweir 583cdf0e10cSrcweir DBG_ASSERT(nCurrentDestIndex == xDestContainer->getCount(), "FmFormObj::ensureModelEnv : something went wrong with the numbers !"); 584cdf0e10cSrcweir xDestContainer->insertByIndex(nCurrentDestIndex, makeAny(xCurrentDestForm)); 585cdf0e10cSrcweir 586cdf0e10cSrcweir ++nCurrentDestIndex; 587cdf0e10cSrcweir // like nCurrentSourceIndex, nCurrentDestIndex now points 'behind' the form it actally means 588cdf0e10cSrcweir } 589cdf0e10cSrcweir catch(Exception&) 590cdf0e10cSrcweir { 591cdf0e10cSrcweir DBG_ERROR("FmFormObj::ensureModelEnv : something went seriously wrong while creating a new form !"); 592cdf0e10cSrcweir // no more options anymore ... 593cdf0e10cSrcweir return Reference< XInterface > (); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir 596cdf0e10cSrcweir } 597cdf0e10cSrcweir } 598cdf0e10cSrcweir 599cdf0e10cSrcweir // now xCurrentDestForm is a form equivalent to xSourceForm (which means they have the same DSS and the same number 600cdf0e10cSrcweir // of left siblings with the same DSS, which counts for all their ancestors, too) 601cdf0e10cSrcweir 602cdf0e10cSrcweir // go down 603cdf0e10cSrcweir xDestContainer = Reference< XIndexContainer > (xCurrentDestForm, UNO_QUERY); 604cdf0e10cSrcweir xSourceContainer = Reference< XIndexContainer > (xSourceForm, UNO_QUERY); 605cdf0e10cSrcweir DBG_ASSERT(xDestContainer.is() && xSourceContainer.is(), "FmFormObj::ensureModelEnv : invalid container !"); 606cdf0e10cSrcweir } 607cdf0e10cSrcweir 608cdf0e10cSrcweir return Reference< XInterface > (xDestContainer, UNO_QUERY); 609cdf0e10cSrcweir } 610cdf0e10cSrcweir 611cdf0e10cSrcweir //------------------------------------------------------------------ 612cdf0e10cSrcweir void FmFormObj::SetModel( SdrModel* _pNewModel ) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir SdrUnoObj::SetModel( _pNewModel ); 615cdf0e10cSrcweir impl_checkRefDevice_nothrow(); 616cdf0e10cSrcweir } 617cdf0e10cSrcweir 618cdf0e10cSrcweir //------------------------------------------------------------------ 619cdf0e10cSrcweir FmFormObj* FmFormObj::GetFormObject( SdrObject* _pSdrObject ) 620cdf0e10cSrcweir { 621cdf0e10cSrcweir FmFormObj* pFormObject = dynamic_cast< FmFormObj* >( _pSdrObject ); 622cdf0e10cSrcweir if ( !pFormObject ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir SdrVirtObj* pVirtualObject = dynamic_cast< SdrVirtObj* >( _pSdrObject ); 625cdf0e10cSrcweir if ( pVirtualObject ) 626cdf0e10cSrcweir pFormObject = dynamic_cast< FmFormObj* >( &pVirtualObject->ReferencedObj() ); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir return pFormObject; 629cdf0e10cSrcweir } 630cdf0e10cSrcweir 631cdf0e10cSrcweir //------------------------------------------------------------------ 632cdf0e10cSrcweir const FmFormObj* FmFormObj::GetFormObject( const SdrObject* _pSdrObject ) 633cdf0e10cSrcweir { 634cdf0e10cSrcweir const FmFormObj* pFormObject = dynamic_cast< const FmFormObj* >( _pSdrObject ); 635cdf0e10cSrcweir if ( !pFormObject ) 636cdf0e10cSrcweir { 637cdf0e10cSrcweir const SdrVirtObj* pVirtualObject = dynamic_cast< const SdrVirtObj* >( _pSdrObject ); 638cdf0e10cSrcweir if ( pVirtualObject ) 639cdf0e10cSrcweir pFormObject = dynamic_cast< const FmFormObj* >( &pVirtualObject->GetReferencedObj() ); 640cdf0e10cSrcweir } 641cdf0e10cSrcweir return pFormObject; 642cdf0e10cSrcweir } 643cdf0e10cSrcweir 644cdf0e10cSrcweir //------------------------------------------------------------------ 645cdf0e10cSrcweir void FmFormObj::SetUnoControlModel( const Reference< com::sun::star::awt::XControlModel >& _rxModel ) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir SdrUnoObj::SetUnoControlModel( _rxModel ); 648cdf0e10cSrcweir 649cdf0e10cSrcweir FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetPage() ); 650cdf0e10cSrcweir if ( pFormPage ) 651cdf0e10cSrcweir pFormPage->GetImpl().formModelAssigned( *this ); 652cdf0e10cSrcweir 653cdf0e10cSrcweir impl_checkRefDevice_nothrow( true ); 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir //------------------------------------------------------------------ 657cdf0e10cSrcweir FASTBOOL FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd ) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir bool bResult = SdrUnoObj::EndCreate(rStat, eCmd); 660cdf0e10cSrcweir if ( bResult && SDRCREATE_FORCEEND == eCmd && rStat.GetView() ) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir if ( pPage ) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pPage ); 665cdf0e10cSrcweir 666cdf0e10cSrcweir try 667cdf0e10cSrcweir { 668cdf0e10cSrcweir Reference< XFormComponent > xContent( xUnoControlModel, UNO_QUERY_THROW ); 669cdf0e10cSrcweir Reference< XForm > xParentForm( xContent->getParent(), UNO_QUERY ); 670cdf0e10cSrcweir 671cdf0e10cSrcweir Reference< XIndexContainer > xFormToInsertInto; 672cdf0e10cSrcweir 673cdf0e10cSrcweir if ( !xParentForm.is() ) 674cdf0e10cSrcweir { // model is not yet part of a form component hierachy 675cdf0e10cSrcweir xParentForm.set( rPage.GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW ); 676cdf0e10cSrcweir xFormToInsertInto.set( xParentForm, UNO_QUERY_THROW ); 677cdf0e10cSrcweir } 678cdf0e10cSrcweir 679cdf0e10cSrcweir rPage.GetImpl().setUniqueName( xContent, xParentForm ); 680cdf0e10cSrcweir 681cdf0e10cSrcweir if ( xFormToInsertInto.is() ) 682cdf0e10cSrcweir xFormToInsertInto->insertByIndex( xFormToInsertInto->getCount(), makeAny( xContent ) ); 683cdf0e10cSrcweir } 684cdf0e10cSrcweir catch( const Exception& ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 687cdf0e10cSrcweir } 688cdf0e10cSrcweir } 689cdf0e10cSrcweir 690cdf0e10cSrcweir FmFormView* pView( dynamic_cast< FmFormView* >( rStat.GetView() ) ); 691cdf0e10cSrcweir FmXFormView* pViewImpl = pView ? pView->GetImpl() : NULL; 692cdf0e10cSrcweir OSL_ENSURE( pViewImpl, "FmFormObj::EndCreate: no view!?" ); 693cdf0e10cSrcweir if ( pViewImpl ) 694cdf0e10cSrcweir pViewImpl->onCreatedFormObject( *this ); 695cdf0e10cSrcweir } 696cdf0e10cSrcweir return bResult; 697cdf0e10cSrcweir } 698cdf0e10cSrcweir 699cdf0e10cSrcweir //------------------------------------------------------------------------------ 700cdf0e10cSrcweir void FmFormObj::BrkCreate( SdrDragStat& rStat ) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir SdrUnoObj::BrkCreate( rStat ); 703cdf0e10cSrcweir impl_isolateControlModel_nothrow(); 704cdf0e10cSrcweir } 705cdf0e10cSrcweir 706cdf0e10cSrcweir // ----------------------------------------------------------------------------- 707cdf0e10cSrcweir sal_Int32 FmFormObj::getType() const 708cdf0e10cSrcweir { 709cdf0e10cSrcweir return m_nType; 710cdf0e10cSrcweir } 711cdf0e10cSrcweir 712cdf0e10cSrcweir // ----------------------------------------------------------------------------- 713cdf0e10cSrcweir // #i70852# overload Layer interface to force to FormColtrol layer 714cdf0e10cSrcweir 715cdf0e10cSrcweir SdrLayerID FmFormObj::GetLayer() const 716cdf0e10cSrcweir { 717cdf0e10cSrcweir // #i72535# 718cdf0e10cSrcweir // i70852 was too radical, in SW obects (and thus, FormControls, too) 719cdf0e10cSrcweir // get moved to invisible layers to hide them (e.g. in hidden sections). 720cdf0e10cSrcweir // This means that form controls ARE allowed to be on other layers than 721cdf0e10cSrcweir // the form control layer ATM and that being member of form control layer 722cdf0e10cSrcweir // is no criteria to find all FormControls of a document. 723cdf0e10cSrcweir // To fix, use parent functionality 724cdf0e10cSrcweir return SdrUnoObj::GetLayer(); 725cdf0e10cSrcweir } 726cdf0e10cSrcweir 727cdf0e10cSrcweir void FmFormObj::NbcSetLayer(SdrLayerID nLayer) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir // #i72535# 730cdf0e10cSrcweir // See above. To fix, use parent functionality 731cdf0e10cSrcweir return SdrUnoObj::NbcSetLayer(nLayer); 732cdf0e10cSrcweir } 733cdf0e10cSrcweir 734cdf0e10cSrcweir // eof 735