LCOV - code coverage report
Current view: top level - sw/source/core/inc - unobookmark.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 6 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11