fdo#46808, convert form::Forms to new style

Change-Id: I966ed18d45dc8a04c97a703d3c83382714025f2c
This commit is contained in:
Noel Grandin 2013-03-27 14:20:45 +02:00
parent 9ffb86c7e9
commit 1165aac95b
22 changed files with 230 additions and 110 deletions

View File

@ -46,7 +46,7 @@ InterfaceRef SAL_CALL OFormsCollection_CreateInstance(const Reference<XMultiServ
//------------------------------------------------------------------------------
OUString SAL_CALL OFormsCollection::getServiceName() throw(RuntimeException)
{
return OUString(FRM_SUN_FORMS_COLLECTION);
return OUString("com.sun.star.form.Forms");
}
//------------------------------------------------------------------------------
@ -127,7 +127,7 @@ StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(Runti
{
StringSequence aReturn(2);
aReturn.getArray()[0] = FRM_SUN_FORMS_COLLECTION;
aReturn.getArray()[0] = OUString("com.sun.star.form.Forms");
aReturn.getArray()[1] = OUString("com.sun.star.form.FormComponents");
return aReturn;
@ -141,7 +141,7 @@ Reference< XCloneable > SAL_CALL OFormsCollection::createClone( ) throw (Runtim
osl_atomic_increment( &pClone->m_refCount );
pClone->clonedFrom( *this );
osl_atomic_decrement( &pClone->m_refCount );
return pClone;
return static_cast<OInterfaceContainer*>(pClone);
}
// OComponentHelper

View File

@ -23,6 +23,7 @@
#include <cppuhelper/implbase2.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/form/XForms.hpp>
//.........................................................................
namespace frm
@ -37,7 +38,7 @@ namespace frm
// oder aussen einen Context uebergeben bekommen
//==================================================================
typedef ::cppu::OComponentHelper FormsCollectionComponentBase;
typedef ::cppu::ImplHelper2< ::com::sun::star::container::XChild
typedef ::cppu::ImplHelper2< ::com::sun::star::form::XForms
,::com::sun::star::lang::XServiceInfo > OFormsCollection_BASE;
// else MSVC kills itself on some statements
@ -84,6 +85,68 @@ public:
// prevent method hiding
using OInterfaceContainer::disposing;
// inheritance ambiguity
virtual com::sun::star::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException)
{ return OInterfaceContainer::getElementType(); }
virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
{ return OInterfaceContainer::hasElements(); }
virtual com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& p1) throw (css::uno::RuntimeException)
{ return OInterfaceContainer::getByName(p1); }
virtual com::sun::star::uno::Sequence<rtl::OUString> SAL_CALL getElementNames() throw (css::uno::RuntimeException)
{ return OInterfaceContainer::getElementNames(); }
virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& p1) throw (css::uno::RuntimeException)
{ return OInterfaceContainer::hasByName(p1); }
virtual void SAL_CALL replaceByName(const rtl::OUString& p1, const com::sun::star::uno::Any& p2) throw (css::uno::RuntimeException)
{ OInterfaceContainer::replaceByName(p1, p2); }
virtual void SAL_CALL insertByName(const rtl::OUString& p1, const com::sun::star::uno::Any& p2) throw (css::uno::RuntimeException)
{ OInterfaceContainer::insertByName(p1, p2); }
virtual void SAL_CALL removeByName(const rtl::OUString& p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::removeByName(p1); }
virtual sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
{ return OInterfaceContainer::getCount(); }
virtual com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 p1) throw (css::uno::RuntimeException)
{ return OInterfaceContainer::getByIndex(p1); }
virtual void SAL_CALL replaceByIndex(sal_Int32 p1, const com::sun::star::uno::Any& p2) throw (css::uno::RuntimeException)
{ return OInterfaceContainer::replaceByIndex(p1, p2); }
virtual void SAL_CALL insertByIndex(sal_Int32 p1, const com::sun::star::uno::Any& p2) throw (css::uno::RuntimeException)
{ return OInterfaceContainer::insertByIndex(p1, p2); }
virtual void removeByIndex(sal_Int32 p1) throw (css::uno::RuntimeException)
{ return OInterfaceContainer::removeByIndex(p1); }
virtual com::sun::star::uno::Reference<com::sun::star::container::XEnumeration> SAL_CALL createEnumeration() throw (css::uno::RuntimeException)
{ return OInterfaceContainer::createEnumeration(); }
virtual void SAL_CALL registerScriptEvent(sal_Int32 p1, const com::sun::star::script::ScriptEventDescriptor& p2) throw (css::uno::RuntimeException)
{ OInterfaceContainer::registerScriptEvent(p1, p2); }
virtual void SAL_CALL registerScriptEvents(sal_Int32 p1, const com::sun::star::uno::Sequence<com::sun::star::script::ScriptEventDescriptor>& p2) throw (css::uno::RuntimeException)
{ OInterfaceContainer::registerScriptEvents(p1, p2); }
virtual void SAL_CALL revokeScriptEvent(sal_Int32 p1, const rtl::OUString& p2, const rtl::OUString& p3, const rtl::OUString& p4) throw (css::uno::RuntimeException)
{ OInterfaceContainer::revokeScriptEvent(p1, p2, p3, p4); }
virtual void SAL_CALL revokeScriptEvents(sal_Int32 p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::revokeScriptEvents(p1); }
virtual void SAL_CALL insertEntry(sal_Int32 p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::insertEntry(p1); }
virtual void SAL_CALL removeEntry(sal_Int32 p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::removeEntry(p1); }
virtual com::sun::star::uno::Sequence<com::sun::star::script::ScriptEventDescriptor> SAL_CALL getScriptEvents(sal_Int32 p1) throw (css::uno::RuntimeException)
{ return OInterfaceContainer::getScriptEvents(p1); }
virtual void SAL_CALL attach(sal_Int32 p1, const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& p2, const com::sun::star::uno::Any& p3) throw (css::uno::RuntimeException)
{ OInterfaceContainer::attach(p1, p2, p3); }
virtual void SAL_CALL detach(sal_Int32 p1, const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& p2) throw (css::uno::RuntimeException)
{ OInterfaceContainer::detach(p1, p2); }
virtual void SAL_CALL addScriptListener(const com::sun::star::uno::Reference<com::sun::star::script::XScriptListener>& p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::addScriptListener(p1); }
virtual void SAL_CALL removeScriptListener(const com::sun::star::uno::Reference<com::sun::star::script::XScriptListener>& p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::removeScriptListener(p1); }
virtual void dispose() throw (css::uno::RuntimeException)
{ FormsCollectionComponentBase::dispose(); }
virtual void addEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw (css::uno::RuntimeException)
{ FormsCollectionComponentBase::addEventListener(p1); }
virtual void removeEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw (css::uno::RuntimeException)
{ FormsCollectionComponentBase::removeEventListener(p1); }
virtual void addContainerListener(const com::sun::star::uno::Reference<com::sun::star::container::XContainerListener>& p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::addContainerListener(p1); }
virtual void removeContainerListener(const com::sun::star::uno::Reference<com::sun::star::container::XContainerListener>& p1) throw (css::uno::RuntimeException)
{ OInterfaceContainer::removeContainerListener(p1); }
};
//.........................................................................

