1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SFX_OBJUNO_HXX 24 #define _SFX_OBJUNO_HXX 25 26 #include <com/sun/star/document/XDocumentInfo.hpp> 27 #include <com/sun/star/document/XStandaloneDocumentInfo.hpp> 28 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> 29 #include <com/sun/star/util/XModifyListener.hpp> 30 #include <com/sun/star/util/XModifyBroadcaster.hpp> 31 #include <com/sun/star/beans/XPropertySet.hpp> 32 #include <com/sun/star/beans/PropertyValue.hpp> 33 #include <com/sun/star/beans/XFastPropertySet.hpp> 34 #include <com/sun/star/beans/XVetoableChangeListener.hpp> 35 #include <com/sun/star/beans/XPropertyChangeListener.hpp> 36 #include <com/sun/star/beans/XPropertyContainer.hpp> 37 #include <com/sun/star/beans/XPropertyAccess.hpp> 38 #include <com/sun/star/lang/XEventListener.hpp> 39 #include <com/sun/star/lang/XServiceInfo.hpp> 40 #include <com/sun/star/embed/XStorage.hpp> 41 #include <com/sun/star/lang/XComponent.hpp> 42 #include <com/sun/star/lang/XInitialization.hpp> 43 #include <com/sun/star/util/XCloneable.hpp> 44 45 #include <com/sun/star/io/IOException.hpp> 46 47 #include <svl/itemprop.hxx> 48 #include <cppuhelper/implbase10.hxx> 49 50 #include "sfxuno.hxx" 51 52 53 // this is now just a wrapper around a XDocumentProperties instance 54 55 class SAL_DLLPRIVATE SfxDocumentInfoObject: public ::cppu::WeakImplHelper10< 56 ::com::sun::star::document::XDocumentInfo, 57 ::com::sun::star::lang::XComponent, 58 ::com::sun::star::beans::XPropertySet, 59 ::com::sun::star::beans::XFastPropertySet, 60 ::com::sun::star::beans::XPropertyAccess, 61 ::com::sun::star::beans::XPropertyContainer, 62 ::com::sun::star::document::XDocumentPropertiesSupplier, 63 ::com::sun::star::util::XModifyBroadcaster, 64 ::com::sun::star::lang::XInitialization, 65 ::com::sun::star::util::XCloneable> 66 { 67 protected: 68 struct SfxDocumentInfoObject_Impl* _pImp; 69 70 public: 71 SfxDocumentInfoObject(); 72 ~SfxDocumentInfoObject(); 73 74 // XComponent 75 virtual void SAL_CALL dispose(); 76 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener); 77 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener); 78 79 // XPropertySet 80 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(); 81 virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue); 82 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName); 83 virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener); 84 virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener); 85 virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener); 86 virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener); 87 88 // ::com::sun::star::beans::XFastPropertySet 89 virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue); 90 virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle); 91 92 // ::com::sun::star::beans::XPropertyAccess 93 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues(); 94 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ); 95 96 // ::com::sun::star::beans::XPropertyContainer 97 virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, ::sal_Int16 Attributes, const ::com::sun::star::uno::Any& DefaultValue ); 98 virtual void SAL_CALL removeProperty( const ::rtl::OUString& Name ); 99 100 // ::com::sun::star::document::XDocumentInfo 101 virtual sal_Int16 SAL_CALL getUserFieldCount(); 102 virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex); 103 virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex); 104 virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ); 105 virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ); 106 107 // ::com::sun::star::document::XDocumentPropertiesSupplier 108 virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > 109 SAL_CALL getDocumentProperties(); 110 111 // ::com::sun::star::util::XModifiable 112 virtual sal_Bool SAL_CALL isModified(); 113 virtual void SAL_CALL setModified( sal_Bool bModified ); 114 115 // ::com::sun::star::util::XModifyBroadcaster 116 virtual void SAL_CALL addModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener >& xListener ) ; 117 virtual void SAL_CALL removeModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener > & xListener) ; 118 119 // ::com::sun::star::lang::XInitialization: 120 virtual void SAL_CALL initialize( 121 const com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments); 122 123 // ::com::sun::star::util::XCloneable: 124 virtual com::sun::star::uno::Reference<com::sun::star::util::XCloneable> SAL_CALL createClone(); 125 126 const SfxDocumentInfoObject& operator=( const SfxDocumentInfoObject & rOther); 127 }; 128 129 class SfxStandaloneDocumentInfoObject: public SfxDocumentInfoObject, 130 public ::com::sun::star::lang::XServiceInfo, 131 public ::com::sun::star::document::XStandaloneDocumentInfo 132 { 133 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > _xFactory; 134 135 public: 136 SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); 137 virtual ~SfxStandaloneDocumentInfoObject(); 138 139 void Clear(); 140 141 // XInterface, XTypeProvider, XServiceInfo 142 SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO 143 144 // ::com::sun::star::document::XDocumentInfo 145 virtual sal_Int16 SAL_CALL getUserFieldCount(); 146 virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex); 147 virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex); 148 virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ); 149 virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ); 150 151 // ::com::sun::star::document::XStandaloneDocumentInfo 152 virtual void SAL_CALL loadFromURL(const ::rtl::OUString& aURL); 153 virtual void SAL_CALL storeIntoURL(const ::rtl::OUString& aURL); 154 }; 155 156 #endif 157