[Libreoffice-commits] core.git: 8 commits - dbaccess/source forms/source framework/inc framework/source offapi/com offapi/type_reference offapi/UnoApi_offapi.mk svx/inc svx/source xmloff/source

Noel Grandin noel at peralex.com
Tue Apr 23 07:06:38 PDT 2013


 dbaccess/source/ui/browser/brwview.cxx                   |    2 
 dbaccess/source/ui/browser/sbagrid.cxx                   |   26 ++--
 dbaccess/source/ui/inc/sbagrid.hxx                       |    6 -
 forms/source/component/FormsCollection.cxx               |    6 -
 forms/source/component/FormsCollection.hxx               |   65 +++++++++++
 forms/source/inc/services.hxx                            |    2 
 forms/source/misc/services.cxx                           |    5 
 framework/inc/uielement/addonstoolbarwrapper.hxx         |    6 -
 framework/inc/uifactory/addonstoolboxfactory.hxx         |    5 
 framework/source/uielement/addonstoolbarwrapper.cxx      |    6 -
 framework/source/uifactory/addonstoolboxfactory.cxx      |   18 +--
 offapi/UnoApi_offapi.mk                                  |    6 -
 offapi/com/sun/star/drawing/ColorTable.idl               |   38 ++++++
 offapi/com/sun/star/form/Forms.idl                       |   10 -
 offapi/com/sun/star/form/XForms.idl                      |   86 +++++++++++++++
 offapi/type_reference/types.rdb                          |binary
 svx/inc/svx/fmgridcl.hxx                                 |    2 
 svx/inc/svx/fmgridif.hxx                                 |   10 -
 svx/inc/svx/fmpage.hxx                                   |    6 -
 svx/inc/svx/gridctrl.hxx                                 |   10 -
 svx/inc/tbunosearchcontrollers.hxx                       |    7 -
 svx/source/accessibility/AccessibleControlShape.cxx      |    7 -
 svx/source/accessibility/lookupcolorname.cxx             |   19 +--
 svx/source/dialog/srchdlg.cxx                            |    3 
 svx/source/fmcomp/fmgridcl.cxx                           |    8 -
 svx/source/fmcomp/fmgridif.cxx                           |   18 +--
 svx/source/fmcomp/gridcell.cxx                           |    4 
 svx/source/fmcomp/gridctrl.cxx                           |    6 -
 svx/source/form/filtnav.cxx                              |   28 ++--
 svx/source/form/fmdmod.cxx                               |   11 +
 svx/source/form/fmdpage.cxx                              |    2 
 svx/source/form/fmmodel.cxx                              |    4 
 svx/source/form/fmobj.cxx                                |   42 ++-----
 svx/source/form/fmpage.cxx                               |   16 +-
 svx/source/form/fmpgeimp.cxx                             |   43 ++-----
 svx/source/form/fmshimp.cxx                              |    9 -
 svx/source/form/fmundo.cxx                               |    8 -
 svx/source/form/formcontrolling.cxx                      |   24 +---
 svx/source/form/navigatortree.cxx                        |    3 
 svx/source/form/navigatortreemodel.cxx                   |   14 --
 svx/source/gallery2/galmisc.cxx                          |   37 ++----
 svx/source/inc/filtnav.hxx                               |   23 +---
 svx/source/inc/fmexch.hxx                                |    7 -
 svx/source/inc/fmexpl.hxx                                |    4 
 svx/source/inc/fmobj.hxx                                 |    9 +
 svx/source/inc/fmpgeimp.hxx                              |    5 
 svx/source/inc/formcontrolling.hxx                       |   15 --
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx |    4 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx           |   16 +-
 xmloff/source/forms/layerexport.cxx                      |    2 
 xmloff/source/forms/strings.hxx                          |    1 
 51 files changed, 418 insertions(+), 296 deletions(-)

New commits:
commit fe46fc0f27ad5dac188517ff3f76bb1604aeeac1
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Mar 27 16:51:20 2013 +0200

    fdo#46808, remove unnecessary XMultiServiceFactory fields

diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 3e36b09..9bd6570 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -202,12 +202,11 @@ Image FmFilterItems::GetImage() const
 //========================================================================
 TYPEINIT1(FmFilterItem, FmFilterData);
 //------------------------------------------------------------------------
-FmFilterItem::FmFilterItem( const Reference< XMultiServiceFactory >& _rxFactory,
-                            FmFilterItems* pParent,
+FmFilterItem::FmFilterItem( FmFilterItems* pParent,
                             const OUString& aFieldName,
                             const OUString& aText,
                             const sal_Int32 _nComponentIndex )
-          :FmFilterData(_rxFactory,pParent, aText)
+          :FmFilterData(pParent, aText)
           ,m_aFieldName(aFieldName)
           ,m_nComponentIndex( _nComponentIndex )
 {
@@ -465,7 +464,7 @@ void FmFilterAdapter::predicateExpressionChanged( const FilterEvent& _Event ) th
         // searching the component by field name
         OUString aFieldName( lcl_getLabelName_nothrow( xFilterController->getFilterComponent( _Event.FilterComponent ) ) );
 
-        pFilterItem = new FmFilterItem( m_pModel->getORB(), pFilter, aFieldName, _Event.PredicateExpression, _Event.FilterComponent );
+        pFilterItem = new FmFilterItem( pFilter, aFieldName, _Event.PredicateExpression, _Event.FilterComponent );
         m_pModel->Insert(pFilter->GetChildren().end(), pFilterItem);
     }
 
@@ -532,7 +531,7 @@ void SAL_CALL FmFilterAdapter::disjunctiveTermAdded( const FilterEvent& _Event )
 
     const ::std::vector< FmFilterData* >::iterator insertPos = pFormItem->GetChildren().begin() + nInsertPos;
 
-    FmFilterItems* pFilterItems = new FmFilterItems( m_pModel->getORB(), pFormItem, String( SVX_RES( RID_STR_FILTER_FILTER_OR ) ) );
+    FmFilterItems* pFilterItems = new FmFilterItems( pFormItem, String( SVX_RES( RID_STR_FILTER_FILTER_OR ) ) );
     m_pModel->Insert( insertPos, pFilterItems );
 }
 
@@ -541,10 +540,9 @@ void SAL_CALL FmFilterAdapter::disjunctiveTermAdded( const FilterEvent& _Event )
 //========================================================================
 TYPEINIT1(FmFilterModel, FmParentData);
 //------------------------------------------------------------------------
