LCOV - code coverage report
Current view: top level - editeng/source/uno - unoviwou.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 65 0.0 %
Date: 2012-08-25 Functions: 0 14 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 68 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                 :            : #include <vcl/outdev.hxx>
      30                 :            : #include <vcl/window.hxx>
      31                 :            : 
      32                 :            : #include <editeng/unoviwou.hxx>
      33                 :            : #include <editeng/outliner.hxx>
      34                 :            : #include <editeng/editeng.hxx>
      35                 :            : 
      36                 :          0 : SvxDrawOutlinerViewForwarder::SvxDrawOutlinerViewForwarder( OutlinerView& rOutl ) :
      37                 :          0 :     mrOutlinerView ( rOutl ), maTextShapeTopLeft()
      38                 :            : {
      39                 :          0 : }
      40                 :            : 
      41                 :          0 : SvxDrawOutlinerViewForwarder::SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft ) :
      42                 :          0 :     mrOutlinerView ( rOutl ), maTextShapeTopLeft( rShapePosTopLeft )
      43                 :            : {
      44                 :          0 : }
      45                 :            : 
      46                 :          0 : SvxDrawOutlinerViewForwarder::~SvxDrawOutlinerViewForwarder()
      47                 :            : {
      48         [ #  # ]:          0 : }
      49                 :            : 
      50                 :          0 : Point SvxDrawOutlinerViewForwarder::GetTextOffset() const
      51                 :            : {
      52                 :            :     // calc text offset from shape anchor
      53         [ #  # ]:          0 :     Rectangle aOutputRect( mrOutlinerView.GetOutputArea() );
      54                 :            : 
      55                 :          0 :     return aOutputRect.TopLeft() - maTextShapeTopLeft;
      56                 :            : }
      57                 :            : 
      58                 :          0 : sal_Bool SvxDrawOutlinerViewForwarder::IsValid() const
      59                 :            : {
      60                 :          0 :     return sal_True;
      61                 :            : }
      62                 :            : 
      63                 :          0 : Rectangle SvxDrawOutlinerViewForwarder::GetVisArea() const
      64                 :            : {
      65                 :          0 :     OutputDevice* pOutDev = mrOutlinerView.GetWindow();
      66                 :            : 
      67         [ #  # ]:          0 :     if( pOutDev )
      68                 :            :     {
      69         [ #  # ]:          0 :         Rectangle aVisArea = mrOutlinerView.GetVisArea();
      70                 :            : 
      71         [ #  # ]:          0 :         Point aTextOffset( GetTextOffset() );
      72         [ #  # ]:          0 :         aVisArea.Move( aTextOffset.X(), aTextOffset.Y() );
      73                 :            : 
      74                 :            :         // figure out map mode from edit engine
      75                 :          0 :         Outliner* pOutliner = mrOutlinerView.GetOutliner();
      76                 :            : 
      77         [ #  # ]:          0 :         if( pOutliner )
      78                 :            :         {
      79         [ #  # ]:          0 :             MapMode aMapMode(pOutDev->GetMapMode());
      80                 :            :             aVisArea = OutputDevice::LogicToLogic( aVisArea,
      81                 :            :                                                    pOutliner->GetRefMapMode(),
      82 [ #  # ][ #  # ]:          0 :                                                    aMapMode.GetMapUnit() );
         [ #  # ][ #  # ]
                 [ #  # ]
      83         [ #  # ]:          0 :             aMapMode.SetOrigin(Point());
      84 [ #  # ][ #  # ]:          0 :             return pOutDev->LogicToPixel( aVisArea, aMapMode );
      85                 :            :         }
      86                 :            :     }
      87                 :            : 
      88                 :          0 :     return Rectangle();
      89                 :            : }
      90                 :            : 
      91                 :          0 : Point SvxDrawOutlinerViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
      92                 :            : {
      93                 :          0 :     OutputDevice* pOutDev = mrOutlinerView.GetWindow();
      94                 :            : 
      95         [ #  # ]:          0 :     if( pOutDev )
      96                 :            :     {
      97                 :          0 :         Point aPoint1( rPoint );
      98         [ #  # ]:          0 :         Point aTextOffset( GetTextOffset() );
      99                 :            : 
     100                 :          0 :         aPoint1.X() += aTextOffset.X();
     101                 :          0 :         aPoint1.Y() += aTextOffset.Y();
     102                 :            : 
     103         [ #  # ]:          0 :         MapMode aMapMode(pOutDev->GetMapMode());
     104                 :            :         Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode,
     105 [ #  # ][ #  # ]:          0 :                                                    aMapMode.GetMapUnit() ) );
                 [ #  # ]
     106         [ #  # ]:          0 :         aMapMode.SetOrigin(Point());
     107 [ #  # ][ #  # ]:          0 :         return pOutDev->LogicToPixel( aPoint2, aMapMode );
     108                 :            :     }
     109                 :            : 
     110                 :          0 :     return Point();
     111                 :            : }
     112                 :            : 
     113                 :          0 : Point SvxDrawOutlinerViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
     114                 :            : {
     115                 :          0 :     OutputDevice* pOutDev = mrOutlinerView.GetWindow();
     116                 :            : 
     117         [ #  # ]:          0 :     if( pOutDev )
     118                 :            :     {
     119         [ #  # ]:          0 :         MapMode aMapMode(pOutDev->GetMapMode());
     120         [ #  # ]:          0 :         aMapMode.SetOrigin(Point());
     121         [ #  # ]:          0 :         Point aPoint1( pOutDev->PixelToLogic( rPoint, aMapMode ) );
     122                 :            :         Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
     123                 :            :                                                    aMapMode.GetMapUnit(),
     124 [ #  # ][ #  # ]:          0 :                                                    rMapMode ) );
                 [ #  # ]
     125         [ #  # ]:          0 :         Point aTextOffset( GetTextOffset() );
     126                 :            : 
     127                 :          0 :         aPoint2.X() -= aTextOffset.X();
     128                 :          0 :         aPoint2.Y() -= aTextOffset.Y();
     129                 :            : 
     130         [ #  # ]:          0 :         return aPoint2;
     131                 :            :     }
     132                 :            : 
     133                 :          0 :     return Point();
     134                 :            : }
     135                 :            : 
     136                 :          0 : sal_Bool SvxDrawOutlinerViewForwarder::GetSelection( ESelection& rSelection ) const
     137                 :            : {
     138                 :          0 :     rSelection = mrOutlinerView.GetSelection();
     139                 :          0 :     return sal_True;
     140                 :            : }
     141                 :            : 
     142                 :          0 : sal_Bool SvxDrawOutlinerViewForwarder::SetSelection( const ESelection& rSelection )
     143                 :            : {
     144                 :          0 :     mrOutlinerView.SetSelection( rSelection );
     145                 :          0 :     return sal_True;
     146                 :            : }
     147                 :            : 
     148                 :          0 : sal_Bool SvxDrawOutlinerViewForwarder::Copy()
     149                 :            : {
     150                 :          0 :     mrOutlinerView.Copy();
     151                 :          0 :     return sal_True;
     152                 :            : }
     153                 :            : 
     154                 :          0 : sal_Bool SvxDrawOutlinerViewForwarder::Cut()
     155                 :            : {
     156                 :          0 :     mrOutlinerView.Cut();
     157                 :          0 :     return sal_True;
     158                 :            : }
     159                 :            : 
     160                 :          0 : sal_Bool SvxDrawOutlinerViewForwarder::Paste()
     161                 :            : {
     162                 :          0 :     mrOutlinerView.Paste();
     163                 :          0 :     return sal_True;
     164                 :            : }
     165                 :            : 
     166                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10