1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SW_UNOBOOKMARK_HXX 29*cdf0e10cSrcweir #define SW_UNOBOOKMARK_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/text/XTextContent.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/text/XFormField.hpp> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include <sfx2/Metadatable.hxx> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #include <unobaseclass.hxx> 43*cdf0e10cSrcweir #include <IDocumentMarkAccess.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir class SwDoc; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper5 50*cdf0e10cSrcweir < ::sfx2::MetadatableMixin 51*cdf0e10cSrcweir , ::com::sun::star::lang::XUnoTunnel 52*cdf0e10cSrcweir , ::com::sun::star::lang::XServiceInfo 53*cdf0e10cSrcweir , ::com::sun::star::beans::XPropertySet 54*cdf0e10cSrcweir , ::com::sun::star::container::XNamed 55*cdf0e10cSrcweir , ::com::sun::star::text::XTextContent 56*cdf0e10cSrcweir > SwXBookmark_Base; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir class SwXBookmark 59*cdf0e10cSrcweir : public SwXBookmark_Base 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir private: 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir class Impl; 65*cdf0e10cSrcweir ::sw::UnoImplPtr<Impl> m_pImpl; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir protected: 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir void attachToRangeEx( 70*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 71*cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange, 72*cdf0e10cSrcweir IDocumentMarkAccess::MarkType eType) 73*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 74*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 75*cdf0e10cSrcweir virtual void attachToRange( 76*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 77*cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange) 78*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 79*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir const ::sw::mark::IMark* GetBookmark() const; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir virtual ~SwXBookmark(); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir /// @param pDoc and pMark != 0, but not & because of ImplInheritanceHelper 86*cdf0e10cSrcweir SwXBookmark(::sw::mark::IMark *const pMark, SwDoc *const pDoc); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir public: 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir /// descriptor 91*cdf0e10cSrcweir SwXBookmark(); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir static ::com::sun::star::uno::Reference< 94*cdf0e10cSrcweir ::com::sun::star::text::XTextContent> 95*cdf0e10cSrcweir CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark); 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir /// @return IMark for this, but only if it lives in pDoc 98*cdf0e10cSrcweir static ::sw::mark::IMark const* GetBookmarkInDoc(SwDoc const*const pDoc, 99*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 100*cdf0e10cSrcweir ::com::sun::star::lang::XUnoTunnel> & xUT); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir // MetadatableMixin 103*cdf0e10cSrcweir virtual ::sfx2::Metadatable* GetCoreObject(); 104*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 105*cdf0e10cSrcweir ::com::sun::star::frame::XModel > GetModel(); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir // XUnoTunnel 110*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( 111*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier) 112*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir // XServiceInfo 115*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 116*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 117*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( 118*cdf0e10cSrcweir const ::rtl::OUString& rServiceName) 119*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 120*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 121*cdf0e10cSrcweir getSupportedServiceNames() 122*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir // XComponent 125*cdf0e10cSrcweir virtual void SAL_CALL dispose() 126*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 127*cdf0e10cSrcweir virtual void SAL_CALL addEventListener( 128*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 129*cdf0e10cSrcweir ::com::sun::star::lang::XEventListener > & xListener) 130*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 131*cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( 132*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 133*cdf0e10cSrcweir ::com::sun::star::lang::XEventListener > & xListener) 134*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir // XPropertySet 137*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 138*cdf0e10cSrcweir ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 139*cdf0e10cSrcweir getPropertySetInfo() 140*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 141*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( 142*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 143*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue) 144*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 145*cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 146*cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 147*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 148*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 149*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 150*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName) 151*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 152*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 153*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 154*cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( 155*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 156*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 157*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener >& xListener) 158*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 159*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 160*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 161*cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( 162*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 163*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 164*cdf0e10cSrcweir ::com::sun::star::beans::XPropertyChangeListener >& xListener) 165*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 166*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 167*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 168*cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( 169*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 170*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 171*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener >& xListener) 172*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 173*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 174*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 175*cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( 176*cdf0e10cSrcweir const ::rtl::OUString& rPropertyName, 177*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 178*cdf0e10cSrcweir ::com::sun::star::beans::XVetoableChangeListener >& xListener) 179*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 180*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 181*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir // XNamed 184*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName() 185*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 186*cdf0e10cSrcweir virtual void SAL_CALL setName(const ::rtl::OUString& rName) 187*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir // XTextContent 190*cdf0e10cSrcweir virtual void SAL_CALL attach( 191*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 192*cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange) 193*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 194*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 195*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 196*cdf0e10cSrcweir ::com::sun::star::text::XTextRange > SAL_CALL getAnchor() 197*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir }; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir class SwXFieldmarkParameters 202*cdf0e10cSrcweir : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameContainer> 203*cdf0e10cSrcweir , private SwClient 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir public: 206*cdf0e10cSrcweir SwXFieldmarkParameters(::sw::mark::IFieldmark* const pFieldmark) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir pFieldmark->Add(this); 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir // XNameContainer 212*cdf0e10cSrcweir 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); 213*cdf0e10cSrcweir 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); 214*cdf0e10cSrcweir // XNameReplace 215*cdf0e10cSrcweir 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); 216*cdf0e10cSrcweir // XNameAccess 217*cdf0e10cSrcweir 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); 218*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); 219*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); 220*cdf0e10cSrcweir // XElementAccess 221*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); 222*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); 223*cdf0e10cSrcweir protected: 224*cdf0e10cSrcweir //SwClient 225*cdf0e10cSrcweir virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ); 226*cdf0e10cSrcweir private: 227*cdf0e10cSrcweir ::sw::mark::IFieldmark::parameter_map_t* getCoreParameters() throw (::com::sun::star::uno::RuntimeException); 228*cdf0e10cSrcweir }; 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir typedef cppu::ImplInheritanceHelper1< SwXBookmark, 231*cdf0e10cSrcweir ::com::sun::star::text::XFormField > SwXFieldmark_Base; 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir class SwXFieldmark 234*cdf0e10cSrcweir : public SwXFieldmark_Base 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir private: 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir bool isReplacementObject; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir public: 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir SwXFieldmark(bool isReplacementObject, 244*cdf0e10cSrcweir ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir virtual void attachToRange( 247*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 248*cdf0e10cSrcweir ::com::sun::star::text::XTextRange > & xTextRange) 249*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 250*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 251*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getFieldType(void) 252*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 253*cdf0e10cSrcweir virtual void SAL_CALL setFieldType(const ::rtl::OUString& description ) 254*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 255*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getParameters( ) 256*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir }; 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir #endif // SW_UNOBOOKMARK_HXX 261*cdf0e10cSrcweir 262