[Libreoffice-commits] .: 8 commits - comphelper/inc comphelper/source cui/source desktop/source embeddedobj/source framework/inc framework/source offapi/com offapi/UnoApi_offapi.mk sdext/source sd/source sfx2/inc sfx2/source svtools/inc svtools/source vbahelper/source vcl/inc vcl/Library_vcl.mk vcl/source vcl/vcl.android.component vcl/vcl.headless.component vcl/vcl.ios.component vcl/vcl.macosx.component vcl/vcl.unx.component vcl/vcl.windows.component vcl/win

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 12 22:06:53 PST 2012


 comphelper/inc/comphelper/storagehelper.hxx                      |   10 
 comphelper/source/misc/storagehelper.cxx                         |   27 
 cui/source/customize/acccfg.cxx                                  |    4 
 cui/source/customize/cfg.cxx                                     |   30 
 cui/source/inc/cfg.hxx                                           |    5 
 desktop/source/app/app.cxx                                       |  108 +-
 embeddedobj/source/general/docholder.cxx                         |   21 
 framework/inc/services.h                                         |    7 
 framework/inc/services/layoutmanager.hxx                         |    4 
 framework/inc/uifactory/menubarfactory.hxx                       |    2 
 framework/inc/uifactory/uielementfactorymanager.hxx              |   10 
 framework/source/accelerators/globalacceleratorconfiguration.cxx |    2 
 framework/source/accelerators/presethandler.cxx                  |    5 
 framework/source/layoutmanager/layoutmanager.cxx                 |   34 
 framework/source/uiconfiguration/moduleuicfgsupplier.cxx         |    2 
 framework/source/uiconfiguration/windowstateconfiguration.cxx    |    2 
 framework/source/uielement/menubarmanager.cxx                    |   17 
 framework/source/uielement/newmenucontroller.cxx                 |   12 
 framework/source/uielement/toolbarmanager.cxx                    |   17 
 framework/source/uielement/toolbarsmenucontroller.cxx            |   54 -
 framework/source/uifactory/menubarfactory.cxx                    |   10 
 framework/source/uifactory/statusbarfactory.cxx                  |    2 
 framework/source/uifactory/toolboxfactory.cxx                    |    2 
 framework/source/uifactory/uielementfactorymanager.cxx           |    2 
 framework/source/uifactory/windowcontentfactorymanager.cxx       |    2 
 offapi/UnoApi_offapi.mk                                          |    6 
 offapi/com/sun/star/ui/GlobalAcceleratorConfiguration.idl        |    3 
 offapi/com/sun/star/ui/UIElementFactoryManager.idl               |   26 
 offapi/com/sun/star/ui/WindowContentFactoryManager.idl           |   39 +
 offapi/com/sun/star/ui/WindowStateConfiguration.idl              |   29 
 offapi/com/sun/star/ui/XUIElementFactoryManager.idl              |   57 +
 sd/source/ui/dlg/present.cxx                                     |   20 
 sd/source/ui/slideshow/SlideShowRestarter.cxx                    |   22 
 sd/source/ui/slideshow/slideshow.cxx                             |   23 
 sdext/source/presenter/PresenterScreen.cxx                       |   26 
 sdext/source/presenter/PresenterScreen.hxx                       |    4 
 sfx2/inc/sfx2/tbxctrl.hxx                                        |    4 
 sfx2/source/dialog/dockwin.cxx                                   |  135 +--
 sfx2/source/dialog/taskpane.cxx                                  |    6 
 sfx2/source/doc/DocumentMetadataAccess.cxx                       |    8 
 sfx2/source/toolbox/tbxitem.cxx                                  |   26 
 svtools/inc/svtools/acceleratorexecute.hxx                       |    5 
 svtools/source/misc/acceleratorexecute.cxx                       |   20 
 vbahelper/source/vbahelper/vbacommandbarhelper.cxx               |    5 
 vcl/Library_vcl.mk                                               |    1 
 vcl/inc/vcl/svapp.hxx                                            |    8 
 vcl/source/app/svapp.cxx                                         |   23 
 vcl/source/components/display.cxx                                |  363 ----------
 vcl/source/components/factory.cxx                                |   10 
 vcl/vcl.android.component                                        |    3 
 vcl/vcl.headless.component                                       |    3 
 vcl/vcl.ios.component                                            |    3 
 vcl/vcl.macosx.component                                         |    3 
 vcl/vcl.unx.component                                            |    3 
 vcl/vcl.windows.component                                        |    3 
 vcl/win/source/window/salframe.cxx                               |   41 -
 56 files changed, 428 insertions(+), 891 deletions(-)

New commits:
commit dde234b6955a421d51d2b37e4fc3972c660146f0
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Dec 11 14:59:39 2012 +0200

    fdo#46808, remove awt::DisplayAccess service.
    
    This service was never documented in an IDL file.
    All it did was provide a wrapper around some VCL module API.
    Now that we can link the VCL stuff into SD and SDEXT, just
    access the API directly.
    
    Change-Id: Ic0ba34c2bca797baa7319878d98cfe3a4ec59d4d

diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index c7e63d8..f30eb5e 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -64,6 +64,7 @@
 #include <com/sun/star/embed/EmbedStates.hpp>
 #include <osl/diagnose.h>
 #include <rtl/process.h>
+#include <vcl/svapp.hxx>
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/namedvaluecollection.hxx>
@@ -910,26 +911,20 @@ uno::Reference< frame::XFrame > DocumentHolder::GetDocFrame()
 
         if( xHWindow.is() )
         {
-            uno::Reference< beans::XPropertySet > xMonProps( m_xFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), uno::UNO_QUERY_THROW );
-            const rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) );
-            sal_Int32 nDisplay = 0;
-            xMonProps->getPropertyValue( sPropName ) >>= nDisplay;
-
-            uno::Reference< container::XIndexAccess > xMultiMon( xMonProps, uno::UNO_QUERY_THROW );
-            uno::Reference< beans::XPropertySet > xMonitor( xMultiMon->getByIndex( nDisplay ), uno::UNO_QUERY_THROW );
-            awt::Rectangle aWorkRect;
-            xMonitor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WorkArea" ) ) ) >>= aWorkRect;
+            sal_Int32 nDisplay = Application::GetDisplayBuiltInScreen();
+
+            Rectangle aWorkRect = Application::GetWorkAreaPosSizePixel( nDisplay );
             awt::Rectangle aWindowRect = xHWindow->getPosSize();
 
