1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SFX_XMLIDREGISTRY_HXX_ 29 #define _SFX_XMLIDREGISTRY_HXX_ 30 31 #include <sal/config.h> 32 33 #include <sfx2/dllapi.h> 34 35 #include <com/sun/star/beans/StringPair.hpp> 36 37 38 namespace com { namespace sun { namespace star { namespace rdf { 39 class XMetadatable; 40 } } } } 41 42 namespace sfx2 { 43 44 // XML ID utilities -------------------------------------------------- 45 46 /** is i_rIdref a valid NCName ? */ 47 bool SFX2_DLLPUBLIC isValidNCName(::rtl::OUString const & i_rIdref); 48 49 extern inline bool 50 isValidXmlId(::rtl::OUString const & i_rStreamName, 51 ::rtl::OUString const & i_rIdref) 52 { 53 return isValidNCName(i_rIdref) && 54 (i_rStreamName.equalsAscii("content.xml") || 55 i_rStreamName.equalsAscii("styles.xml")); 56 } 57 58 59 // XML ID handling --------------------------------------------------- 60 61 /** interface for getElementByMetadataReference; 62 for use by sfx2::DocumentMetadataAccess 63 */ 64 class SFX2_DLLPUBLIC IXmlIdRegistry 65 { 66 67 public: 68 virtual ~IXmlIdRegistry() { } 69 70 virtual ::com::sun::star::uno::Reference< 71 ::com::sun::star::rdf::XMetadatable > SAL_CALL 72 GetElementByMetadataReference( 73 const ::com::sun::star::beans::StringPair & i_rXmlId) const = 0; 74 75 }; 76 77 /** supplier interface for the registry. 78 79 This indirection is unfortunately necessary, because the SwDocShell 80 is not always connected to a SwDoc, so we cannot guarantee that a 81 registry given to a SfxBaseModel/DocumentMetadataAccess remains valid; 82 it has to be retrieved from this supplier interface on access. 83 */ 84 class SFX2_DLLPUBLIC IXmlIdRegistrySupplier 85 { 86 87 public: 88 virtual ~IXmlIdRegistrySupplier() { } 89 90 /** override this if you have a XmlIdRegistry. */ 91 virtual const IXmlIdRegistry* GetXmlIdRegistry() const { return 0; } 92 93 }; 94 95 } // namespace sfx2 96 97 #endif // _SFX_XMLIDREGISTRY_HXX_ 98 99