[Libreoffice-commits] core.git: 5 commits - forms/source i18npool/source offapi/com offapi/type_reference offapi/UnoApi_offapi.mk sd/source sfx2/source svtools/source svx/source sw/source toolkit/source ucb/source xmloff/source
Noel Grandin
noel at peralex.com
Mon Mar 4 00:14:01 PST 2013
forms/source/xforms/model.hxx | 32 ++++++
forms/source/xforms/xforms_services.cxx | 2
i18npool/source/breakiterator/breakiteratorImpl.cxx | 2
i18npool/source/calendar/calendarImpl.cxx | 2
i18npool/source/characterclassification/characterclassificationImpl.cxx | 2
i18npool/source/collator/collatorImpl.cxx | 2
i18npool/source/indexentry/indexentrysupplier.cxx | 2
i18npool/source/textconversion/textconversionImpl.cxx | 2
i18npool/source/textconversion/textconversion_ko.cxx | 2
offapi/UnoApi_offapi.mk | 6 +
offapi/com/sun/star/awt/tree/DefaultTreeDataModel.idl | 38 +++++++
offapi/com/sun/star/util/OfficeInstallationDirectories.idl | 20 ----
offapi/com/sun/star/util/theOfficeInstallationDirectories.idl | 48 ++++++++++
offapi/com/sun/star/xforms/Model.idl | 37 +++++++
offapi/com/sun/star/xforms/XModel2.idl | 44 +++++++++
offapi/type_reference/types.rdb |binary
sd/source/ui/unoidl/unosrch.cxx | 15 +--
sfx2/source/doc/doctemplates.cxx | 11 --
svtools/source/misc/templatefoldercache.cxx | 10 --
svtools/source/table/cellvalueconversion.cxx | 33 +-----
svtools/source/table/cellvalueconversion.hxx | 8 -
svtools/source/table/gridtablerenderer.cxx | 2
svtools/source/uno/treecontrolpeer.cxx | 10 --
svx/source/accessibility/AccessibleControlShape.cxx | 4
sw/source/core/doc/docxforms.cxx | 25 ++---
toolkit/source/controls/unocontrol.cxx | 2
ucb/source/ucp/hierarchy/hierarchyprovider.cxx | 10 --
xmloff/source/xforms/XFormsBindContext.cxx | 8 -
xmloff/source/xforms/XFormsBindContext.hxx | 6 -
xmloff/source/xforms/XFormsInstanceContext.cxx | 8 -
xmloff/source/xforms/XFormsInstanceContext.hxx | 6 -
xmloff/source/xforms/XFormsModelContext.cxx | 9 -
xmloff/source/xforms/XFormsModelContext.hxx | 5 -
xmloff/source/xforms/XFormsSubmissionContext.cxx | 12 +-
xmloff/source/xforms/XFormsSubmissionContext.hxx | 3
xmloff/source/xforms/xformsapi.cxx | 24 +----
xmloff/source/xforms/xformsapi.hxx | 6 -
37 files changed, 294 insertions(+), 164 deletions(-)
New commits:
commit b313e37a92a18bc663ea5eb97ea0a569c6b0a962
Author: Noel Grandin <noel at peralex.com>
Date: Fri Mar 1 16:32:32 2013 +0200
fdo#46808, convert xforms::Model to new style
the service already existed, it just needed an IDL file.
Change-Id: Id8f33183d9332f9defd855b3a3c7413fde24a61b
diff --git a/forms/source/xforms/model.hxx b/forms/source/xforms/model.hxx
index acbeff4..2e989ab 100644
--- a/forms/source/xforms/model.hxx
+++ b/forms/source/xforms/model.hxx
@@ -22,7 +22,7 @@
#include <cppuhelper/implbase4.hxx>
#include <propertysetbase.hxx>
-#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XModel2.hpp>
#include <com/sun/star/xforms/XFormsUIHelper1.hpp>
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -68,7 +68,7 @@ namespace xforms
*/
typedef cppu::ImplInheritanceHelper4<
PropertySetBase,
- com::sun::star::xforms::XModel,
+ com::sun::star::xforms::XModel2,
com::sun::star::xforms::XFormsUIHelper1,
com::sun::star::util::XUpdatable,
com::sun::star::lang::XUnoTunnel
@@ -281,7 +281,35 @@ public:
virtual XSet_t SAL_CALL getSubmissions()
throw( RuntimeException_t );
+ // XPropertySet
+ virtual css::uno::Any SAL_CALL getPropertyValue(const rtl::OUString& p)
+ throw( css::uno::RuntimeException )
+ { return PropertySetBase::getPropertyValue(p); }
+
+ virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2)
+ throw( css::uno::RuntimeException )
+ { PropertySetBase::addPropertyChangeListener(p1, p2); }
+
+ virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2)
+ throw( css::uno::RuntimeException )
+ { PropertySetBase::removePropertyChangeListener(p1, p2); }
+
+ virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2)
+ throw( css::uno::RuntimeException )
+ { PropertySetBase::addVetoableChangeListener(p1, p2); }
+
+ virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2)
+ throw( css::uno::RuntimeException )
+ { PropertySetBase::removeVetoableChangeListener(p1, p2); }
+
+ virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo()
+ throw( css::uno::RuntimeException )
+ { return PropertySetBase::getPropertySetInfo(); }
+
+ virtual void SAL_CALL setPropertyValue(const rtl::OUString& p1, const com::sun::star::uno::Any& p2)
+ throw( css::uno::RuntimeException )
+ { PropertySetBase::setPropertyValue(p1, p2); }
//
// XFormsUIHelper1 & friends:
diff --git a/forms/source/xforms/xforms_services.cxx b/forms/source/xforms/xforms_services.cxx
index da09e6a..7e03f99 100644
--- a/forms/source/xforms/xforms_services.cxx
+++ b/forms/source/xforms/xforms_services.cxx
@@ -46,7 +46,7 @@ Reference<XInterface> Model_CreateInstance(
const Reference<XMultiServiceFactory>& )
throw( RuntimeException )
{
- return static_cast<XPropertySet*>( new xforms::Model );
+ return static_cast<XPropertySet*>( static_cast<PropertySetBase*>( new xforms::Model ) );
}
Reference<XInterface> XForms_CreateInstance(
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 6877658..3f2f287 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -366,6 +366,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
UriAbbreviation \
URLTransformer \
))
+$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xforms,\
+ Model \
+))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/crypto,\
NSSInitializer \
SEInitializer \
@@ -4072,6 +4075,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xforms,\
XFormsSupplier \
XFormsUIHelper1 \
XModel \
+ XModel2 \
XSubmission \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml,\
diff --git a/offapi/com/sun/star/xforms/Model.idl b/offapi/com/sun/star/xforms/Model.idl
new file mode 100644
index 0000000..186ae88
--- /dev/null
+++ b/offapi/com/sun/star/xforms/Model.idl
@@ -0,0 +1,37 @@
+/* -*- 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_xforms_Model_idl__
+#define __com_sun_star_xforms_Model_idl__
+
+#include <com/sun/star/xforms/XModel2.idl>
+
+
+module com { module sun { module star { module xforms {
+
+/**
+ @since LibreOffice 4.1
+ */
+service Model : XModel2;
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/xforms/XModel2.idl b/offapi/com/sun/star/xforms/XModel2.idl
new file mode 100644
index 0000000..ec1704d
--- /dev/null
+++ b/offapi/com/sun/star/xforms/XModel2.idl
@@ -0,0 +1,44 @@
+/* -*- 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_xforms_XModel2_idl__
+#define __com_sun_star_xforms_XModel2_idl__
+
+#include <com/sun/star/xforms/XModel.idl>
+
+
+module com { module sun { module star { module xforms {
+
+
+/**
+ @since LibreOffice 4.1
+ */
+interface XModel2
+{
+ interface com::sun::star::xforms::XModel;
+
+ interface com::sun::star::beans::XPropertySet;
+
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docxforms.cxx b/sw/source/core/doc/docxforms.cxx
index e027adc..6841e97 100644
--- a/sw/source/core/doc/docxforms.cxx
+++ b/sw/source/core/doc/docxforms.cxx
@@ -23,7 +23,8 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XModule.hpp>
-#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/Model.hpp>
+#include <com/sun/star/xforms/XModel2.hpp>
#include <com/sun/star/xforms/XFormsUIHelper1.hpp>
#include <comphelper/processfactory.hxx>
#include <tools/diagnose_ex.h>
@@ -37,7 +38,7 @@ using uno::UNO_QUERY;
using uno::makeAny;
using uno::Exception;
using container::XNameContainer;
-using xforms::XModel;
+using xforms::XModel2;
using frame::XModule;
using xforms::XFormsUIHelper1;
using ::rtl::OUString;
@@ -84,19 +85,13 @@ void SwDoc::initXForms( bool bCreateDefaultModel )
if( bCreateDefaultModel && mxXForms.is() )
{
OUString sName("Model 1");
- Reference<XModel> xModel(
- lcl_createInstance( "com.sun.star.xforms.Model" ),
- UNO_QUERY );
- OSL_ENSURE( xModel.is(), "no model?" );
- if( xModel.is() )
- {
- xModel->setID( sName );
- Reference<XFormsUIHelper1>( xModel, UNO_QUERY )->newInstance(
- OUString("Instance 1"),
- OUString(), sal_True );
- xModel->initialize();
- mxXForms->insertByName( sName, makeAny( xModel ) );
- }
+ Reference<XModel2> xModel = xforms::Model::create( comphelper::getProcessComponentContext() );
+ xModel->setID( sName );
+ Reference<XFormsUIHelper1>( xModel, uno::UNO_QUERY_THROW )->newInstance(
+ OUString("Instance 1"),
+ OUString(), sal_True );
+ xModel->initialize();
+ mxXForms->insertByName( sName, makeAny( xModel ) );
OSL_ENSURE( mxXForms->hasElements(), "can't create XForms model" );
}
diff --git a/xmloff/source/xforms/XFormsBindContext.cxx b/xmloff/source/xforms/XFormsBindContext.cxx
index eee251b..452156c 100644
--- a/xmloff/source/xforms/XFormsBindContext.cxx
+++ b/xmloff/source/xforms/XFormsBindContext.cxx
@@ -30,7 +30,7 @@
#include <xmloff/nmspmap.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XModel2.hpp>
#include <tools/debug.hxx>
@@ -42,7 +42,7 @@ using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::UNO_QUERY_THROW;
using com::sun::star::container::XNameContainer;
using com::sun::star::xml::sax::XAttributeList;
-using com::sun::star::xforms::XModel;
+using com::sun::star::xforms::XModel2;
using namespace xmloff::token;
@@ -69,9 +69,9 @@ XFormsBindContext::XFormsBindContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
- const Reference<XPropertySet>& xModel ) :
+ const Reference<XModel2>& xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
- mxModel( xModel, UNO_QUERY_THROW ),
+ mxModel( xModel ),
mxBinding( NULL )
{
// attach binding to model
diff --git a/xmloff/source/xforms/XFormsBindContext.hxx b/xmloff/source/xforms/XFormsBindContext.hxx
index 0de4cdb..d376c60 100644
--- a/xmloff/source/xforms/XFormsBindContext.hxx
+++ b/xmloff/source/xforms/XFormsBindContext.hxx
@@ -31,7 +31,7 @@
namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } }
namespace beans { class XPropertySet; }
- namespace xforms { class XModel; }
+ namespace xforms { class XModel2; }
} } }
namespace rtl { class OUString; }
class SvXMLImport;
@@ -41,7 +41,7 @@ class SvXMLImportContext;
/** import the xforms:binding element */
class XFormsBindContext : public TokenContext
{
- const com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel;
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> mxModel;
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxBinding;
public:
@@ -49,7 +49,7 @@ public:
XFormsBindContext( SvXMLImport& rImport,
sal_uInt16 nPrefix,
const rtl::OUString& rLocalName,
- const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel );
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2>& xModel );
virtual ~XFormsBindContext();
diff --git a/xmloff/source/xforms/XFormsInstanceContext.cxx b/xmloff/source/xforms/XFormsInstanceContext.cxx
index e004bf8..abfa932 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.cxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
-#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XModel2.hpp>
#include <tools/debug.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -43,7 +43,7 @@ using com::sun::star::uno::Reference;
using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Sequence;
-using com::sun::star::xforms::XModel;
+using com::sun::star::xforms::XModel2;
using com::sun::star::beans::XPropertySet;
using com::sun::star::beans::PropertyValue;
using com::sun::star::xml::sax::XAttributeList;
@@ -64,9 +64,9 @@ XFormsInstanceContext::XFormsInstanceContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
- Reference<XPropertySet> xModel ) :
+ const Reference<XModel2> & xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aEmptyMap ),
- mxModel( Reference<XModel>( xModel, UNO_QUERY ) )
+ mxModel( xModel )
{
DBG_ASSERT( mxModel.is(), "need model" );
}
diff --git a/xmloff/source/xforms/XFormsInstanceContext.hxx b/xmloff/source/xforms/XFormsInstanceContext.hxx
index 631c8f9..30b50c2 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.hxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.hxx
@@ -32,7 +32,7 @@ namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } }
namespace xml { namespace dom { class XDocument; } }
namespace beans { class XPropertySet; }
- namespace xforms { class XModel; }
+ namespace xforms { class XModel2; }
} } }
namespace rtl { class OUString; }
class SvXMLImport;
@@ -42,7 +42,7 @@ class SvXMLImportContext;
/** import the xforms:instance element */
class XFormsInstanceContext : public TokenContext
{
- com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel;
+ com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> mxModel;
com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> mxInstance;
rtl::OUString msId;
rtl::OUString msURL;
@@ -52,7 +52,7 @@ public:
XFormsInstanceContext( SvXMLImport& rImport,
sal_uInt16 nPrfx,
const ::rtl::OUString& rLName,
- com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xModel );
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> & xModel );
virtual ~XFormsInstanceContext();
diff --git a/xmloff/source/xforms/XFormsModelContext.cxx b/xmloff/source/xforms/XFormsModelContext.cxx
index 3a47de5..0cccc42 100644
--- a/xmloff/source/xforms/XFormsModelContext.cxx
+++ b/xmloff/source/xforms/XFormsModelContext.cxx
@@ -35,7 +35,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/util/XUpdatable.hpp>
-#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XModel2.hpp>
using rtl::OUString;
@@ -78,7 +78,7 @@ XFormsModelContext::~XFormsModelContext()
}
-Reference<XPropertySet> XFormsModelContext::getModel()
+Reference<css::xforms::XModel2> XFormsModelContext::getModel()
{
return mxModel;
}
@@ -126,10 +126,7 @@ SvXMLImportContext* XFormsModelContext::HandleChild(
break;
case XML_SCHEMA:
pContext = new SchemaContext(
- GetImport(), nPrefix, rLocalName,
- Reference<com::sun::star::xforms::XModel>( mxModel,
- UNO_QUERY_THROW )
- ->getDataTypeRepository() );
+ GetImport(), nPrefix, rLocalName, mxModel->getDataTypeRepository() );
break;
default:
OSL_FAIL( "Boooo!" );
diff --git a/xmloff/source/xforms/XFormsModelContext.hxx b/xmloff/source/xforms/XFormsModelContext.hxx
index acbb99d..9339bc5 100644
--- a/xmloff/source/xforms/XFormsModelContext.hxx
+++ b/xmloff/source/xforms/XFormsModelContext.hxx
@@ -22,6 +22,7 @@
#include "TokenContext.hxx"
#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/xforms/XModel2.hpp>
//
@@ -39,7 +40,7 @@ class SvXMLImportContext;
/** import the xforms:model element */
class XFormsModelContext : public TokenContext
{
- com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxModel;
+ com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> mxModel;
public:
@@ -48,7 +49,7 @@ public:
const ::rtl::OUString& rLName );
virtual ~XFormsModelContext();
- com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> getModel();
+ com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> getModel();
//
// implement SvXMLImportContext & TokenContext methods:
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.cxx b/xmloff/source/xforms/XFormsSubmissionContext.cxx
index 7ad50a6..23e470c 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.cxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.cxx
@@ -32,7 +32,7 @@
#include <sax/tools/converter.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XModel2.hpp>
#include <tools/debug.hxx>
@@ -40,7 +40,7 @@ using rtl::OUString;
using com::sun::star::beans::XPropertySet;
using com::sun::star::container::XNameContainer;
using com::sun::star::xml::sax::XAttributeList;
-using com::sun::star::xforms::XModel;
+using com::sun::star::xforms::XModel2;
using namespace com::sun::star::uno;
using namespace xmloff::token;
@@ -72,17 +72,15 @@ XFormsSubmissionContext::XFormsSubmissionContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
- const Reference<XPropertySet>& xModel ) :
+ const Reference<XModel2>& xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
mxSubmission()
{
// register submission with model
DBG_ASSERT( xModel.is(), "need model" );
- Reference<XModel> xXModel( xModel, UNO_QUERY );
- DBG_ASSERT( xXModel.is(), "need XModel" );
- mxSubmission = xXModel->createSubmission().get();
+ mxSubmission = xModel->createSubmission().get();
DBG_ASSERT( mxSubmission.is(), "can't create submission" );
- xXModel->getSubmissions()->insert( makeAny( mxSubmission ) );
+ xModel->getSubmissions()->insert( makeAny( mxSubmission ) );
}
XFormsSubmissionContext::~XFormsSubmissionContext()
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.hxx b/xmloff/source/xforms/XFormsSubmissionContext.hxx
index 6636d7b..0c56d8b 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.hxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.hxx
@@ -31,6 +31,7 @@
namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } }
namespace beans { class XPropertySet; }
+ namespace xforms { class XModel2; }
} } }
namespace rtl { class OUString; }
class SvXMLImport;
@@ -47,7 +48,7 @@ public:
XFormsSubmissionContext( SvXMLImport& rImport,
sal_uInt16 nPrefix,
const rtl::OUString& rLocalName,
- const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel );
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2>& xModel );
virtual ~XFormsSubmissionContext();
diff --git a/xmloff/source/xforms/xformsapi.cxx b/xmloff/source/xforms/xformsapi.cxx
index 7a6a606..b73af0a 100644
--- a/xmloff/source/xforms/xformsapi.cxx
+++ b/xmloff/source/xforms/xformsapi.cxx
@@ -26,7 +26,8 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/xforms/XFormsSupplier.hpp>
#include <com/sun/star/xforms/XDataTypeRepository.hpp>
-#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/Model.hpp>
+#include <com/sun/star/xforms/XModel2.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xsd/DataTypeClass.hpp>
@@ -48,8 +49,9 @@ using com::sun::star::container::XNameAccess;
using com::sun::star::lang::XMultiServiceFactory;
using com::sun::star::xforms::XFormsSupplier;
using com::sun::star::xforms::XDataTypeRepository;
+using com::sun::star::xforms::Model;
+using com::sun::star::xforms::XModel2;
using com::sun::star::container::XNameContainer;
-using comphelper::getProcessServiceFactory;
using com::sun::star::uno::makeAny;
using com::sun::star::uno::Any;
using com::sun::star::uno::Exception;
@@ -57,26 +59,16 @@ using com::sun::star::uno::Exception;
using namespace com::sun::star;
using namespace xmloff::token;
-static Reference<XPropertySet> lcl_createPropertySet( const OUString& rServiceName )
+Reference<XModel2> xforms_createXFormsModel()
{
- Reference<XMultiServiceFactory> xFactory = getProcessServiceFactory();
- DBG_ASSERT( xFactory.is(), "can't get service factory" );
-
- Reference<XPropertySet> xModel( xFactory->createInstance( rServiceName ),
- UNO_QUERY_THROW );
- DBG_ASSERT( xModel.is(), "can't create model" );
+ Reference<XModel2> xModel = Model::create( comphelper::getProcessComponentContext() );
return xModel;
}
-Reference<XPropertySet> xforms_createXFormsModel()
-{
- return lcl_createPropertySet( "com.sun.star.xforms.Model" );
-}
-
void xforms_addXFormsModel(
const Reference<frame::XModel>& xDocument,
- const Reference<XPropertySet>& xModel )
+ const Reference<xforms::XModel2>& xModel )
{
bool bSuccess = false;
try
@@ -129,7 +121,7 @@ static Reference<XPropertySet> lcl_findXFormsBindingOrSubmission(
sal_Int32 nNames = aNames.getLength();
for( sal_Int32 n = 0; (n < nNames) && !xRet.is(); n++ )
{
- Reference<xforms::XModel> xModel(
+ Reference<xforms::XModel2> xModel(
xForms->getByName( pNames[n] ), UNO_QUERY );
if( xModel.is() )
{
diff --git a/xmloff/source/xforms/xformsapi.hxx b/xmloff/source/xforms/xformsapi.hxx
index b9e0e10..75115b9 100644
--- a/xmloff/source/xforms/xformsapi.hxx
+++ b/xmloff/source/xforms/xformsapi.hxx
@@ -31,15 +31,15 @@ namespace com { namespace sun { namespace star {
namespace beans { class XPropertySet; }
namespace frame { class XModel; }
namespace uno { template<class A> class Reference; }
- namespace xforms { class XDataTypeRepository; }
+ namespace xforms { class XDataTypeRepository; class XModel2; }
} } }
class SvXMLNamespaceMap;
-com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xforms_createXFormsModel();
+com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> xforms_createXFormsModel();
void xforms_addXFormsModel(
const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xDocument,
- const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel );
+ const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2>& xModel );
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xforms_findXFormsBinding( com::sun::star::uno::Reference<com::sun::star::frame::XModel>&, const rtl::OUString& );
commit fb0f7c2415321a3bcae00802b98ae76144ea4e79
Author: Noel Grandin <noel at peralex.com>
Date: Wed Feb 13 08:31:59 2013 +0200
fdo#46808, convert singleton util::theOfficeInstallationDirectories
.. to new-style UNO.
And deprecate old service in favour of singleton.
Change-Id: I67244097c22af02530214d7c529dd0d32f5964c1
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 21e050f..6877658 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -362,6 +362,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
NumberFormatsSupplier \
PathSubstitution \
TextSearch \
+ theOfficeInstallationDirectories \
UriAbbreviation \
URLTransformer \
))
diff --git a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl
index a4c8f13..94f7164 100644
--- a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl
+++ b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl
@@ -39,24 +39,10 @@ module com { module sun { module star { module util {
installations.
@since OOo 2.0
+ @deprecated rather use the singleton theOfficeInstallationDirectories
*/
-published service OfficeInstallationDirectories
-{
- /** provides access to the current office installation directories (office
- base installation and user data).
- */
- interface com::sun::star::util::XOfficeInstallationDirectories;
-};
-
-
-/** A singleton that provides access to the current office installation
- directories.
-
- @see OfficeInstallationDirectories
-*/
-published singleton theOfficeInstallationDirectories
-{
- service com::sun::star::util::OfficeInstallationDirectories;
+published service OfficeInstallationDirectories {
+ interface XOfficeInstallationDirectories;
};
diff --git a/offapi/com/sun/star/util/theOfficeInstallationDirectories.idl b/offapi/com/sun/star/util/theOfficeInstallationDirectories.idl
new file mode 100644
index 0000000..275c069
--- /dev/null
+++ b/offapi/com/sun/star/util/theOfficeInstallationDirectories.idl
@@ -0,0 +1,48 @@
+/* -*- 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_util_theOfficeInstallationDirectories_idl__
+#define __com_sun_star_util_theOfficeInstallationDirectories_idl__
+
+#include <com/sun/star/util/XOfficeInstallationDirectories.idl>
+
+
+module com { module sun { module star { module util {
+
+
+/** encapsulates access to the current office installation directory and
+ office user data directory, provides functionality to create URLs
+ containing relocatable (not absolute) references to the current office
+ installation directory and user data directory and vice versa.
+
+ <p>This functionality is useful when data containing references to the
+ current office installation directory or user data directory must be made
+ persistent and re-read later. In many cases, storing the reference
+ directly would destroy the relocatability of an office installation and the
+ possibility to share one office user data directory among parallel office
+ installations.
+ */
+published singleton theOfficeInstallationDirectories : XOfficeInstallationDirectories;
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 720c3ec..ff334d8 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index d85ca00..c25faa6 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/util/theMacroExpander.hpp>
+#include <com/sun/star/util/theOfficeInstallationDirectories.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
@@ -2830,15 +2831,7 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
uno::Reference< XComponentContext > xCtx(
comphelper::getComponentContext( mxFactory ) );
- xCtx->getValueByName(
- rtl::OUString(
- "/singletons/"
- "com.sun.star.util.theOfficeInstallationDirectories" ) )
- >>= mxOfficeInstDirs;
-
- OSL_ENSURE( mxOfficeInstDirs.is(),
- "Unable to obtain office installation directory "
- "singleton!" );
+ mxOfficeInstDirs = theOfficeInstallationDirectories::get(xCtx);
}
}
}
diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx
index 18e8730..538c224 100644
--- a/svtools/source/misc/templatefoldercache.cxx
+++ b/svtools/source/misc/templatefoldercache.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
+#include <com/sun/star/util/theOfficeInstallationDirectories.hpp>
#include <ucbhelper/content.hxx>
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
@@ -829,13 +829,7 @@ namespace svt
{
uno::Reference< uno::XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
- xCtx->getValueByName(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) ) )
- >>= m_xOfficeInstDirs;
-
- OSL_ENSURE( m_xOfficeInstDirs.is(),
- "Unable to obtain office directories singleton!" );
+ m_xOfficeInstDirs = util::theOfficeInstallationDirectories::get(xCtx);
}
}
return m_xOfficeInstDirs;
diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx
index 0fc6ec64..2920d44 100644
--- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx
@@ -28,7 +28,7 @@
#include <osl/diagnose.h>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
+#include <com/sun/star/util/theOfficeInstallationDirectories.hpp>
#include <comphelper/processfactory.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include "hierarchyprovider.hxx"
@@ -268,13 +268,7 @@ HierarchyContentProvider::getOfficeInstallationDirectories()
{
OSL_ENSURE( m_xContext.is(), "No service manager!" );
- m_xContext->getValueByName(
- rtl::OUString( "/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) )
- >>= m_xOfficeInstDirs;
-
-// Be silent. singleton only available in an Office environment.
-// OSL_ENSURE( m_xOfficeInstDirs.is(),
-// "Unable to obtain office directories singleton!" );
+ m_xOfficeInstDirs = util::theOfficeInstallationDirectories::get(m_xContext);
}
}
return m_xOfficeInstDirs;
commit 57dbe20c2bfa0cf5ced0826f61a130414c948f83
Author: Noel Grandin <noel at peralex.com>
Date: Tue Feb 12 17:20:49 2013 +0200
fdo#46808, clean up some old queryInterface() calls
clean up stuff like this
xI->queryInterface( getCppuType((const Reference< XExtendedInputSequenceChecker>*)0) ) >>= xISC;
to
xISC.set(xI, UNO_QUERY);
Change-Id: I3b16a38c2a363440f6079cfe6ae47f009d3940db
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index 4f2207a..55b0315 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -549,7 +549,7 @@ sal_Bool SAL_CALL BreakIteratorImpl::createLocaleSpecificBreakIterator(const OUS
OUString("com.sun.star.i18n.BreakIterator_") + aLocaleName, m_xContext);
if ( xI.is() ) {
- xI->queryInterface( getCppuType((const Reference< XBreakIterator>*)0) ) >>= xBI;
+ xBI.set(xI, UNO_QUERY);
if (xBI.is()) {
lookupTable.push_back(new lookupTableItem(Locale(aLocaleName, aLocaleName, aLocaleName), xBI));
return sal_True;
diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx
index e7c76ef..81a191b 100644
--- a/i18npool/source/calendar/calendarImpl.cxx
+++ b/i18npool/source/calendar/calendarImpl.cxx
@@ -86,7 +86,7 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale ) thr
}
if ( xI.is() )
- xI->queryInterface(::getCppuType((const Reference< XCalendar3>*)0)) >>= xCalendar;
+ xCalendar.set(xI, UNO_QUERY);
else
throw ERROR;
diff --git a/i18npool/source/characterclassification/characterclassificationImpl.cxx b/i18npool/source/characterclassification/characterclassificationImpl.cxx
index 6786449..d3ab351 100644
--- a/i18npool/source/characterclassification/characterclassificationImpl.cxx
+++ b/i18npool/source/characterclassification/characterclassificationImpl.cxx
@@ -145,7 +145,7 @@ sal_Bool SAL_CALL CharacterClassificationImpl::createLocaleSpecificCharacterClas
Reference < XCharacterClassification > xCI;
if ( xI.is() ) {
- xI->queryInterface(::getCppuType((const Reference< XCharacterClassification>*)0) ) >>= xCI;
+ xCI.set( xI, UNO_QUERY );
if (xCI.is()) {
lookupTable.push_back( cachedItem = new lookupTableItem(rLocale, serviceName, xCI) );
return sal_True;
diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx
index fde6eef..35cfd3c 100644
--- a/i18npool/source/collator/collatorImpl.cxx
+++ b/i18npool/source/collator/collatorImpl.cxx
@@ -159,7 +159,7 @@ CollatorImpl::createCollator(const lang::Locale& rLocale, const OUString& servic
if (xI.is()) {
Reference < XCollator > xC;
- xI->queryInterface( getCppuType((const Reference< XCollator>*)0) ) >>= xC;
+ xC.set( xI, UNO_QUERY );
if (xC.is()) {
lookupTable.push_back(cachedItem = new lookupTableItem(rLocale, rSortAlgorithm, serviceName, xC));
return sal_True;
diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx
index 9005d12..9c5ab17 100644
--- a/i18npool/source/indexentry/indexentrysupplier.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier.cxx
@@ -105,7 +105,7 @@ sal_Bool SAL_CALL IndexEntrySupplier::createLocaleSpecificIndexEntrySupplier(con
OUString("com.sun.star.i18n.IndexEntrySupplier_") + name, m_xContext);
if ( xI.is() ) {
- xI->queryInterface( ::getCppuType((const Reference< com::sun::star::i18n::XExtendedIndexEntrySupplier>*)0) ) >>= xIES;
+ xIES.set( xI, UNO_QUERY );
return xIES.is();
}
return sal_False;
diff --git a/i18npool/source/textconversion/textconversionImpl.cxx b/i18npool/source/textconversion/textconversionImpl.cxx
index ab2ad1f..c035177 100644
--- a/i18npool/source/textconversion/textconversionImpl.cxx
+++ b/i18npool/source/textconversion/textconversionImpl.cxx
@@ -102,7 +102,7 @@ TextConversionImpl::getLocaleSpecificTextConversion(const Locale& rLocale) throw
OUString("_") + aLocale.Variant, m_xContext);
if (xI.is())
- xI->queryInterface( getCppuType((const Reference< XTextConversion>*)0) ) >>= xTC;
+ xTC.set( xI, UNO_QUERY );
else if (xTC.is())
xTC.clear();
}
diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx
index bb86903..f20a1e6 100644
--- a/i18npool/source/textconversion/textconversion_ko.cxx
+++ b/i18npool/source/textconversion/textconversion_ko.cxx
@@ -49,7 +49,7 @@ TextConversion_ko::TextConversion_ko( const Reference < XComponentContext >& xCo
OUString("com.sun.star.i18n.ConversionDictionary_ko"), xContext);
if ( xI.is() )
- xI->queryInterface( getCppuType((const Reference< XConversionDictionary>*)0) ) >>= xCD;
+ xCD.set( xI, UNO_QUERY );
xCDL = ConversionDictionaryList::create(xContext);
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index 62d6851..83fe43a 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -120,7 +120,7 @@ sal_Int32 SAL_CALL SdUnoSearchReplaceShape::replaceAll( const uno::Reference< ut
{
uno::Reference< drawing::XDrawPage > xPage( mpPage );
- xPage->queryInterface( ITYPE( drawing::XShapes ) ) >>= xShapes;
+ xShapes.set( xPage, uno::UNO_QUERY );
if( xShapes.is() && (xShapes->getCount() > 0) )
{
@@ -223,7 +223,7 @@ uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL SdUnoSearch
if(mpPage)
{
uno::Reference< drawing::XDrawPage > xPage( mpPage );
- xPage->queryInterface( ITYPE( drawing::XShapes ) ) >>= xShapes;
+ xShapes.set( xPage, uno::UNO_QUERY );
if( xShapes.is() && xShapes->getCount() > 0 )
{
@@ -267,9 +267,9 @@ uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL SdUnoSearch
// test if its a group
uno::Reference< drawing::XShapes > xGroupShape;
- uno::Any aAny( xShape->queryInterface( ITYPE( drawing::XShapes )));
+ xGroupShape.set( xShape, uno::UNO_QUERY );
- if( (aAny >>= xGroupShape ) && xGroupShape->getCount() > 0 )
+ if( xGroupShape.is() && xGroupShape->getCount() > 0 )
{
pContext = new SearchContext_impl( xGroupShape, pContext );
xShape = pContext->firstShape();
@@ -382,7 +382,7 @@ uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SdUnoSearchReplaceS
else
xCurrentShape = NULL;
- xCurrentShape->queryInterface( ITYPE( text::XTextRange ) ) >>= xRange;
+ xRange.set( xCurrentShape, uno::UNO_QUERY );
if(!(xCurrentShape.is() && (xRange.is())))
xRange = NULL;
}
@@ -468,8 +468,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere
if( !xParent.is() )
{
- uno::Any aAny( xText->queryInterface( ITYPE( text::XText )) );
- aAny >>= xParent;
+ xParent.set( xText, uno::UNO_QUERY );
}
const OUString aText( xParent->getString() );
@@ -684,7 +683,7 @@ uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetShape( uno::Refer
{
do
{
- xText->queryInterface( ITYPE( drawing::XShape )) >>= xShape;
+ xShape.set( xText, uno::UNO_QUERY );
if(!xShape.is())
{
uno::Reference< text::XText > xParent( xText->getText() );
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index 972804e..17084fe 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -265,8 +265,8 @@ void AccessibleControlShape::Init()
if ( xNativeControlContext.is() )
{
m_xControlContextProxy = xFactory->createProxy( xNativeControlContext );
- OSL_VERIFY( xNativeControlContext->queryInterface( ::getCppuType( &m_xControlContextTypeAccess ) ) >>= m_xControlContextTypeAccess );
- OSL_VERIFY( xNativeControlContext->queryInterface( ::getCppuType( &m_xControlContextComponent ) ) >>= m_xControlContextComponent );
+ m_xControlContextTypeAccess.set( xNativeControlContext, UNO_QUERY_THROW );
+ m_xControlContextComponent.set( xNativeControlContext, UNO_QUERY_THROW );
// aggregate the proxy
osl_atomic_increment( &m_refCount );
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 0194488..f3d9bd9 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -311,7 +311,7 @@ Reference< XWindow > UnoControl::getParentPeer() const
{
Reference< XWindowPeer > xP = xContComp->getPeer();
if ( xP.is() )
- xP->queryInterface( ::getCppuType((const Reference< XWindow >*)0) ) >>= xPeer;
+ xPeer.set( xP, UNO_QUERY );
}
}
return xPeer;
commit 587c294daba76f89f8de17e86ab0cae495123997
Author: Noel Grandin <noel at peralex.com>
Date: Mon Feb 11 16:22:06 2013 +0200
fdo#46808, convert some code in svtools to XComponentContext
Change-Id: If5f37e8464df3434075eb989ef07a4f7d769e318
diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx
index 86a84bd..53258071 100644
--- a/svtools/source/table/cellvalueconversion.cxx
+++ b/svtools/source/table/cellvalueconversion.cxx
@@ -27,13 +27,13 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
-#include <comphelper/componentcontext.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/math.hxx>
#include <tools/date.hxx>
#include <tools/time.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/syslocale.hxx>
+#include <comphelper/processfactory.hxx>
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
@@ -44,30 +44,16 @@ namespace svt
//......................................................................................................................
/** === begin UNO using === **/
- using ::com::sun::star::uno::Any;
+ using namespace ::com::sun::star::uno;
using ::com::sun::star::util::XNumberFormatter;
using ::com::sun::star::util::XNumberFormatter2;
using ::com::sun::star::util::NumberFormatter;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::util::XNumberFormatsSupplier;
using ::com::sun::star::util::NumberFormatsSupplier;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::lang::Locale;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
using ::com::sun::star::util::DateTime;
- using ::com::sun::star::uno::TypeClass;
using ::com::sun::star::util::XNumberFormatTypes;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::Type;
- using ::com::sun::star::uno::TypeClass_BYTE;
- using ::com::sun::star::uno::TypeClass_SHORT;
- using ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT;
- using ::com::sun::star::uno::TypeClass_LONG;
- using ::com::sun::star::uno::TypeClass_UNSIGNED_LONG;
- using ::com::sun::star::uno::TypeClass_HYPER;
/** === end UNO using === **/
namespace NumberFormat = ::com::sun::star::util::NumberFormat;
@@ -120,14 +106,12 @@ namespace svt
//==================================================================================================================
struct CellValueConversion_Data
{
- ::comphelper::ComponentContext const aContext;
Reference< XNumberFormatter > xNumberFormatter;
bool bAttemptedFormatterCreation;
NormalizerCache aNormalizers;
- CellValueConversion_Data( ::comphelper::ComponentContext const & i_context )
- :aContext( i_context )
- ,xNumberFormatter()
+ CellValueConversion_Data()
+ :xNumberFormatter()
,bAttemptedFormatterCreation( false )
,aNormalizers()
{
@@ -338,14 +322,15 @@ namespace svt
try
{
+ Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
// a number formatter
- Reference< XNumberFormatter > const xFormatter( NumberFormatter::create( io_data.aContext.getUNOContext() ), UNO_QUERY_THROW );
+ Reference< XNumberFormatter > const xFormatter( NumberFormatter::create( xContext ), UNO_QUERY_THROW );
// a supplier of number formats
Locale aLocale = SvtSysLocale().GetLanguageTag().getLocale();
Reference< XNumberFormatsSupplier > const xSupplier =
- NumberFormatsSupplier::createWithLocale( io_data.aContext.getUNOContext(), aLocale );
+ NumberFormatsSupplier::createWithLocale( xContext, aLocale );
// ensure a NullDate we will assume later on
UnoDate const aNullDate( 1, 1, 1900 );
@@ -428,8 +413,8 @@ namespace svt
//= CellValueConversion
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
- CellValueConversion::CellValueConversion( ::comphelper::ComponentContext const & i_context )
- :m_pData( new CellValueConversion_Data( i_context ) )
+ CellValueConversion::CellValueConversion()
+ :m_pData( new CellValueConversion_Data )
{
}
diff --git a/svtools/source/table/cellvalueconversion.hxx b/svtools/source/table/cellvalueconversion.hxx
index fbf3ae7..c9cb66b 100644
--- a/svtools/source/table/cellvalueconversion.hxx
+++ b/svtools/source/table/cellvalueconversion.hxx
@@ -21,14 +21,10 @@
#define SVTOOLS_CELLVALUECONVERSION_HXX
#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <boost/scoped_ptr.hpp>
-namespace comphelper
-{
- class ComponentContext;
-}
-
//......................................................................................................................
namespace svt
{
@@ -41,7 +37,7 @@ namespace svt
class CellValueConversion
{
public:
- CellValueConversion( ::comphelper::ComponentContext const & i_context );
+ CellValueConversion();
~CellValueConversion();
::rtl::OUString convertToString( const ::com::sun::star::uno::Any& i_cellValue );
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index 26935ad..9f81c2e 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -121,7 +121,7 @@ namespace svt { namespace table
,nCurrentRow( ROW_INVALID )
,bUseGridLines( true )
,aSortIndicator( )
- ,aStringConverter( ::comphelper::ComponentContext( ::comphelper::getProcessServiceFactory() ) )
+ ,aStringConverter()
{
}
};
commit fcd01fba69db6de6cfc983fae65b6ba6764de0d6
Author: Noel Grandin <noel at peralex.com>
Date: Mon Feb 11 15:59:15 2013 +0200
fdo#46808, create IDL for awt::tree::DefaultTreeDataModel
The service already existed.
Change-Id: I2acf73b772a7e9cbcb8915561f19c32768459f5c
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 5854aaf..21e050f 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt/tab,\
UnoControlTabPageModel \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt/tree,\
+ DefaultTreeDataModel \
MutableTreeDataModel \
MutableTreeNode \
TreeControl \
diff --git a/offapi/com/sun/star/awt/tree/DefaultTreeDataModel.idl b/offapi/com/sun/star/awt/tree/DefaultTreeDataModel.idl
new file mode 100644
index 0000000..c709a0b
--- /dev/null
+++ b/offapi/com/sun/star/awt/tree/DefaultTreeDataModel.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_awt_tree_DefaultTreeDataModel_idl__
+#define __com_sun_star_awt_tree_DefaultTreeDataModel_idl__
+
+#include <com/sun/star/awt/tree/XTreeDataModel.idl>
+
+
+module com { module sun { module star { module awt { module tree {
+
+
+/**
+ @since LibreOffice 4.1
+ */
+service DefaultTreeDataModel : XTreeDataModel;
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 186490c..809cf61 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -22,6 +22,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/awt/tree/DefaultTreeDataModel.hpp>
+
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -1229,12 +1231,8 @@ void TreeControlPeer::onChangeDataModel( UnoTreeListBoxImpl& rTree, const Refere
if( !xDataModel.is() )
{
- static const OUString aSN( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.DefaultTreeDataModel" ) );
- Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
- if( xORB.is() )
- {
- mxDataModel.query( xORB->createInstance( aSN ) );
- }
+ Reference< XComponentContext > xORB( ::comphelper::getProcessComponentContext() );
+ mxDataModel.query( DefaultTreeDataModel::create(xORB));
}
mxDataModel = xDataModel;
More information about the Libreoffice-commits
mailing list