-            if (( aWindowRect.Width < aWorkRect.Width) && ( aWindowRect.Height < aWorkRect.Height ))
+            if (( aWindowRect.Width < aWorkRect.GetWidth()) && ( aWindowRect.Height < aWorkRect.GetHeight() ))
             {
-                int OffsetX = ( aWorkRect.Width - aWindowRect.Width ) / 2 + aWorkRect.X;
-                int OffsetY = ( aWorkRect.Height - aWindowRect.Height ) /2 + aWorkRect.Y;
+                int OffsetX = ( aWorkRect.GetWidth() - aWindowRect.Width ) / 2 + aWorkRect.Left();
+                int OffsetY = ( aWorkRect.GetHeight() - aWindowRect.Height ) /2 + aWorkRect.Top();
                 xHWindow->setPosSize( OffsetX, OffsetY, aWindowRect.Width, aWindowRect.Height, awt::PosSize::POS );
             }
             else
             {
-                xHWindow->setPosSize( aWorkRect.X, aWorkRect.Y, aWorkRect.Width, aWorkRect.Height, awt::PosSize::POSSIZE );
+                xHWindow->setPosSize( aWorkRect.Left(), aWorkRect.Top(), aWorkRect.GetWidth(), aWorkRect.GetHeight(), awt::PosSize::POSSIZE );
             }
 
             xHWindow->setVisible( sal_True );
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 7ab2c83..e815122 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -80,7 +80,6 @@ namespace framework{
 #define SERVICENAME_STRINGABBREVIATION                          DECLARE_ASCII("com.sun.star.util.UriAbbreviation"                   )
 #define SERVICENAME_IMAGEMANAGER                                DECLARE_ASCII("com.sun.star.ui.ImageManager"                        )
 #define SERVICENAME_TABWINDOWSERVICE                            DECLARE_ASCII("com.sun.star.ui.dialogs.TabContainerWindow"          )
-#define SERVICENAME_DISPLAYACCESS                               DECLARE_ASCII("com.sun.star.awt.DisplayAccess"                      )
 #define SERVICENAME_PANELFACTORY                                DECLARE_ASCII("com.sun.star.ui.PanelFactory"                        )
 #define SERVICENAME_MODELWINSERVICE                             DECLARE_ASCII("com.sun.star.ui.ModelWinService"                     )
 
diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index 9e813a7..e45794c 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -286,7 +286,6 @@ namespace framework
 
             css::uno::Reference< css::lang::XMultiServiceFactory >                      m_xSMGR; /** reference to factory, which has created this instance. */
             css::uno::Reference< css::util::XURLTransformer >                           m_xURLTransformer;
-            css::uno::Reference< css::container::XIndexAccess >                         m_xDisplayAccess;
             css::uno::Reference< css::frame::XFrame >                                   m_xFrame;
             css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >        m_xModuleCfgMgr;
             css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >        m_xDocCfgMgr;
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index a916428..ece410c 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -113,7 +113,6 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM
         , LayoutManager_PBase( *(static_cast< ::cppu::OBroadcastHelper* >(this)) )
         , m_xSMGR( xServiceManager )
         , m_xURLTransformer( URLTransformer::create(::comphelper::getComponentContext(xServiceManager)) )
-        , m_xDisplayAccess( xServiceManager->createInstance( SERVICENAME_DISPLAYACCESS ), UNO_QUERY )
         , m_nLockCount( 0 )
         , m_bActive( false )
         , m_bInplaceMenuSet( false )
@@ -2472,25 +2471,15 @@ sal_Bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContaine
     Reference< awt::XWindow >               xContainerWindow    = m_xContainerWindow;
     Reference< awt::XTopWindow2 >           xContainerTopWindow = m_xContainerTopWindow;
     Reference< awt::XWindow >               xComponentWindow    = m_xFrame->getComponentWindow();
-    Reference< container::XIndexAccess >    xDisplayAccess      = m_xDisplayAccess;
     aReadLock.unlock();
 
     // calculate the maximum size we have for the container window
-    awt::Rectangle aWorkArea;
-    try
-    {
-        sal_Int32 nDisplay = xContainerTopWindow->getDisplay();
-        Reference< beans::XPropertySet > xDisplayInfo( xDisplayAccess->getByIndex( nDisplay ), UNO_QUERY_THROW );
-        OSL_VERIFY( xDisplayInfo->getPropertyValue( ::rtl::OUString( "WorkArea"  ) ) >>= aWorkArea );
-    }
-    catch( const Exception& )
-    {
-        DBG_UNHANDLED_EXCEPTION();
-    }
+    sal_Int32 nDisplay = xContainerTopWindow->getDisplay();
+    Rectangle aWorkArea = Application::GetWorkAreaPosSizePixel( nDisplay );
 
-    if (( aWorkArea.Width > 0 ) && ( aWorkArea.Height > 0 ))
+    if (( aWorkArea.GetWidth() > 0 ) && ( aWorkArea.GetHeight() > 0 ))
     {
-        if (( rContainerSize.Width > aWorkArea.Width ) || ( rContainerSize.Height > aWorkArea.Height ))
+        if (( rContainerSize.Width > aWorkArea.GetWidth() ) || ( rContainerSize.Height > aWorkArea.GetHeight() ))
             return sal_False;
         // Strictly, this is not correct. If we have a multi-screen display (css.awt.DisplayAccess.MultiDisplay == true),
         // the the "effective work area" would be much larger than the work area of a single display, since we could in theory
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index 5b94cb3..1e1a812 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <comphelper/processfactory.hxx>
 #include <svl/itemset.hxx>
+#include <vcl/svapp.hxx>
 
 #include "sdattr.hxx"
 #include "present.hxx"
@@ -176,13 +177,11 @@ void SdStartPresentationDlg::InitMonitorSettings()
 {
     try
     {
-        Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-        Reference< XIndexAccess > xMultiMon( xFactory->createInstance("com.sun.star.awt.DisplayAccess" ), UNO_QUERY_THROW );
         maGrpMonitor.Show( true );
         maFtMonitor.Show( true );
         maLBMonitor.Show( true );
 
-        mnMonitors = xMultiMon->getCount();
+        mnMonitors = Application::GetScreenCount();
 
         if( mnMonitors <= 1 )
         {
@@ -191,19 +190,8 @@ void SdStartPresentationDlg::InitMonitorSettings()
         }
         else
         {
-            sal_Bool bUnifiedDisplay = false;
-            sal_Int32 nExternalIndex = 0;
-            Reference< XPropertySet > xMonProps( xMultiMon, UNO_QUERY );
-            if( xMonProps.is() ) try
-            {
-                const OUString sPropName1( "IsUnifiedDisplay" );
-                xMonProps->getPropertyValue( sPropName1 ) >>= bUnifiedDisplay;
-                const OUString sPropName2( "ExternalDisplay" );
-                xMonProps->getPropertyValue( sPropName2 ) >>= nExternalIndex;
-            }
-            catch( Exception& )
-            {
-            }
+            sal_Bool bUnifiedDisplay = Application::IsUnifiedDisplay();
+            sal_Int32 nExternalIndex = Application::GetDisplayExternalScreen();
 
             sal_Int32 nSelectedIndex (-1);
             sal_Int32 nDefaultExternalIndex (-1);
diff --git a/sd/source/ui/slideshow/SlideShowRestarter.cxx b/sd/source/ui/slideshow/SlideShowRestarter.cxx
index ad452d8..90ed514 100644
--- a/sd/source/ui/slideshow/SlideShowRestarter.cxx
+++ b/sd/source/ui/slideshow/SlideShowRestarter.cxx
@@ -42,7 +42,7 @@ SlideShowRestarter::SlideShowRestarter (
     : mnEventId(0),
       mpSlideShow(rpSlideShow),
       mpViewShellBase(pViewShellBase),
-      mnDisplayCount(GetDisplayCount()),
+      mnDisplayCount(Application::GetScreenCount()),
       mpDispatcher(pViewShellBase->GetViewFrame()->GetDispatcher()),
       mnCurrentSlideNumber(0)
 {
@@ -77,30 +77,12 @@ void SlideShowRestarter::Restart (bool bForce)
         LINK(this, SlideShowRestarter, EndPresentation));
 }
 
-sal_Int32 SlideShowRestarter::GetDisplayCount (void)
-{
-    const Reference<XComponentContext> xContext (
-        ::comphelper::getProcessComponentContext() );
-    Reference<XMultiComponentFactory> xFactory (
-        xContext->getServiceManager(), UNO_QUERY);
-    if ( ! xFactory.is())
-        return 0;
-
-    Reference<com::sun::star::container::XIndexAccess> xIndexAccess (
-        xFactory->createInstanceWithContext("com.sun.star.awt.DisplayAccess",xContext),
-        UNO_QUERY);
-    if ( ! xIndexAccess.is())
-        return 0;
-
-    return xIndexAccess->getCount();
-}
-
 IMPL_LINK_NOARG(SlideShowRestarter, EndPresentation)
 {
     mnEventId = 0;
     if (mpSlideShow.is())
     {
-        if (mnDisplayCount!=GetDisplayCount())
+        if (mnDisplayCount != (sal_Int32)Application::GetScreenCount())
         {
             mpSlideShow->end();
 
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
index 9980082..af2033e 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -101,25 +101,6 @@ namespace {
     private:
         ::boost::shared_ptr<SlideShowRestarter> mpRestarter;
     };
-
-    /** Return the default display id (or -1 when that can not be
-        determined.)
-    */
-    sal_Int32 GetExternalDisplay (void)
-    {
-        try
-        {
-            Reference< XMultiServiceFactory > xFactory(::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-            Reference< XPropertySet > xMonProps(xFactory->createInstance( "com.sun.star.awt.DisplayAccess" ), UNO_QUERY_THROW );
-            sal_Int32 nPrimaryIndex (-1);
-            if (xMonProps->getPropertyValue( "ExternalDisplay" ) >>= nPrimaryIndex)
-                return nPrimaryIndex;
-        }
-        catch( Exception& )
-        {
-        }
-        return -1;
-    }
 }
 
 
@@ -573,7 +554,7 @@ void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const
         {
             // Convert value to true display id.
             if (nDisplay == 0)
-                nDisplay = GetExternalDisplay();
+                nDisplay = Application::GetDisplayExternalScreen();
             else if (nDisplay < 0)
                 nDisplay = -1;
             else
@@ -665,7 +646,7 @@ Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName ) throw(U
         SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
         const sal_Int32 nDisplay (pOptions->GetDisplay());
         // Convert true display id to the previously used schema.
-        if (nDisplay == GetExternalDisplay())
+        if (nDisplay == (sal_Int32)Application::GetDisplayExternalScreen())
             return Any(sal_Int32(0));
         else if (nDisplay < 0)
             return Any(sal_Int32(-1));
diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx
index d4fadf6..41133a1 100644
--- a/sdext/source/presenter/PresenterScreen.cxx
+++ b/sdext/source/presenter/PresenterScreen.cxx
@@ -39,6 +39,7 @@
 #include <boost/bind.hpp>
 
 #include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <vcl/svapp.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -409,13 +410,6 @@ void PresenterScreen::InitializePresenterScreen (void)
     }
 }
 
-css::uno::Reference<css::beans::XPropertySet> PresenterScreen::GetDisplayAccess() const
-{
-    Reference<XComponentContext> xContext (mxContextWeak);
-    Reference<lang::XMultiComponentFactory> xFactory (xContext->getServiceManager(), UNO_QUERY_THROW);
-    return Reference<beans::XPropertySet>( xFactory->createInstanceWithContext(A2S("com.sun.star.awt.DisplayAccess"), xContext), UNO_QUERY_THROW);
-}
-
 void PresenterScreen::SwitchMonitors()
 {
     try {
@@ -429,9 +423,8 @@ void PresenterScreen::SwitchMonitors()
             return;
 
         // Adapt that display number to be the 'default' setting of 0 if it matches
-        sal_Int32 nExternalDisplay = 0;
-        Reference<beans::XPropertySet> xDisplayProperties = GetDisplayAccess();
-        xDisplayProperties->getPropertyValue(A2S("ExternalDisplay")) >>= nExternalDisplay;
+        sal_Int32 nExternalDisplay = Application::GetDisplayExternalScreen();
+
         if (nNewScreen == nExternalDisplay)
             nNewScreen = 0; // screen zero is best == the primary display
         else
@@ -473,7 +466,6 @@ sal_Int32 PresenterScreen::GetPresenterScreenNumber (
             return -1;
         }
 
-        Reference<beans::XPropertySet> xDisplayProperties = GetDisplayAccess();
         if (nDisplayNumber > 0)
         {
             nScreenNumber = nDisplayNumber - 1;
@@ -481,18 +473,14 @@ sal_Int32 PresenterScreen::GetPresenterScreenNumber (
         else if (nDisplayNumber == 0)
         {
             // A display number value of 0 indicates the primary screen.
-            // Instantiate the DisplayAccess service to find out which
-            // screen number that is.
-            if (nDisplayNumber <= 0 && xDisplayProperties.is())
-                xDisplayProperties->getPropertyValue(A2S("ExternalDisplay")) >>= nScreenNumber;
+            // Find out which screen number that is.
+            if (nDisplayNumber <= 0)
+                nScreenNumber = Application::GetDisplayExternalScreen();
         }
 
         // We still have to determine the number of screens to decide
         // whether the presenter screen may be shown at all.
-        Reference<container::XIndexAccess> xIndexAccess (xDisplayProperties, UNO_QUERY);
-        if ( ! xIndexAccess.is())
-            return -1;
-        nScreenCount = xIndexAccess->getCount();
+        nScreenCount = Application::GetScreenCount();
 
         if (nScreenCount < 2 || nDisplayNumber > nScreenCount)
         {
diff --git a/sdext/source/presenter/PresenterScreen.hxx b/sdext/source/presenter/PresenterScreen.hxx
index cc0102b..16a3e05 100644
--- a/sdext/source/presenter/PresenterScreen.hxx
+++ b/sdext/source/presenter/PresenterScreen.hxx
@@ -228,10 +228,6 @@ private:
     */
     css::uno::Reference<css::drawing::framework::XResourceId> GetMainPaneId (
         const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
-
-    /** Gets the display access property bag
-     */
-    css::uno::Reference<css::beans::XPropertySet> GetDisplayAccess () const;
 };
 
 } }
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 57fd4cf..af31488 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -125,7 +125,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/app/unohelp2 \
     vcl/source/app/unohelp \
     vcl/source/app/vclevent \
-    vcl/source/components/display \
     vcl/source/components/dtranscomp \
     vcl/source/components/factory \
     vcl/source/components/fontident \
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index d95e44b..0a1aa56 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -282,18 +282,20 @@ public:
     //               (e.g. Xserver with Xinerama, Windows)
     //        false: different screens are separate and windows cannot be moved
     //               between them (e.g. Xserver with multiple screens)
-    SAL_DLLPRIVATE static bool          IsUnifiedDisplay();
+    static bool          IsUnifiedDisplay();
     // if IsUnifiedDisplay() == true the return value will be
     // nearest screen of the target rectangle
     // in case of IsUnifiedDisplay() == false the return value
     // will always be GetDisplayDefaultScreen()
     SAL_DLLPRIVATE static unsigned int  GetBestScreen( const Rectangle& );
-    SAL_DLLPRIVATE static Rectangle     GetWorkAreaPosSizePixel( unsigned int nScreen );
+    static Rectangle     GetWorkAreaPosSizePixel( unsigned int nScreen );
     // This returns the LCD screen number for a laptop, or the primary
     // external VGA display for a desktop machine - it is where a presenter
     // console should be rendered if there are other (non-built-in) screens
     // present.
-    SAL_DLLPRIVATE static unsigned int  GetDisplayBuiltInScreen();
+    static unsigned int  GetDisplayBuiltInScreen();
+    // Practically, this means - Get the screen we should run a presentation on.
+    static unsigned int  GetDisplayExternalScreen();
     SAL_DLLPRIVATE static rtl::OUString GetDisplayScreenName( unsigned int nScreen );
 
     static const LocaleDataWrapper& GetAppLocaleDataWrapper();
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 6a799cd..1a79987 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1238,6 +1238,29 @@ unsigned int Application::GetDisplayBuiltInScreen()
     return pSys ? pSys->GetDisplayBuiltInScreen() : 0;
 }
 
+unsigned int Application::GetDisplayExternalScreen()
+{
+    // This is really unpleasant, in theory we could have multiple
+    // external displays etc.
+    int nExternal(0);
+    switch (GetDisplayBuiltInScreen())
+    {
+    case 0:
+        nExternal = 1;
+        break;
+    case 1:
+        nExternal = 0;
+        break;
+    default:
+        // When the built-in display is neither 0 nor 1
+        // then place the full-screen presentation on the
+        // first available screen.
+        nExternal = 0;
+        break;
+    }
+    return nExternal;
+}
+
 Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen )
 {
     SalSystem* pSys = ImplGetSalSystem();
diff --git a/vcl/source/components/display.cxx b/vcl/source/components/display.cxx
deleted file mode 100644
index f1862bc..0000000
--- a/vcl/source/components/display.cxx
+++ /dev/null
@@ -1,363 +0,0 @@
-/* -*- 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 .
- */
-
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-#include <vcl/svapp.hxx>
-
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase4.hxx>
-
-
-using ::rtl::OUString;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
-
-// -----------------------------------------------------------------------
-
-namespace vcl
-{
-
-class DisplayInfo : public ::cppu::WeakAggImplHelper3< XPropertySet, XPropertySetInfo, XServiceInfo >
-{
-public:
-    DisplayInfo( sal_uInt32 nDisplayScreen );
-
-    // XPropertySet
-    virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (RuntimeException);
-    virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
-    virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-
-    // XPropertySetInfo
-    virtual Sequence< Property > SAL_CALL getProperties() throw (RuntimeException);
-    virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException);
-    virtual ::sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException);
-
-    // XServiceInfo
-    virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
-    virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
-    virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
-
-private:
-    sal_uInt32 mnDisplayScreen;
-};
-
-static const char* pScreenAreaName = "ScreenArea";
-static const char* pWorkAreaName = "WorkArea";
-static const char* pScreenName = "ScreenName";
-
-// --------------------------------------------------------------------
-
-DisplayInfo::DisplayInfo( sal_uInt32 nDisplayScreen )
-: mnDisplayScreen( nDisplayScreen )
-{
-}
-
-// XPropertySet
-Reference< XPropertySetInfo > SAL_CALL DisplayInfo::getPropertySetInfo() throw (RuntimeException)
-{
-    return this;
-}
-
-void SAL_CALL DisplayInfo::setPropertyValue( const OUString& /*aPropertyName* */, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
-{
-    throw PropertyVetoException();
-}
-
-Any SAL_CALL DisplayInfo::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
-{
-    Rectangle aRect;
-    if( PropertyName.equalsAscii( pScreenAreaName ) )
-    {
-        aRect = Application::GetScreenPosSizePixel( mnDisplayScreen );
-    }
-    else if( PropertyName.equalsAscii( pWorkAreaName ) )
-    {
-        aRect = Application::GetWorkAreaPosSizePixel( mnDisplayScreen );
-    }
-    else if( PropertyName.equalsAscii( pScreenName ) )
-    {
-        return Any( Application::GetDisplayScreenName( mnDisplayScreen ) );
-    }
-    else
-        throw UnknownPropertyException();
-
-    return Any( com::sun::star::awt::Rectangle( aRect.Left(), aRect.Top(), aRect.getWidth(), aRect.getHeight() ) );
-}
-
-void SAL_CALL DisplayInfo::addPropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-void SAL_CALL DisplayInfo::removePropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-void SAL_CALL DisplayInfo::addVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-void SAL_CALL DisplayInfo::removeVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-
-// XPropertySetInfo
-Sequence< Property > SAL_CALL DisplayInfo::getProperties() throw (RuntimeException)
-{
-    Sequence< Property > aProps(2);
-    aProps[0] = getPropertyByName( OUString::createFromAscii( pScreenAreaName ) );
-    aProps[1] = getPropertyByName( OUString::createFromAscii( pWorkAreaName ) );
-    return aProps;
-}
-
-Property SAL_CALL DisplayInfo::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException)
-{
-    if( aName.equalsAscii( pScreenAreaName ) ||
-        aName.equalsAscii( pWorkAreaName ) )
-        return Property( aName, 0, ::getCppuType( (::com::sun::star::awt::Rectangle const *)0 ), PropertyAttribute::READONLY );
-    throw UnknownPropertyException();
-}
-
-::sal_Bool SAL_CALL DisplayInfo::hasPropertyByName( const OUString& Name ) throw (RuntimeException)
-{
-    return Name.equalsAscii( pScreenAreaName ) ||
-           Name.equalsAscii( pWorkAreaName );
-}
-
-// XServiceInfo
-OUString SAL_CALL DisplayInfo::getImplementationName() throw (RuntimeException)
-{
-    return OUString(RTL_CONSTASCII_USTRINGPARAM("vcl::DisplayInfo"));
-}
-
-::sal_Bool SAL_CALL DisplayInfo::supportsService( const OUString& ServiceName ) throw (RuntimeException)
-{
-    Sequence< OUString > aSN( getSupportedServiceNames() );
-    for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ )
-    {
-        if( aSN[nService] == ServiceName )
-            return sal_True;
-    }
-    return sal_False;
-}
-
-Sequence< OUString > SAL_CALL DisplayInfo::getSupportedServiceNames() throw (RuntimeException)
-{
-    OUString aServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DisplayInfo"));
-    return Sequence< OUString >(&aServiceName, 1);
-}
-
-// ====================================================================
-
-class DisplayAccess : public ::cppu::WeakAggImplHelper4< XPropertySet, XPropertySetInfo, XIndexAccess, XServiceInfo >
-{
-public:
-    DisplayAccess ();
-
-    // XPropertySet
-    virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (RuntimeException);
-    virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
-    virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-    virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
-
-    // XPropertySetInfo
-    virtual Sequence< Property > SAL_CALL getProperties() throw (RuntimeException);
-    virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException);
-    virtual ::sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException);
-
-    // XIndexAccess
-    virtual ::sal_Int32 SAL_CALL getCount() throw (RuntimeException);
-    virtual Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
-
-    // XElementAccess
-    virtual Type SAL_CALL getElementType() throw (RuntimeException);
-    virtual ::sal_Bool SAL_CALL hasElements() throw (RuntimeException);
-
-    // XServiceInfo
-    virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
-    virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
-    virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
-};
-
-Sequence< OUString > DisplayAccess_getSupportedServiceNames()
-{
-    OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) );
-    return Sequence< OUString >( &aServiceName, 1 );
-}
-
-OUString DisplayAccess_getImplementationName()
-{
-    return OUString( RTL_CONSTASCII_USTRINGPARAM( "vcl::DisplayAccess" ) );
-}
-
-Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory >&  )
-{
-    return static_cast< ::cppu::OWeakObject * >( new DisplayAccess );
-}
-
-DisplayAccess::DisplayAccess()
-{
-}
-
-static const char* pUnifiedDisplayName = "IsUnifiedDisplay";
-static const char* pDefaultDisplayName = "DefaultDisplay";
-static const char* pBuiltInDisplayName = "BuiltInDisplay";
-static const char* pExternalDisplayName = "ExternalDisplay";
-
-// XPropertySet
-Reference< XPropertySetInfo > SAL_CALL DisplayAccess::getPropertySetInfo() throw (RuntimeException)
-{
-    return this;
-}
-
-void SAL_CALL DisplayAccess::setPropertyValue( const OUString& /*aPropertyName* */, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
-{
-    throw PropertyVetoException();
-}
-
-Any SAL_CALL DisplayAccess::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
-{
-    Any aRet;
-    if( PropertyName.equalsAscii( pUnifiedDisplayName ) )
-    {
-        aRet <<= sal_Bool( Application::IsUnifiedDisplay() );
-    }
-    else if( PropertyName.equalsAscii( pDefaultDisplayName ) || // Unhelpful name, legacy setting
-             PropertyName.equalsAscii( pBuiltInDisplayName ) )
-    {
-        aRet <<= sal_Int32( Application::GetDisplayBuiltInScreen() );
-    }
-    else if( PropertyName.equalsAscii( pExternalDisplayName ) )
-    {
-        // This is really unpleasant, in theory we could have multiple
-        // external displays etc.
-        sal_Int32 nExternal(0);
-        switch (Application::GetDisplayBuiltInScreen())
-        {
-        case 0:
-            nExternal = 1;
-            break;
-        case 1:
-            nExternal = 0;
-            break;
-        default:
-            // When the built-in display is neither 0 nor 1
-            // then place the full-screen presentation on the
-            // first available screen.
-            nExternal = 0;
-            break;
-        }
-        aRet <<= nExternal;
-    }
-    else
-        throw UnknownPropertyException();
-
-    return aRet;
-}
-
-void SAL_CALL DisplayAccess::addPropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-void SAL_CALL DisplayAccess::removePropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-void SAL_CALL DisplayAccess::addVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-void SAL_CALL DisplayAccess::removeVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
-
-// XPropertySetInfo
-Sequence< Property > SAL_CALL DisplayAccess::getProperties() throw (RuntimeException)
-{
-    Sequence< Property > aProps(4);
-    aProps[0] = getPropertyByName( OUString::createFromAscii( pUnifiedDisplayName ) );
-    aProps[1] = getPropertyByName( OUString::createFromAscii( pDefaultDisplayName ) );
-    aProps[2] = getPropertyByName( OUString::createFromAscii( pBuiltInDisplayName ) );
-    aProps[3] = getPropertyByName( OUString::createFromAscii( pExternalDisplayName ) );
-    return aProps;
-}
-
-Property SAL_CALL DisplayAccess::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException)
-{
-    if( aName.equalsAscii( pUnifiedDisplayName ) )
-        return Property( aName, 0, ::getCppuType( (sal_Bool const *)0 ), PropertyAttribute::READONLY );
-
-    if( aName.equalsAscii( pDefaultDisplayName ) ||
-        aName.equalsAscii( pBuiltInDisplayName ) ||
-        aName.equalsAscii( pExternalDisplayName ) )
-        return Property( aName, 0, ::getCppuType( (sal_Int32 const *)0 ), PropertyAttribute::READONLY );
-
-    throw UnknownPropertyException();
-}
-
-::sal_Bool SAL_CALL DisplayAccess::hasPropertyByName( const OUString& Name ) throw (RuntimeException)
-{
-    return Name.equalsAscii( pUnifiedDisplayName ) ||
-           Name.equalsAscii( pDefaultDisplayName ) ||
-           Name.equalsAscii( pBuiltInDisplayName ) ||
-           Name.equalsAscii( pExternalDisplayName );
-}
-
-// XIndexAccess
-::sal_Int32 SAL_CALL DisplayAccess::getCount() throw (RuntimeException)
-{
-    return Application::GetScreenCount();
-}
-
-Any SAL_CALL DisplayAccess::getByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
-{
-    if( (Index < 0) || (Index >= getCount()) )
-        throw IndexOutOfBoundsException();
-
-    return makeAny( Reference< XPropertySet >( new DisplayInfo( Index ) ) );
-}
-
-// XElementAccess
-Type SAL_CALL DisplayAccess::getElementType() throw (RuntimeException)
-{
-    return XPropertySet::static_type();
-}
-
-::sal_Bool SAL_CALL DisplayAccess::hasElements() throw (RuntimeException)
-{
-    return true;
-}
-
-// XServiceInfo
-OUString SAL_CALL DisplayAccess::getImplementationName() throw (RuntimeException)
-{
-    return DisplayAccess_getImplementationName();
-}
-
-::sal_Bool SAL_CALL DisplayAccess::supportsService( const OUString& ServiceName ) throw (RuntimeException)
-{
-    Sequence< OUString > aSN( DisplayAccess_getSupportedServiceNames() );
-    for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ )
-    {
-        if( aSN[nService] == ServiceName )
-            return sal_True;
-    }
-    return sal_False;
-}
-
-Sequence< OUString > SAL_CALL DisplayAccess::getSupportedServiceNames() throw (RuntimeException)
-{
-    return DisplayAccess_getSupportedServiceNames();
-}
-
-} // namespace vcl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx
index 85bc7ee..eb7c05b 100644
--- a/vcl/source/components/factory.cxx
+++ b/vcl/source/components/factory.cxx
@@ -37,10 +37,6 @@ extern Reference< XInterface > SAL_CALL vcl_session_createInstance( const Refere
 
 namespace vcl
 {
-extern Sequence< OUString > SAL_CALL DisplayAccess_getSupportedServiceNames();
-extern OUString SAL_CALL DisplayAccess_getImplementationName();
-extern Reference< XInterface > SAL_CALL DisplayAccess_createInstance( const Reference< XMultiServiceFactory > & );
-
 extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames();
 extern OUString SAL_CALL FontIdentificator_getImplementationName();
 extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & );
@@ -84,12 +80,6 @@ extern "C" {
                     xMgr, vcl_session_getImplementationName(), vcl_session_createInstance,
                     vcl_session_getSupportedServiceNames() );
             }
