diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-27 14:20:45 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-04-23 16:05:56 +0200 |
commit | 1165aac95b8e44f41fc16a44bfec4c1c05801ac8 (patch) | |
tree | 7887802f0d1ba62ab95bad1c6fe8ebf323c87a91 | |
parent | 9ffb86c7e93c1633866ed89f0749831fd7f31a35 (diff) |
fdo#46808, convert form::Forms to new style
Change-Id: I966ed18d45dc8a04c97a703d3c83382714025f2c
-rw-r--r-- | forms/source/component/FormsCollection.cxx | 6 | ||||
-rw-r--r-- | forms/source/component/FormsCollection.hxx | 65 | ||||
-rw-r--r-- | forms/source/inc/services.hxx | 2 | ||||
-rw-r--r-- | forms/source/misc/services.cxx | 5 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 5 | ||||
-rw-r--r-- | offapi/com/sun/star/form/Forms.idl | 10 | ||||
-rw-r--r-- | offapi/com/sun/star/form/XForms.idl | 86 | ||||
-rw-r--r-- | offapi/type_reference/types.rdb | bin | 7439360 -> 7439360 bytes | |||
-rw-r--r-- | svx/inc/svx/fmpage.hxx | 6 | ||||
-rw-r--r-- | svx/source/form/fmdpage.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmmodel.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/fmobj.cxx | 42 | ||||
-rw-r--r-- | svx/source/form/fmpage.cxx | 16 | ||||
-rw-r--r-- | svx/source/form/fmpgeimp.cxx | 41 | ||||
-rw-r--r-- | svx/source/form/fmundo.cxx | 8 | ||||
-rw-r--r-- | svx/source/form/navigatortreemodel.cxx | 14 | ||||
-rw-r--r-- | svx/source/inc/fmexch.hxx | 7 | ||||
-rw-r--r-- | svx/source/inc/fmexpl.hxx | 4 | ||||
-rw-r--r-- | svx/source/inc/fmobj.hxx | 9 | ||||
-rw-r--r-- | svx/source/inc/fmpgeimp.hxx | 5 | ||||
-rw-r--r-- | xmloff/source/forms/layerexport.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/forms/strings.hxx | 1 |
22 files changed, 230 insertions, 110 deletions
diff --git a/forms/source/component/FormsCollection.cxx b/forms/source/component/FormsCollection.cxx index f1dfbd688e31..1da85ce08828 100644 --- a/forms/source/component/FormsCollection.cxx +++ b/forms/source/component/FormsCollection.cxx @@ -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 diff --git a/forms/source/component/FormsCollection.hxx b/forms/source/component/FormsCollection.hxx index c6c585806584..8c92e7b97f29 100644 --- a/forms/source/component/FormsCollection.hxx +++ b/forms/source/component/FormsCollection.hxx @@ -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); } }; //......................................................................... diff --git a/forms/source/inc/services.hxx b/forms/source/inc/services.hxx index 57c18771fa92..dc5d4c3789d9 100644 --- a/forms/source/inc/services.hxx +++ b/forms/source/inc/services.hxx @@ -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" diff --git a/forms/source/misc/services.cxx b/forms/source/misc/services.cxx index dfbd656d01a6..29e173c0b255 100644 --- a/forms/source/misc/services.cxx +++ b/forms/source/misc/services.cxx @@ -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); // ======================================================================== diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index b43877b1ca7a..cae76f660462 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -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 \ diff --git a/offapi/com/sun/star/form/Forms.idl b/offapi/com/sun/star/form/Forms.idl index 196e18c1174b..2b86048ac2c2 100644 --- a/offapi/com/sun/star/form/Forms.idl +++ b/offapi/com/sun/star/form/Forms.idl @@ -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; }; }; }; }; diff --git a/offapi/com/sun/star/form/XForms.idl b/offapi/com/sun/star/form/XForms.idl new file mode 100644 index 000000000000..4571d9c28d6c --- /dev/null +++ b/offapi/com/sun/star/form/XForms.idl @@ -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: */ diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex ecd1b60cac58..097590fe8c91 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/svx/inc/svx/fmpage.hxx b/svx/inc/svx/fmpage.hxx index 548bdb65c7d7..ba3bdd13679d 100644 --- a/svx/inc/svx/fmpage.hxx +++ b/svx/inc/svx/fmpage.hxx @@ -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; } diff --git a/svx/source/form/fmdpage.cxx b/svx/source/form/fmdpage.cxx index 5d239f5b6042..76d1c97f930f 100644 --- a/svx/source/form/fmdpage.cxx +++ b/svx/source/form/fmdpage.cxx @@ -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; } diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index 474f8abfa1a2..b84f8b6912c4 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -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 ); } diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 5f0641a9910d..34949302dc9f 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -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 !"); diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx index 3243c2314a68..507e2294712f 100644 --- a/svx/source/form/fmpage.cxx +++ b/svx/source/form/fmpage.cxx @@ -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 ); diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index 6d46e64d705d..ab7c9d597989 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -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& ) diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 20b924b28f66..29ef91a77aa5 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -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 ); } diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx index 4187473ef9b3..a5c7d96c99f8 100644 --- a/svx/source/form/navigatortreemodel.cxx +++ b/svx/source/form/navigatortreemodel.cxx @@ -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); diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx index 3221e644a376..9b1265026c74 100644 --- a/svx/source/inc/fmexch.hxx +++ b/svx/source/inc/fmexch.hxx @@ -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; } }; diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx index 1b20fe4f666d..67e4adf6ca24 100644 --- a/svx/source/inc/fmexpl.hxx +++ b/svx/source/inc/fmexpl.hxx @@ -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 ); diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx index 5bbd02aa01ec..5e77e56eb5d2 100644 --- a/svx/source/inc/fmobj.hxx +++ b/svx/source/inc/fmobj.hxx @@ -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 diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx index db53cc09bf8c..57a3ad0826e7 100644 --- a/svx/source/inc/fmpgeimp.hxx +++ b/svx/source/inc/fmpgeimp.hxx @@ -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; } diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index 2b065c7d5165..c880662d9d3a 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -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 diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx index 3aa99906c8d5..51c56211fbf1 100644 --- a/xmloff/source/forms/strings.hxx +++ b/xmloff/source/forms/strings.hxx @@ -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" |