1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SW_UNOBOOKMARK_HXX 25cdf0e10cSrcweir #define SW_UNOBOOKMARK_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 28cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 31cdf0e10cSrcweir #include <com/sun/star/text/XTextContent.hpp> 32cdf0e10cSrcweir #include <com/sun/star/text/XFormField.hpp> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <sfx2/Metadatable.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <unobaseclass.hxx> 39cdf0e10cSrcweir #include <IDocumentMarkAccess.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir class SwDoc; 43cdf0e10cSrcweir 44cdf0e10cSrcweir 45cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper5 46cdf0e10cSrcweir < ::sfx2::MetadatableMixin 47cdf0e10cSrcweir , ::com::sun::star::lang::XUnoTunnel 48cdf0e10cSrcweir , ::com::sun::star::lang::XServiceInfo 49cdf0e10cSrcweir , ::com::sun::star::beans::XPropertySet 50cdf0e10cSrcweir , ::com::sun::star::container::XNamed 51cdf0e10cSrcweir , ::com::sun::star::text::XTextContent 52cdf0e10cSrcweir > SwXBookmark_Base; 53cdf0e10cSrcweir 54cdf0e10cSrcweir class SwXBookmark 55cdf0e10cSrcweir : public SwXBookmark_Base 56cdf0e10cSrcweir { 57cdf0e10cSrcweir 58cdf0e10cSrcweir private: 59cdf0e10cSrcweir 60cdf0e10cSrcweir class Impl; 61cdf0e10cSrcweir ::sw::UnoImplPtr<Impl> m_pImpl; 62cdf0e10cSrcweir 63cdf0e10cSrcweir protected: 64cdf0e10cSrcweir 65cdf0e10cSrcweir void attachToRangeEx( 66cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 67cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange, 68cdf0e10cSrcweir IDocumentMarkAccess::MarkType eType) 69cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 70cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 71cdf0e10cSrcweir virtual void attachToRange( 72cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 73cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange) 74cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 75cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 76cdf0e10cSrcweir 77cdf0e10cSrcweir const ::sw::mark::IMark* GetBookmark() const; 78cdf0e10cSrcweir 79cdf0e10cSrcweir virtual ~SwXBookmark(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir /// @param pDoc and pMark != 0, but not & because of ImplInheritanceHelper 82cdf0e10cSrcweir SwXBookmark(::sw::mark::IMark *const pMark, SwDoc *const pDoc); 83cdf0e10cSrcweir 84cdf0e10cSrcweir public: 85cdf0e10cSrcweir 86cdf0e10cSrcweir /// descriptor 87cdf0e10cSrcweir SwXBookmark(); 88cdf0e10cSrcweir 89cdf0e10cSrcweir static ::com::sun::star::uno::Reference< 90cdf0e10cSrcweir ::com::sun::star::text::XTextContent> 91cdf0e10cSrcweir CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark); 92cdf0e10cSrcweir 93cdf0e10cSrcweir /// @return IMark for this, but only if it lives in pDoc 94cdf0e10cSrcweir static ::sw::mark::IMark const* GetBookmarkInDoc(SwDoc const*const pDoc, 95cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 96cdf0e10cSrcweir ::com::sun::star::lang::XUnoTunnel> & xUT); 97cdf0e10cSrcweir 98cdf0e10cSrcweir // MetadatableMixin 99cdf0e10cSrcweir virtual ::sfx2::Metadatable* GetCoreObject(); 100cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 101cdf0e10cSrcweir ::com::sun::star::frame::XModel > GetModel(); 102cdf0e10cSrcweir 103cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // XUnoTunnel 106cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( 107cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier) 108cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir 110cdf0e10cSrcweir // XServiceInfo 111cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 112cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 113cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( 114cdf0e10cSrcweir const ::rtl::OUString& rServiceName) 115cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 116cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 117cdf0e10cSrcweir getSupportedServiceNames() 118cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 119cdf0e10cSrcweir 120cdf0e10cSrcweir // XComponent 121cdf0e10cSrcweir virtual void SAL_CALL dispose() 122cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir virtual void SAL_CALL addEventListener( 124cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 125cdf0e10cSrcweir ::com::sun::star::lang::XEventListener > & xListener) 126cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 127cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( 128cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 129cdf0e10cSrcweir ::com::sun::star::lang::XEventListener > & xListener) 130cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // XPropertySet 133cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 134cdf0e10cSrcweir ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 135cdf0e10cSrcweir getPropertySetInfo() 136cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 137cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( 138cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 139cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue) 140cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 141cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 142cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 143cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 144cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 145cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 146cdf0e10cSrcweir const ::rtl::OUString& rPropertyName) 147cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 148cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 149cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 150cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( 151cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 152cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 153cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener >& xListener) 154cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 155cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 156cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 157cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( 158cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 159cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 160cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener >& xListener) 161cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 162cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 163cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 164cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( 165cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 166cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 167cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener >& xListener) 168cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 169cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 170cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 171cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( 172cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 173cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 174cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener >& xListener) 175cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 176cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 177cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 178cdf0e10cSrcweir 179cdf0e10cSrcweir // XNamed 180cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName() 181cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 182cdf0e10cSrcweir virtual void SAL_CALL setName(const ::rtl::OUString& rName) 183cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 184cdf0e10cSrcweir 185cdf0e10cSrcweir // XTextContent 186cdf0e10cSrcweir virtual void SAL_CALL attach( 187cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 188cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange) 189cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 190cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 191cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 192cdf0e10cSrcweir ::com::sun::star::text::XTextRange > SAL_CALL getAnchor() 193cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 194cdf0e10cSrcweir 195cdf0e10cSrcweir }; 196cdf0e10cSrcweir 197cdf0e10cSrcweir class SwXFieldmarkParameters 198cdf0e10cSrcweir : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameContainer> 199cdf0e10cSrcweir , private SwClient 200cdf0e10cSrcweir { 201cdf0e10cSrcweir public: 202cdf0e10cSrcweir SwXFieldmarkParameters(::sw::mark::IFieldmark* const pFieldmark) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir pFieldmark->Add(this); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir 207cdf0e10cSrcweir // XNameContainer 208cdf0e10cSrcweir virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 209cdf0e10cSrcweir virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 210cdf0e10cSrcweir // XNameReplace 211cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 212cdf0e10cSrcweir // XNameAccess 213cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 214cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); 215cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); 216cdf0e10cSrcweir // XElementAccess 217cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); 218cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); 219cdf0e10cSrcweir protected: 220cdf0e10cSrcweir //SwClient 221cdf0e10cSrcweir virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ); 222cdf0e10cSrcweir private: 223cdf0e10cSrcweir ::sw::mark::IFieldmark::parameter_map_t* getCoreParameters() throw (::com::sun::star::uno::RuntimeException); 224cdf0e10cSrcweir }; 225cdf0e10cSrcweir 226cdf0e10cSrcweir typedef cppu::ImplInheritanceHelper1< SwXBookmark, 227cdf0e10cSrcweir ::com::sun::star::text::XFormField > SwXFieldmark_Base; 228cdf0e10cSrcweir 229cdf0e10cSrcweir class SwXFieldmark 230cdf0e10cSrcweir : public SwXFieldmark_Base 231cdf0e10cSrcweir { 232cdf0e10cSrcweir 233cdf0e10cSrcweir private: 234cdf0e10cSrcweir 235cdf0e10cSrcweir bool isReplacementObject; 236cdf0e10cSrcweir 237cdf0e10cSrcweir public: 238cdf0e10cSrcweir 239cdf0e10cSrcweir SwXFieldmark(bool isReplacementObject, 240cdf0e10cSrcweir ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0); 241cdf0e10cSrcweir 242cdf0e10cSrcweir virtual void attachToRange( 243cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 244cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange) 245cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 246cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 247cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getFieldType(void) 248cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 249cdf0e10cSrcweir virtual void SAL_CALL setFieldType(const ::rtl::OUString& description ) 250cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 251cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getParameters( ) 252cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 253cdf0e10cSrcweir 254cdf0e10cSrcweir }; 255cdf0e10cSrcweir 256cdf0e10cSrcweir #endif // SW_UNOBOOKMARK_HXX 257cdf0e10cSrcweir 258