-            else if( vcl::DisplayAccess_getImplementationName().equalsAscii( pImplementationName ) )
-            {
-                xFactory = ::cppu::createSingleFactory(
-                    xMgr, vcl::DisplayAccess_getImplementationName(), vcl::DisplayAccess_createInstance,
-                    vcl::DisplayAccess_getSupportedServiceNames() );
-            }
             else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) )
             {
                 xFactory = ::cppu::createSingleFactory(
diff --git a/vcl/vcl.android.component b/vcl/vcl.android.component
index 299d8b3..53ebfe3 100644
--- a/vcl/vcl.android.component
+++ b/vcl/vcl.android.component
@@ -22,9 +22,6 @@
   <implementation name="com.sun.star.frame.VCLSessionManagerClient">
     <service name="com.sun.star.frame.SessionManagerClient"/>
   </implementation>
-  <implementation name="vcl::DisplayAccess">
-    <service name="com.sun.star.awt.DisplayAccess"/>
-  </implementation>
   <implementation name="vcl::FontIdentificator">
     <service name="com.sun.star.awt.FontIdentificator"/>
   </implementation>
diff --git a/vcl/vcl.headless.component b/vcl/vcl.headless.component
index 299d8b3..53ebfe3 100644
--- a/vcl/vcl.headless.component
+++ b/vcl/vcl.headless.component
@@ -22,9 +22,6 @@
   <implementation name="com.sun.star.frame.VCLSessionManagerClient">
     <service name="com.sun.star.frame.SessionManagerClient"/>
   </implementation>
-  <implementation name="vcl::DisplayAccess">
-    <service name="com.sun.star.awt.DisplayAccess"/>
-  </implementation>
   <implementation name="vcl::FontIdentificator">
     <service name="com.sun.star.awt.FontIdentificator"/>
   </implementation>
diff --git a/vcl/vcl.ios.component b/vcl/vcl.ios.component
index 299d8b3..53ebfe3 100644
--- a/vcl/vcl.ios.component
+++ b/vcl/vcl.ios.component
@@ -22,9 +22,6 @@
   <implementation name="com.sun.star.frame.VCLSessionManagerClient">
     <service name="com.sun.star.frame.SessionManagerClient"/>
   </implementation>
-  <implementation name="vcl::DisplayAccess">
-    <service name="com.sun.star.awt.DisplayAccess"/>
-  </implementation>
   <implementation name="vcl::FontIdentificator">
     <service name="com.sun.star.awt.FontIdentificator"/>
   </implementation>
diff --git a/vcl/vcl.macosx.component b/vcl/vcl.macosx.component
index d0e7b40..5842d9a 100644
--- a/vcl/vcl.macosx.component
+++ b/vcl/vcl.macosx.component
@@ -31,9 +31,6 @@
   <implementation name="com.sun.star.frame.VCLSessionManagerClient">
     <service name="com.sun.star.frame.SessionManagerClient"/>
   </implementation>
-  <implementation name="vcl::DisplayAccess">
-    <service name="com.sun.star.awt.DisplayAccess"/>
-  </implementation>
   <implementation name="vcl::FontIdentificator">
     <service name="com.sun.star.awt.FontIdentificator"/>
   </implementation>
diff --git a/vcl/vcl.unx.component b/vcl/vcl.unx.component
index cf51164..3596875 100644
--- a/vcl/vcl.unx.component
+++ b/vcl/vcl.unx.component
@@ -31,9 +31,6 @@
   <implementation name="com.sun.star.frame.VCLSessionManagerClient">
     <service name="com.sun.star.frame.SessionManagerClient"/>
   </implementation>
-  <implementation name="vcl::DisplayAccess">
-    <service name="com.sun.star.awt.DisplayAccess"/>
-  </implementation>
   <implementation name="vcl::FontIdentificator">
     <service name="com.sun.star.awt.FontIdentificator"/>
   </implementation>
diff --git a/vcl/vcl.windows.component b/vcl/vcl.windows.component
index 2e303fd..921f299 100644
--- a/vcl/vcl.windows.component
+++ b/vcl/vcl.windows.component
@@ -22,9 +22,6 @@
   <implementation name="com.sun.star.frame.VCLSessionManagerClient">
     <service name="com.sun.star.frame.SessionManagerClient"/>
   </implementation>
-  <implementation name="vcl::DisplayAccess">
-    <service name="com.sun.star.awt.DisplayAccess"/>
-  </implementation>
   <implementation name="vcl::FontIdentificator">
     <service name="com.sun.star.awt.FontIdentificator"/>
   </implementation>
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index f2110d5..b673c46 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -783,40 +783,27 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame,
 
     try
     {
-        uno::Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-        uno::Reference< XIndexAccess > xMultiMon( xFactory->createInstance( "com.sun.star.awt.DisplayAccess" ), UNO_QUERY_THROW );
-        sal_Int32 nMonitors = xMultiMon->getCount();
+        sal_Int32 nMonitors = Application::GetScreenCount();
         if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < nMonitors) )
         {
-            uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( pFrame->mnDisplay ), UNO_QUERY_THROW );
-            com::sun::star::awt::Rectangle aRect;
-            if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect )
-            {
-                nScreenX = aRect.X;
-                nScreenY = aRect.Y;
-                nScreenDX = aRect.Width+1;  // difference between java/awt convention and vcl
-                nScreenDY = aRect.Height+1; // difference between java/awt convention and vcl
-            }
+            com::sun::star::awt::Rectangle aRect = Application::GetScreenPosSizePixel( pFrame->mnDisplay );
+            nScreenX = aRect.X;
+            nScreenY = aRect.Y;
+            nScreenDX = aRect.Width+1;  // difference between java/awt convention and vcl
+            nScreenDY = aRect.Height+1; // difference between java/awt convention and vcl
         }
         else
         {
             Rectangle aCombined;
-            uno::Reference< XPropertySet > xMonitor( xMultiMon->getByIndex( 0 ), UNO_QUERY_THROW );
-            com::sun::star::awt::Rectangle aRect;
-            if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect )
+            com::sun::star::awt::Rectangle aRect = Application::GetScreenPosSizePixel( 0 );
+            aCombined.Left()   = aRect.X;
+            aCombined.Top()    = aRect.Y;
+            aCombined.Right()  = aRect.X + aRect.Width;
+            aCombined.Bottom() = aRect.Y + aRect.Height;
+            for( sal_Int32 i = 1 ; i < nMonitors ; i++ )
             {
-                aCombined.Left()   = aRect.X;
-                aCombined.Top()    = aRect.Y;
-                aCombined.Right()  = aRect.X + aRect.Width;
-                aCombined.Bottom() = aRect.Y + aRect.Height;
-                for( sal_Int32 i = 1 ; i < nMonitors ; i++ )
-                {
-                    xMonitor = uno::Reference< XPropertySet >( xMultiMon->getByIndex(i), UNO_QUERY_THROW );
-                    if( xMonitor->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ScreenArea" ) ) ) >>= aRect )
-                    {
-                        aCombined.Union( Rectangle( aRect.X, aRect.Y, aRect.X+aRect.Width, aRect.Y+aRect.Height ) );
-                    }
-                }
+                aRect = Application::GetScreenPosSizePixel( i );
+                aCombined.Union( Rectangle( aRect.X, aRect.Y, aRect.X+aRect.Width, aRect.Y+aRect.Height ) );
             }
             nScreenX  = aCombined.Left();
             nScreenY  = aCombined.Top();
commit 37b6871fa1fb12c4b2b45db5f3e6ac583577f538
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Dec 11 11:45:28 2012 +0200

    Remove unnecessary member field
    
    If SfxPopup is always going to use
    comphelper::getProcessServiceFactory, it doesn't need to store it
    in a member field.
    
    Change-Id: Id8806bcc4cc92e66e94d4a5c54c3413570963335

diff --git a/sfx2/inc/sfx2/tbxctrl.hxx b/sfx2/inc/sfx2/tbxctrl.hxx
index b0c3599..f675140 100644
--- a/sfx2/inc/sfx2/tbxctrl.hxx
+++ b/sfx2/inc/sfx2/tbxctrl.hxx
@@ -26,6 +26,7 @@
 #include <vcl/menu.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/floatwin.hxx>
+#include <comphelper/processfactory.hxx>
 #include <sfx2/ctrlitem.hxx>
 #include <sfx2/sfxstatuslistener.hxx>
 #include <svtools/toolboxcontroller.hxx>
@@ -109,7 +110,6 @@ class SFX2_DLLPUBLIC SfxPopupWindow: public FloatingWindow, public SfxStatusList
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >              m_xFrame;
     SfxFrameStatusListener*                                                          m_pStatusListener;
     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >           m_xStatusListener;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
 
 private:
     SfxFrameStatusListener* GetOrCreateStatusListener();
@@ -125,7 +125,7 @@ protected:
 
     sal_uInt16                  GetId() const { return m_nId; }
     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& GetFrame() const { return m_xFrame; }
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& GetServiceManager() const { return m_xServiceManager; }
+    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceManager() const { return ::comphelper::getProcessServiceFactory(); }
 
     void                    BindListener();
     void                    UnbindListener();
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 3409247..64e8901 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -1159,8 +1159,6 @@ SfxPopupWindow::SfxPopupWindow(
     , m_xFrame( rFrame )
     , m_pStatusListener( 0 )
 {
-    m_xServiceManager = ::comphelper::getProcessServiceFactory();
-
     Window* pWindow = GetTopMostParentSystemWindow( this );
     if ( pWindow )
         ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this );
@@ -1179,8 +1177,6 @@ SfxPopupWindow::SfxPopupWindow(
     , m_xFrame( rFrame )
     , m_pStatusListener( 0 )
 {
-    m_xServiceManager = ::comphelper::getProcessServiceFactory();
-
     Window* pWindow = GetTopMostParentSystemWindow( this );
     if ( pWindow )
         ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this );
@@ -1200,8 +1196,6 @@ SfxPopupWindow::SfxPopupWindow(
     , m_xFrame( rFrame )
     , m_pStatusListener( 0 )
 {
-    m_xServiceManager = ::comphelper::getProcessServiceFactory();
-
     Window* pWindow = GetTopMostParentSystemWindow( this );
     if ( pWindow )
         ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this );
@@ -1229,7 +1223,7 @@ SfxFrameStatusListener* SfxPopupWindow::GetOrCreateStatusListener()
     if ( !m_xStatusListener.is() )
     {
         m_pStatusListener = new SfxFrameStatusListener(
-                                    m_xServiceManager,
+                                    ::comphelper::getProcessServiceFactory(),
                                     m_xFrame,
                                     this );
         m_xStatusListener = Reference< XComponent >( static_cast< cppu::OWeakObject* >(
commit b552f521f6bbf917ae41ccfcddeb498c75c824e3
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Dec 11 11:27:08 2012 +0200

    fdo#46808, Adapt ui::UIElementFactoryManager UNO service to new style
    
    Required creating a new merged interface.
    
    Change-Id: I12be54e7e4c0614a31a04715342aa244d1687c42

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index c78c76b..26d79ec 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -62,7 +62,7 @@
 #include <com/sun/star/task/XRestartManager.hpp>
 #include <com/sun/star/document/XEventListener.hpp>
 #include <com/sun/star/frame/UICommandDescription.hpp>
-#include <com/sun/star/ui/XUIElementFactoryRegistration.hpp>
+#include <com/sun/star/ui/UIElementFactoryManager.hpp>
 #include <com/sun/star/ui/WindowStateConfiguration.hpp>
 #include <com/sun/star/frame/XUIControllerRegistration.hpp>
 
@@ -2137,19 +2137,13 @@ void Desktop::PreloadConfigurationData()
 
     // preload user interface element factories
     Sequence< Sequence< css::beans::PropertyValue > > aSeqSeqPropValue;
-    Reference< ::com::sun::star::ui::XUIElementFactoryRegistration > xUIElementFactory(
-        rFactory->createInstance(
-            rtl::OUString( "com.sun.star.ui.UIElementFactoryManager" )),
-            UNO_QUERY );
-    if ( xUIElementFactory.is() )
+    Reference< XUIElementFactoryManager > xUIElementFactory = UIElementFactoryManager::create( xContext );
+    try
+    {
+        aSeqSeqPropValue = xUIElementFactory->getRegisteredFactories();
+    }
+    catch ( const ::com::sun::star::uno::Exception& )
     {
-        try
-        {
-            aSeqSeqPropValue = xUIElementFactory->getRegisteredFactories();
-        }
-        catch ( const ::com::sun::star::uno::Exception& )
-        {
-        }
     }
 
     // preload popup menu controller factories. As all controllers are in the same
diff --git a/framework/inc/services.h b/framework/inc/services.h
index e606390..7ab2c83 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -57,7 +57,6 @@ namespace framework{
 #define SERVICENAME_POPUPMENUCONTROLLERFACTORY                  DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory" )
 #define SERVICENAME_POPUPMENUCONTROLLER                         DECLARE_ASCII("com.sun.star.frame.PopupMenuController"       )
 #define SERVICENAME_UICOMMANDDESCRIPTION                        DECLARE_ASCII("com.sun.star.frame.UICommandDescription"      )
-#define SERVICENAME_UIELEMENTFACTORYMANAGER                     DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager"      )
 #define SERVICENAME_UICONFIGURATIONMANAGER                      DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager"       )
 #define SERVICENAME_MODULEUICONFIGURATIONMANAGER                DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" )
 #define SERVICENAME_MENUBARFACTORY                              DECLARE_ASCII("com.sun.star.ui.UIElementFactory"             )
diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index 79477b2..9e813a7 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -52,6 +52,7 @@
 #include <com/sun/star/awt/XWindowListener.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <com/sun/star/ui/XUIElementFactoryManager.hpp>
 #include <com/sun/star/ui/DockingArea.hpp>
 #include <com/sun/star/awt/XTopWindow2.hpp>
 #include <com/sun/star/awt/XDockableWindow.hpp>
@@ -317,7 +318,7 @@ namespace framework
             UIElement                                                                   m_aProgressBarElement;
             com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >          m_xProgressBarBackup;
             css::uno::Reference< ::com::sun::star::frame::XModuleManager2 >             m_xModuleManager;
-            css::uno::Reference< ::com::sun::star::ui::XUIElementFactory >              m_xUIElementFactoryManager;
+            css::uno::Reference< ::com::sun::star::ui::XUIElementFactoryManager >       m_xUIElementFactoryManager;
             css::uno::Reference< ::com::sun::star::container::XNameAccess >             m_xPersistentWindowState;
             css::uno::Reference< ::com::sun::star::container::XNameAccess >             m_xPersistentWindowStateSupplier;
             GlobalSettings*                                                             m_pGlobalSettings;
diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/uielementfactorymanager.hxx
index e9bbfcf..2661118 100644
--- a/framework/inc/uifactory/uielementfactorymanager.hxx
+++ b/framework/inc/uifactory/uielementfactorymanager.hxx
@@ -34,14 +34,13 @@
 #include <stdtypes.h>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/ui/XUIElementFactory.hpp>
-#include <com/sun/star/ui/XUIElementFactoryRegistration.hpp>
+#include <com/sun/star/ui/XUIElementFactoryManager.hpp>
 #include <com/sun/star/container/XContainerListener.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include "com/sun/star/frame/XModuleManager2.hpp"
 
 #include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
 #include <rtl/ustring.hxx>
 
 namespace framework
@@ -100,9 +99,8 @@ namespace framework
 
 
 class UIElementFactoryManager :  private ThreadHelpBase                                             ,   // Struct for right initalization of mutex member! Must be first of baseclasses.
-                                 public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,
-                                                                 ::com::sun::star::ui::XUIElementFactory,
-                                                                 ::com::sun::star::ui::XUIElementFactoryRegistration>
+                                 public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo,
+                                                                 ::com::sun::star::ui::XUIElementFactoryManager>
 {
     public:
         UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 18f1f81..a916428 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -51,6 +51,7 @@
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
 #include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/UIElementFactoryManager.hpp>
 #include <com/sun/star/container/XNameReplace.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/frame/LayoutManagerEvents.hpp>
@@ -131,8 +132,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM
         , m_bMenuBarCloser( false )
         , m_pInplaceMenuBar( NULL )
         , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ))
-        , m_xUIElementFactoryManager( Reference< ui::XUIElementFactory >(
-                xServiceManager->createInstance( SERVICENAME_UIELEMENTFACTORYMANAGER ), UNO_QUERY ))
+        , m_xUIElementFactoryManager( ui::UIElementFactoryManager::create(comphelper::getComponentContext(xServiceManager)) )
         , m_xPersistentWindowStateSupplier( ui::WindowStateConfiguration::create( comphelper::getComponentContext(xServiceManager) ) )
         , m_pGlobalSettings( 0 )
         , m_aStatusBarAlias( "private:resource/statusbar/statusbar" )
@@ -155,7 +155,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM
     m_aStatusBarElement.m_aType = rtl::OUString( "statusbar" );
     m_aStatusBarElement.m_aName = m_aStatusBarAlias;
 
-    m_pToolbarManager = new ToolbarLayoutManager( comphelper::getComponentContext(xServiceManager), m_xUIElementFactoryManager, this );
+    m_pToolbarManager = new ToolbarLayoutManager( comphelper::getComponentContext(xServiceManager), Reference<XUIElementFactory>(m_xUIElementFactoryManager, UNO_QUERY_THROW), this );
     m_xToolbarManager = uno::Reference< ui::XUIConfigurationListener >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY );
 
     Application::AddEventListener( LINK( this, LayoutManager, SettingsChanged ) );
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index 8e465c4..dd366b7 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -373,7 +373,7 @@ sal_Bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aE
 //*****************************************************************************************************************
 DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2  (   UIElementFactoryManager                         ,
                                             ::cppu::OWeakObject                             ,
-                                            SERVICENAME_UIELEMENTFACTORYMANAGER             ,
+                                            DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager"),
                                             IMPLEMENTATIONNAME_UIELEMENTFACTORYMANAGER
                                         )
 
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index b2bcb4a..29f07f5 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -304,6 +304,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ucb,\
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\
 	GlobalAcceleratorConfiguration \
     ModuleUIConfigurationManagerSupplier \
+    UIElementFactoryManager \
 	WindowContentFactory \
     WindowContentFactoryManager \
 	WindowStateConfiguration \
@@ -1448,7 +1449,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui,\
 	UIConfigurationManager \
 	UIElement \
 	UIElementFactory \
-	UIElementFactoryManager \
 	UIElementSettings \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui/dialogs,\
@@ -3870,6 +3870,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ui,\
 	XUIConfigurationStorage \
 	XUIElement \
 	XUIElementFactory \
+    XUIElementFactoryManager \
 	XUIElementFactoryRegistration \
 	XUIElementSettings \
 	XUIFunctionListener \
diff --git a/offapi/com/sun/star/ui/UIElementFactoryManager.idl b/offapi/com/sun/star/ui/UIElementFactoryManager.idl
index cf19f6c..7ff3746 100644
--- a/offapi/com/sun/star/ui/UIElementFactoryManager.idl
+++ b/offapi/com/sun/star/ui/UIElementFactoryManager.idl
@@ -17,11 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef __com_sun_star_ui_UIElementFactory_idl__
-#define __com_sun_star_ui_UIElementFactory_idl__
+#ifndef __com_sun_star_ui_UIElementFactoryManager_idl__
+#define __com_sun_star_ui_UIElementFactoryManager_idl__
 
-#include <com/sun/star/lang/XMultiComponentFactory.idl>
-#include <com/sun/star/ui/XUIElementFactoryRegistration.idl>
+#include <com/sun/star/ui/XUIElementFactoryManager.idl>
 
 
 module com { module sun { module star { module ui {
@@ -37,24 +36,7 @@ module com { module sun { module star { module ui {
     @since OOo 2.0
 */
 
-service UIElementFactoryManager
-{
-    /** provides a function to create new instances of user interface elements.
-
-        <p>
-        A user interface element factory manager is also a user interface element factory. It
-        retrieves the responsible user interface element factory from the provided arguments and passes
-        the arguments to it.
-
-        see @XUIElementFactory
-        </p>
-     */
-    interface XUIElementFactory;
-
-    /** provides functions to query, retrieve, register and deregister user interface element factories.
-    */
-    interface XUIElementFactoryRegistration;
-};
+service UIElementFactoryManager : XUIElementFactoryManager;
 
 }; }; }; };
 
diff --git a/offapi/com/sun/star/ui/XUIElementFactoryManager.idl b/offapi/com/sun/star/ui/XUIElementFactoryManager.idl
new file mode 100644
index 0000000..15ec523
--- /dev/null
+++ b/offapi/com/sun/star/ui/XUIElementFactoryManager.idl
@@ -0,0 +1,57 @@
+/* -*- 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_ui_XUIElementFactoryManager_idl__
+#define __com_sun_star_ui_XUIElementFactoryManager_idl__
+
+#include <com/sun/star/lang/XMultiComponentFactory.idl>
+#include <com/sun/star/ui/XUIElementFactoryRegistration.idl>
+
+
+module com { module sun { module star { module ui {
+
+
+/** Provides a unified interface for the new-style service XUIElementFactoryManager.
+
+    @since LibreOffice 4.1
+*/
+interface XUIElementFactoryManager
+{
+    /** provides a function to create new instances of user interface elements.
+
+        <p>
+        A user interface element factory manager is also a user interface element factory. It
+        retrieves the responsible user interface element factory from the provided arguments and passes
+        the arguments to it.
+
+        see @XUIElementFactory
+        </p>
+     */
+    interface XUIElementFactory;
+
+    /** provides functions to query, retrieve, register and deregister user interface element factories.
+    */
+    interface XUIElementFactoryRegistration;
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index fa73b75..a92d27e 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/graphic/XGraphicProvider.hpp>
 #include <com/sun/star/accessibility/XAccessible.hpp>
 #include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/ui/UIElementFactoryManager.hpp>
 
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/namedvaluecollection.hxx>
@@ -76,6 +77,8 @@ namespace sfx2
     using ::com::sun::star::container::XNameAccess;
     using ::com::sun::star::ui::XToolPanel;
     using ::com::sun::star::ui::XUIElementFactory;
+    using ::com::sun::star::ui::XUIElementFactoryManager;
+    using ::com::sun::star::ui::UIElementFactoryManager;
     using ::com::sun::star::ui::XUIElement;
     using ::com::sun::star::awt::XWindow;
     using ::com::sun::star::frame::XFrame;
@@ -357,8 +360,7 @@ namespace sfx2
         m_bAttemptedCreation = true;
         try
         {
-            const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-            const Reference< XUIElementFactory > xFactory( aContext.createComponent( "com.sun.star.ui.UIElementFactoryManager" ), UNO_QUERY_THROW );
+            const Reference< XUIElementFactoryManager > xFactory = UIElementFactoryManager::create( ::comphelper::getProcessComponentContext() );
 
             ::comphelper::NamedValueCollection aCreationArgs;
             aCreationArgs.put( "Frame", makeAny( m_xFrame ) );
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index d67b789..3409247 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -43,6 +43,7 @@
 #include <com/sun/star/frame/XModuleManager.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/ui/XUIFunctionListener.hpp>
+#include <com/sun/star/ui/UIElementFactoryManager.hpp>
 #include <com/sun/star/frame/status/Visibility.hpp>
 #include <svl/eitem.hxx>
 #include <svl/stritem.hxx>
@@ -774,7 +775,7 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSub
 
     if ( pImpl->pBox )
     {
-        static WeakReference< XUIElementFactory > xWeakUIElementFactory;
+        static WeakReference< XUIElementFactoryManager > xWeakUIElementFactory;
 
         sal_uInt16 nItemId = pImpl->pBox->GetDownItemId();
 
@@ -785,16 +786,13 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSub
         Reference< XMultiServiceFactory >   xServiceManager = getServiceManager();
         Reference< XFrame >                 xFrame          = getFrameInterface();
         Reference< XUIElement >             xUIElement;
-        Reference< XUIElementFactory >      xUIEementFactory;
+        Reference< XUIElementFactoryManager >  xUIElementFactory;
 
-        xUIEementFactory = xWeakUIElementFactory;
-        if ( !xUIEementFactory.is() )
+        xUIElementFactory = xWeakUIElementFactory;
+        if ( !xUIElementFactory.is() )
         {
-            xUIEementFactory = Reference< XUIElementFactory >(
-                xServiceManager->createInstance(
-                    rtl::OUString( "com.sun.star.ui.UIElementFactoryManager" )),
-                UNO_QUERY );
-            xWeakUIElementFactory = xUIEementFactory;
+            xUIElementFactory = UIElementFactoryManager::create( comphelper::getComponentContext(xServiceManager) );
+            xWeakUIElementFactory = xUIElementFactory;
         }
 
         Sequence< PropertyValue > aPropSeq( 3 );
@@ -807,7 +805,7 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSub
 
         try
         {
-            xUIElement = xUIEementFactory->createUIElement( rSubToolBarResName, aPropSeq );
+            xUIElement = xUIElementFactory->createUIElement( rSubToolBarResName, aPropSeq );
         }
         catch ( ::com::sun::star::container::NoSuchElementException& )
         {
commit bb8900baaaaa489442a5bd805bb42d43cd6fc152
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Dec 11 09:34:11 2012 +0200

    fdo#46808, Create new-style ui::WindowContentFactoryManager service
    
    The service already existed, it just did not have an IDL file.
    
    Change-Id: Ie059e8d81fdfb4c3a5eca274a2406f806ee77b5c

diff --git a/framework/inc/services.h b/framework/inc/services.h
index fcae2a0..e606390 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -81,7 +81,6 @@ namespace framework{
 #define SERVICENAME_STRINGABBREVIATION                          DECLARE_ASCII("com.sun.star.util.UriAbbreviation"                   )
 #define SERVICENAME_IMAGEMANAGER                                DECLARE_ASCII("com.sun.star.ui.ImageManager"                        )
 #define SERVICENAME_TABWINDOWSERVICE                            DECLARE_ASCII("com.sun.star.ui.dialogs.TabContainerWindow"          )
-#define SERVICENAME_WINDOWCONTENTFACTORYMANAGER                 DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager"         )
 #define SERVICENAME_DISPLAYACCESS                               DECLARE_ASCII("com.sun.star.awt.DisplayAccess"                      )
 #define SERVICENAME_PANELFACTORY                                DECLARE_ASCII("com.sun.star.ui.PanelFactory"                        )
 #define SERVICENAME_MODELWINSERVICE                             DECLARE_ASCII("com.sun.star.ui.ModelWinService"                     )
diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx
index f9e27eb..496e74e 100644
--- a/framework/source/uifactory/windowcontentfactorymanager.cxx
+++ b/framework/source/uifactory/windowcontentfactorymanager.cxx
@@ -56,7 +56,7 @@ namespace framework
 //*****************************************************************************************************************
 DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2  (   WindowContentFactoryManager                     ,
                                             ::cppu::OWeakObject                             ,
-                                            SERVICENAME_WINDOWCONTENTFACTORYMANAGER         ,
+                                            DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager"),
                                             IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER
                                         )
 
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 9c1aa3f..b2bcb4a 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -305,6 +305,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\
 	GlobalAcceleratorConfiguration \
     ModuleUIConfigurationManagerSupplier \
 	WindowContentFactory \
+    WindowContentFactoryManager \
 	WindowStateConfiguration \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui/dialogs,\
diff --git a/offapi/com/sun/star/ui/WindowContentFactoryManager.idl b/offapi/com/sun/star/ui/WindowContentFactoryManager.idl
new file mode 100644
index 0000000..95ea4ce
--- /dev/null
+++ b/offapi/com/sun/star/ui/WindowContentFactoryManager.idl
@@ -0,0 +1,39 @@
+/* -*- 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_ui_WindowContentFactoryManager_idl__
+#define __com_sun_star_ui_WindowContentFactoryManager_idl__
+
+#include <com/sun/star/lang/XSingleComponentFactory.idl>
+
+
+module com {  module sun {  module star {  module ui {
+
+
+/**
+  This interface could be imcomplete since I derived it from it's sole place of use.
+
+  @since LibreOffice 4.1
+*/
+service WindowContentFactoryManager : com::sun::star::lang::XSingleComponentFactory;
+
+
+}; }; }; };
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 8932896..c8cb078 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -46,6 +46,7 @@
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/ui/WindowStateConfiguration.hpp>
+#include <com/sun/star/ui/WindowContentFactoryManager.hpp>
 
 #define MAX_TOGGLEAREA_WIDTH        20
 #define MAX_TOGGLEAREA_HEIGHT       20
@@ -128,7 +129,7 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
                                       SfxChildWinInfo* pInfo )
                     : SfxChildWindow( pParentWnd , nId )
 {
-    uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
+    uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
     const rtl::OUString aDockWindowResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/dockingwindow/" ));
 
     SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd,
@@ -136,86 +137,76 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
     pWindow = pTitleDockWindow;
     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
 
-    // Use factory manager to retrieve XWindow factory. That can be used to instanciate
+    // Use factory manager to retrieve XWindow factory. That can be used to instantiate
     // the real window factory.
-    uno::Reference< lang::XSingleComponentFactory > xFactoryMgr(
-            xServiceManager->createInstance(
-                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-                    "com.sun.star.ui.WindowContentFactoryManager"))),
-                uno::UNO_QUERY );
-
-    if (xFactoryMgr.is())
+    uno::Reference< lang::XSingleComponentFactory > xFactoryMgr = ui::WindowContentFactoryManager::create(xContext);
+
+    SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
+    uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
+    uno::Sequence< uno::Any > aArgs(2);
+    beans::PropertyValue      aPropValue;
+    aPropValue.Name  = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
+    aPropValue.Value = uno::makeAny( xFrame );
+    aArgs[0] <<= aPropValue;
+    aPropValue.Name  = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
+
+    // create a resource URL from the nId provided by the sfx2
+    ::rtl::OUString aResourceURL( aDockWindowResourceURL );
+    aResourceURL += ::rtl::OUString::valueOf(sal_Int32(nId));
+    aPropValue.Value = uno::makeAny( aResourceURL );
+    aArgs[1] <<= aPropValue;
+
+    uno::Reference< awt::XWindow > xWindow;
+    try
     {
-        SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
-        uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
-        uno::Sequence< uno::Any > aArgs(2);
-        beans::PropertyValue      aPropValue;
-        aPropValue.Name  = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
-        aPropValue.Value = uno::makeAny( xFrame );
-        aArgs[0] <<= aPropValue;
-        aPropValue.Name  = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
-
-        // create a resource URL from the nId provided by the sfx2
-        ::rtl::OUString aResourceURL( aDockWindowResourceURL );
-        aResourceURL += ::rtl::OUString::valueOf(sal_Int32(nId));
-        aPropValue.Value = uno::makeAny( aResourceURL );
-        aArgs[1] <<= aPropValue;
-
-        uno::Reference< awt::XWindow > xWindow;
-        try
-        {
-            uno::Reference< uno::XComponentContext > xContext(
-                comphelper::getComponentContext( xServiceManager ) );
-
-            xWindow = uno::Reference< awt::XWindow>(
-                xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
-                uno::UNO_QUERY );
-
-            static uno::WeakReference< frame::XModuleManager2 >  m_xModuleManager;
-
-            uno::Reference< frame::XModuleManager2 > xModuleManager( m_xModuleManager );
-            if ( !xModuleManager.is() )
-            {
-                xModuleManager = frame::ModuleManager::create(comphelper::getComponentContext(xServiceManager));
-                m_xModuleManager = xModuleManager;
-            }
-
-            static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration;
+        xWindow = uno::Reference< awt::XWindow>(
+            xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
+            uno::UNO_QUERY );
 
-            uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration );
-            if ( !xWindowStateConfiguration.is() )
-            {
-                xWindowStateConfiguration = ui::WindowStateConfiguration::create( comphelper::getComponentContext(xServiceManager) );
-                m_xWindowStateConfiguration = xWindowStateConfiguration;
-            }
+        static uno::WeakReference< frame::XModuleManager2 >  m_xModuleManager;
 
-            ::rtl::OUString sModuleIdentifier = xModuleManager->identify( xFrame );
-
-            uno::Reference< container::XNameAccess > xModuleWindowState(
-                                                        xWindowStateConfiguration->getByName( sModuleIdentifier ),
-                                                        uno::UNO_QUERY );
-            if ( xModuleWindowState.is() )
-            {
-                WindowState aDockWinState;
-                if ( lcl_getWindowState( xModuleWindowState, aResourceURL, aDockWinState ))
-                    pTitleDockWindow->SetText( aDockWinState.sTitle );
-            }
-        }
-        catch ( beans::UnknownPropertyException& )
+        uno::Reference< frame::XModuleManager2 > xModuleManager( m_xModuleManager );
+        if ( !xModuleManager.is() )
         {
+            xModuleManager = frame::ModuleManager::create(xContext);
+            m_xModuleManager = xModuleManager;
         }
-        catch ( uno::RuntimeException& )
+
+        static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration;
+
+        uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration );
+        if ( !xWindowStateConfiguration.is() )
         {
+            xWindowStateConfiguration = ui::WindowStateConfiguration::create( xContext );
+            m_xWindowStateConfiguration = xWindowStateConfiguration;
         }
-        catch ( uno::Exception& )
+
+        ::rtl::OUString sModuleIdentifier = xModuleManager->identify( xFrame );
+
+        uno::Reference< container::XNameAccess > xModuleWindowState(
+                                                    xWindowStateConfiguration->getByName( sModuleIdentifier ),
+                                                    uno::UNO_QUERY );
+        if ( xModuleWindowState.is() )
         {
+            WindowState aDockWinState;
+            if ( lcl_getWindowState( xModuleWindowState, aResourceURL, aDockWinState ))
+                pTitleDockWindow->SetText( aDockWinState.sTitle );
         }
-
-        Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
-        if ( pContentWindow )
-            pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
-        pTitleDockWindow->SetWrappedWindow(pContentWindow);
     }
+    catch ( beans::UnknownPropertyException& )
+    {
+    }
+    catch ( uno::RuntimeException& )
+    {
+    }
+    catch ( uno::Exception& )
+    {
+    }
+
+    Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
+    if ( pContentWindow )
+        pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+    pTitleDockWindow->SetWrappedWindow(pContentWindow);
 
     pWindow->SetOutputSizePixel( Size( 270, 240 ) );
 
commit c1e42d60c572d23c61a703cd66495eab1cea4e05
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Dec 11 08:16:08 2012 +0200

    fdo#46808, use service constructor for ui::WindowStateConfiguration
    
    Change-Id: I0b7f773a7db47049d7df4138d07e7fc38c657a65

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index a6bc4d8..1c234cb 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -78,6 +78,7 @@
 #include <com/sun/star/ui/XUIElement.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
 #include <com/sun/star/ui/ImageType.hpp>
+#include <com/sun/star/ui/WindowStateConfiguration.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
@@ -881,8 +882,7 @@ SaveInData::SaveInData(
             bDocConfig( isDocConfig ),
             bReadOnly( sal_False ),
             m_xCfgMgr( xCfgMgr ),
-            m_xParentCfgMgr( xParentCfgMgr ),
-            m_xComponentContext( comphelper::getProcessComponentContext() )
+            m_xParentCfgMgr( xParentCfgMgr )
 {
     m_aSeparatorSeq.realloc( 1 );
     m_aSeparatorSeq[0].Name  = OUString( ITEM_DESCRIPTOR_TYPE  );
@@ -896,12 +896,10 @@ SaveInData::SaveInData(
         bReadOnly = xDocPersistence->isReadOnly();
     }
 
-    m_xServiceManager = uno::Reference< lang::XMultiServiceFactory >(
-        ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
 
     uno::Reference< container::XNameAccess > xNameAccess(
-        css::frame::UICommandDescription::create(
-            comphelper::getComponentContext(m_xServiceManager)) );
+        css::frame::UICommandDescription::create(xContext) );
 
     xNameAccess->getByName( aModuleId ) >>= m_xCommandToLabelMap;
 
@@ -1265,6 +1263,8 @@ void MenuSaveInData::Apply(
     SvxEntries::const_iterator iter = GetEntries()->begin();
     SvxEntries::const_iterator end = GetEntries()->end();
 
+    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+
     for ( ; iter != end; ++iter )
     {
         SvxConfigEntry* pEntryData = *iter;
@@ -1273,7 +1273,7 @@ void MenuSaveInData::Apply(
             ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntryData );
 
         uno::Reference< container::XIndexContainer > xSubMenuBar(
-            rFactory->createInstanceWithContext( m_xComponentContext ),
+            rFactory->createInstanceWithContext( xContext ),
             uno::UNO_QUERY );
 
         sal_Int32 nIndex = aPropValueSeq.getLength();
@@ -1291,6 +1291,8 @@ void MenuSaveInData::ApplyMenu(
     uno::Reference< lang::XSingleComponentFactory >& rFactory,
     SvxConfigEntry* pMenuData )
 {
+    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+
     SvxEntries::const_iterator iter = pMenuData->GetEntries()->begin();
     SvxEntries::const_iterator end = pMenuData->GetEntries()->end();
 
@@ -1304,7 +1306,7 @@ void MenuSaveInData::ApplyMenu(
                 ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntry );
 
             uno::Reference< container::XIndexContainer > xSubMenuBar(
-                rFactory->createInstanceWithContext( m_xComponentContext ),
+                rFactory->createInstanceWithContext( xContext ),
                     uno::UNO_QUERY );
 
             sal_Int32 nIndex = aPropValueSeq.getLength();
@@ -3706,13 +3708,9 @@ ToolbarSaveInData::ToolbarSaveInData(
 {
     // Initialize the m_xPersistentWindowState variable which is used
     // to get the default properties of system toolbars such as name
-    uno::Reference< container::XNameAccess > xPWSS(
-        m_xServiceManager->createInstance(
-            OUString( "com.sun.star.ui.WindowStateConfiguration"  ) ),
-        uno::UNO_QUERY );
+    uno::Reference< container::XNameAccess > xPWSS = css::ui::WindowStateConfiguration::create( m_xContext );
 
-    if ( xPWSS.is() )
-        xPWSS->getByName( aModuleId ) >>= m_xPersistentWindowState;
+    xPWSS->getByName( aModuleId ) >>= m_xPersistentWindowState;
 }
 
 ToolbarSaveInData::~ToolbarSaveInData()
@@ -4191,6 +4189,8 @@ void ToolbarSaveInData::ApplyToolbar(
     uno::Reference< lang::XSingleComponentFactory >& rFactory,
     SvxConfigEntry* pToolbarData )
 {
+    uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+
     SvxEntries::const_iterator iter = pToolbarData->GetEntries()->begin();
     SvxEntries::const_iterator end = pToolbarData->GetEntries()->end();
 
@@ -4204,7 +4204,7 @@ void ToolbarSaveInData::ApplyToolbar(
                 ConvertToolbarEntry( m_xCommandToLabelMap, pEntry );
 
             uno::Reference< container::XIndexContainer > xSubMenuBar(
-                rFactory->createInstanceWithContext( m_xComponentContext ),
+                rFactory->createInstanceWithContext( xContext ),
                     uno::UNO_QUERY );
 
             sal_Int32 nIndex = aPropValueSeq.getLength();
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index bccef1c..87c758d 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -132,14 +132,11 @@ public:
             GetParentImageManager() { return m_xParentImgMgr; };
 
     ::com::sun::star::uno::Reference
-        < com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+        < com::sun::star::uno::XComponentContext > m_xContext;
 
     ::com::sun::star::uno::Reference
         < com::sun::star::container::XNameAccess > m_xCommandToLabelMap;
 
-    com::sun::star::uno::Reference
-        < com::sun::star::uno::XComponentContext > m_xComponentContext;
-
     com::sun::star::uno::Sequence
         < com::sun::star::beans::PropertyValue > m_aSeparatorSeq;
 
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index abea8e1..c78c76b 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -63,6 +63,7 @@
 #include <com/sun/star/document/XEventListener.hpp>
 #include <com/sun/star/frame/UICommandDescription.hpp>
 #include <com/sun/star/ui/XUIElementFactoryRegistration.hpp>
+#include <com/sun/star/ui/WindowStateConfiguration.hpp>
 #include <com/sun/star/frame/XUIControllerRegistration.hpp>
 
 #include <toolkit/unohlp.hxx>
@@ -127,6 +128,7 @@ using namespace ::com::sun::star::document;
 using namespace ::com::sun::star::view;
 using namespace ::com::sun::star::task;
 using namespace ::com::sun::star::system;
+using namespace ::com::sun::star::ui;
 using namespace ::com::sun::star::ui::dialogs;
 using namespace ::com::sun::star::container;
 
@@ -1977,8 +1979,6 @@ void Desktop::EnableOleAutomation()
 
 void Desktop::PreloadModuleData( const CommandLineArgs& rArgs )
 {
-    Reference< XMultiServiceFactory > rFactory = ::comphelper::getProcessServiceFactory();
-
     Sequence < com::sun::star::beans::PropertyValue > args(1);
     args[0].Name = ::rtl::OUString("Hidden");
     args[0].Value <<= sal_True;
@@ -2092,51 +2092,47 @@ void Desktop::PreloadConfigurationData()
     }
 
     // preload window state configuration
-    xNameAccess = Reference< XNameAccess >( rFactory->createInstance(
-                    rtl::OUString( "com.sun.star.ui.WindowStateConfiguration" )), UNO_QUERY );
-    if ( xNameAccess.is() )
+    xNameAccess = WindowStateConfiguration::create( xContext );
+    Reference< XNameAccess > xWindowAccess;
+    try
+    {
+        a = xNameAccess->getByName( aWriterDoc );
+        a >>= xWindowAccess;
+        if ( xWindowAccess.is() )
+            xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
+    }
+    catch ( const ::com::sun::star::uno::Exception& )
+    {
+    }
+    try
+    {
+        a = xNameAccess->getByName( aCalcDoc );
+        a >>= xWindowAccess;
+        if ( xWindowAccess.is() )
+            xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
+    }
+    catch ( const ::com::sun::star::uno::Exception& )
+    {
+    }
+    try
+    {
+        a = xNameAccess->getByName( aDrawDoc );
+        a >>= xWindowAccess;
+        if ( xWindowAccess.is() )
+            xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
+    }
+    catch ( const ::com::sun::star::uno::Exception& )
+    {
+    }
+    try
+    {
+        a = xNameAccess->getByName( aImpressDoc );
+        a >>= xWindowAccess;
+        if ( xWindowAccess.is() )
+            xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
+    }
+    catch ( const ::com::sun::star::uno::Exception& )
     {
-        Reference< XNameAccess > xWindowAccess;
-        try
-        {
-            a = xNameAccess->getByName( aWriterDoc );
-            a >>= xWindowAccess;
-            if ( xWindowAccess.is() )
-                xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
-        }
-        catch ( const ::com::sun::star::uno::Exception& )
-        {
-        }
-        try
-        {
-            a = xNameAccess->getByName( aCalcDoc );
-            a >>= xWindowAccess;
-            if ( xWindowAccess.is() )
-                xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
-        }
-        catch ( const ::com::sun::star::uno::Exception& )
-        {
-        }
-        try
-        {
-            a = xNameAccess->getByName( aDrawDoc );
-            a >>= xWindowAccess;
-            if ( xWindowAccess.is() )
-                xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
-        }
-        catch ( const ::com::sun::star::uno::Exception& )
-        {
-        }
-        try
-        {
-            a = xNameAccess->getByName( aImpressDoc );
-            a >>= xWindowAccess;
-            if ( xWindowAccess.is() )
-                xWindowAccess->getByName( rtl::OUString( "private:resource/toolbar/standardbar" ));
-        }
-        catch ( const ::com::sun::star::uno::Exception& )
-        {
-        }
     }
 
     // preload user interface element factories
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 7ad58c5..fcae2a0 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -61,7 +61,6 @@ namespace framework{
 #define SERVICENAME_UICONFIGURATIONMANAGER                      DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager"       )
 #define SERVICENAME_MODULEUICONFIGURATIONMANAGER                DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" )
 #define SERVICENAME_MENUBARFACTORY                              DECLARE_ASCII("com.sun.star.ui.UIElementFactory"             )
-#define SERVICENAME_WINDOWSTATECONFIGURATION                    DECLARE_ASCII("com.sun.star.ui.WindowStateConfiguration"     )
 #define SERVICENAME_STARTMODULE                                 DECLARE_ASCII("com.sun.star.frame.StartModule"                      )
 #define SERVICENAME_FRAMECONTROLLER                             DECLARE_ASCII("com.sun.star.frame.Controller"                       )
 #define SERVICENAME_MODULEACCELERATORCONFIGURATION              DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration")
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 1c20dd3..18f1f81 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -50,6 +50,7 @@
 #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
+#include <com/sun/star/ui/WindowStateConfiguration.hpp>
 #include <com/sun/star/container/XNameReplace.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/frame/LayoutManagerEvents.hpp>
@@ -132,8 +133,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM
         , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ))
         , m_xUIElementFactoryManager( Reference< ui::XUIElementFactory >(
                 xServiceManager->createInstance( SERVICENAME_UIELEMENTFACTORYMANAGER ), UNO_QUERY ))
-        , m_xPersistentWindowStateSupplier( Reference< XNameAccess >(
-                xServiceManager->createInstance( SERVICENAME_WINDOWSTATECONFIGURATION ), UNO_QUERY ))
+        , m_xPersistentWindowStateSupplier( ui::WindowStateConfiguration::create( comphelper::getComponentContext(xServiceManager) ) )
         , m_pGlobalSettings( 0 )
         , m_aStatusBarAlias( "private:resource/statusbar/statusbar" )
         , m_aProgressBarAlias( "private:resource/progressbar/progressbar" )
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index a6989d2..8ed6853 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -1345,7 +1345,7 @@ DEFINE_XTYPEPROVIDER_4                  (   WindowStateConfiguration
 
 DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2(   WindowStateConfiguration                    ,
                                             ::cppu::OWeakObject                         ,
-                                            SERVICENAME_WINDOWSTATECONFIGURATION        ,
+                                            DECLARE_ASCII("com.sun.star.ui.WindowStateConfiguration"),
                                             IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION
                                         )
 
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 34520aa..75b8351 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -41,6 +41,7 @@
 #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
 #include <com/sun/star/ui/UIElementType.hpp>
+#include <com/sun/star/ui/WindowStateConfiguration.hpp>
 
 #include <vcl/menu.hxx>
 #include <vcl/svapp.hxx>
@@ -824,38 +825,33 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume
         if ( m_bInitialized )
         {
             Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) );
-            Reference< XNameAccess > xPersistentWindowStateSupplier( m_xServiceManager->createInstance(
-                                                                        SERVICENAME_WINDOWSTATECONFIGURATION ),
-                                                                     UNO_QUERY );
+            Reference< XNameAccess > xPersistentWindowStateSupplier = ::com::sun::star::ui::WindowStateConfiguration::create( comphelper::getComponentContext(m_xServiceManager) );
 
             // Retrieve persistent window state reference for our module
-            if ( xPersistentWindowStateSupplier.is() && xModuleManager.is() )
+            rtl::OUString aModuleIdentifier;
+            try
             {
-                rtl::OUString aModuleIdentifier;
-                try
-                {
-                    aModuleIdentifier = xModuleManager->identify( m_xFrame );
-                    xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState;
-
-                    Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier =
-                        ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(m_xServiceManager) );
-                    m_xModuleCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
-
-                    Reference< XController > xController = m_xFrame->getController();
-                    Reference< XModel >      xModel;
-                    if ( xController.is() )
-                        xModel = xController->getModel();
-                    if ( xModel.is() )
-                    {
-                        Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
-                        if ( xUIConfigurationManagerSupplier.is() )
-                            m_xDocCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
-                    }
-                    m_aModuleIdentifier = aModuleIdentifier;
-                }
-                catch ( const Exception& )
+                aModuleIdentifier = xModuleManager->identify( m_xFrame );
+                xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState;
+
+                Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier =
+                    ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(m_xServiceManager) );
+                m_xModuleCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
+
+                Reference< XController > xController = m_xFrame->getController();
+                Reference< XModel >      xModel;
+                if ( xController.is() )
+                    xModel = xController->getModel();
+                if ( xModel.is() )
                 {
+                    Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
+                    if ( xUIConfigurationManagerSupplier.is() )
+                        m_xDocCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
                 }
+                m_aModuleIdentifier = aModuleIdentifier;
+            }
+            catch ( const Exception& )
+            {
             }
         }
     }
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 5bf747e..9c1aa3f 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -305,6 +305,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\
 	GlobalAcceleratorConfiguration \
     ModuleUIConfigurationManagerSupplier \
 	WindowContentFactory \
+	WindowStateConfiguration \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui/dialogs,\
 	FolderPicker \
@@ -1448,7 +1449,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui,\
 	UIElementFactory \
 	UIElementFactoryManager \
 	UIElementSettings \
-	WindowStateConfiguration \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui/dialogs,\
 	FilePicker \
diff --git a/offapi/com/sun/star/ui/WindowStateConfiguration.idl b/offapi/com/sun/star/ui/WindowStateConfiguration.idl
index 6a13e9d..afd43f7 100644
--- a/offapi/com/sun/star/ui/WindowStateConfiguration.idl
+++ b/offapi/com/sun/star/ui/WindowStateConfiguration.idl
@@ -36,26 +36,23 @@ module com { module sun { module star { module ui {
     part of OpenOffice.org modules, like Writer or Calc.
     </p>
 
-    @since OOo 2.0
-*/
+    Provides access to window based information about user interface elements
+   of all installed application modules.
 
-service WindowStateConfiguration
-{
-    /** provides access to window based information about user interface elements
-        of all installed application modules.
+    <p>
+    To access the window based information of a module, a unique module specifier
+    must be provided to <member scope="com::sun::star::container">XNameAccess::getByName()</member> function.
+    The module specifier can be retrieved from the <type scope="com::sun::star::frame">ModuleManager</type>
+    service. The interface provides references to a <type scope="com::sun:star::ui">ModuleWindowStateConfiguration</type>.
+    </p>
 
-        <p>

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list