View File

@ -181,8 +181,6 @@ namespace frm
#define FRM_SUN_CONTROL_RICHTEXTCONTROL "com.sun.star.form.control.RichTextControl"
#define FRM_SUN_CONTROL_SUBMITBUTTON "com.sun.star.form.control.SubmitButton"
#define FRM_SUN_FORMS_COLLECTION "com.sun.star.form.Forms"
#define BINDABLE_DATABASE_CHECK_BOX "com.sun.star.form.binding.BindableDatabaseCheckBox"
#define BINDABLE_DATABASE_COMBO_BOX "com.sun.star.form.binding.BindableDatabaseComboBox"
#define BINDABLE_DATABASE_FORMATTED_FIELD "com.sun.star.form.binding.BindableDatabaseFormattedField"

View File

@ -258,7 +258,10 @@ void ensureClassInfos()
// ========================================================================
// = various
REGISTER_CLASS1(OFormsCollection, FRM_SUN_FORMS_COLLECTION);
aServices.realloc(1);
aServices.getArray()[0] = OUString("com.sun.star.form.Forms");
REGISTER_CLASS_CORE(OFormsCollection);
REGISTER_CLASS1(ImageProducer, SRV_AWT_IMAGEPRODUCER);
// ========================================================================

View File

@ -144,6 +144,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/embed,\
OOoEmbeddedObjectFactory \
StorageFactory \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form,\
Forms \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/control,\
FilterControl \
))
@ -790,7 +793,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/form,\
FormControlModel \
FormController \
FormControllerDispatcher \
Forms \
PropertyBrowserController \
modules \
))
@ -2440,6 +2442,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/form,\
XErrorBroadcaster \
XErrorListener \
XForm \
XForms \
XFormComponent \
XFormController \
XFormControllerListener \