-FmFilterModel::FmFilterModel(const Reference< XMultiServiceFactory >& _rxFactory)
-              :FmParentData(_rxFactory,NULL, OUString())
-              ,OSQLParserClient(comphelper::getComponentContext(_rxFactory))
-              ,m_xORB(_rxFactory)
+FmFilterModel::FmFilterModel()
+              :FmParentData(NULL, OUString())
+              ,OSQLParserClient(comphelper::getProcessComponentContext())
               ,m_pAdapter(NULL)
               ,m_pCurrentItems(NULL)
 {
@@ -630,7 +628,7 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, FmPar
             OSL_VERIFY( xFormProperties->getPropertyValue( FM_PROP_NAME ) >>= aName );
 
             // Insert a new item for the form
-            FmFormItem* pFormItem = new FmFormItem( m_xORB, pParent, xController, aName );
+            FmFormItem* pFormItem = new FmFormItem( pParent, xController, aName );
             Insert( pParent->GetChildren().end(), pFormItem );
 
             Reference< XFilterController > xFilterController( pFormItem->GetFilterController(), UNO_SET_THROW );
@@ -645,7 +643,7 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, FmPar
                 )
             {
                 // we always display one row, even if there's no term to be displayed
-                FmFilterItems* pFilterItems = new FmFilterItems( m_xORB, pFormItem, aTitle );
+                FmFilterItems* pFilterItems = new FmFilterItems( pFormItem, aTitle );
                 Insert( pFormItem->GetChildren().end(), pFilterItems );
 
                 const Sequence< OUString >& rDisjunction( *pConjunctionTerm );
@@ -665,7 +663,7 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, FmPar
                     const OUString sDisplayName( lcl_getLabelName_nothrow( xFilterControl ) );
 
                     // insert a new entry
-                    FmFilterItem* pANDCondition = new FmFilterItem( m_xORB, pFilterItems, sDisplayName, *pDisjunctiveTerm, nComponentIndex );
+                    FmFilterItem* pANDCondition = new FmFilterItem( pFilterItems, sDisplayName, *pDisjunctiveTerm, nComponentIndex );
                     Insert( pFilterItems->GetChildren().end(), pANDCondition );
                 }
 
@@ -888,7 +886,7 @@ sal_Bool FmFilterModel::ValidateText(FmFilterItem* pItem, OUString& rText, OUStr
         // obtain a number formatter for this connection
         // TODO: shouldn't this be cached?
         Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats( xConnection, sal_True );
-        Reference< XNumberFormatter > xFormatter( NumberFormatter::create( comphelper::getComponentContext(m_xORB) ), UNO_QUERY_THROW );
+        Reference< XNumberFormatter > xFormatter( NumberFormatter::create( comphelper::getProcessComponentContext() ), UNO_QUERY_THROW );
         xFormatter->attachNumberFormatsSupplier( xFormatSupplier );
 
         // get the field (database column) which the item is responsible for
@@ -1161,7 +1159,7 @@ FmFilterNavigator::FmFilterNavigator( Window* pParent )
         );
     }
 
-    m_pModel = new FmFilterModel(comphelper::getProcessServiceFactory());
+    m_pModel = new FmFilterModel();
     StartListening( *m_pModel );
 
     EnableInplaceEditing( sal_True );
