LCOV - code coverage report
Current view: top level - sd/source/core/annotations - Annotation.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 163 0.0 %
Date: 2012-08-25 Functions: 0 43 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 180 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "osl/time.h"
      31                 :            : #include "sal/config.h"
      32                 :            : 
      33                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      34                 :            : #include <com/sun/star/office/XAnnotation.hpp>
      35                 :            : #include <com/sun/star/drawing/XDrawPage.hpp>
      36                 :            : 
      37                 :            : #include <comphelper/processfactory.hxx>
      38                 :            : #include <cppuhelper/propertysetmixin.hxx>
      39                 :            : #include <cppuhelper/compbase1.hxx>
      40                 :            : #include <cppuhelper/basemutex.hxx>
      41                 :            : 
      42                 :            : #include "drawdoc.hxx"
      43                 :            : #include "sdpage.hxx"
      44                 :            : #include "textapi.hxx"
      45                 :            : 
      46                 :            : using ::rtl::OUString;
      47                 :            : using namespace ::com::sun::star::uno;
      48                 :            : using namespace ::com::sun::star::lang;
      49                 :            : using namespace ::com::sun::star::beans;
      50                 :            : using namespace ::com::sun::star::office;
      51                 :            : using namespace ::com::sun::star::drawing;
      52                 :            : using namespace ::com::sun::star::geometry;
      53                 :            : using namespace ::com::sun::star::text;
      54                 :            : using namespace ::com::sun::star::util;
      55                 :            : using namespace ::com::sun::star;
      56                 :            : 
      57                 :            : extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource );
      58                 :            : 
      59                 :            : namespace sd {
      60                 :            : 
      61 [ #  # ][ #  # ]:          0 : class Annotation : private ::cppu::BaseMutex,
         [ #  # ][ #  # ]
      62                 :            :                    public ::cppu::WeakComponentImplHelper1< XAnnotation>,
      63                 :            :                    public ::cppu::PropertySetMixin< XAnnotation >
      64                 :            : {
      65                 :            : public:
      66                 :            :     explicit Annotation( const Reference< XComponentContext >& context, SdPage* pPage );
      67                 :            : 
      68                 :          0 :     SdPage* GetPage() const { return mpPage; }
      69         [ #  # ]:          0 :     SdrModel* GetModel() { return (mpPage != 0) ? mpPage->GetModel() : 0; }
      70                 :            : 
      71                 :            :     // XInterface:
      72                 :            :     virtual Any SAL_CALL queryInterface(Type const & type) throw (RuntimeException);
      73                 :          0 :     virtual void SAL_CALL acquire() throw () { ::cppu::WeakComponentImplHelper1< XAnnotation >::acquire(); }
      74                 :          0 :     virtual void SAL_CALL release() throw () { ::cppu::WeakComponentImplHelper1< XAnnotation >::release(); }
      75                 :            : 
      76                 :            :     // ::com::sun::star::beans::XPropertySet:
      77                 :            :     virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (RuntimeException);
      78                 :            :     virtual void SAL_CALL setPropertyValue(const OUString & aPropertyName, const Any & aValue) throw (RuntimeException, UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException);
      79                 :            :     virtual Any SAL_CALL getPropertyValue(const OUString & PropertyName) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
      80                 :            :     virtual void SAL_CALL addPropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
      81                 :            :     virtual void SAL_CALL removePropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
      82                 :            :     virtual void SAL_CALL addVetoableChangeListener(const OUString & PropertyName, const Reference< XVetoableChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
      83                 :            :     virtual void SAL_CALL removeVetoableChangeListener(const OUString & PropertyName, const Reference< XVetoableChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException);
      84                 :            : 
      85                 :            :     // ::com::sun::star::office::XAnnotation:
      86                 :            :     virtual ::com::sun::star::uno::Any SAL_CALL getAnchor() throw (::com::sun::star::uno::RuntimeException);
      87                 :            :     virtual RealPoint2D SAL_CALL getPosition() throw (RuntimeException);
      88                 :            :     virtual void SAL_CALL setPosition(const RealPoint2D & the_value) throw (RuntimeException);
      89                 :            :     virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
      90                 :            :     virtual void SAL_CALL setSize( const ::com::sun::star::geometry::RealSize2D& _size ) throw (::com::sun::star::uno::RuntimeException);
      91                 :            :     virtual OUString SAL_CALL getAuthor() throw (RuntimeException);
      92                 :            :     virtual void SAL_CALL setAuthor(const OUString & the_value) throw (RuntimeException);
      93                 :            :     virtual util::DateTime SAL_CALL getDateTime() throw (RuntimeException);
      94                 :            :     virtual void SAL_CALL setDateTime(const util::DateTime & the_value) throw (RuntimeException);
      95                 :            :     virtual Reference< XText > SAL_CALL getTextRange() throw (RuntimeException);
      96                 :            : 
      97                 :            : private:
      98                 :            :     Annotation(const Annotation &); // not defined
      99                 :            :     Annotation& operator=(const Annotation &); // not defined
     100                 :            : 
     101                 :            :     // destructor is private and will be called indirectly by the release call    virtual ~Annotation() {}
     102                 :            : 
     103                 :            :     void createChangeUndo();
     104                 :            : 
     105                 :            :     // overload WeakComponentImplHelperBase::disposing()
     106                 :            :     // This function is called upon disposing the component,
     107                 :            :     // if your component needs special work when it becomes
     108                 :            :     // disposed, do it here.
     109                 :            :     virtual void SAL_CALL disposing();
     110                 :            : 
     111                 :            :     SdPage* mpPage;
     112                 :            :     Reference< XComponentContext > m_xContext;
     113                 :            :     mutable ::osl::Mutex m_aMutex;
     114                 :            :     RealPoint2D m_Position;
     115                 :            :     RealSize2D m_Size;
     116                 :            :     OUString m_Author;
     117                 :            :     util::DateTime m_DateTime;
     118                 :            :     rtl::Reference< TextApiObject > m_TextRange;
     119                 :            : };
     120                 :            : 
     121         [ #  # ]:          0 : class UndoInsertOrRemoveAnnotation : public SdrUndoAction
     122                 :            : {
     123                 :            : public:
     124                 :            :     UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert );
     125                 :            : 
     126                 :            :     virtual void Undo();
     127                 :            :     virtual void Redo();
     128                 :            : 
     129                 :            : protected:
     130                 :            :     rtl::Reference< Annotation > mxAnnotation;
     131                 :            :     bool mbInsert;
     132                 :            :     int mnIndex;
     133                 :            : };
     134                 :            : 
     135                 :          0 : struct AnnotationData
     136                 :            : {
     137                 :            :     RealPoint2D m_Position;
     138                 :            :     RealSize2D m_Size;
     139                 :            :     OUString m_Author;
     140                 :            :     util::DateTime m_DateTime;
     141                 :            : 
     142                 :          0 :     void get( const rtl::Reference< Annotation >& xAnnotation )
     143                 :            :     {
     144                 :          0 :         m_Position = xAnnotation->getPosition();
     145                 :          0 :         m_Size = xAnnotation->getSize();
     146                 :          0 :         m_Author = xAnnotation->getAuthor();
     147                 :          0 :         m_DateTime = xAnnotation->getDateTime();
     148                 :          0 :     }
     149                 :            : 
     150                 :          0 :     void set( const rtl::Reference< Annotation >& xAnnotation )
     151                 :            :     {
     152                 :          0 :         xAnnotation->setPosition(m_Position);
     153                 :          0 :         xAnnotation->setSize(m_Size);
     154                 :          0 :         xAnnotation->setAuthor(m_Author);
     155                 :          0 :         xAnnotation->setDateTime(m_DateTime);
     156                 :          0 :     }
     157                 :            : };
     158                 :            : 
     159         [ #  # ]:          0 : class UndoAnnotation : public SdrUndoAction
     160                 :            : {
     161                 :            : public:
     162                 :            :     UndoAnnotation( Annotation& rAnnotation );
     163                 :            : 
     164                 :            :     virtual void Undo();
     165                 :            :     virtual void Redo();
     166                 :            : 
     167                 :            : protected:
     168                 :            :     rtl::Reference< Annotation > mxAnnotation;
     169                 :            :     AnnotationData maUndoData;
     170                 :            :     AnnotationData maRedoData;
     171                 :            : };
     172                 :            : 
     173                 :          0 : void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage )
     174                 :            : {
     175 [ #  # ][ #  # ]:          0 :     Reference<XComponentContext> xContext (comphelper_getProcessComponentContext());
     176 [ #  # ][ #  # ]:          0 :     xAnnotation.set( new Annotation(xContext, pPage) );
                 [ #  # ]
     177         [ #  # ]:          0 :     pPage->addAnnotation(xAnnotation);
     178                 :          0 : }
     179                 :            : 
     180                 :          0 : Annotation::Annotation( const Reference< XComponentContext >& context, SdPage* pPage )
     181                 :            : : ::cppu::WeakComponentImplHelper1< XAnnotation >(m_aMutex)
     182                 :            : , ::cppu::PropertySetMixin< XAnnotation >(context, static_cast< Implements >(IMPLEMENTS_PROPERTY_SET), Sequence< ::rtl::OUString >())
     183 [ #  # ][ #  # ]:          0 : , mpPage( pPage )
         [ #  # ][ #  # ]
     184                 :            : {
     185                 :          0 : }
     186                 :            : 
     187                 :            : // overload WeakComponentImplHelperBase::disposing()
     188                 :            : // This function is called upon disposing the component,
     189                 :            : // if your component needs special work when it becomes
     190                 :            : // disposed, do it here.
     191                 :          0 : void SAL_CALL Annotation::disposing()
     192                 :            : {
     193                 :          0 :     mpPage = 0;
     194         [ #  # ]:          0 :     if( m_TextRange.is() )
     195                 :            :     {
     196                 :          0 :         m_TextRange->dispose();
     197                 :          0 :         m_TextRange.clear();
     198                 :            :     }
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : Any Annotation::queryInterface(Type const & type) throw (RuntimeException)
     202                 :            : {
     203                 :          0 :     return ::cppu::WeakComponentImplHelper1< XAnnotation>::queryInterface(type);
     204                 :            : }
     205                 :            : 
     206                 :            : // com.sun.star.beans.XPropertySet:
     207                 :          0 : Reference< XPropertySetInfo > SAL_CALL Annotation::getPropertySetInfo() throw (RuntimeException)
     208                 :            : {
     209                 :          0 :     return ::cppu::PropertySetMixin< XAnnotation >::getPropertySetInfo();
     210                 :            : }
     211                 :            : 
     212                 :          0 : void SAL_CALL Annotation::setPropertyValue(const OUString & aPropertyName, const Any & aValue) throw (RuntimeException, UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException)
     213                 :            : {
     214                 :          0 :     ::cppu::PropertySetMixin< XAnnotation >::setPropertyValue(aPropertyName, aValue);
     215                 :          0 : }
     216                 :            : 
     217                 :          0 : Any SAL_CALL Annotation::getPropertyValue(const OUString & aPropertyName) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
     218                 :            : {
     219                 :          0 :     return ::cppu::PropertySetMixin< XAnnotation >::getPropertyValue(aPropertyName);
     220                 :            : }
     221                 :            : 
     222                 :          0 : void SAL_CALL Annotation::addPropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
     223                 :            : {
     224                 :          0 :     ::cppu::PropertySetMixin< XAnnotation >::addPropertyChangeListener(aPropertyName, xListener);
     225                 :          0 : }
     226                 :            : 
     227                 :          0 : void SAL_CALL Annotation::removePropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
     228                 :            : {
     229                 :          0 :     ::cppu::PropertySetMixin< XAnnotation >::removePropertyChangeListener(aPropertyName, xListener);
     230                 :          0 : }
     231                 :            : 
     232                 :          0 : void SAL_CALL Annotation::addVetoableChangeListener(const OUString & aPropertyName, const Reference< XVetoableChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
     233                 :            : {
     234                 :          0 :     ::cppu::PropertySetMixin< XAnnotation >::addVetoableChangeListener(aPropertyName, xListener);
     235                 :          0 : }
     236                 :            : 
     237                 :          0 : void SAL_CALL Annotation::removeVetoableChangeListener(const OUString & aPropertyName, const Reference< XVetoableChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException)
     238                 :            : {
     239                 :          0 :     ::cppu::PropertySetMixin< XAnnotation >::removeVetoableChangeListener(aPropertyName, xListener);
     240                 :          0 : }
     241                 :            : 
     242                 :          0 : Any SAL_CALL Annotation::getAnchor() throw (RuntimeException)
     243                 :            : {
     244         [ #  # ]:          0 :     osl::MutexGuard g(m_aMutex);
     245                 :          0 :     Any aRet;
     246         [ #  # ]:          0 :     if( mpPage )
     247                 :            :     {
     248 [ #  # ][ #  # ]:          0 :         Reference< XDrawPage > xPage( mpPage->getUnoPage(), UNO_QUERY );
     249         [ #  # ]:          0 :         aRet <<= xPage;
     250                 :            :     }
     251         [ #  # ]:          0 :     return aRet;
     252                 :            : }
     253                 :            : 
     254                 :            : // ::com::sun::star::office::XAnnotation:
     255                 :          0 : RealPoint2D SAL_CALL Annotation::getPosition() throw (RuntimeException)
     256                 :            : {
     257         [ #  # ]:          0 :     osl::MutexGuard g(m_aMutex);
     258         [ #  # ]:          0 :     return m_Position;
     259                 :            : }
     260                 :            : 
     261                 :          0 : void SAL_CALL Annotation::setPosition(const RealPoint2D & the_value) throw (RuntimeException)
     262                 :            : {
     263         [ #  # ]:          0 :     prepareSet("Position", Any(), Any(), 0);
     264                 :            :     {
     265         [ #  # ]:          0 :         osl::MutexGuard g(m_aMutex);
     266         [ #  # ]:          0 :         createChangeUndo();
     267         [ #  # ]:          0 :         m_Position = the_value;
     268                 :            :     }
     269                 :          0 : }
     270                 :            : 
     271                 :            : // ::com::sun::star::office::XAnnotation:
     272                 :          0 : RealSize2D SAL_CALL Annotation::getSize() throw (RuntimeException)
     273                 :            : {
     274         [ #  # ]:          0 :     osl::MutexGuard g(m_aMutex);
     275         [ #  # ]:          0 :     return m_Size;
     276                 :            : }
     277                 :            : 
     278                 :          0 : void SAL_CALL Annotation::setSize(const RealSize2D & the_value) throw (RuntimeException)
     279                 :            : {
     280         [ #  # ]:          0 :     prepareSet("Size", Any(), Any(), 0);
     281                 :            :     {
     282         [ #  # ]:          0 :         osl::MutexGuard g(m_aMutex);
     283         [ #  # ]:          0 :         createChangeUndo();
     284         [ #  # ]:          0 :         m_Size = the_value;
     285                 :            :     }
     286                 :          0 : }
     287                 :            : 
     288                 :          0 : OUString SAL_CALL Annotation::getAuthor() throw (RuntimeException)
     289                 :            : {
     290         [ #  # ]:          0 :     osl::MutexGuard g(m_aMutex);
     291         [ #  # ]:          0 :     return m_Author;
     292                 :            : }
     293                 :            : 
     294                 :          0 : void SAL_CALL Annotation::setAuthor(const OUString & the_value) throw (RuntimeException)
     295                 :            : {
     296         [ #  # ]:          0 :     prepareSet("Author", Any(), Any(), 0);
     297                 :            :     {
     298         [ #  # ]:          0 :         osl::MutexGuard g(m_aMutex);
     299         [ #  # ]:          0 :         createChangeUndo();
     300         [ #  # ]:          0 :         m_Author = the_value;
     301                 :            :     }
     302                 :          0 : }
     303                 :            : 
     304                 :          0 : util::DateTime SAL_CALL Annotation::getDateTime() throw (RuntimeException)
     305                 :            : {
     306         [ #  # ]:          0 :     osl::MutexGuard g(m_aMutex);
     307         [ #  # ]:          0 :     return m_DateTime;
     308                 :            : }
     309                 :            : 
     310                 :          0 : void SAL_CALL Annotation::setDateTime(const util::DateTime & the_value) throw (RuntimeException)
     311                 :            : {
     312         [ #  # ]:          0 :     prepareSet("DateTime", Any(), Any(), 0);
     313                 :            :     {
     314         [ #  # ]:          0 :         osl::MutexGuard g(m_aMutex);
     315         [ #  # ]:          0 :         createChangeUndo();
     316         [ #  # ]:          0 :         m_DateTime = the_value;
     317                 :            :     }
     318                 :          0 : }
     319                 :            : 
     320                 :          0 : void Annotation::createChangeUndo()
     321                 :            : {
     322                 :          0 :     SdrModel* pModel = GetModel();
     323 [ #  # ][ #  # ]:          0 :     if( pModel && pModel->IsUndoEnabled() )
                 [ #  # ]
     324         [ #  # ]:          0 :         pModel->AddUndo( new UndoAnnotation( *this ) );
     325                 :            : 
     326         [ #  # ]:          0 :     if( pModel )
     327                 :            :     {
     328         [ #  # ]:          0 :         pModel->SetChanged();
     329         [ #  # ]:          0 :         Reference< XInterface > xSource( static_cast<uno::XWeak*>( this ) );
     330         [ #  # ]:          0 :         NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationChanged" , xSource );
     331                 :            :     }
     332                 :          0 : }
     333                 :            : 
     334                 :          0 : Reference< XText > SAL_CALL Annotation::getTextRange() throw (RuntimeException)
     335                 :            : {
     336         [ #  # ]:          0 :     osl::MutexGuard g(m_aMutex);
     337 [ #  # ][ #  # ]:          0 :     if( !m_TextRange.is() && (mpPage != 0) )
                 [ #  # ]
     338                 :            :     {
     339 [ #  # ][ #  # ]:          0 :         m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( mpPage->GetModel() ) );
                 [ #  # ]
     340                 :            :     }
     341 [ #  # ][ #  # ]:          0 :     return Reference< XText >( m_TextRange.get() );
                 [ #  # ]
     342                 :            : }
     343                 :            : 
     344                 :          0 : SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert )
     345                 :            : {
     346         [ #  # ]:          0 :     Annotation* pAnnotation = dynamic_cast< Annotation* >( xAnnotation.get() );
     347         [ #  # ]:          0 :     if( pAnnotation )
     348                 :            :     {
     349         [ #  # ]:          0 :         return new UndoInsertOrRemoveAnnotation( *pAnnotation, bInsert );
     350                 :            :     }
     351                 :            :     else
     352                 :            :     {
     353                 :          0 :         return 0;
     354                 :            :     }
     355                 :            : }
     356                 :            : 
     357                 :          0 : UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert )
     358                 :          0 : : SdrUndoAction( *rAnnotation.GetModel() )
     359                 :            : , mxAnnotation( &rAnnotation )
     360                 :            : , mbInsert( bInsert )
     361                 :          0 : , mnIndex( 0 )
     362                 :            : {
     363                 :          0 :     SdPage* pPage = rAnnotation.GetPage();
     364         [ #  # ]:          0 :     if( pPage )
     365                 :            :     {
     366         [ #  # ]:          0 :         Reference< XAnnotation > xAnnotation( &rAnnotation );
     367                 :            : 
     368                 :          0 :         const AnnotationVector& rVec = pPage->getAnnotations();
     369 [ #  # ][ #  # ]:          0 :         for( AnnotationVector::const_iterator iter = rVec.begin(); iter != rVec.end(); ++iter )
     370                 :            :         {
     371 [ #  # ][ #  # ]:          0 :             if( (*iter) == xAnnotation )
     372                 :          0 :                 break;
     373                 :            : 
     374                 :          0 :             mnIndex++;
     375                 :          0 :         }
     376                 :            :     }
     377                 :          0 : }
     378                 :            : 
     379                 :          0 : void UndoInsertOrRemoveAnnotation::Undo()
     380                 :            : {
     381                 :          0 :     SdPage* pPage = mxAnnotation->GetPage();
     382                 :          0 :     SdrModel* pModel = mxAnnotation->GetModel();
     383 [ #  # ][ #  # ]:          0 :     if( pPage && pModel )
     384                 :            :     {
     385 [ #  # ][ #  # ]:          0 :         Reference< XAnnotation > xAnnotation( mxAnnotation.get() );
     386         [ #  # ]:          0 :         if( mbInsert )
     387                 :            :         {
     388         [ #  # ]:          0 :             pPage->removeAnnotation( xAnnotation );
     389                 :            :         }
     390                 :            :         else
     391                 :            :         {
     392         [ #  # ]:          0 :             pPage->addAnnotation( xAnnotation, mnIndex );
     393                 :          0 :         }
     394                 :            :     }
     395                 :          0 : }
     396                 :            : 
     397                 :          0 : void UndoInsertOrRemoveAnnotation::Redo()
     398                 :            : {
     399                 :          0 :     SdPage* pPage = mxAnnotation->GetPage();
     400                 :          0 :     SdrModel* pModel = mxAnnotation->GetModel();
     401 [ #  # ][ #  # ]:          0 :     if( pPage && pModel )
     402                 :            :     {
     403 [ #  # ][ #  # ]:          0 :         Reference< XAnnotation > xAnnotation( mxAnnotation.get() );
     404                 :            : 
     405         [ #  # ]:          0 :         if( mbInsert )
     406                 :            :         {
     407         [ #  # ]:          0 :             pPage->addAnnotation( xAnnotation, mnIndex );
     408                 :            :         }
     409                 :            :         else
     410                 :            :         {
     411         [ #  # ]:          0 :             pPage->removeAnnotation( xAnnotation );
     412                 :          0 :         }
     413                 :            :     }
     414                 :          0 : }
     415                 :            : 
     416                 :          0 : UndoAnnotation::UndoAnnotation( Annotation& rAnnotation )
     417                 :          0 : : SdrUndoAction( *rAnnotation.GetModel() )
     418                 :          0 : , mxAnnotation( &rAnnotation )
     419                 :            : {
     420         [ #  # ]:          0 :     maUndoData.get( mxAnnotation );
     421                 :          0 : }
     422                 :            : 
     423                 :          0 : void UndoAnnotation::Undo()
     424                 :            : {
     425                 :          0 :     maRedoData.get( mxAnnotation );
     426                 :          0 :     maUndoData.set( mxAnnotation );
     427                 :          0 : }
     428                 :            : 
     429                 :          0 : void UndoAnnotation::Redo()
     430                 :            : {
     431                 :          0 :     maUndoData.get( mxAnnotation );
     432                 :          0 :     maRedoData.set( mxAnnotation );
     433                 :          0 : }
     434                 :            : 
     435                 :            : } // namespace sd
     436                 :            : 
     437                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10