merge sfx2::IXmlIdRegistrySupplier with SfxObjectShell

Change-Id: I7e8bad6b1c944f14b850b91b902b82613c26faeb
Reviewed-on: https://gerrit.libreoffice.org/26899
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin
2016-07-04 11:55:35 +02:00
committed by Noel Grandin
parent c752aad433
commit 6964c17415
5 changed files with 12 additions and 28 deletions

View File

@@ -326,7 +326,6 @@ merge sdr::contact::ObjectContactOfPagePainter with sdr::contact::PagePrimitiveE
merge sdr::event::EventHandler with sdr::event::TimerEventHandler
merge sdr::table::TableDesignUser with sdr::table::SdrTableObjImpl
merge sfx2::IXmlIdRegistry with sfx2::XmlIdRegistry
merge sfx2::IXmlIdRegistrySupplier with SfxObjectShell
merge sfx::DummyWindowWrapper with sfx::DummyItemConnection
merge sfx::MultiControlWrapperHelper with sfx::MultiControlWrapper
merge slideshow::internal::(anonymous namespace)::EventContainer with slideshow::internal::ClickEventHandler

View File

@@ -44,6 +44,7 @@
namespace com { namespace sun { namespace star { namespace embed {
class XStorage;
} } } }
class SfxObjectShell;
namespace sfx2 {
@@ -65,10 +66,8 @@ createBaseURI(
OUString const & i_rSubDocument = OUString());
class IXmlIdRegistrySupplier;
struct DocumentMetadataAccess_Impl;
class SFX2_DLLPUBLIC DocumentMetadataAccess :
public ::cppu::WeakImplHelper1< css::rdf::XDocumentMetadataAccess>
{
@@ -76,12 +75,12 @@ class SFX2_DLLPUBLIC DocumentMetadataAccess :
DocumentMetadataAccess& operator=( const DocumentMetadataAccess& ) = delete;
public:
explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext,
IXmlIdRegistrySupplier const & i_rRegistrySupplier,
SfxObjectShell const & i_rRegistrySupplier,
OUString const & i_rBaseURI);
// N.B.: in contrast to previous, this constructor does _not_ initialize!
// caller must immediately call loadFromStorage/Medium!
explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext,
IXmlIdRegistrySupplier const & i_rRegistrySupplier);
SfxObjectShell const & i_rRegistrySupplier);
virtual ~DocumentMetadataAccess();
// css::rdf::XNode:

View File

@@ -58,24 +58,6 @@ public:
};
/** supplier interface for the registry.
This indirection is unfortunately necessary, because the SwDocShell
is not always connected to a SwDoc, so we cannot guarantee that a
registry given to a SfxBaseModel/DocumentMetadataAccess remains valid;
it has to be retrieved from this supplier interface on access.
*/
class SFX2_DLLPUBLIC IXmlIdRegistrySupplier
{
public:
virtual ~IXmlIdRegistrySupplier() { }
/** override this if you have a XmlIdRegistry. */
virtual const IXmlIdRegistry* GetXmlIdRegistry() const { return nullptr; }
};
} // namespace sfx2
#endif // INCLUDED_SFX2_XMLIDREGISTRY_HXX

View File

@@ -199,7 +199,7 @@ template<class T> bool checkSfxObjectShell(const SfxObjectShell* pShell)
class SFX2_DLLPUBLIC SfxObjectShell :
public SfxShell, virtual public SotObject,
public ::comphelper::IEmbeddedHelper, public ::sfx2::IXmlIdRegistrySupplier
public ::comphelper::IEmbeddedHelper
{
friend struct ModifyBlocker_Impl;
friend class SfxObjectShellLock;
@@ -720,6 +720,9 @@ public:
SAL_DLLPRIVATE void CancelCheckOut( );
SAL_DLLPRIVATE void CheckIn( );
SAL_DLLPRIVATE css::uno::Sequence< css::document::CmisVersion > GetCmisVersions();
/** override this if you have a XmlIdRegistry. */
virtual const sfx2::IXmlIdRegistry* GetXmlIdRegistry() const { return nullptr; }
};
#define SFX_GLOBAL_CLASSID \

View File

@@ -45,6 +45,7 @@
#include <sfx2/docfile.hxx>
#include <sfx2/XmlIdRegistry.hxx>
#include <sfx2/objsh.hxx>
#include <libxml/tree.h>
@@ -188,13 +189,13 @@ struct DocumentMetadataAccess_Impl
{
// note: these are all initialized in constructor, and loadFromStorage
const uno::Reference<uno::XComponentContext> m_xContext;
const IXmlIdRegistrySupplier & m_rXmlIdRegistrySupplier;
const SfxObjectShell & m_rXmlIdRegistrySupplier;
uno::Reference<rdf::XURI> m_xBaseURI;
uno::Reference<rdf::XRepository> m_xRepository;
uno::Reference<rdf::XNamedGraph> m_xManifest;
DocumentMetadataAccess_Impl(
uno::Reference<uno::XComponentContext> const& i_xContext,
IXmlIdRegistrySupplier const & i_rRegistrySupplier)
SfxObjectShell const & i_rRegistrySupplier)
: m_xContext(i_xContext)
, m_rXmlIdRegistrySupplier(i_rRegistrySupplier)
, m_xBaseURI()
@@ -768,7 +769,7 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl)
DocumentMetadataAccess::DocumentMetadataAccess(
uno::Reference< uno::XComponentContext > const & i_xContext,
const IXmlIdRegistrySupplier & i_rRegistrySupplier)
const SfxObjectShell & i_rRegistrySupplier)
: m_pImpl(new DocumentMetadataAccess_Impl(i_xContext, i_rRegistrySupplier))
{
// no initialization: must call loadFrom...
@@ -776,7 +777,7 @@ DocumentMetadataAccess::DocumentMetadataAccess(
DocumentMetadataAccess::DocumentMetadataAccess(
uno::Reference< uno::XComponentContext > const & i_xContext,
const IXmlIdRegistrySupplier & i_rRegistrySupplier,
const SfxObjectShell & i_rRegistrySupplier,
OUString const & i_rURI)
: m_pImpl(new DocumentMetadataAccess_Impl(i_xContext, i_rRegistrySupplier))
{