summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-08 15:02:35 +0200
committerNoel Grandin <noel@peralex.com>2013-05-13 09:38:01 +0200
commit86c1ebc1ef4a90e9bc58fb69c2d1d978765a34ca (patch)
treef9ba1c3c02198c83484b68fc190cd2995f6734ab /framework
parentee7f8cb10178fbc348210f6dea0e2ae64964ab6d (diff)
fdo#46808, Convert util::PathSettings service to new style
Change-Id: I302be46b46518e1e872771e1c8a0647f7c330b30
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/services.h2
-rw-r--r--framework/inc/services/pathsettings.hxx146
-rw-r--r--framework/source/accelerators/presethandler.cxx22
-rw-r--r--framework/source/services/pathsettings.cxx32
4 files changed, 180 insertions, 22 deletions
diff --git a/framework/inc/services.h b/framework/inc/services.h
index bf1502632bea..b77c0a680be0 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -37,7 +37,6 @@ namespace framework{
#define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" )
#define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" )
#define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" )
-#define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" )
#define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" )
#define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" )
#define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" )
@@ -75,7 +74,6 @@ namespace framework{
#define IMPLEMENTATIONNAME_MAILTODISPATCHER DECLARE_ASCII("com.sun.star.comp.framework.MailToDispatcher" )
#define IMPLEMENTATIONNAME_SERVICEHANDLER DECLARE_ASCII("com.sun.star.comp.framework.ServiceHandler" )
#define IMPLEMENTATIONNAME_SUBSTITUTEPATHVARIABLES DECLARE_ASCII("com.sun.star.comp.framework.PathSubstitution" )
-#define IMPLEMENTATIONNAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.comp.framework.PathSettings" )
#define IMPLEMENTATIONNAME_JOBDISPATCH DECLARE_ASCII("com.sun.star.comp.framework.jobs.JobDispatch" )
#define IMPLEMENTATIONNAME_DISPATCHHELPER DECLARE_ASCII("com.sun.star.comp.framework.services.DispatchHelper" )
#define IMPLEMENTATIONNAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.comp.framework.LayoutManager" )
diff --git a/framework/inc/services/pathsettings.hxx b/framework/inc/services/pathsettings.hxx
index 4dffe13a91ae..799e2fac7571 100644
--- a/framework/inc/services/pathsettings.hxx
+++ b/framework/inc/services/pathsettings.hxx
@@ -28,11 +28,12 @@
#include <stdtypes.h>
#include <properties.h>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <com/sun/star/util/XChangesListener.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/util/XPathSettings.hpp>
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/interfacecontainer.hxx>
@@ -50,6 +51,7 @@ namespace framework
class PathSettings : public css::lang::XTypeProvider ,
public css::lang::XServiceInfo ,
public css::util::XChangesListener , // => XEventListener
+ public css::util::XPathSettings , // => XPropertySet
// base classes
// Order is necessary for right initialization!
private ThreadHelpBase ,
@@ -173,11 +175,151 @@ class PathSettings : public css::lang::XTypeProvider ,
using ::cppu::OPropertySetHelper::disposing;
+
+ /**
+ * XPathSettings attribute methods
+ */
+ virtual OUString SAL_CALL getAddin() throw (css::uno::RuntimeException)
+ { return getStringProperty("Addin"); }
+ virtual void SAL_CALL setAddin(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Addin", p1); }
+ virtual OUString getAutoCorrect() throw (css::uno::RuntimeException)
+ { return getStringProperty("AutoCorrect"); }
+ virtual void SAL_CALL setAutoCorrect(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("AutoCorrect", p1); }
+ virtual OUString SAL_CALL getAutoText() throw (css::uno::RuntimeException)
+ { return getStringProperty("AutoText"); }
+ virtual void SAL_CALL setAutoText(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("AutoText", p1); }
+ virtual OUString SAL_CALL getBackup() throw (css::uno::RuntimeException)
+ { return getStringProperty("Backup"); }
+ virtual void SAL_CALL setBackup(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Backup", p1); }
+ virtual OUString SAL_CALL getBasic() throw (css::uno::RuntimeException)
+ { return getStringProperty("Basic"); }
+ virtual void SAL_CALL setBasic(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Basic", p1); }
+ virtual OUString SAL_CALL getBitmap() throw (css::uno::RuntimeException)
+ { return getStringProperty("Bitmap"); }
+ virtual void SAL_CALL setBitmap(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Bitmap", p1); }
+ virtual OUString SAL_CALL getConfig() throw (css::uno::RuntimeException)
+ { return getStringProperty("Config"); }
+ virtual void SAL_CALL setConfig(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Config", p1); }
+ virtual OUString SAL_CALL getDictionary() throw (css::uno::RuntimeException)
+ { return getStringProperty("Dictionary"); }
+ virtual void SAL_CALL setDictionary(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Dictionary", p1); }
+ virtual OUString SAL_CALL getFavorite() throw (css::uno::RuntimeException)
+ { return getStringProperty("Favorite"); }
+ virtual void SAL_CALL setFavorite(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Favorite", p1); }
+ virtual OUString SAL_CALL getFilter() throw (css::uno::RuntimeException)
+ { return getStringProperty("Filter"); }
+ virtual void SAL_CALL setFilter(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Filter", p1); }
+ virtual OUString SAL_CALL getGallery() throw (css::uno::RuntimeException)
+ { return getStringProperty("Gallery"); }
+ virtual void SAL_CALL setGallery(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Gallery", p1); }
+ virtual OUString SAL_CALL getGraphic() throw (css::uno::RuntimeException)
+ { return getStringProperty("Graphic"); }
+ virtual void SAL_CALL setGraphic(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Graphic", p1); }
+ virtual OUString SAL_CALL getHelp() throw (css::uno::RuntimeException)
+ { return getStringProperty("Help"); }
+ virtual void SAL_CALL setHelp(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Help", p1); }
+ virtual OUString SAL_CALL getLinguistic() throw (css::uno::RuntimeException)
+ { return getStringProperty("Linguistic"); }
+ virtual void SAL_CALL setLinguistic(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Linguistic", p1); }
+ virtual OUString SAL_CALL getModule() throw (css::uno::RuntimeException)
+ { return getStringProperty("Module"); }
+ virtual void SAL_CALL setModule(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Module", p1); }
+ virtual OUString SAL_CALL getPalette() throw (css::uno::RuntimeException)
+ { return getStringProperty("Palette"); }
+ virtual void SAL_CALL setPalette(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Palette", p1); }
+ virtual OUString SAL_CALL getPlugin() throw (css::uno::RuntimeException)
+ { return getStringProperty("Plugin"); }
+ virtual void SAL_CALL setPlugin(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Plugin", p1); }
+ virtual OUString SAL_CALL getStorage() throw (css::uno::RuntimeException)
+ { return getStringProperty("Storage"); }
+ virtual void SAL_CALL setStorage(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Storage", p1); }
+ virtual OUString SAL_CALL getTemp() throw (css::uno::RuntimeException)
+ { return getStringProperty("Temp"); }
+ virtual void SAL_CALL setTemp(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Temp", p1); }
+ virtual OUString SAL_CALL getTemplate() throw (css::uno::RuntimeException)
+ { return getStringProperty("Template"); }
+ virtual void SAL_CALL setTemplate(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Template", p1); }
+ virtual OUString SAL_CALL getUIConfig() throw (css::uno::RuntimeException)
+ { return getStringProperty("UIConfig"); }
+ virtual void SAL_CALL setUIConfig(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("UIConfig", p1); }
+ virtual OUString SAL_CALL getUserConfig() throw (css::uno::RuntimeException)
+ { return getStringProperty("UserConfig"); }
+ virtual void SAL_CALL setUserConfig(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("UserConfig", p1); }
+ virtual OUString SAL_CALL getUserDictionary() throw (css::uno::RuntimeException)
+ { return getStringProperty("UserDictionary"); }
+ virtual void SAL_CALL setUserDictionary(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("UserDictionary", p1); }
+ virtual OUString SAL_CALL getWork() throw (css::uno::RuntimeException)
+ { return getStringProperty("Work"); }
+ virtual void SAL_CALL setWork(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("Work", p1); }
+ virtual OUString SAL_CALL getBasePathShareLayer() throw (css::uno::RuntimeException)
+ { return getStringProperty("UIConfig"); }
+ virtual void SAL_CALL setBasePathShareLayer(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("UIConfig", p1); }
+ virtual OUString SAL_CALL getBasePathUserLayer() throw (css::uno::RuntimeException)
+ { return getStringProperty("UserConfig"); }
+ virtual void SAL_CALL setBasePathUserLayer(const OUString& p1) throw (css::uno::RuntimeException)
+ { setStringProperty("UserConfig", p1); }
+
+
+
+ /**
+ * overrides to resolve inheritance ambiguity
+ */
+ virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2)
+ throw (css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException)
+ { ::cppu::OPropertySetHelper::setPropertyValue(p1, p2); }
+ virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1)
+ throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException)
+ { return ::cppu::OPropertySetHelper::getPropertyValue(p1); }
+ virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2)
+ throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException)
+ { ::cppu::OPropertySetHelper::addPropertyChangeListener(p1, p2); }
+ virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2)
+ throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException)
+ { ::cppu::OPropertySetHelper::removePropertyChangeListener(p1, p2); }
+ virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2)
+ throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException)
+ { ::cppu::OPropertySetHelper::addVetoableChangeListener(p1, p2); }
+ virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2)
+ throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException)
+ { ::cppu::OPropertySetHelper::removeVetoableChangeListener(p1, p2); }
+
+
// ___________________________________________
// helper
private:
+ OUString getStringProperty(const OUString& p1)
+ throw(css::uno::RuntimeException);
+
+ void setStringProperty(const OUString& p1, const OUString& p2)
+ throw(css::uno::RuntimeException);
+
/** read all configured paths and create all needed internal structures. */
void impl_readAll();
@@ -264,7 +406,7 @@ class PathSettings : public css::lang::XTypeProvider ,
virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue ,
sal_Int32 nHandle ) const;
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( );
- virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) throw(::css::uno::RuntimeException);
/** factory methods to guarantee right (but on demand) initialized members ... */
css::uno::Reference< css::util::XStringSubstitution > fa_getSubstitution();
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index 0ba15b8bde76..6cc93c36efec 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -26,14 +26,15 @@
#include <threadhelp/writeguard.hxx>
#include <services.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/configuration/CorruptedUIConfigurationException.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/FileSystemStorageFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/util/PathSettings.hpp>
#include <vcl/svapp.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -44,9 +45,6 @@
#define SUBSTORAGE_GLOBAL DECLARE_ASCII("global" )
#define SUBSTORAGE_MODULES DECLARE_ASCII("modules")
-#define BASEPATH_SHARE_LAYER DECLARE_ASCII("UIConfig" )
-#define BASEPATH_USER_LAYER DECLARE_ASCII("UserConfig")
-
#define RELPATH_SHARE_LAYER DECLARE_ASCII("soffice.cfg")
#define RELPATH_USER_LAYER DECLARE_ASCII("soffice.cfg")
@@ -228,12 +226,10 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::beans::XPropertySet > xPathSettings(
- xSMGR->createInstance(SERVICENAME_PATHSETTINGS),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::util::XPathSettings > xPathSettings =
+ css::util::PathSettings::create( comphelper::getComponentContext(xSMGR) );
- OUString sShareLayer;
- xPathSettings->getPropertyValue(BASEPATH_SHARE_LAYER) >>= sShareLayer;
+ OUString sShareLayer = xPathSettings->getBasePathShareLayer();
// "UIConfig" is a "multi path" ... use first part only here!
sal_Int32 nPos = sShareLayer.indexOf(';');
@@ -288,12 +284,10 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::beans::XPropertySet > xPathSettings(
- xSMGR->createInstance(SERVICENAME_PATHSETTINGS),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::util::XPathSettings > xPathSettings =
+ css::util::PathSettings::create( comphelper::getComponentContext(xSMGR) );
- OUString sUserLayer;
- xPathSettings->getPropertyValue(BASEPATH_USER_LAYER) >>= sUserLayer ;
+ OUString sUserLayer = xPathSettings->getBasePathUserLayer();
// Note: May be an user uses URLs without a final slash! Check it ...
sal_Int32 nPos = sUserLayer.lastIndexOf('/');
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index 1369950ae942..4734eb2eb27a 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -74,29 +74,34 @@ sal_Int32 impl_getPropGroup(sal_Int32 nID)
}
+#define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" )
+#define IMPLEMENTATIONNAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.comp.framework.PathSettings" )
+
namespace framework
{
//-----------------------------------------------------------------------------
// XInterface, XTypeProvider, XServiceInfo
-DEFINE_XINTERFACE_7 ( PathSettings ,
+DEFINE_XINTERFACE_8 ( PathSettings ,
OWeakObject ,
DIRECT_INTERFACE ( css::lang::XTypeProvider ),
DIRECT_INTERFACE ( css::lang::XServiceInfo ),
DERIVED_INTERFACE( css::lang::XEventListener, css::util::XChangesListener),
DIRECT_INTERFACE ( css::util::XChangesListener ),
- DIRECT_INTERFACE ( css::beans::XPropertySet ),
+ DIRECT_INTERFACE ( css::util::XPathSettings ),
+ DERIVED_INTERFACE( css::beans::XPropertySet, css::util::XPathSettings),
DIRECT_INTERFACE ( css::beans::XFastPropertySet ),
DIRECT_INTERFACE ( css::beans::XMultiPropertySet )
)
-DEFINE_XTYPEPROVIDER_7 ( PathSettings ,
+DEFINE_XTYPEPROVIDER_8 ( PathSettings ,
css::lang::XTypeProvider ,
css::lang::XServiceInfo ,
css::lang::XEventListener ,
css::util::XChangesListener ,
- css::beans::XPropertySet ,
+ css::util::XPathSettings ,
+ css::beans::XPropertySet ,
css::beans::XFastPropertySet ,
css::beans::XMultiPropertySet
)
@@ -195,6 +200,23 @@ void SAL_CALL PathSettings::disposing(const css::lang::EventObject& aSource)
}
//-----------------------------------------------------------------------------
+OUString PathSettings::getStringProperty(const OUString& p1)
+ throw(css::uno::RuntimeException)
+{
+ css::uno::Any a = ::cppu::OPropertySetHelper::getPropertyValue(p1);
+ OUString s;
+ a >>= s;
+ return s;
+}
+
+//-----------------------------------------------------------------------------
+void PathSettings::setStringProperty(const OUString& p1, const OUString& p2)
+ throw(css::uno::RuntimeException)
+{
+ ::cppu::OPropertySetHelper::setPropertyValue(p1, css::uno::Any(p2));
+}
+
+//-----------------------------------------------------------------------------
void PathSettings::impl_readAll()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PathSettings::impl_readAll" );
@@ -1124,6 +1146,8 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgNew()
ReadGuard aReadLock(m_aLock);
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
css::uno::Reference< css::container::XNameAccess > xCfg = m_xCfgNew;
+ if (xCfg.is())
+ return xCfg;
aReadLock.unlock();
// <- SAFE