View File

@ -19,10 +19,7 @@
#ifndef __com_sun_star_form_Forms_idl__
#define __com_sun_star_form_Forms_idl__
#include <com/sun/star/container/XNameContainer.idl>
#include <com/sun/star/container/XIndexContainer.idl>
#include <com/sun/star/container/XEnumerationAccess.idl>
#include <com/sun/star/form/FormComponents.idl>
#include <com/sun/star/form/XForms.idl>
module com { module sun { module star { module form {
@ -36,10 +33,7 @@
@see com::sun::star::form::component::Form
*/
published service Forms
{
service FormComponents;
};
published service Forms : XForms;
}; }; }; };

View File

@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_form_XForms_idl__
#define __com_sun_star_form_XForms_idl__
#include <com/sun/star/container/XNameContainer.idl>
#include <com/sun/star/container/XIndexContainer.idl>
#include <com/sun/star/container/XEnumerationAccess.idl>
#include <com/sun/star/container/XContainer.idl>
#include <com/sun/star/container/XChild.idl>
#include <com/sun/star/lang/XComponent.idl>
#include <com/sun/star/script/XEventAttacherManager.idl>
#include <com/sun/star/util/XCloneable.idl>
module com { module sun { module star { module form {
/**
@since LibreOffice 4.1
*/
published interface XForms
{
/** allows to register listeners to be notified of changes in the container.
*/
interface com::sun::star::container::XContainer;
/** allows to add/remove elements by name.
*/
interface com::sun::star::container::XNameContainer; // ->XNameReplace->XNameAccess->XElementAccess->XInterface
/** gives access to the elements by index.
*/
interface com::sun::star::container::XIndexContainer; // ->XIndexReplace->XIndexAccess->XElementAccess->XInterface
/** creates an enumeration of the elements.
*/
interface com::sun::star::container::XEnumerationAccess; // ->XElementAccess->XInterface
/** This interface has to be implemented to supply the scripting environment
for the contained components.
<p>The interface allows managing of scripts associated with dependent components, accessed by index.
However, as a client of the <type>FormComponents</type> service, there's no need to bother with
the container aspect of the <type scope="com::sun::star::script">XEventAttacherManager</type>
directly. A <type>FormComponents</type> container will automatically synchronize the elements
you put into it with the scripting information obtained at the
<type scope="com::sun::star::script">XEventAttacherManager</type> interface.</p>
<p>For instance, at any time you can obtain the events associated with the <code>n</code><super>th</super>
element in the form components by calling
<member scope="com::sun::star::script">XEventAttacherManager::getScriptEvents</member>
with parameter <code>n</code>. In particular, this invariant is always met, even after you
inserted/removed elements into/from the container.</p>
*/
interface com::sun::star::script::XEventAttacherManager; // ->XInterface
interface com::sun::star::container::XChild;
interface com::sun::star::util::XCloneable;
interface com::sun::star::lang::XComponent;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Binary file not shown.

View File

@ -30,8 +30,8 @@ class FmFormModel;
class FmFormPageImpl; // contains a list of all forms
namespace com { namespace sun { namespace star {
namespace container {
class XNameContainer;
namespace form {
class XForms;
}
}}}
@ -63,7 +63,7 @@ public:
virtual SdrObject* RemoveObject(sal_uLong nObjNum);
// access to all forms
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& GetForms( bool _bForceCreate = true ) const;
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForms>& GetForms( bool _bForceCreate = true ) const;
FmFormPageImpl& GetImpl() const { return *m_pImpl; }

View File

@ -112,7 +112,7 @@ SdrObject *SvxFmDrawPage::_CreateSdrObject( const ::com::sun::star::uno::Referen
FmFormPage *pFmPage = PTR_CAST( FmFormPage, GetSdrPage() );
if( pFmPage )
xForms = pFmPage->GetForms();
xForms.set( pFmPage->GetForms(), css::uno::UNO_QUERY_THROW );
return xForms;
}

View File

@ -175,7 +175,7 @@ SdrPage* FmFormModel::RemovePage(sal_uInt16 nPgNum)
if ( pToBeRemovedPage )
{
Reference< XNameContainer > xForms( pToBeRemovedPage->GetForms( false ) );
Reference< XNameContainer > xForms( pToBeRemovedPage->GetForms( false ), css::uno::UNO_QUERY );
if ( xForms.is() )
m_pImpl->pUndoEnv->RemoveForms( xForms );
}
@ -210,7 +210,7 @@ SdrPage* FmFormModel::RemoveMasterPage(sal_uInt16 nPgNum)
if ( pPage )
{
Reference< XNameContainer > xForms( pPage->GetForms( false ) );
Reference< XNameContainer > xForms( pPage->GetForms( false ), css::uno::UNO_QUERY );
if ( xForms.is() )
m_pImpl->pUndoEnv->RemoveForms( xForms );
}

View File

@ -31,9 +31,10 @@
#include "svx/dialmgr.hxx"
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/script/XEventAttacherManager.hpp>
#include <com/sun/star/io/XPersistObject.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/form/Forms.hpp>
#include <com/sun/star/io/XPersistObject.hpp>
#include <com/sun/star/script/XEventAttacherManager.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include "svx/fmtools.hxx"
@ -84,9 +85,8 @@ FmFormObj::~FmFormObj()
{
DBG_DTOR(FmFormObj, NULL);
Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY);
if (xHistory.is())
xHistory->dispose();
if (m_xEnvironmentHistory.is())
m_xEnvironmentHistory->dispose();
m_xEnvironmentHistory = NULL;
m_aEventsHistory.realloc(0);
@ -194,7 +194,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
return;
}
Reference< XIndexContainer > xNewPageForms( pNewFormPage->GetForms( true ), UNO_QUERY );
Reference< css::form::XForms > xNewPageForms = pNewFormPage->GetForms( true );
Reference< XIndexContainer > xNewParent;
Sequence< ScriptEventDescriptor> aNewEvents;
@ -204,7 +204,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
{
// the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within _pNewPage->GetForms)
// is the right-most element in the tree.
Reference< XIndexContainer > xRightMostLeaf = m_xEnvironmentHistory;
Reference< XIndexContainer > xRightMostLeaf( m_xEnvironmentHistory, UNO_QUERY_THROW );
try
{
while ( xRightMostLeaf->getCount() )
@ -318,9 +318,8 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
}
// delete my history
Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY);
if (xHistory.is())
xHistory->dispose();
if (m_xEnvironmentHistory.is())
m_xEnvironmentHistory->dispose();
m_xEnvironmentHistory = NULL;
m_aEventsHistory.realloc(0);
@ -345,9 +344,8 @@ sal_uInt16 FmFormObj::GetObjIdentifier() const
void FmFormObj::clonedFrom(const FmFormObj* _pSource)
{
DBG_ASSERT(_pSource != NULL, "FmFormObj::clonedFrom : invalid source !");
Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY);
if (xHistory.is())
xHistory->dispose();
if (m_xEnvironmentHistory.is())
m_xEnvironmentHistory->dispose();
m_xEnvironmentHistory = NULL;
m_aEventsHistory.realloc(0);
@ -358,17 +356,11 @@ void FmFormObj::clonedFrom(const FmFormObj* _pSource)
Reference< XInterface > xSourceContainer = xSourceAsChild->getParent();
m_xEnvironmentHistory = Reference< XIndexContainer >(
::comphelper::getProcessServiceFactory()->createInstance(OUString("com.sun.star.form.Forms") ),
UNO_QUERY);
DBG_ASSERT(m_xEnvironmentHistory.is(), "FmFormObj::clonedFrom : could not create a forms collection !");
m_xEnvironmentHistory = css::form::Forms::create( comphelper::getProcessComponentContext() );
if (m_xEnvironmentHistory.is())
{
ensureModelEnv(xSourceContainer, m_xEnvironmentHistory);
m_aEventsHistory = aEvts;
// if we we're clone there was a call to operator=, so aEvts are excatly the events we need here ...
}
ensureModelEnv(xSourceContainer, m_xEnvironmentHistory);
m_aEventsHistory = aEvts;
// if we we're clone there was a call to operator=, so aEvts are excatly the events we need here ...
}
//------------------------------------------------------------------
@ -454,7 +446,7 @@ namespace
}
//------------------------------------------------------------------
Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > & _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > _rTopLevelDestContainer)
Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > & _rSourceContainer, const Reference<css::form::XForms>& _rTopLevelDestContainer)
{
Reference< XInterface > xTopLevelSouce;
OUString sAccessPath = lcl_getFormComponentAccessPath(_rSourceContainer, xTopLevelSouce);
@ -462,7 +454,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface >
// something went wrong, maybe _rSourceContainer isn't part of a valid forms hierarchy
return Reference< XInterface > ();
Reference< XIndexContainer > xDestContainer(_rTopLevelDestContainer);
Reference< XIndexContainer > xDestContainer(_rTopLevelDestContainer, UNO_QUERY_THROW);
Reference< XIndexContainer > xSourceContainer(xTopLevelSouce, UNO_QUERY);
DBG_ASSERT(xSourceContainer.is(), "FmFormObj::ensureModelEnv : the top level source is invalid !");

View File

@ -99,19 +99,15 @@ void FmFormPage::SetModel(SdrModel* pNewModel)
{
try
{
Reference< XNameContainer > xForms( m_pImpl->getForms( false ) );
Reference< css::form::XForms > xForms( m_pImpl->getForms( false ) );
if ( xForms.is() )
{
// we want to keep the current collection, just reset the model
// with which it's associated.
Reference< XChild > xAsChild( xForms, UNO_QUERY );
if ( xAsChild.is() )
{
FmFormModel* pDrawModel = (FmFormModel*) GetModel();
SfxObjectShell* pObjShell = pDrawModel->GetObjectShell();
if ( pObjShell )
xAsChild->setParent( pObjShell->GetModel() );
}
FmFormModel* pDrawModel = (FmFormModel*) GetModel();
SfxObjectShell* pObjShell = pDrawModel->GetObjectShell();
if ( pObjShell )
xForms->setParent( pObjShell->GetModel() );
}
}
catch( ::com::sun::star::uno::Exception const& )
@ -140,7 +136,7 @@ void FmFormPage::InsertObject(SdrObject* pObj, sal_uLong nPos,
}
//------------------------------------------------------------------
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & FmFormPage::GetForms( bool _bForceCreate ) const
const Reference< css::form::XForms > & FmFormPage::GetForms( bool _bForceCreate ) const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::GetForms" );
const SdrPage& rMasterPage( *this );

View File

@ -35,6 +35,7 @@
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/container/EnumerableMap.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/form/Forms.hpp>
#include <sfx2/objsh.hxx>
#include <svx/fmglob.hxx>
@ -159,18 +160,11 @@ namespace
void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
{
// clone the Forms collection
const Reference< XNameContainer > xForeignForms( const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ) );
const Reference< XCloneable > xCloneable( xForeignForms, UNO_QUERY );
if ( !xCloneable.is() )
{
// great, nothing to do
OSL_ENSURE( !xForeignForms.is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" );
return;
}
const Reference< css::form::XForms > xForeignForms( const_cast< FmFormPageImpl& >( i_foreignImpl ).getForms( false ) );
try
{
m_xForms.set( xCloneable->createClone(), UNO_QUERY_THROW );
m_xForms.set( xForeignForms->createClone(), UNO_QUERY_THROW );
// create a mapping between the original control models and their clones
MapControlModels aModelAssignment;
@ -179,7 +173,7 @@ void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
FormComponentVisitor aVisitor = FormComponentVisitor( FormHierarchyComparator() );
FormComponentAssignment aAssignmentProcessor( aModelAssignment );
aVisitor.process( FormComponentPair( xCloneable, m_xForms ), aAssignmentProcessor );
aVisitor.process( FormComponentPair( xForeignForms, m_xForms ), aAssignmentProcessor );
// assign the cloned models to their SdrObjects
SdrObjListIter aForeignIter( i_foreignImpl.m_rPage );
@ -318,7 +312,7 @@ Reference< XMap > FmFormPageImpl::impl_createControlShapeMap_nothrow()
}
//------------------------------------------------------------------------------
const Reference< XNameContainer >& FmFormPageImpl::getForms( bool _bForceCreate )
const Reference< css::form::XForms >& FmFormPageImpl::getForms( bool _bForceCreate )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::getForms" );
if ( m_xForms.is() || !_bForceCreate )
@ -328,12 +322,8 @@ const Reference< XNameContainer >& FmFormPageImpl::getForms( bool _bForceCreate
{
m_bAttemptedFormCreation = true;
const OUString sFormsCollectionServiceName("com.sun.star.form.Forms");
Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
m_xForms.set(
xContext->getServiceManager()->createInstanceWithContext( sFormsCollectionServiceName, xContext),
UNO_QUERY_THROW
);
m_xForms = css::form::Forms::create( xContext );
if ( m_aFormsCreationHdl.IsSet() )
{
@ -343,17 +333,13 @@ const Reference< XNameContainer >& FmFormPageImpl::getForms( bool _bForceCreate
FmFormModel* pFormsModel = PTR_CAST( FmFormModel, m_rPage.GetModel() );
// give the newly created collection a place in the universe
Reference< XChild > xAsChild( m_xForms, UNO_QUERY );
if ( xAsChild.is() )
{
SfxObjectShell* pObjShell = pFormsModel ? pFormsModel->GetObjectShell() : NULL;
if ( pObjShell )
xAsChild->setParent( pObjShell->GetModel() );
}
SfxObjectShell* pObjShell = pFormsModel ? pFormsModel->GetObjectShell() : NULL;
if ( pObjShell )
m_xForms->setParent( pObjShell->GetModel() );
// tell the UNDO environment that we have a new forms collection
if ( pFormsModel )
pFormsModel->GetUndoEnv().AddForms( m_xForms );
pFormsModel->GetUndoEnv().AddForms( Reference<XNameContainer>(m_xForms,UNO_QUERY_THROW) );
}
return m_xForms;
}
@ -395,13 +381,13 @@ Reference< XForm > FmFormPageImpl::getDefaultForm()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::getDefaultForm" );
Reference< XForm > xForm;
Reference< XNameContainer > xForms( getForms() );
Reference< XForms > xForms( getForms() );
// by default, we use our "current form"
if ( !validateCurForm() )
{
// check whether there is a "standard" form
if ( xForms->hasElements() )
if ( Reference<XNameAccess>(xForms,UNO_QUERY_THROW)->hasElements() )
{
// suche die Standardform
OUString sStandardFormname = String( SVX_RES( RID_STR_STDFORMNAME ) );
@ -412,8 +398,7 @@ Reference< XForm > FmFormPageImpl::getDefaultForm()
xForm.set( xForms->getByName( sStandardFormname ), UNO_QUERY_THROW );
else
{
Reference< XIndexAccess > xFormsByIndex( xForms, UNO_QUERY_THROW );
xForm.set( xFormsByIndex->getByIndex(0), UNO_QUERY_THROW );
xForm.set( xForms->getByIndex(0), UNO_QUERY_THROW );
}
}
catch( const Exception& )

View File

@ -214,7 +214,7 @@ void FmXUndoEnvironment::dispose()
FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetPage(i) );
if ( pPage )
{
Reference< XInterface > xForms = pPage->GetForms( false ).get();
Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
if ( xForms.is() )
RemoveElement( xForms );
}
@ -226,7 +226,7 @@ void FmXUndoEnvironment::dispose()
FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetMasterPage(i) );
if ( pPage )
{
Reference< XInterface > xForms = pPage->GetForms( false ).get();
Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
if ( xForms.is() )
RemoveElement( xForms );
}
@ -265,7 +265,7 @@ void FmXUndoEnvironment::ModeChanged()
FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetPage(i) );
if ( pPage )
{
Reference< XInterface > xForms = pPage->GetForms( false ).get();
Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
if ( xForms.is() )
TogglePropertyListening( xForms );
}
@ -277,7 +277,7 @@ void FmXUndoEnvironment::ModeChanged()
FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetMasterPage(i) );
if ( pPage )
{
Reference< XInterface > xForms = pPage->GetForms( false ).get();
Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
if ( xForms.is() )
TogglePropertyListening( xForms );
}

View File

@ -253,10 +253,8 @@ namespace svxform
void NavigatorTreeModel::Clear()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::Clear" );
Reference< XNameContainer > xForms( GetForms());
Reference< XContainer > xContainer(xForms, UNO_QUERY);
if (xContainer.is())
xContainer->removeContainerListener((XContainerListener*)m_pPropChangeList);
Reference< css::form::XForms > xForms( GetForms());
xForms->removeContainerListener((XContainerListener*)m_pPropChangeList);
//////////////////////////////////////////////////////////////////////
// RootList loeschen
@ -269,7 +267,7 @@ namespace svxform
}
//------------------------------------------------------------------------
Reference< XNameContainer > NavigatorTreeModel::GetForms() const
Reference< css::form::XForms > NavigatorTreeModel::GetForms() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::GetForms" );
if( !m_pFormShell || !m_pFormShell->GetCurPage())
@ -869,7 +867,7 @@ namespace svxform
}
//------------------------------------------------------------------------
void NavigatorTreeModel::UpdateContent( const Reference< XNameContainer > & xForms )
void NavigatorTreeModel::UpdateContent( const Reference< css::form::XForms > & xForms )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::UpdateContent" );
//////////////////////////////////////////////////////////////////////
@ -877,9 +875,7 @@ namespace svxform
Clear();
if (xForms.is())
{
Reference< XContainer > xFormContainer(xForms, UNO_QUERY);
if (xFormContainer.is())
xFormContainer->addContainerListener((XContainerListener*)m_pPropChangeList);
xForms->addContainerListener((XContainerListener*)m_pPropChangeList);
FillBranch(NULL);

View File

@ -23,6 +23,7 @@
#include <svtools/transfer.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/form/XForms.hpp>
#include <tools/link.hxx>
#include <svx/svxdllapi.h>
@ -137,7 +138,7 @@ namespace svxform
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >
m_aHiddenControlModels;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
::com::sun::star::uno::Reference< ::com::sun::star::form::XForms >
m_xFormsRoot; // the root of the forms collection where the entries we represent reside
// this uniquely identifies the page and the document
@ -171,7 +172,7 @@ namespace svxform
size_t onEntryRemoved( SvTreeListEntry* _pEntry );
void setFormsRoot(
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxFormsRoot
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForms >& _rxFormsRoot
) { m_xFormsRoot = _rxFormsRoot; }
void buildPathFormat(SvTreeListBox* pTreeBox, SvTreeListEntry* pRoot);
@ -192,7 +193,7 @@ namespace svxform
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >
hiddenControls() const { return m_aHiddenControlModels; }
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
::com::sun::star::uno::Reference< ::com::sun::star::form::XForms >
getFormsRoot() const { return m_xFormsRoot; }
};

View File

@ -359,7 +359,7 @@ namespace svxform
ImageList m_aNormalImages;
void UpdateContent( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xForms );
void UpdateContent( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForms >& xForms );
FmControlData* CreateControlData( ::com::sun::star::form::XFormComponent* pFormComponent );
void InsertForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm, sal_uInt32 nRelPos);
@ -395,7 +395,7 @@ namespace svxform
void Clear();
void SetModified( sal_Bool bMod=sal_True );
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetForms() const;
::com::sun::star::uno::Reference< ::com::sun::star::form::XForms > GetForms() const;
FmFormShell* GetFormShell() const { return m_pFormShell; }
FmFormPage* GetFormPage() const { return m_pFormPage; }
FmEntryData* FindData( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElement, FmEntryDataList* pDataList, sal_Bool bRecurs=sal_True );

