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

Generated by: LCOV version 1.10