diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-03-18 17:42:43 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-03-18 17:42:43 +0000 |
commit | 82dec32adb5a5793a8a2ae9b571e050a09e48c8e (patch) | |
tree | fc3d6b3410778f6765b72efe826d44b09679fe90 /svx/source/form/fmmodel.cxx | |
parent | e97beb270fd1a5121cdb69ffafd12ea04100e290 (diff) |
INTEGRATION: CWS xmlperf02 (1.11.234); FILE MERGED
2005/02/01 14:53:34 fs 1.11.234.1: #119224# obtain the forms of a page only when needed - for pure read access, don't create the forms container
Diffstat (limited to 'svx/source/form/fmmodel.cxx')
-rw-r--r-- | svx/source/form/fmmodel.cxx | 57 |
1 files changed, 17 insertions, 40 deletions
diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index 8d39fecdf104..0556551d03f5 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmmodel.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: pjunck $ $Date: 2004-11-03 10:43:12 $ + * last change: $Author: kz $ $Date: 2005-03-18 18:42:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,6 +91,9 @@ class SfxObjectShell; #include "svdobj.hxx" #endif +using ::com::sun::star::uno::Reference; +using ::com::sun::star::container::XNameContainer; + TYPEINIT1(FmFormModel, SdrModel); struct FmFormModelImplData @@ -332,35 +335,6 @@ void FmFormModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos) #endif SdrModel::InsertPage( pPage, nPos ); - -#ifndef SVX_LIGHT - if ( !m_pImpl->bMovingPage ) - { - // this flag here is kind of a hack. - // When a page is moved, the SdrModel::MovePage calls an InsertPage only, but - // no preceding RemovePage. Thus, we (as a derivee) don't have a chance to see - // that the page which is just being inserted is (in real) already a part of the - // model. Especially, we do not have a chance to notice that the UndoEnvironment - // already _knows_ the forms we're just going to add below. - // - // The real solution to this would have been to fix SdrModel::MovePage, which - // is buggy in it's current form (as it violates the semantics of InsertPage, which - // is: insert a page which /currently is not part of any model/). - // However, this change in the SdrModel is much too risky. - // - // Another solution to this would have been to track (in the UndoEnv) which pages - // we know, and ignore any AddForms calls which are for such a page. - // But I refuse to do this (much more) work to hack a bug in the SdrModel. - // - // The decision is to do this "small hack" here (which I don't consider really - // bad). - // - // 2002-01-10 - #i3235# - fs@openoffice.org - // - if ( pPage ) - m_pImpl->pUndoEnv->AddForms( static_cast< FmFormPage* >( pPage )->GetForms() ); - } -#endif } /************************************************************************* @@ -393,7 +367,11 @@ SdrPage* FmFormModel::RemovePage(sal_uInt16 nPgNum) #ifndef SVX_LIGHT if (pPage) - m_pImpl->pUndoEnv->RemoveForms(pPage->GetForms()); + { + Reference< XNameContainer > xForms( pPage->GetForms( false ) ); + if ( xForms.is() ) + m_pImpl->pUndoEnv->RemoveForms( xForms ); + } #endif return pPage; @@ -413,11 +391,6 @@ void FmFormModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos) #endif SdrModel::InsertMasterPage(pPage, nPos); - -#ifndef SVX_LIGHT - if (pPage) - m_pImpl->pUndoEnv->AddForms(((FmFormPage*)pPage)->GetForms()); -#endif } /************************************************************************* @@ -430,8 +403,12 @@ SdrPage* FmFormModel::RemoveMasterPage(sal_uInt16 nPgNum) FmFormPage* pPage = (FmFormPage*)SdrModel::RemoveMasterPage(nPgNum); #ifndef SVX_LIGHT - if (pPage) - m_pImpl->pUndoEnv->RemoveForms(pPage->GetForms()); + if ( pPage ) + { + Reference< XNameContainer > xForms( pPage->GetForms( false ) ); + if ( xForms.is() ) + m_pImpl->pUndoEnv->RemoveForms( xForms ); + } #endif return pPage; @@ -502,7 +479,7 @@ void FmFormModel::SetObjectShell( SfxObjectShell* pShell ) if (pObjShell) { - m_pImpl->pUndoEnv->SetReadOnly(pObjShell->IsReadOnly() || pObjShell->IsReadOnlyUI()); + m_pImpl->pUndoEnv->SetReadOnly( pObjShell->IsReadOnly() || pObjShell->IsReadOnlyUI(), FmXUndoEnvironment::Accessor() ); if (!m_pImpl->pUndoEnv->IsReadOnly()) m_pImpl->pUndoEnv->StartListening(*this); |