1*6df1ea1fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6df1ea1fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6df1ea1fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6df1ea1fSAndrew Rist * distributed with this work for additional information 6*6df1ea1fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6df1ea1fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6df1ea1fSAndrew Rist * "License"); you may not use this file except in compliance 9*6df1ea1fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*6df1ea1fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*6df1ea1fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6df1ea1fSAndrew Rist * software distributed under the License is distributed on an 15*6df1ea1fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6df1ea1fSAndrew Rist * KIND, either express or implied. See the License for the 17*6df1ea1fSAndrew Rist * specific language governing permissions and limitations 18*6df1ea1fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*6df1ea1fSAndrew Rist *************************************************************/ 21*6df1ea1fSAndrew Rist 22*6df1ea1fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef ODMA_CONTENT_HXX 25cdf0e10cSrcweir #define ODMA_CONTENT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <list> 28cdf0e10cSrcweir #include <ucbhelper/contenthelper.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace com { namespace sun { namespace star { 31cdf0e10cSrcweir namespace beans { 32cdf0e10cSrcweir struct Property; 33cdf0e10cSrcweir struct PropertyValue; 34cdf0e10cSrcweir } 35cdf0e10cSrcweir namespace sdbc { 36cdf0e10cSrcweir class XRow; 37cdf0e10cSrcweir } 38cdf0e10cSrcweir namespace io { 39cdf0e10cSrcweir class XInputStream; 40cdf0e10cSrcweir } 41cdf0e10cSrcweir }}} 42cdf0e10cSrcweir namespace ucbhelper 43cdf0e10cSrcweir { 44cdf0e10cSrcweir class Content; 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir 48cdf0e10cSrcweir // @@@ Adjust namespace name. 49cdf0e10cSrcweir namespace odma 50cdf0e10cSrcweir { 51cdf0e10cSrcweir 52cdf0e10cSrcweir //========================================================================= 53cdf0e10cSrcweir 54cdf0e10cSrcweir // @@@ Adjust service name. 55cdf0e10cSrcweir 56cdf0e10cSrcweir // UNO service name for the content. 57cdf0e10cSrcweir #define ODMA_CONTENT_SERVICE_NAME \ 58cdf0e10cSrcweir "com.sun.star.ucb.OdmaContent" 59cdf0e10cSrcweir 60cdf0e10cSrcweir //========================================================================= 61cdf0e10cSrcweir class ContentProvider; 62cdf0e10cSrcweir class ContentProperties; 63cdf0e10cSrcweir class Content : public ::ucbhelper::ContentImplHelper 64cdf0e10cSrcweir { 65cdf0e10cSrcweir ::rtl::Reference<ContentProperties> m_aProps; 66cdf0e10cSrcweir ContentProvider* m_pProvider; 67cdf0e10cSrcweir ::ucbhelper::Content* m_pContent; 68cdf0e10cSrcweir 69cdf0e10cSrcweir private: 70cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property > 71cdf0e10cSrcweir getProperties( const com::sun::star::uno::Reference< 72cdf0e10cSrcweir com::sun::star::ucb::XCommandEnvironment > & xEnv ); 73cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo > 74cdf0e10cSrcweir getCommands( const com::sun::star::uno::Reference< 75cdf0e10cSrcweir com::sun::star::ucb::XCommandEnvironment > & xEnv ); 76cdf0e10cSrcweir virtual ::rtl::OUString getParentURL(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 79cdf0e10cSrcweir getPropertyValues( const ::com::sun::star::uno::Sequence< 80cdf0e10cSrcweir ::com::sun::star::beans::Property >& rProperties, 81cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 82cdf0e10cSrcweir ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); 83cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 84cdf0e10cSrcweir setPropertyValues( const ::com::sun::star::uno::Sequence< 85cdf0e10cSrcweir ::com::sun::star::beans::PropertyValue >& rValues, 86cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 87cdf0e10cSrcweir ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir /** openDoc returns the file URL for the DOC ID 90cdf0e10cSrcweir @return the url of the temporary file 91cdf0e10cSrcweir */ 92cdf0e10cSrcweir ::rtl::OUString openDoc(); 93cdf0e10cSrcweir 94cdf0e10cSrcweir /** changePropertyValue sets the property referenced by _sMemberValue to the new value 95cdf0e10cSrcweir @param _rValue the new value to set 96cdf0e10cSrcweir @param _rnCurrentPos the current position inside the Any sequence _rRet 97cdf0e10cSrcweir @param _sMemberValue the place where to set the property 98cdf0e10cSrcweir @param _rnChanged will be incremented when property changed 99cdf0e10cSrcweir @param _rRet collect the exceptions 100cdf0e10cSrcweir @param _rChanges contains the changes done 101cdf0e10cSrcweir */ 102cdf0e10cSrcweir void changePropertyValue(const ::com::sun::star::beans::PropertyValue& _rValue, 103cdf0e10cSrcweir sal_Int32 _rnCurrentPos, 104cdf0e10cSrcweir ::rtl::OUString& _rsMemberValue, 105cdf0e10cSrcweir sal_Int32& _rnChanged, 106cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rRet, 107cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& _rChanges) throw (::com::sun::star::beans::IllegalTypeException); 108cdf0e10cSrcweir 109cdf0e10cSrcweir // typedef rtl::Reference< Content > ContentRef; 110cdf0e10cSrcweir // typedef std::list< ContentRef > ContentRefList; 111cdf0e10cSrcweir // void queryChildren( ContentRefList& rChildren ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir // Command "insert" 114cdf0e10cSrcweir void insert( const ::com::sun::star::uno::Reference< 115cdf0e10cSrcweir ::com::sun::star::io::XInputStream > & xInputStream, 116cdf0e10cSrcweir sal_Bool bReplaceExisting, 117cdf0e10cSrcweir const com::sun::star::uno::Reference< 118cdf0e10cSrcweir com::sun::star::ucb::XCommandEnvironment >& Environment ) 119cdf0e10cSrcweir throw( ::com::sun::star::uno::Exception ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir // // Command "delete" 122cdf0e10cSrcweir // void destroy( sal_Bool bDeletePhysical ) 123cdf0e10cSrcweir // throw( ::com::sun::star::uno::Exception ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir public: 126cdf0e10cSrcweir Content( const ::com::sun::star::uno::Reference< 127cdf0e10cSrcweir ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, 128cdf0e10cSrcweir ContentProvider* pProvider, 129cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 130cdf0e10cSrcweir ::com::sun::star::ucb::XContentIdentifier >& Identifier, 131cdf0e10cSrcweir const ::rtl::Reference<ContentProperties>& _rProps); 132cdf0e10cSrcweir virtual ~Content(); 133cdf0e10cSrcweir 134cdf0e10cSrcweir // XInterface 135cdf0e10cSrcweir XINTERFACE_DECL() 136cdf0e10cSrcweir 137cdf0e10cSrcweir // XTypeProvider 138cdf0e10cSrcweir XTYPEPROVIDER_DECL() 139cdf0e10cSrcweir 140cdf0e10cSrcweir // XServiceInfo 141cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 142cdf0e10cSrcweir getImplementationName() 143cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 144cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 145cdf0e10cSrcweir getSupportedServiceNames() 146cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir // XContent 149cdf0e10cSrcweir virtual rtl::OUString SAL_CALL 150cdf0e10cSrcweir getContentType() 151cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir // XCommandProcessor 154cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 155cdf0e10cSrcweir execute( const com::sun::star::ucb::Command& aCommand, 156cdf0e10cSrcweir sal_Int32 CommandId, 157cdf0e10cSrcweir const com::sun::star::uno::Reference< 158cdf0e10cSrcweir com::sun::star::ucb::XCommandEnvironment >& Environment ) 159cdf0e10cSrcweir throw( com::sun::star::uno::Exception, 160cdf0e10cSrcweir com::sun::star::ucb::CommandAbortedException, 161cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 162cdf0e10cSrcweir virtual void SAL_CALL 163cdf0e10cSrcweir abort( sal_Int32 CommandId ) 164cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 165cdf0e10cSrcweir 166cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 167cdf0e10cSrcweir // Additional interfaces 168cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 169cdf0e10cSrcweir 170cdf0e10cSrcweir // @@@ Add additional interfaces ( like com::sun:.star::ucb::XContentCreator ). 171cdf0e10cSrcweir 172cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 173cdf0e10cSrcweir // Non-interface methods. 174cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 175cdf0e10cSrcweir 176cdf0e10cSrcweir // Called from resultset data supplier. 177cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > 178cdf0e10cSrcweir getPropertyValues( const ::com::sun::star::uno::Reference< 179cdf0e10cSrcweir ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, 180cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 181cdf0e10cSrcweir ::com::sun::star::beans::Property >& rProperties, 182cdf0e10cSrcweir const ::rtl::Reference<ContentProperties>& rData, 183cdf0e10cSrcweir const ::rtl::Reference< 184cdf0e10cSrcweir ::ucbhelper::ContentProviderImplHelper >& rProvider, 185cdf0e10cSrcweir const ::rtl::OUString& rContentId ); 186cdf0e10cSrcweir getContentProvider() const187cdf0e10cSrcweir ContentProvider* getContentProvider() const { return m_pProvider; } 188cdf0e10cSrcweir }; 189cdf0e10cSrcweir 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir #endif 193