View File

@ -20,8 +20,9 @@
#define _SVX_FMOBJ_HXX
#include <svx/svdouno.hxx>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/form/XForms.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
//==================================================================
// FmFormObj
@ -36,7 +37,7 @@ class FmFormObj: public SdrUnoObj
// Informationen fuer die Controlumgebung
// werden nur vorgehalten, wenn ein Object sich nicht in einer Objectliste befindet
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> m_xParent;
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xEnvironmentHistory;
::com::sun::star::uno::Reference< ::com::sun::star::form::XForms > m_xEnvironmentHistory;
sal_Int32 m_nPos;
OutputDevice* m_pLastKnownRefDevice;
@ -78,7 +79,9 @@ public:
virtual void clonedFrom(const FmFormObj* _pSource);
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> _rTopLevelDestContainer);
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer,
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForms>& _rTopLevelDestContainer);
/** returns the FmFormObj behind the given SdrObject

View File

@ -23,6 +23,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/form/XFormComponent.hpp>
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/XForms.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@ -49,7 +50,7 @@ class SVX_DLLPRIVATE FmFormPageImpl
{
::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >,SdrObject* > m_aComponentMap;
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xCurrentForm;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xForms;
::com::sun::star::uno::Reference< ::com::sun::star::form::XForms > m_xForms;
::com::sun::star::uno::WeakReference< ::com::sun::star::container::XMap > m_aControlShapeMap;
FmFormPage& m_rPage;
@ -90,7 +91,7 @@ public:
inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; }
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& getForms( bool _bForceCreate = true );
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForms>& getForms( bool _bForceCreate = true );
void SetFormsCreationHdl( const Link& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; }
const Link& GetFormsCreationHdl() const { return m_aFormsCreationHdl; }

View File

@ -127,7 +127,7 @@ namespace xmloff
if (!xSI.is())
return sal_False;
if (!xSI->supportsService(SERVICE_FORMSCOLLECTION))
if (!xSI->supportsService("com.sun.star.form.Forms"))
{
OSL_FAIL("OFormLayerXMLExport_Impl::impl_isFormPageContainingForms: invalid collection (is no com.sun.star.form.Forms)!");
// nothing to do

View File

@ -142,7 +142,6 @@ namespace xmloff
#define PROPERTY_RICH_TEXT "RichText"
// services
#define SERVICE_FORMSCOLLECTION "com.sun.star.form.Forms"
#define SERVICE_SPREADSHEET_DOCUMENT "com.sun.star.sheet.SpreadsheetDocument"
#define SERVICE_CELLVALUEBINDING "com.sun.star.table.CellValueBinding"
#define SERVICE_LISTINDEXCELLBINDING "com.sun.star.table.ListPositionCellBinding"