@@ -1619,7 +1617,7 @@ void FmFilterNavigator::insertFilterItem(const ::std::vector<FmFilterItem*>& _rF
         String aText = pLookupItem->GetText();
         if ( !pFilterItem )
         {
-            pFilterItem = new FmFilterItem( m_pModel->getORB(), _pTargetItems, pLookupItem->GetFieldName(), aText, pLookupItem->GetComponentIndex() );
+            pFilterItem = new FmFilterItem( _pTargetItems, pLookupItem->GetFieldName(), aText, pLookupItem->GetComponentIndex() );
             m_pModel->Append( _pTargetItems, pFilterItem );
         }
 
diff --git a/svx/source/inc/filtnav.hxx b/svx/source/inc/filtnav.hxx
index 79d01cc..a71bacc 100644
--- a/svx/source/inc/filtnav.hxx
+++ b/svx/source/inc/filtnav.hxx
@@ -58,15 +58,13 @@ class FmFilterAdapter;
 //========================================================================
 class FmFilterData
 {
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
     FmParentData*           m_pParent;
     OUString         m_aText;
 
 public:
     TYPEINFO();
-    FmFilterData(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* pParent = NULL, const OUString& rText = OUString())
-        :m_xORB( _rxFactory )
-        ,m_pParent( pParent )
+    FmFilterData(FmParentData* pParent = NULL, const OUString& rText = OUString())
+        :m_pParent( pParent )
         ,m_aText( rText )
     {}
     virtual ~FmFilterData(){}
@@ -86,8 +84,8 @@ protected:
 
 public:
     TYPEINFO();
-    FmParentData(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* pParent, const OUString& rText)
-        : FmFilterData(_rxFactory,pParent, rText)
+    FmParentData(FmParentData* pParent, const OUString& rText)
+        : FmFilterData(pParent, rText)
     {}
     virtual ~FmParentData();
 
@@ -104,10 +102,10 @@ class FmFormItem : public FmParentData
 public:
     TYPEINFO();
 
-    FmFormItem(  const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* _pParent,
+    FmFormItem(  FmParentData* _pParent,
                  const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & _xController,
                  const OUString& _rText)
-        :FmParentData( _rxFactory, _pParent, _rText )
+        :FmParentData( _pParent, _rText )
         ,m_xController( _xController )
         ,m_xFilterController( _xController, ::com::sun::star::uno::UNO_QUERY_THROW )
     {
@@ -127,8 +125,8 @@ class FmFilterItems : public FmParentData
 {
 public:
     TYPEINFO();
-    FmFilterItems(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory):FmParentData(_rxFactory,NULL, OUString()){}
-    FmFilterItems(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmFormItem* pParent, const OUString& rText ):FmParentData(_rxFactory,pParent, rText){}
+    FmFilterItems() : FmParentData(NULL, OUString()) {}
+    FmFilterItems(FmFormItem* pParent, const OUString& rText ) : FmParentData(pParent, rText) {}
 
     FmFilterItem* Find( const ::sal_Int32 _nFilterComponentIndex ) const;
     virtual Image GetImage() const;
@@ -143,7 +141,6 @@ class FmFilterItem : public FmFilterData
 public:
     TYPEINFO();
     FmFilterItem(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,
         FmFilterItems* pParent,
         const OUString& aFieldName,
         const OUString& aCondition,
@@ -165,13 +162,12 @@ class FmFilterModel : public FmParentData
 
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >           m_xControllers;
     ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >    m_xController;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >        m_xORB;
     FmFilterAdapter*        m_pAdapter;
     FmFilterItems*          m_pCurrentItems;
 
 public:
     TYPEINFO();
-    FmFilterModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+    FmFilterModel();
     virtual ~FmFilterModel();
 
     void Update(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers, const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & xCurrent);
@@ -183,7 +179,6 @@ public:
     FmFormItem* GetCurrentForm() const {return m_pCurrentItems ? (FmFormItem*)m_pCurrentItems->GetParent() : NULL;}
     FmFilterItems* GetCurrentItems() const {return m_pCurrentItems;}
     void SetCurrentItems(FmFilterItems* pCurrent);
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; }
 
     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & GetControllers() const {return m_xControllers;}
     const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & GetCurrentController() const {return m_xController;}
commit da0e902ab4b397b90264866c705a2b66412c3d6e
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Mar 27 16:20:37 2013 +0200

    fdo#46808, convert svx::DbGridControl to XComponentContext

diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index acdaecb..fa47c37 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -93,7 +93,7 @@ void UnoDataBrowserView::Construct(const Reference< ::com::sun::star::awt::XCont
         m_xMe = VCLUnoHelper::CreateControlContainer(this);
 
         // create the (UNO-) control
-        m_xGrid = new SbaXGridControl(Reference<XMultiServiceFactory>(getORB()->getServiceManager(), UNO_QUERY_THROW) );
+        m_xGrid = new SbaXGridControl( getORB() );
         OSL_ENSURE(m_xGrid.is(), "UnoDataBrowserView::Construct : could not create a grid control !");
         // in design mode (for the moment)
         m_xGrid->setDesignMode(sal_True);
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 3aac745..973aeca 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -118,7 +118,7 @@ extern "C" void SAL_CALL createRegistryInfo_SbaXGridControl()
 // -------------------------------------------------------------------------
 Reference< XInterface > SAL_CALL SbaXGridControl::Create(const Reference<XMultiServiceFactory >& _rxFactory)
 {
-    return *(new SbaXGridControl(_rxFactory));
+    return *(new SbaXGridControl( comphelper::getComponentContext(_rxFactory) ));
 }
 
 //------------------------------------------------------------------
@@ -151,7 +151,7 @@ Sequence< OUString> SbaXGridControl::getSupportedServiceNames_Static(void) throw
 }
 DBG_NAME(SbaXGridControl );
 //---------------------------------------------------------------------------------------
-SbaXGridControl::SbaXGridControl(const Reference< XMultiServiceFactory >& _rM)
+SbaXGridControl::SbaXGridControl(const Reference< XComponentContext >& _rM)
     : FmXGridControl(_rM)
 {
     DBG_CTOR(SbaXGridControl ,NULL);
@@ -166,7 +166,7 @@ SbaXGridControl::~SbaXGridControl()
 //---------------------------------------------------------------------------------------
 FmXGridPeer* SbaXGridControl::imp_CreatePeer(Window* pParent)
 {
-    FmXGridPeer* pReturn = new SbaXGridPeer(m_xServiceFactory);
+    FmXGridPeer* pReturn = new SbaXGridPeer(m_xContext);
 
     // translate properties into WinBits
     WinBits nStyle = WB_TABSTOP;
@@ -328,7 +328,7 @@ void SAL_CALL SbaXGridControl::dispose(void) throw( RuntimeException )
 //=======================================================================================
 DBG_NAME(SbaXGridPeer )
 //---------------------------------------------------------------------------------------
-SbaXGridPeer::SbaXGridPeer(const Reference< XMultiServiceFactory >& _rM)
+SbaXGridPeer::SbaXGridPeer(const Reference< XComponentContext >& _rM)
 : FmXGridPeer(_rM)
 ,m_aStatusListeners(m_aMutex)
 {
@@ -606,7 +606,7 @@ SbaXGridPeer* SbaXGridPeer::getImplementation(const Reference< XInterface >& _rx
 //---------------------------------------------------------------------------------------
 FmGridControl* SbaXGridPeer::imp_CreateControl(Window* pParent, WinBits nStyle)
 {
-    return new SbaGridControl(m_xServiceFactory, pParent, this, nStyle);
+    return new SbaGridControl( m_xContext, pParent, this, nStyle);
 }
 
 //==================================================================
@@ -772,7 +772,7 @@ void SbaGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupM
 //==================================================================
 DBG_NAME(SbaGridControl );
 //---------------------------------------------------------------------------------------
-SbaGridControl::SbaGridControl(Reference< XMultiServiceFactory > _rM,
+SbaGridControl::SbaGridControl(Reference< XComponentContext > _rM,
                                Window* pParent, FmXGridPeer* _pPeer, WinBits nBits)
     :FmGridControl(_rM,pParent, _pPeer, nBits)
     ,m_pMasterListener(NULL)
@@ -836,7 +836,7 @@ void SbaGridControl::PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu)
 //------------------------------------------------------------------------------
 SvNumberFormatter* SbaGridControl::GetDatasourceFormatter()
 {
-    Reference< ::com::sun::star::util::XNumberFormatsSupplier >  xSupplier = ::dbtools::getNumberFormats(::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)), sal_True, comphelper::getComponentContext(getServiceManager()));
+    Reference< ::com::sun::star::util::XNumberFormatsSupplier >  xSupplier = ::dbtools::getNumberFormats(::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)), sal_True, getContext());
 
     SvNumberFormatsSupplierObj* pSupplierImpl = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
     if ( !pSupplierImpl )
@@ -958,10 +958,8 @@ void SbaGridControl::SetBrowserAttrs()
         Sequence< Any > aDialogArgs(1);
         aDialogArgs[0] <<= aArg;
 
-        Reference< XInterface > xDialog = getServiceManager()->createInstanceWithArguments(
-            OUString("com.sun.star.form.ControlFontDialog"),
-            aDialogArgs
-            );
+        Reference< XComponentContext > xContext = getContext();
+        Reference< XInterface > xDialog = xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.form.ControlFontDialog", aDialogArgs, xContext);
         if (!xDialog.is())
         {
             ShowServiceNotAvailableError(this, OUString("com.sun.star.form.ControlFontDialog"), sal_True);
@@ -1304,7 +1302,7 @@ void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfC
     Reference< XResultSet> xRowSetClone;
     try
     {
-        ODataClipboard* pTransfer = new ODataClipboard( xForm, aSelectedRows, bSelectionBookmarks, comphelper::getComponentContext(getServiceManager()) );
+        ODataClipboard* pTransfer = new ODataClipboard( xForm, aSelectedRows, bSelectionBookmarks, getContext() );
 
         Reference< XTransferable > xEnsureDelete = pTransfer;
         if ( _bTrueIfClipboardFalseIfDrag )
@@ -1555,7 +1553,7 @@ IMPL_LINK(SbaGridControl, AsynchDropEvent, void*, /*EMPTY_ARG*/)
         if ( !bCountFinal )
             setDataSource(NULL); // deattach from grid control
         Reference< XResultSetUpdate > xResultSetUpdate(xDataSource,UNO_QUERY);
-        ODatabaseImportExport* pImExport = new ORowSetImportExport(this,xResultSetUpdate,m_aDataDescriptor, comphelper::getComponentContext(getServiceManager()));
+        ODatabaseImportExport* pImExport = new ORowSetImportExport(this,xResultSetUpdate,m_aDataDescriptor, getContext());
         Reference<XEventListener> xHolder = pImExport;
         Hide();
         try
@@ -1574,7 +1572,7 @@ IMPL_LINK(SbaGridControl, AsynchDropEvent, void*, /*EMPTY_ARG*/)
         {
             AfterDrop();
             Show();
-            ::dbaui::showError(::dbtools::SQLExceptionInfo(e),this,comphelper::getComponentContext(getServiceManager()));
+            ::dbaui::showError( ::dbtools::SQLExceptionInfo(e), this, getContext() );
         }
         catch(const Exception& )
         {
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index 57ad9e7..d930cc0 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -66,7 +66,7 @@ namespace dbaui
         StatusMultiplexerArray      m_aStatusMultiplexer;
 
     public:
-        SbaXGridControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+        SbaXGridControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
         virtual ~SbaXGridControl();
 
         // UNO
@@ -111,7 +111,7 @@ namespace dbaui
         ::cppu::OMultiTypeInterfaceContainerHelperVar< ::com::sun::star::util::URL,SbaURLHash , SbaURLCompare>  m_aStatusListeners;
 
     public:
-        SbaXGridPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+        SbaXGridPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
         virtual ~SbaXGridPeer();
 
         // UNO
@@ -246,7 +246,7 @@ namespace dbaui
         sal_uInt16  GetCurrentActionColumn() const  { return m_nCurrentActionColId; }
 
     public:
-        SbaGridControl(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >,Window* pParent, FmXGridPeer* _pPeer, WinBits nBits = WB_TABSTOP);
+        SbaGridControl(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >,Window* pParent, FmXGridPeer* _pPeer, WinBits nBits = WB_TABSTOP);
         virtual ~SbaGridControl();
 
         virtual void Command( const CommandEvent& rCEvt );
diff --git a/svx/inc/svx/fmgridcl.hxx b/svx/inc/svx/fmgridcl.hxx
index c3f6313..b0d225c 100644
--- a/svx/inc/svx/fmgridcl.hxx
+++ b/svx/inc/svx/fmgridcl.hxx
@@ -105,7 +105,7 @@ class SVX_DLLPUBLIC FmGridControl : public DbGridControl
 
 public:
     FmGridControl(
-        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >,
+        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&,
         Window* pParent,
         FmXGridPeer* _pPeer,
         WinBits nBits);
diff --git a/svx/inc/svx/fmgridif.hxx b/svx/inc/svx/fmgridif.hxx
index 156d5b9..7a1951d 100644
--- a/svx/inc/svx/fmgridif.hxx
+++ b/svx/inc/svx/fmgridif.hxx
@@ -218,10 +218,10 @@ protected:
     sal_uInt16  m_nPeerCreationLevel;
     sal_Bool    m_bInDraw;
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xServiceFactory;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >    m_xContext;
 
 public:
-    FmXGridControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+    FmXGridControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
     virtual ~FmXGridControl();
 
     // UNO connection
@@ -367,11 +367,11 @@ class SVX_DLLPUBLIC FmXGridPeer :public VCLXWindow
     GridListenerDelegator*  m_pGridListener;
 
 protected:
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xServiceFactory;
-    ::osl::Mutex                                                                        m_aMutex;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >    m_xContext;
+    ::osl::Mutex                                                                    m_aMutex;
 
 public:
-    FmXGridPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+    FmXGridPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
     ~FmXGridPeer();
 
     // spaeter Constructor, immer nach dem realen Constructor zu rufen !
diff --git a/svx/inc/svx/gridctrl.hxx b/svx/inc/svx/gridctrl.hxx
index d308a92..9a14635 100644
--- a/svx/inc/svx/gridctrl.hxx
+++ b/svx/inc/svx/gridctrl.hxx
@@ -221,8 +221,8 @@ private:
     Link            m_aMasterStateProvider;
     Link            m_aMasterSlotExecutor;
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >        m_xFormatter;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xServiceFactory;
+    ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >    m_xFormatter;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >    m_xContext;
 
     DbGridColumns   m_aColumns;         // Column description
     NavigationBar   m_aBar;
@@ -365,7 +365,7 @@ protected:
 
 public:
     DbGridControl(
-        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >,
+        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >,
         Window* pParent,
         WinBits nBits = WB_BORDER);
 
@@ -496,8 +496,8 @@ public:
     */
     void        ForceHideScrollbars( sal_Bool _bForce );
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
-        getServiceManager() const { return m_xServiceFactory; }
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+        getContext() const { return m_xContext; }
 
     /// returns <TRUE/> if the text of the given cell can be copied into the clipboard
     sal_Bool    canCopyCellText(sal_Int32 _nRow, sal_Int16 _nColId);
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index b3c259d..a864db3 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -285,8 +285,8 @@ sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt )
             try
             {
                 OUString sSignificantSource( sDatasouce.isEmpty() ? sDatabaseLocation : sDatasouce );
-                xConnection = OStaticDataAccessTools().getConnection_withFeedback(sSignificantSource, OUString(),OUString(),
-                                  comphelper::getComponentContext( static_cast<FmGridControl*>(GetParent())->getServiceManager() ));
+                xConnection = OStaticDataAccessTools().getConnection_withFeedback(sSignificantSource, OUString(), OUString(),
+                                  static_cast<FmGridControl*>(GetParent())->getContext() );
             }
             catch(NoSuchElementException&)
             {   // allowed, means sDatasouce isn't a valid data source name ....
@@ -1017,11 +1017,11 @@ void FmGridHeader::Command(const CommandEvent& rEvt)
 
 //------------------------------------------------------------------------------
 FmGridControl::FmGridControl(
-                Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxFactory,
+                const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
                 Window* pParent,
                 FmXGridPeer* _pPeer,
                 WinBits nBits)
-        :DbGridControl(_rxFactory, pParent, nBits)
+        :DbGridControl(_rxContext, pParent, nBits)
         ,m_pPeer(_pPeer)
         ,m_nCurrentSelectedColumn(-1)
         ,m_nMarkedColumnId(BROWSER_INVALIDID)
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index d202afc..53781d2 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -351,11 +351,11 @@ void SAL_CALL FmXGridControlMultiplexer::columnChanged( const EventObject& _even
 //------------------------------------------------------------------
 Reference< XInterface > SAL_CALL FmXGridControl_NewInstance_Impl(const Reference< XMultiServiceFactory>& _rxFactory)
 {
-    return *(new FmXGridControl(_rxFactory));
+    return *(new FmXGridControl( comphelper::getComponentContext(_rxFactory) ));
 }
 DBG_NAME(FmXGridControl )
 //------------------------------------------------------------------------------
-FmXGridControl::FmXGridControl(const Reference< XMultiServiceFactory >& _rxFactory)
+FmXGridControl::FmXGridControl(const Reference< XComponentContext >& _rxContext)
                :UnoControl()
                ,m_aModifyListeners(*this, GetMutex())
                ,m_aUpdateListeners(*this, GetMutex())
@@ -364,7 +364,7 @@ FmXGridControl::FmXGridControl(const Reference< XMultiServiceFactory >& _rxFacto
                ,m_aGridControlListeners(*this, GetMutex())
                ,m_nPeerCreationLevel(0)
                ,m_bInDraw(sal_False)
-               ,m_xServiceFactory(_rxFactory)
+               ,m_xContext(_rxContext)
 {
     DBG_CTOR(FmXGridControl ,NULL);
 }
@@ -475,7 +475,7 @@ sal_Bool SAL_CALL FmXGridControl::setModel(const Reference< ::com::sun::star::aw
 //------------------------------------------------------------------------------
 FmXGridPeer* FmXGridControl::imp_CreatePeer(Window* pParent)
 {
-    FmXGridPeer* pReturn = new FmXGridPeer(m_xServiceFactory);
+    FmXGridPeer* pReturn = new FmXGridPeer(m_xContext);
 
     // translate properties into WinBits
     WinBits nStyle = WB_TABSTOP;
@@ -1057,7 +1057,7 @@ void FmXGridPeer::GridListenerDelegator::columnChanged()
 //------------------------------------------------------------------
 Reference< XInterface >  FmXGridPeer_CreateInstance(const Reference< XMultiServiceFactory>& _rxFactory)
 {
-    FmXGridPeer* pNewObject = new FmXGridPeer(_rxFactory);
+    FmXGridPeer* pNewObject = new FmXGridPeer( comphelper::getComponentContext(_rxFactory) );
     pNewObject->Create(NULL, WB_TABSTOP);
     return *pNewObject;
 }
@@ -1122,7 +1122,7 @@ namespace fmgridif
 using namespace fmgridif;
 
 //------------------------------------------------------------------
-FmXGridPeer::FmXGridPeer(const Reference< XMultiServiceFactory >& _rxFactory)
+FmXGridPeer::FmXGridPeer(const Reference< XComponentContext >& _rxContext)
             :m_aModifyListeners(m_aMutex)
             ,m_aUpdateListeners(m_aMutex)
             ,m_aContainerListeners(m_aMutex)
@@ -1134,7 +1134,7 @@ FmXGridPeer::FmXGridPeer(const Reference< XMultiServiceFactory >& _rxFactory)
             ,m_pStateCache(NULL)
             ,m_pDispatchers(NULL)
             ,m_pGridListener(NULL)
-            ,m_xServiceFactory(_rxFactory)
+            ,m_xContext(_rxContext)
 {
     // Create must be called after this constructure
     m_pGridListener = new GridListenerDelegator( this );
@@ -1143,7 +1143,7 @@ FmXGridPeer::FmXGridPeer(const Reference< XMultiServiceFactory >& _rxFactory)
 //------------------------------------------------------------------------------
 FmGridControl* FmXGridPeer::imp_CreateControl(Window* pParent, WinBits nStyle)
 {
-    return new FmGridControl(m_xServiceFactory, pParent, this, nStyle);
+    return new FmGridControl(m_xContext, pParent, this, nStyle);
 }
 
 //------------------------------------------------------------------------------
@@ -1826,7 +1826,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeExcep
     if (::comphelper::getBOOL(aHidden))
         pGrid->HideColumn(pCol->GetId());
 
-    FormControlFactory( m_xServiceFactory ).initializeTextFieldLineEnds( xNewColumn );
+    FormControlFactory( m_xContext ).initializeTextFieldLineEnds( xNewColumn );
 }
 
 //------------------------------------------------------------------------------
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index dae1f8d..f7dcf11 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -178,7 +178,7 @@ void DbGridColumn::CreateControl(sal_Int32 _nFieldPos, const Reference< ::com::s
     DbCellControl* pCellControl = NULL;
     if (m_rParent.IsFilterMode())
     {
-        pCellControl = new DbFilterField(comphelper::getComponentContext(m_rParent.getServiceManager()),*this);
+        pCellControl = new DbFilterField(m_rParent.getContext(),*this);
     }
     else
     {
@@ -191,7 +191,7 @@ void DbGridColumn::CreateControl(sal_Int32 _nFieldPos, const Reference< ::com::s
             case TYPE_DATEFIELD: pCellControl = new DbDateField(*this); break;
             case TYPE_LISTBOX: pCellControl = new DbListBox(*this); break;
             case TYPE_NUMERICFIELD: pCellControl = new DbNumericField(*this); break;
-            case TYPE_PATTERNFIELD: pCellControl = new DbPatternField( *this, ::comphelper::ComponentContext( m_rParent.getServiceManager() ) ); break;
+            case TYPE_PATTERNFIELD: pCellControl = new DbPatternField( *this, m_rParent.getContext() ); break;
             case TYPE_TEXTFIELD: pCellControl = new DbTextField(*this); break;
             case TYPE_TIMEFIELD: pCellControl = new DbTimeField(*this); break;
             case TYPE_FORMATTEDFIELD: pCellControl = new DbFormattedField(*this); break;
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 64bf734..83358a7 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -904,11 +904,11 @@ void DbGridRow::SetState(CursorWrapper* pCur, sal_Bool bPaintCursor)
 DBG_NAME(DbGridControl);
 //------------------------------------------------------------------------------
 DbGridControl::DbGridControl(
-                Reference< XMultiServiceFactory > _rxFactory,
+                Reference< XComponentContext > _rxContext,
                 Window* pParent,
                 WinBits nBits)
             :DbGridControl_Base(pParent, EBBF_NONE, nBits, DEFAULT_BROWSE_MODE )
-            ,m_xServiceFactory(_rxFactory)
+            ,m_xContext(_rxContext)
             ,m_aBar(this)
             ,m_nAsynAdjustEvent(0)
             ,m_pDataSourcePropMultiplexer(NULL)
@@ -1448,7 +1448,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt
     if (xSupplier.is())
     {
         m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(
-            ::com::sun::star::util::NumberFormatter::create(comphelper::getComponentContext(m_xServiceFactory)),
+            ::com::sun::star::util::NumberFormatter::create(m_xContext),
             UNO_QUERY);
         m_xFormatter->attachNumberFormatsSupplier(xSupplier);
 
commit 1165aac95b8e44f41fc16a44bfec4c1c05801ac8
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Mar 27 14:20:45 2013 +0200

    fdo#46808, convert form::Forms to new style
    
    Change-Id: I966ed18d45dc8a04c97a703d3c83382714025f2c

diff --git a/forms/source/component/FormsCollection.cxx b/forms/source/component/FormsCollection.cxx
index f1dfbd6..1da85ce 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 c6c5858..8c92e7b 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 57c1877..dc5d4c3 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 dfbd656..29e173c 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 b43877b..cae76f6 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 196e18c..2b86048 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 0000000..4571d9c
--- /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
index ecd1b60..097590f 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/svx/inc/svx/fmpage.hxx b/svx/inc/svx/fmpage.hxx
index 548bdb6..ba3bdd1 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 5d239f5..76d1c97 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 474f8ab..b84f8b6 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 5f0641a..3494930 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 3243c23..507e229 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 at sun.com", "FmFormPage::GetForms" );
     const SdrPage& rMasterPage( *this );
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index 6d46e64..ab7c9d5 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 at 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 at 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 20b924b..29ef91a 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 4187473..a5c7d96 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 at 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 at 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 at 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 3221e64..9b12650 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 1b20fe4..67e4adf 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 5bbd02a..5e77e56 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 db53cc0..57a3ad0 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 2b065c7..c880662 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 3aa9990..51c5621 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"
commit 9ffb86c7e93c1633866ed89f0749831fd7f31a35
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Mar 27 10:41:40 2013 +0200

    fdo#46808, convert drawing::ColorTable to new style
    
    The service already existed, it just needed an IDL file.

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3ad428a..b43877b 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -116,6 +116,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\
 	XMLOasisBasicImporter \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\
+	ColorTable \
 	GraphicExportFilter \
 	ModuleDispatcher \
 	ShapeCollection \
diff --git a/offapi/com/sun/star/drawing/ColorTable.idl b/offapi/com/sun/star/drawing/ColorTable.idl
new file mode 100644
index 0000000..3b9bcdd
--- /dev/null
+++ b/offapi/com/sun/star/drawing/ColorTable.idl
@@ -0,0 +1,38 @@
+/* -*- 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_drawing_ColorTable_idl__
+#define __com_sun_star_drawing_ColorTable_idl__
+
+#include <com/sun/star/container/XNameContainer.idl>
+
+
+module com { module sun { module star { module drawing {
+
+
+/**
+    @since LibreOffice 4.1
+ */
+published service ColorTable : com::sun::star::container::XNameContainer;
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/accessibility/lookupcolorname.cxx b/svx/source/accessibility/lookupcolorname.cxx
index d0805d2..b31f8f9 100644
--- a/svx/source/accessibility/lookupcolorname.cxx
+++ b/svx/source/accessibility/lookupcolorname.cxx
@@ -23,6 +23,7 @@
 #include "boost/unordered_map.hpp"
 #include "com/sun/star/container/XNameAccess.hpp"
 #include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/drawing/ColorTable.hpp"
 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
 #include "com/sun/star/uno/Any.hxx"
 #include "com/sun/star/uno/Reference.hxx"
@@ -54,19 +55,15 @@ ColorNameMap::ColorNameMap() {
     try
     {
         // Create color table in which to look up the given color.
-        css::uno::Reference< css::container::XNameContainer > xColorTable (
-            comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.drawing.ColorTable" ),
-            css::uno::UNO_QUERY);
+            css::uno::Reference< css::container::XNameContainer > xColorTable =
+                 css::drawing::ColorTable::create( comphelper::getProcessComponentContext() );
 
         // Get list of color names in order to iterate over the color table.
-        xNA = css::uno::Reference< css::container::XNameAccess >(xColorTable, css::uno::UNO_QUERY);
-        if (xNA.is())
-        {
-            // Lock the solar mutex here as workarround for missing lock in
-            // called function.
-            SolarMutexGuard aGuard;
-            aNames = xNA->getElementNames();
-        }
+
+        // Lock the solar mutex here as workarround for missing lock in
+        // called function.
+        SolarMutexGuard aGuard;
+        aNames = xNA->getElementNames();
     }
     catch (css::uno::RuntimeException const&)
     {
commit 1dec1f2f7efc579dedaec0535e3a750945039019
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 26 15:15:19 2013 +0200

    fdo#46808, convert framework::AddonsToolBarWrapper to XComponentContext

diff --git a/framework/inc/uielement/addonstoolbarwrapper.hxx b/framework/inc/uielement/addonstoolbarwrapper.hxx
index d73c67b..34d80ae 100644
--- a/framework/inc/uielement/addonstoolbarwrapper.hxx
+++ b/framework/inc/uielement/addonstoolbarwrapper.hxx
@@ -24,7 +24,7 @@
 
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 namespace framework
 {
@@ -33,7 +33,7 @@ class AddonsToolBarManager;
 class AddonsToolBarWrapper : public UIElementWrapperBase
 {
     public:
-        AddonsToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+        AddonsToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext );
         virtual ~AddonsToolBarWrapper();
 
         // XComponent
@@ -49,7 +49,7 @@ class AddonsToolBarWrapper : public UIElementWrapperBase
     //  protected methods
     //-------------------------------------------------------------------------------------------------------------
     private:
-        com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >                             m_xServiceManager;
+        com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >                                 m_xContext;
         com::sun::star::uno::Reference< com::sun::star::lang::XComponent >                                       m_xToolBarManager;
         com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aConfigData;
 };
diff --git a/framework/inc/uifactory/addonstoolboxfactory.hxx b/framework/inc/uifactory/addonstoolboxfactory.hxx
index 7f0c377..920a4ed 100644
--- a/framework/inc/uifactory/addonstoolboxfactory.hxx
+++ b/framework/inc/uifactory/addonstoolboxfactory.hxx
@@ -30,7 +30,6 @@
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/ui/XUIElementFactory.hpp>
 #include <com/sun/star/frame/XModuleManager2.hpp>
@@ -48,7 +47,7 @@ class AddonsToolBoxFactory :  protected ThreadHelpBase
                                                               com::sun::star::ui::XUIElementFactory >
 {
     public:
-        AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+        AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
         virtual ~AddonsToolBoxFactory();
 
         //  XInterface, XTypeProvider, XServiceInfo
@@ -61,7 +60,7 @@ class AddonsToolBoxFactory :  protected ThreadHelpBase
                                       const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
 
     private:
-        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >     m_xContext;
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >     m_xModuleManager;
 };
 
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 2921b02..3153b2a 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -53,9 +53,9 @@ using namespace ::com::sun::star::ui;
 namespace framework
 {
 
-AddonsToolBarWrapper::AddonsToolBarWrapper( const Reference< XMultiServiceFactory >& xServiceManager ) :
+AddonsToolBarWrapper::AddonsToolBarWrapper( const Reference< XComponentContext >& xContext ) :
     UIElementWrapperBase( UIElementType::TOOLBAR ),
-    m_xServiceManager( xServiceManager )
+    m_xContext( xContext )
 {
 }
 
@@ -116,7 +116,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument
                     sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
 
                     pToolBar = new ToolBox( pWindow, nStyles );
-                    pToolBarManager = new AddonsToolBarManager( comphelper::getComponentContext(m_xServiceManager), xFrame, m_aResourceURL, pToolBar );
+                    pToolBarManager = new AddonsToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
                     m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
                 }
             }
diff --git a/framework/source/uifactory/addonstoolboxfactory.cxx b/framework/source/uifactory/addonstoolboxfactory.cxx
index 823ca67..990f32d 100644
--- a/framework/source/uifactory/addonstoolboxfactory.cxx
+++ b/framework/source/uifactory/addonstoolboxfactory.cxx
@@ -51,19 +51,19 @@ namespace framework
 //*****************************************************************************************************************
 //  XInterface, XTypeProvider, XServiceInfo
 //*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE  (   AddonsToolBoxFactory                            ,
-                                            ::cppu::OWeakObject                             ,
-                                            SERVICENAME_TOOLBARFACTORY                      ,
-                                            IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY
-                                        )
+PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( AddonsToolBoxFactory,
+                                      ::cppu::OWeakObject,
+                                      SERVICENAME_TOOLBARFACTORY,
+                                      IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY )
+PRIVATE_DEFINE_ONEINSTANCEFACTORY( AddonsToolBoxFactory )
 
 DEFINE_INIT_SERVICE                     (   AddonsToolBoxFactory, {} )
 
 AddonsToolBoxFactory::AddonsToolBoxFactory(
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) :
+    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
     ThreadHelpBase( &Application::GetSolarMutex() )
-    , m_xServiceManager( xServiceManager )
-    , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) )
+    , m_xContext( xContext )
+    , m_xModuleManager( ModuleManager::create( xContext ) )
 {
 }
 
@@ -186,7 +186,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
         aPropSeq[2] <<= aPropValue;
 
         SolarMutexGuard aGuard;
-        AddonsToolBarWrapper* pToolBarWrapper = new AddonsToolBarWrapper( m_xServiceManager );
+        AddonsToolBarWrapper* pToolBarWrapper = new AddonsToolBarWrapper( m_xContext );
         xToolBar = Reference< ::com::sun::star::ui::XUIElement >( (OWeakObject *)pToolBarWrapper, UNO_QUERY );
         Reference< XInitialization > xInit( xToolBar, UNO_QUERY );
         xInit->initialize( aPropSeq );
commit dbb4d4dd98c623c5c9309961ebb0548898b111e1
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 26 14:58:58 2013 +0200

    fdo#46808, convert svx::FindTextFieldControl to XComponentContext

diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index b15c2c5..23eb22f 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -47,7 +47,7 @@ class FindTextFieldControl : public ComboBox
 public:
     FindTextFieldControl( Window* pParent, WinBits nStyle,
         css::uno::Reference< css::frame::XFrame >& xFrame,
-        const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
+        const css::uno::Reference< css::uno::XComponentContext >& xContext );
     virtual ~FindTextFieldControl();
 
     virtual long PreNotify( NotifyEvent& rNEvt );
@@ -58,7 +58,7 @@ public:
 private:
 
     css::uno::Reference< css::frame::XFrame > m_xFrame;
-    css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager;
+    css::uno::Reference< css::uno::XComponentContext > m_xContext;
 };
 
 class SearchToolbarControllersManager
@@ -225,7 +225,7 @@ class FindbarDispatcher : public css::lang::XServiceInfo,
 {
 public:
 
-    FindbarDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
+    FindbarDispatcher();
     virtual ~FindbarDispatcher();
 
     // XInterface
@@ -259,7 +259,6 @@ public:
 
 private:
 
-    css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
     css::uno::Reference< css::frame::XFrame > m_xFrame;
 
 };
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index cac328b..ad15872 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -70,10 +70,10 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
 
 FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle,
     css::uno::Reference< css::frame::XFrame >& xFrame,
-    const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) :
+    const css::uno::Reference< css::uno::XComponentContext >& xContext) :
     ComboBox( pParent, nStyle ),
     m_xFrame(xFrame),
-    m_xServiceManager(xServiceManager)
+    m_xContext(xContext)
 {
     SetPlaceholderText(SVX_RESSTR(RID_SVXSTR_FINDBAR_FIND));
     EnableAutocomplete(sal_True, sal_True);
@@ -178,7 +178,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
                 lArgs[2].Name = OUString(SEARCHITEM_SEARCHFLAGS);
                 lArgs[2].Value <<= (sal_Int32)0;
 
-                impl_executeSearch( comphelper::getComponentContext(m_xServiceManager), m_xFrame, lArgs);
+                impl_executeSearch( m_xContext, m_xFrame, lArgs);
                 nRet = 1;
             }
             break;
@@ -420,7 +420,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::cre
     if ( pParent )
     {
         ToolBox* pToolbar =  ( ToolBox* )pParent;
-        m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, css::uno::Reference<css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW)  );
+        m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext  );
 
         Size aSize(250, m_pFindTextFieldControl->GetTextHeight() + 200);
         m_pFindTextFieldControl->SetSizePixel( aSize );
@@ -720,14 +720,12 @@ void SAL_CALL ExitSearchToolboxController::statusChanged( const css::frame::Feat
 //-----------------------------------------------------------------------------------------------------------
 // class FindbarDispatcher
 
-FindbarDispatcher::FindbarDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory)
-    : m_xFactory( xFactory )
+FindbarDispatcher::FindbarDispatcher()
 {
 }
 
 FindbarDispatcher::~FindbarDispatcher()
 {
-    m_xFactory = NULL;
     m_xFrame = NULL;
 }
 
@@ -907,9 +905,9 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ExitFindbarToolboxControlle
 }
 
 css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance(
-    const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
+    const css::uno::Reference< css::lang::XMultiServiceFactory >&  )
 {
-    return static_cast< cppu::OWeakObject * >( new FindbarDispatcher( rSMgr ) );
+    return static_cast< cppu::OWeakObject * >( new FindbarDispatcher );
 }
 
 //-----------------------------------------------------------------------------------------------------------
commit 6dd58cd811f888aa2158242f08bed5ce9e8fd340
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 26 14:42:37 2013 +0200

    fdo#46808, remove unnecessary XMultiServiceFactory from svx::ControllerFeatures
    
    all of the callers sites are using getProcessServiceFactory(),
    so no need to store it in instance field

diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 013861e..6beaa7b 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -645,8 +645,8 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame )
         ,m_nActivationEvent( 0 )
         ,m_pShell( &_rShell )
         ,m_pTextShell( new ::svx::FmTextControlShell( _pViewFrame ) )
-        ,m_aActiveControllerFeatures( ::comphelper::getProcessServiceFactory(), this )
-        ,m_aNavControllerFeatures( ::comphelper::getProcessServiceFactory(), this )
+        ,m_aActiveControllerFeatures( this )
+        ,m_aNavControllerFeatures( this )
         ,m_eDocumentType( eUnknownDocumentType )
         ,m_nLockSlotInvalidation( 0 )
         ,m_bHadPropertyBrowserInDesignMode( sal_False )
@@ -3266,7 +3266,7 @@ void FmXFormShell::CreateExternalView()
             if ( m_xExternalViewController == getActiveController() )
             {
                 Reference< runtime::XFormController > xAsFormController( m_xExternalViewController, UNO_QUERY );
-                ControllerFeatures aHelper( ::comphelper::getProcessServiceFactory(), xAsFormController, NULL );
+                ControllerFeatures aHelper( xAsFormController, NULL );
                 aHelper->commitCurrentControl();
             }
 
diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx
index b86a381..b344483 100644
--- a/svx/source/form/formcontrolling.cxx
+++ b/svx/source/form/formcontrolling.cxx
@@ -32,6 +32,7 @@
 
 #include <tools/diagnose_ex.h>
 #include <comphelper/anytostring.hxx>
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <osl/diagnose.h>
 
@@ -44,7 +45,7 @@ namespace svx
 //........................................................................
 
     using ::com::sun::star::uno::Reference;
-    using ::com::sun::star::lang::XMultiServiceFactory;
+    using ::com::sun::star::uno::XComponentContext;
     using ::com::sun::star::form::runtime::XFormController;
     using ::com::sun::star::form::XForm;
     using ::com::sun::star::form::runtime::FormOperations;
@@ -195,18 +196,15 @@ namespace svx
     //= ControllerFeatures
     //====================================================================
     //--------------------------------------------------------------------
-    ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB, IControllerFeatureInvalidation* _pInvalidationCallback )
-        :m_aContext( _rxORB )
-        ,m_pInvalidationCallback( _pInvalidationCallback )
+    ControllerFeatures::ControllerFeatures( IControllerFeatureInvalidation* _pInvalidationCallback )
+        :m_pInvalidationCallback( _pInvalidationCallback )
         ,m_pImpl( NULL )
     {
     }
 
     //--------------------------------------------------------------------
-    ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
-            const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
-        :m_aContext( _rxORB )
-        ,m_pInvalidationCallback( _pInvalidationCallback )
+    ControllerFeatures::ControllerFeatures( const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
+        :m_pInvalidationCallback( _pInvalidationCallback )
         ,m_pImpl( NULL )
     {
         assign( _rxController );
@@ -216,7 +214,7 @@ namespace svx
     void ControllerFeatures::assign( const Reference< XFormController >& _rxController )
     {
         dispose();
-        m_pImpl = new FormControllerHelper( m_aContext, _rxController, m_pInvalidationCallback );
+        m_pImpl = new FormControllerHelper( _rxController, m_pInvalidationCallback );
         m_pImpl->acquire();
     }
 
@@ -241,15 +239,13 @@ namespace svx
     //= FormControllerHelper
     //====================================================================
     //--------------------------------------------------------------------
-    FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
-            const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
-        :m_aContext( _rContext )
-        ,m_pInvalidationCallback( _pInvalidationCallback )
+    FormControllerHelper::FormControllerHelper( const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
+        :m_pInvalidationCallback( _pInvalidationCallback )
     {
         osl_atomic_increment( &m_refCount );
         try
         {
-            m_xFormOperations = FormOperations::createWithFormController( m_aContext.getUNOContext(), _rxController );
+            m_xFormOperations = FormOperations::createWithFormController( comphelper::getProcessComponentContext(), _rxController );
             if ( m_xFormOperations.is() )
                 m_xFormOperations->setFeatureInvalidation( this );
 
diff --git a/svx/source/inc/formcontrolling.hxx b/svx/source/inc/formcontrolling.hxx
index 7f08fbe..065a7c0 100644
--- a/svx/source/inc/formcontrolling.hxx
+++ b/svx/source/inc/formcontrolling.hxx
@@ -22,13 +22,11 @@
 
 #include <com/sun/star/form/runtime/XFormController.hpp>
 #include <com/sun/star/form/XForm.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/form/runtime/FeatureState.hpp>
 #include <com/sun/star/form/runtime/XFormOperations.hpp>
 #include <com/sun/star/sdb/XSQLErrorListener.hpp>
 
 #include <cppuhelper/implbase2.hxx>
-#include <comphelper/componentcontext.hxx>
 
 #include <vector>
 
@@ -83,7 +81,6 @@ namespace svx
     class ControllerFeatures
     {
     protected:
-        ::comphelper::ComponentContext  m_aContext;
         IControllerFeatureInvalidation* m_pInvalidationCallback;    // necessary as long as m_pImpl is not yet constructed
         FormControllerHelper*           m_pImpl;
 
@@ -92,22 +89,15 @@ namespace svx
 
             The instance is not functional until <method>assign</method> is used.
 
-            @param _rxORB
-                a multi service factory for creating various needed components
-
             @param _pInvalidationCallback
                 the callback for invalidating feature states
         */
         ControllerFeatures(
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
             IControllerFeatureInvalidation* _pInvalidationCallback
         );
 
         /** constructs the instance from a <type scope="com::sun::star::form::runtime">XFormController<type> instance
 
-            @param _rxORB
-                a multi service factory for creating various needed components
-
             @param _rxController
                 The form controller which the helper should be responsible for. Must not
                 be <NULL/>, and must have a valid model (form).
@@ -116,7 +106,6 @@ namespace svx
                 the callback for invalidating feature states
         */
         ControllerFeatures(
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
             const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController,
             IControllerFeatureInvalidation* _pInvalidationCallback
         );
@@ -159,7 +148,6 @@ namespace svx
     class FormControllerHelper : public FormControllerHelper_Base
     {
     protected:
-        ::comphelper::ComponentContext  m_aContext;
         IControllerFeatureInvalidation* m_pInvalidationCallback;
         ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
                                         m_xFormOperations;
@@ -169,8 +157,6 @@ namespace svx
     public:
         /** constructs the helper from a <type scope="com::sun::star::form::runtime">XFormController<type> instance
 
-            @param _rContext
-                the context the component lives in
             @param _rxController
                 The form controller which the helper should be responsible for. Must not
                 be <NULL/>, and must have a valid model (form).
@@ -178,7 +164,6 @@ namespace svx
                 the callback for invalidating feature states
         */
         FormControllerHelper(
-            const ::comphelper::ComponentContext& _rContext,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list