LCOV - code coverage report
Current view: top level - sc/source/ui/Accessibility - AccessibleText.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 318 792 40.2 %
Date: 2012-08-25 Functions: 43 135 31.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 239 1076 22.2 %

           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 "scitems.hxx"
      31                 :            : #include <editeng/eeitem.hxx>
      32                 :            : 
      33                 :            : #include <memory>
      34                 :            : #include "AccessibleText.hxx"
      35                 :            : #include "AccessibleCell.hxx"
      36                 :            : #include "tabvwsh.hxx"
      37                 :            : #include "editutil.hxx"
      38                 :            : #include "document.hxx"
      39                 :            : #include "scmod.hxx"
      40                 :            : #include "prevwsh.hxx"
      41                 :            : #include "docsh.hxx"
      42                 :            : #include "prevloc.hxx"
      43                 :            : #include "patattr.hxx"
      44                 :            : #include "inputwin.hxx"
      45                 :            : #include <editeng/unofored.hxx>
      46                 :            : #include <editeng/editview.hxx>
      47                 :            : #include <editeng/unoedhlp.hxx>
      48                 :            : #include <vcl/virdev.hxx>
      49                 :            : #include <editeng/editobj.hxx>
      50                 :            : #include <editeng/adjitem.hxx>
      51                 :            : #include <editeng/justifyitem.hxx>
      52                 :            : #include <svx/svdmodel.hxx>
      53                 :            : #include <svx/algitem.hxx>
      54                 :            : #include <vcl/svapp.hxx>
      55                 :            : 
      56                 :            : 
      57                 :            : // ============================================================================
      58                 :            : 
      59                 :            : class ScViewForwarder : public SvxViewForwarder
      60                 :            : {
      61                 :            :     ScTabViewShell*     mpViewShell;
      62                 :            :     ScAddress           maCellPos;
      63                 :            :     ScSplitPos          meSplitPos;
      64                 :            : public:
      65                 :            :                         ScViewForwarder(ScTabViewShell* pViewShell, ScSplitPos eSplitPos, const ScAddress& rCell);
      66                 :            :     virtual             ~ScViewForwarder();
      67                 :            : 
      68                 :            :     virtual sal_Bool        IsValid() const;
      69                 :            :     virtual Rectangle   GetVisArea() const;
      70                 :            :     virtual Point       LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
      71                 :            :     virtual Point       PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
      72                 :            : 
      73                 :            :     void                SetInvalid();
      74                 :            : };
      75                 :            : 
      76                 :          0 : ScViewForwarder::ScViewForwarder(ScTabViewShell* pViewShell, ScSplitPos eSplitPos, const ScAddress& rCell)
      77                 :            :     :
      78                 :            :     mpViewShell(pViewShell),
      79                 :            :     maCellPos(rCell),
      80                 :          0 :     meSplitPos(eSplitPos)
      81                 :            : {
      82                 :          0 : }
      83                 :            : 
      84                 :          0 : ScViewForwarder::~ScViewForwarder()
      85                 :            : {
      86         [ #  # ]:          0 : }
      87                 :            : 
      88                 :          0 : sal_Bool ScViewForwarder::IsValid() const
      89                 :            : {
      90                 :          0 :     return mpViewShell != NULL;
      91                 :            : }
      92                 :            : 
      93                 :          0 : Rectangle ScViewForwarder::GetVisArea() const
      94                 :            : {
      95                 :          0 :     Rectangle aVisArea;
      96         [ #  # ]:          0 :     if (mpViewShell)
      97                 :            :     {
      98                 :          0 :         Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
      99         [ #  # ]:          0 :         if (pWindow)
     100                 :            :         {
     101 [ #  # ][ #  # ]:          0 :             aVisArea.SetSize(pWindow->GetSizePixel());
     102                 :            : 
     103                 :            :             ScHSplitPos eWhichH = ((meSplitPos == SC_SPLIT_TOPLEFT) || (meSplitPos == SC_SPLIT_BOTTOMLEFT)) ?
     104 [ #  # ][ #  # ]:          0 :                                     SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
     105                 :            :             ScVSplitPos eWhichV = ((meSplitPos == SC_SPLIT_TOPLEFT) || (meSplitPos == SC_SPLIT_TOPRIGHT)) ?
     106 [ #  # ][ #  # ]:          0 :                                     SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
     107                 :            : 
     108                 :          0 :             Point aBaseCellPos(mpViewShell->GetViewData()->GetScrPos(mpViewShell->GetViewData()->GetPosX(eWhichH),
     109         [ #  # ]:          0 :                 mpViewShell->GetViewData()->GetPosY(eWhichV), meSplitPos, sal_True));
     110         [ #  # ]:          0 :             Point aCellPos(mpViewShell->GetViewData()->GetScrPos(maCellPos.Col(), maCellPos.Row(), meSplitPos, sal_True));
     111                 :          0 :             aVisArea.SetPos(aCellPos - aBaseCellPos);
     112                 :            :         }
     113                 :            :     }
     114                 :            :     else
     115                 :            :     {
     116                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     117                 :            :     }
     118                 :          0 :     return aVisArea;
     119                 :            : }
     120                 :            : 
     121                 :          0 : Point ScViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
     122                 :            : {
     123         [ #  # ]:          0 :     if (mpViewShell)
     124                 :            :     {
     125                 :          0 :         Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
     126         [ #  # ]:          0 :         if (pWindow)
     127                 :          0 :             return pWindow->LogicToPixel( rPoint, rMapMode );
     128                 :            :     }
     129                 :            :     else
     130                 :            :     {
     131                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     132                 :            :     }
     133                 :          0 :     return Point();
     134                 :            : }
     135                 :            : 
     136                 :          0 : Point ScViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
     137                 :            : {
     138         [ #  # ]:          0 :     if (mpViewShell)
     139                 :            :     {
     140                 :          0 :         Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
     141         [ #  # ]:          0 :         if (pWindow)
     142                 :          0 :             return pWindow->PixelToLogic( rPoint, rMapMode );
     143                 :            :     }
     144                 :            :     else
     145                 :            :     {
     146                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     147                 :            :     }
     148                 :          0 :     return Point();
     149                 :            : }
     150                 :            : 
     151                 :          0 : void ScViewForwarder::SetInvalid()
     152                 :            : {
     153                 :          0 :     mpViewShell = NULL;
     154                 :          0 : }
     155                 :            : 
     156                 :            : // ============================================================================
     157                 :            : 
     158                 :            : class ScEditObjectViewForwarder : public SvxViewForwarder
     159                 :            : {
     160                 :            :     Window*             mpWindow;
     161                 :            :     // #i49561# EditView needed for access to its visible area.
     162                 :            :     const EditView* mpEditView;
     163                 :            : public:
     164                 :            :                         ScEditObjectViewForwarder( Window* pWindow,
     165                 :            :                                                    const EditView* _pEditView);
     166                 :            :     virtual             ~ScEditObjectViewForwarder();
     167                 :            : 
     168                 :            :     virtual sal_Bool        IsValid() const;
     169                 :            :     virtual Rectangle   GetVisArea() const;
     170                 :            :     virtual Point       LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
     171                 :            :     virtual Point       PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
     172                 :            : 
     173                 :            :     void                SetInvalid();
     174                 :            : };
     175                 :            : 
     176                 :          0 : ScEditObjectViewForwarder::ScEditObjectViewForwarder( Window* pWindow,
     177                 :            :                                                       const EditView* _pEditView )
     178                 :            :     :
     179                 :            :     mpWindow(pWindow),
     180                 :          0 :     mpEditView( _pEditView )
     181                 :            : {
     182                 :          0 : }
     183                 :            : 
     184                 :          0 : ScEditObjectViewForwarder::~ScEditObjectViewForwarder()
     185                 :            : {
     186         [ #  # ]:          0 : }
     187                 :            : 
     188                 :          0 : sal_Bool ScEditObjectViewForwarder::IsValid() const
     189                 :            : {
     190                 :          0 :     return (mpWindow != NULL);
     191                 :            : }
     192                 :            : 
     193                 :          0 : Rectangle ScEditObjectViewForwarder::GetVisArea() const
     194                 :            : {
     195                 :          0 :     Rectangle aVisArea;
     196         [ #  # ]:          0 :     if (mpWindow)
     197                 :            :     {
     198 [ #  # ][ #  # ]:          0 :         Rectangle aVisRect(mpWindow->GetWindowExtentsRelative(mpWindow->GetAccessibleParentWindow()));
     199                 :            : 
     200                 :          0 :         aVisRect.SetPos(Point(0, 0));
     201                 :            : 
     202                 :          0 :         aVisArea = aVisRect;
     203                 :            :     }
     204                 :            :     else
     205                 :            :     {
     206                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     207                 :            :     }
     208                 :          0 :     return aVisArea;
     209                 :            : }
     210                 :            : 
     211                 :          0 : Point ScEditObjectViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
     212                 :            : {
     213         [ #  # ]:          0 :     if (mpWindow)
     214                 :            :     {
     215                 :            :         // #i49561# - consider offset of the visible area
     216                 :            :         // of the EditView before converting point to pixel.
     217                 :          0 :         Point aPoint( rPoint );
     218         [ #  # ]:          0 :         if ( mpEditView )
     219                 :            :         {
     220         [ #  # ]:          0 :             Rectangle aEditViewVisArea( mpEditView->GetVisArea() );
     221                 :          0 :             aPoint += aEditViewVisArea.TopLeft();
     222                 :            :         }
     223         [ #  # ]:          0 :         return mpWindow->LogicToPixel( aPoint, rMapMode );
     224                 :            :     }
     225                 :            :     else
     226                 :            :     {
     227                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     228                 :            :     }
     229                 :          0 :     return Point();
     230                 :            : }
     231                 :            : 
     232                 :          0 : Point ScEditObjectViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
     233                 :            : {
     234         [ #  # ]:          0 :     if (mpWindow)
     235                 :            :     {
     236                 :            :         // #i49561# - consider offset of the visible area
     237                 :            :         // of the EditView after converting point to logic.
     238         [ #  # ]:          0 :         Point aPoint( mpWindow->PixelToLogic( rPoint, rMapMode ) );
     239         [ #  # ]:          0 :         if ( mpEditView )
     240                 :            :         {
     241         [ #  # ]:          0 :             Rectangle aEditViewVisArea( mpEditView->GetVisArea() );
     242                 :          0 :             aPoint -= aEditViewVisArea.TopLeft();
     243                 :            :         }
     244                 :          0 :         return aPoint;
     245                 :            :     }
     246                 :            :     else
     247                 :            :     {
     248                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     249                 :            :     }
     250                 :          0 :     return Point();
     251                 :            : }
     252                 :            : 
     253                 :          0 : void ScEditObjectViewForwarder::SetInvalid()
     254                 :            : {
     255                 :          0 :     mpWindow = NULL;
     256                 :          0 : }
     257                 :            : 
     258                 :            : class ScPreviewViewForwarder : public SvxViewForwarder
     259                 :            : {
     260                 :            : protected:
     261                 :            :     ScPreviewShell*     mpViewShell;
     262                 :            :     mutable ScPreviewTableInfo* mpTableInfo;
     263                 :            : public:
     264                 :            :                         ScPreviewViewForwarder(ScPreviewShell* pViewShell);
     265                 :            :     virtual             ~ScPreviewViewForwarder();
     266                 :            : 
     267                 :            :     virtual sal_Bool        IsValid() const;
     268                 :            :     virtual Rectangle   GetVisArea() const;
     269                 :            :     virtual Point       LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
     270                 :            :     virtual Point       PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
     271                 :            : 
     272                 :            :     void                SetInvalid();
     273                 :            : 
     274                 :            :     Rectangle GetVisRect() const;
     275                 :            : 
     276                 :            :     // clips the VisArea and calculates with the negativ coordinates
     277                 :            :     Rectangle CorrectVisArea(const Rectangle& rVisArea) const;
     278                 :            : };
     279                 :            : 
     280                 :         44 : ScPreviewViewForwarder::ScPreviewViewForwarder(ScPreviewShell* pViewShell)
     281                 :            :     :
     282                 :            :     mpViewShell(pViewShell),
     283                 :         44 :     mpTableInfo(NULL)
     284                 :            : {
     285                 :         44 : }
     286                 :            : 
     287                 :         15 : ScPreviewViewForwarder::~ScPreviewViewForwarder()
     288                 :            : {
     289 [ -  + ][ #  # ]:         15 :     delete mpTableInfo;
     290         [ -  + ]:         15 : }
     291                 :            : 
     292                 :        229 : sal_Bool ScPreviewViewForwarder::IsValid() const
     293                 :            : {
     294                 :        229 :     return mpViewShell != NULL;
     295                 :            : }
     296                 :            : 
     297                 :          0 : Rectangle ScPreviewViewForwarder::GetVisArea() const
     298                 :            : {
     299                 :          0 :     Rectangle aVisArea;
     300                 :            :     OSL_FAIL("should be implemented in an abrevated class");
     301                 :          0 :     return aVisArea;
     302                 :            : }
     303                 :            : 
     304                 :        410 : Point ScPreviewViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
     305                 :            : {
     306         [ +  - ]:        410 :     if (mpViewShell)
     307                 :            :     {
     308                 :        410 :         Window* pWindow = mpViewShell->GetWindow();
     309         [ +  - ]:        410 :         if (pWindow)
     310                 :            :         {
     311         [ +  - ]:        410 :             MapMode aMapMode(pWindow->GetMapMode().GetMapUnit());
     312         [ +  - ]:        410 :             Point aPoint2( OutputDevice::LogicToLogic( rPoint, rMapMode, aMapMode) );
     313 [ +  - ][ +  - ]:        410 :             return pWindow->LogicToPixel(aPoint2);
     314                 :            :         }
     315                 :            :     }
     316                 :            :     else
     317                 :            :     {
     318                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     319                 :            :     }
     320                 :        410 :     return Point();
     321                 :            : }
     322                 :            : 
     323                 :         24 : Point ScPreviewViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
     324                 :            : {
     325         [ +  - ]:         24 :     if (mpViewShell)
     326                 :            :     {
     327                 :         24 :         Window* pWindow = mpViewShell->GetWindow();
     328         [ +  - ]:         24 :         if (pWindow)
     329                 :            :         {
     330         [ +  - ]:         24 :             MapMode aMapMode(pWindow->GetMapMode());
     331         [ +  - ]:         24 :             aMapMode.SetOrigin(Point());
     332         [ +  - ]:         24 :             Point aPoint1( pWindow->PixelToLogic( rPoint ) );
     333                 :            :             Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
     334                 :            :                                                        aMapMode.GetMapUnit(),
     335 [ +  - ][ +  - ]:         24 :                                                        rMapMode ) );
                 [ +  - ]
     336         [ +  - ]:         24 :             return aPoint2;
     337                 :            :         }
     338                 :            :     }
     339                 :            :     else
     340                 :            :     {
     341                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     342                 :            :     }
     343                 :         24 :     return Point();
     344                 :            : }
     345                 :            : 
     346                 :         11 : void ScPreviewViewForwarder::SetInvalid()
     347                 :            : {
     348                 :         11 :     mpViewShell = NULL;
     349                 :         11 : }
     350                 :            : 
     351                 :         16 : Rectangle ScPreviewViewForwarder::GetVisRect() const
     352                 :            : {
     353         [ +  - ]:         16 :     if ( mpViewShell )
     354                 :            :     {
     355                 :         16 :         Size aOutputSize;
     356                 :         16 :         Window* pWindow = mpViewShell->GetWindow();
     357         [ +  - ]:         16 :         if ( pWindow )
     358                 :         16 :             aOutputSize = pWindow->GetOutputSizePixel();
     359                 :         16 :         Point aPoint;
     360         [ +  - ]:         16 :         Rectangle aVisRect( aPoint, aOutputSize );
     361                 :         16 :         return aVisRect;
     362                 :            :     }
     363                 :         16 :     return Rectangle();
     364                 :            : }
     365                 :            : 
     366                 :         64 : Rectangle ScPreviewViewForwarder::CorrectVisArea(const Rectangle& rVisArea) const
     367                 :            : {
     368                 :         64 :     Rectangle aVisArea(rVisArea);
     369                 :         64 :     Point aPos = aVisArea.TopLeft(); // get first the position to remember negative positions after clipping
     370                 :            : 
     371                 :         64 :     Window* pWin = mpViewShell->GetWindow();
     372         [ +  - ]:         64 :     if (pWin)
     373 [ +  - ][ +  - ]:         64 :         aVisArea = pWin->GetWindowExtentsRelative(pWin).GetIntersection(aVisArea);
     374                 :            : 
     375                 :         64 :     sal_Int32 nX(aPos.getX());
     376                 :         64 :     sal_Int32 nY(aPos.getY());
     377                 :            : 
     378         [ +  - ]:         64 :     if (nX > 0)
     379                 :         64 :         nX = 0;
     380         [ #  # ]:          0 :     else if (nX < 0)
     381                 :          0 :         nX = -nX;
     382         [ +  - ]:         64 :     if (nY > 0)
     383                 :         64 :         nY = 0;
     384         [ #  # ]:          0 :     else if (nY < 0)
     385                 :          0 :         nY = -nY;
     386                 :         64 :     aVisArea.SetPos(Point(nX, nY));
     387                 :            : 
     388                 :         64 :     return aVisArea;
     389                 :            : }
     390                 :            : 
     391                 :            : class ScPreviewHeaderFooterViewForwarder : public ScPreviewViewForwarder
     392                 :            : {
     393                 :            :     sal_Bool            mbHeader;
     394                 :            : public:
     395                 :            :                         ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell, sal_Bool bHeader);
     396                 :            :     virtual             ~ScPreviewHeaderFooterViewForwarder();
     397                 :            : 
     398                 :            :     virtual Rectangle   GetVisArea() const;
     399                 :            : };
     400                 :            : 
     401                 :         18 : ScPreviewHeaderFooterViewForwarder::ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell, sal_Bool bHeader)
     402                 :            :     :
     403                 :            :     ScPreviewViewForwarder(pViewShell),
     404                 :         18 :     mbHeader(bHeader)
     405                 :            : {
     406                 :         18 : }
     407                 :            : 
     408                 :          0 : ScPreviewHeaderFooterViewForwarder::~ScPreviewHeaderFooterViewForwarder()
     409                 :            : {
     410         [ #  # ]:          0 : }
     411                 :            : 
     412                 :         28 : Rectangle ScPreviewHeaderFooterViewForwarder::GetVisArea() const
     413                 :            : {
     414                 :         28 :     Rectangle aVisArea;
     415         [ +  - ]:         28 :     if (mpViewShell)
     416                 :            :     {
     417                 :         28 :         const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
     418         [ +  + ]:         28 :         if ( mbHeader )
     419                 :         18 :             rData.GetHeaderPosition( aVisArea );
     420                 :            :         else
     421                 :         10 :             rData.GetFooterPosition( aVisArea );
     422                 :            : 
     423                 :         28 :         aVisArea = CorrectVisArea(aVisArea);
     424                 :            :     }
     425                 :            :     else
     426                 :            :     {
     427                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     428                 :            :     }
     429                 :         28 :     return aVisArea;
     430                 :            : }
     431                 :            : 
     432                 :            : class ScPreviewCellViewForwarder : public ScPreviewViewForwarder
     433                 :            : {
     434                 :            :     ScAddress           maCellPos;
     435                 :            : public:
     436                 :            :                         ScPreviewCellViewForwarder(ScPreviewShell* pViewShell,
     437                 :            :                             ScAddress aCellPos);
     438                 :            :     virtual             ~ScPreviewCellViewForwarder();
     439                 :            : 
     440                 :            :     virtual Rectangle   GetVisArea() const;
     441                 :            : };
     442                 :            : 
     443                 :         15 : ScPreviewCellViewForwarder::ScPreviewCellViewForwarder(ScPreviewShell* pViewShell,
     444                 :            :                                                        ScAddress aCellPos)
     445                 :            :     :
     446                 :            :     ScPreviewViewForwarder(pViewShell),
     447                 :         15 :     maCellPos(aCellPos)
     448                 :            : {
     449                 :         15 : }
     450                 :            : 
     451                 :         15 : ScPreviewCellViewForwarder::~ScPreviewCellViewForwarder()
     452                 :            : {
     453         [ -  + ]:         30 : }
     454                 :            : 
     455                 :         20 : Rectangle ScPreviewCellViewForwarder::GetVisArea() const
     456                 :            : {
     457                 :         20 :     Rectangle aVisArea;
     458         [ +  - ]:         20 :     if (mpViewShell)
     459                 :            :     {
     460                 :         20 :         const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
     461                 :         20 :         aVisArea = rData.GetCellOutputRect(maCellPos);
     462                 :            : 
     463                 :         20 :         aVisArea = CorrectVisArea(aVisArea);
     464                 :            :     }
     465                 :            :     else
     466                 :            :     {
     467                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     468                 :            :     }
     469                 :         20 :     return aVisArea;
     470                 :            : }
     471                 :            : 
     472                 :            : class ScPreviewHeaderCellViewForwarder : public ScPreviewViewForwarder
     473                 :            : {
     474                 :            :     ScAddress           maCellPos;
     475                 :            :     sal_Bool            mbColHeader;
     476                 :            :     sal_Bool            mbRowHeader;
     477                 :            : public:
     478                 :            :                         ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell,
     479                 :            :                             ScAddress aCellPos,
     480                 :            :                             sal_Bool bColHeader, sal_Bool bRowHeader);
     481                 :            :     virtual             ~ScPreviewHeaderCellViewForwarder();
     482                 :            : 
     483                 :            :     virtual Rectangle   GetVisArea() const;
     484                 :            : };
     485                 :            : 
     486                 :         11 : ScPreviewHeaderCellViewForwarder::ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell,
     487                 :            :                                                                    ScAddress aCellPos,
     488                 :            :                                                                    sal_Bool bColHeader, sal_Bool bRowHeader)
     489                 :            :     :
     490                 :            :     ScPreviewViewForwarder(pViewShell),
     491                 :            :     maCellPos(aCellPos),
     492                 :            :     mbColHeader(bColHeader),
     493                 :         11 :     mbRowHeader(bRowHeader)
     494                 :            : {
     495                 :         11 : }
     496                 :            : 
     497                 :          0 : ScPreviewHeaderCellViewForwarder::~ScPreviewHeaderCellViewForwarder()
     498                 :            : {
     499         [ #  # ]:          0 : }
     500                 :            : 
     501                 :         16 : Rectangle ScPreviewHeaderCellViewForwarder::GetVisArea() const
     502                 :            : {
     503                 :         16 :     Rectangle aVisArea;
     504         [ +  - ]:         16 :     if (mpViewShell)
     505                 :            :     {
     506                 :         16 :         const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
     507         [ +  - ]:         16 :         aVisArea = rData.GetHeaderCellOutputRect(GetVisRect(), maCellPos, mbColHeader);
     508                 :            : 
     509                 :         16 :         aVisArea = CorrectVisArea(aVisArea);
     510                 :            :     }
     511                 :            :     else
     512                 :            :     {
     513                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     514                 :            :     }
     515                 :         16 :     return aVisArea;
     516                 :            : }
     517                 :            : 
     518                 :            : class ScPreviewNoteViewForwarder : public ScPreviewViewForwarder
     519                 :            : {
     520                 :            :     ScAddress           maCellPos;
     521                 :            :     sal_Bool            mbNoteMark;
     522                 :            : public:
     523                 :            :                         ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell,
     524                 :            :                             ScAddress aCellPos,
     525                 :            :                             sal_Bool bNoteMark);
     526                 :            :     virtual             ~ScPreviewNoteViewForwarder();
     527                 :            : 
     528                 :            :     virtual Rectangle   GetVisArea() const;
     529                 :            : };
     530                 :            : 
     531                 :          0 : ScPreviewNoteViewForwarder::ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell,
     532                 :            :                                                                    ScAddress aCellPos,
     533                 :            :                                                                    sal_Bool bNoteMark)
     534                 :            :     :
     535                 :            :     ScPreviewViewForwarder(pViewShell),
     536                 :            :     maCellPos(aCellPos),
     537                 :          0 :     mbNoteMark(bNoteMark)
     538                 :            : {
     539                 :          0 : }
     540                 :            : 
     541                 :          0 : ScPreviewNoteViewForwarder::~ScPreviewNoteViewForwarder()
     542                 :            : {
     543         [ #  # ]:          0 : }
     544                 :            : 
     545                 :          0 : Rectangle ScPreviewNoteViewForwarder::GetVisArea() const
     546                 :            : {
     547                 :          0 :     Rectangle aVisArea;
     548         [ #  # ]:          0 :     if (mpViewShell)
     549                 :            :     {
     550                 :          0 :         const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
     551         [ #  # ]:          0 :         aVisArea = rData.GetNoteInRangeOutputRect(GetVisRect(), mbNoteMark, maCellPos);
     552                 :            : 
     553                 :          0 :         aVisArea = CorrectVisArea(aVisArea);
     554                 :            :     }
     555                 :            :     else
     556                 :            :     {
     557                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     558                 :            :     }
     559                 :          0 :     return aVisArea;
     560                 :            : }
     561                 :            : 
     562                 :            : class ScEditViewForwarder : public SvxEditViewForwarder
     563                 :            : {
     564                 :            :     EditView*           mpEditView;
     565                 :            :     Window*             mpWindow;
     566                 :            : public:
     567                 :            :                         ScEditViewForwarder(EditView* pEditView, Window* pWin);
     568                 :            :     virtual             ~ScEditViewForwarder();
     569                 :            : 
     570                 :            :     virtual sal_Bool        IsValid() const;
     571                 :            :     virtual Rectangle   GetVisArea() const;
     572                 :            :     virtual Point       LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
     573                 :            :     virtual Point       PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
     574                 :            :     virtual sal_Bool    GetSelection( ESelection& rSelection ) const;
     575                 :            :     virtual sal_Bool    SetSelection( const ESelection& rSelection );
     576                 :            :     virtual sal_Bool    Copy();
     577                 :            :     virtual sal_Bool    Cut();
     578                 :            :     virtual sal_Bool    Paste();
     579                 :            : 
     580                 :            :     void                GrabFocus();
     581                 :            : 
     582                 :            :     void                SetInvalid();
     583                 :            : };
     584                 :            : 
     585                 :          0 : ScEditViewForwarder::ScEditViewForwarder(EditView* pEditView, Window* pWin)
     586                 :            :     : mpEditView(pEditView),
     587                 :          0 :     mpWindow(pWin)
     588                 :            : {
     589                 :          0 :     GrabFocus();
     590                 :          0 : }
     591                 :            : 
     592                 :          0 : ScEditViewForwarder::~ScEditViewForwarder()
     593                 :            : {
     594         [ #  # ]:          0 : }
     595                 :            : 
     596                 :          0 : sal_Bool ScEditViewForwarder::IsValid() const
     597                 :            : {
     598                 :          0 :     sal_Bool bResult(false);
     599 [ #  # ][ #  # ]:          0 :     if (mpWindow && mpEditView)
     600                 :            :     {
     601                 :          0 :         bResult = sal_True;
     602                 :            :     }
     603                 :          0 :     return bResult;
     604                 :            : }
     605                 :            : 
     606                 :          0 : Rectangle ScEditViewForwarder::GetVisArea() const
     607                 :            : {
     608                 :          0 :     Rectangle aVisArea;
     609 [ #  # ][ #  # ]:          0 :     if (IsValid() && mpEditView->GetEditEngine())
                 [ #  # ]
     610                 :            :     {
     611 [ #  # ][ #  # ]:          0 :         MapMode aMapMode(mpEditView->GetEditEngine()->GetRefMapMode());
     612                 :            : 
     613 [ #  # ][ #  # ]:          0 :         aVisArea = mpWindow->LogicToPixel( mpEditView->GetVisArea(), aMapMode );
                 [ #  # ]
     614                 :            :     }
     615                 :            :     else
     616                 :            :     {
     617                 :            :         OSL_FAIL("this EditViewForwarder is no longer valid");
     618                 :            :     }
     619                 :          0 :     return aVisArea;
     620                 :            : }
     621                 :            : 
     622                 :          0 : Point ScEditViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
     623                 :            : {
     624         [ #  # ]:          0 :     if (mpWindow)
     625                 :          0 :         return mpWindow->LogicToPixel( rPoint, rMapMode );
     626                 :            :     else
     627                 :            :     {
     628                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     629                 :            :     }
     630                 :          0 :     return Point();
     631                 :            : }
     632                 :            : 
     633                 :          0 : Point ScEditViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
     634                 :            : {
     635         [ #  # ]:          0 :     if (mpWindow)
     636                 :          0 :         return mpWindow->PixelToLogic( rPoint, rMapMode );
     637                 :            :     else
     638                 :            :     {
     639                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     640                 :            :     }
     641                 :          0 :     return Point();
     642                 :            : }
     643                 :            : 
     644                 :          0 : sal_Bool ScEditViewForwarder::GetSelection( ESelection& rSelection ) const
     645                 :            : {
     646                 :          0 :     sal_Bool bResult(false);
     647         [ #  # ]:          0 :     if (IsValid())
     648                 :            :     {
     649                 :          0 :         rSelection = mpEditView->GetSelection();
     650                 :          0 :         bResult = sal_True;
     651                 :            :     }
     652                 :            :     else
     653                 :            :     {
     654                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     655                 :            :     }
     656                 :          0 :     return bResult;
     657                 :            : }
     658                 :            : 
     659                 :          0 : sal_Bool ScEditViewForwarder::SetSelection( const ESelection& rSelection )
     660                 :            : {
     661                 :          0 :     sal_Bool bResult(false);
     662         [ #  # ]:          0 :     if (IsValid())
     663                 :            :     {
     664                 :          0 :         mpEditView->SetSelection(rSelection);
     665                 :          0 :         bResult = sal_True;
     666                 :            :     }
     667                 :            :     else
     668                 :            :     {
     669                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     670                 :            :     }
     671                 :          0 :     return bResult;
     672                 :            : }
     673                 :            : 
     674                 :          0 : sal_Bool ScEditViewForwarder::Copy()
     675                 :            : {
     676                 :          0 :     sal_Bool bResult(false);
     677         [ #  # ]:          0 :     if (IsValid())
     678                 :            :     {
     679                 :          0 :         mpEditView->Copy();
     680                 :          0 :         bResult = sal_True;
     681                 :            :     }
     682                 :            :     else
     683                 :            :     {
     684                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     685                 :            :     }
     686                 :          0 :     return bResult;
     687                 :            : }
     688                 :            : 
     689                 :          0 : sal_Bool ScEditViewForwarder::Cut()
     690                 :            : {
     691                 :          0 :     sal_Bool bResult(false);
     692         [ #  # ]:          0 :     if (IsValid())
     693                 :            :     {
     694                 :          0 :         mpEditView->Cut();
     695                 :          0 :         bResult = sal_True;
     696                 :            :     }
     697                 :            :     else
     698                 :            :     {
     699                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     700                 :            :     }
     701                 :          0 :     return bResult;
     702                 :            : }
     703                 :            : 
     704                 :          0 : sal_Bool ScEditViewForwarder::Paste()
     705                 :            : {
     706                 :          0 :     sal_Bool bResult(false);
     707         [ #  # ]:          0 :     if (IsValid())
     708                 :            :     {
     709                 :          0 :         mpEditView->Paste();
     710                 :          0 :         bResult = sal_True;
     711                 :            :     }
     712                 :            :     else
     713                 :            :     {
     714                 :            :         OSL_FAIL("this ViewForwarder is not valid");
     715                 :            :     }
     716                 :          0 :     return bResult;
     717                 :            : }
     718                 :            : 
     719                 :          0 : void ScEditViewForwarder::GrabFocus()
     720                 :            : {
     721                 :          0 : }
     722                 :            : 
     723                 :          0 : void ScEditViewForwarder::SetInvalid()
     724                 :            : {
     725                 :          0 :     mpWindow = NULL;
     726                 :          0 :     mpEditView = NULL;
     727                 :          0 : }
     728                 :            : 
     729                 :            : //  ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
     730                 :            : 
     731                 :         11 : ScAccessibleCellTextData::ScAccessibleCellTextData(ScTabViewShell* pViewShell,
     732                 :            :         const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell)
     733                 :            :     : ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP),
     734                 :            :     mpViewForwarder(NULL),
     735                 :            :     mpEditViewForwarder(NULL),
     736                 :            :     mpViewShell(pViewShell),
     737                 :            :     meSplitPos(eSplitPos),
     738                 :            :     mbViewEditEngine(false),
     739                 :         11 :     mpAccessibleCell( pAccCell )
     740                 :            : {
     741                 :         11 : }
     742                 :            : 
     743                 :         11 : ScAccessibleCellTextData::~ScAccessibleCellTextData()
     744                 :            : {
     745         [ -  + ]:         11 :     if (pEditEngine)
     746 [ #  # ][ #  # ]:          0 :         pEditEngine->SetNotifyHdl(Link());
     747         [ -  + ]:         11 :     if (mpViewForwarder)
     748 [ #  # ][ #  # ]:          0 :         delete mpViewForwarder;
     749         [ -  + ]:         11 :     if (mpEditViewForwarder)
     750 [ #  # ][ #  # ]:          0 :         delete mpEditViewForwarder;
     751         [ -  + ]:         22 : }
     752                 :            : 
     753                 :         47 : void ScAccessibleCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     754                 :            : {
     755         [ +  - ]:         47 :     if ( rHint.ISA( SfxSimpleHint ) )
     756                 :            :     {
     757                 :         47 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
     758         [ +  + ]:         47 :         if ( nId == SFX_HINT_DYING )
     759                 :            :         {
     760                 :         11 :             mpViewShell = NULL;                     // invalid now
     761         [ -  + ]:         11 :             if (mpViewForwarder)
     762                 :          0 :                 mpViewForwarder->SetInvalid();
     763         [ -  + ]:         11 :             if (mpEditViewForwarder)
     764                 :          0 :                 mpEditViewForwarder->SetInvalid();
     765                 :            :         }
     766                 :            :     }
     767                 :         47 :     ScAccessibleCellBaseTextData::Notify(rBC, rHint);
     768                 :         47 : }
     769                 :            : 
     770                 :          0 : ScAccessibleTextData* ScAccessibleCellTextData::Clone() const
     771                 :            : {
     772         [ #  # ]:          0 :     return new ScAccessibleCellTextData( mpViewShell, aCellPos, meSplitPos, mpAccessibleCell );
     773                 :            : }
     774                 :            : 
     775                 :          9 : void ScAccessibleCellTextData::GetCellText(const ScAddress& rCellPos, String& rText)
     776                 :            : {
     777                 :            : //  #104893#; don't use the input string
     778                 :            : //    ScCellTextData::GetCellText(rCellPos, rText);
     779                 :          9 :     ScDocument* pDoc = pDocShell->GetDocument();
     780         [ +  - ]:          9 :     if (pDoc)
     781                 :            :     {
     782                 :            :         //  #104893#; use the displayed string
     783                 :          9 :         pDoc->GetString(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText);
     784         [ +  - ]:          9 :         if (mpViewShell)
     785                 :            :         {
     786                 :          9 :             const ScViewOptions& aOptions = mpViewShell->GetViewData()->GetOptions();
     787                 :            :             CellType aCellType;
     788         [ +  - ]:          9 :             pDoc->GetCellType(rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), aCellType);
     789 [ -  + ][ #  # ]:          9 :             if (aCellType == CELLTYPE_FORMULA && aOptions.GetOption( VOPT_FORMULAS ))
                 [ -  + ]
     790                 :            :             {
     791         [ #  # ]:          0 :                 pDoc->GetFormula( rCellPos.Col(), rCellPos.Row(), rCellPos.Tab(), rText);
     792                 :            :             }
     793         [ -  + ]:          9 :             else if (!aOptions.GetOption( VOPT_NULLVALS ))
     794                 :            :             {
     795 [ #  # ][ #  # ]:          0 :                 if ((aCellType == CELLTYPE_VALUE || aCellType == CELLTYPE_FORMULA) && pDoc->GetValue(rCellPos) == 0.0)
         [ #  # ][ #  # ]
                 [ #  # ]
     796         [ #  # ]:          9 :                     rText.Erase();
     797                 :            :             }
     798                 :            :         }
     799                 :            :     }
     800                 :          9 : }
     801                 :            : 
     802                 :         22 : SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
     803                 :            : {
     804                 :         22 :     ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine
     805                 :            : 
     806         [ +  - ]:         22 :     ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
     807 [ +  - ][ +  - ]:         22 :     if ( pDoc && pEditEngine && mpViewShell )
                 [ +  - ]
     808                 :            :     {
     809                 :            :         long nSizeX, nSizeY;
     810                 :            :         mpViewShell->GetViewData()->GetMergeSizePixel(
     811         [ +  - ]:         22 :             aCellPos.Col(), aCellPos.Row(), nSizeX, nSizeY);
     812                 :            : 
     813                 :         22 :         Size aSize(nSizeX, nSizeY);
     814                 :            : 
     815                 :            :         // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
     816                 :         22 :         long nIndent = 0;
     817                 :            :         const SvxHorJustifyItem* pHorJustifyItem = static_cast< const SvxHorJustifyItem* >(
     818         [ +  - ]:         22 :             pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) );
     819         [ +  - ]:         22 :         SvxCellHorJustify eHorJust = ( pHorJustifyItem ? static_cast< SvxCellHorJustify >( pHorJustifyItem->GetValue() ) : SVX_HOR_JUSTIFY_STANDARD );
     820         [ -  + ]:         22 :         if ( eHorJust == SVX_HOR_JUSTIFY_LEFT )
     821                 :            :         {
     822                 :            :             const SfxUInt16Item* pIndentItem = static_cast< const SfxUInt16Item* >(
     823         [ #  # ]:          0 :                 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) );
     824         [ #  # ]:          0 :             if ( pIndentItem )
     825                 :            :             {
     826                 :          0 :                 nIndent = static_cast< long >( pIndentItem->GetValue() );
     827                 :            :             }
     828                 :            :         }
     829                 :            : 
     830                 :            :         const SvxMarginItem* pMarginItem = static_cast< const SvxMarginItem* >(
     831         [ +  - ]:         22 :             pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_MARGIN ) );
     832                 :         22 :         ScViewData* pViewData = mpViewShell->GetViewData();
     833         [ +  - ]:         22 :         double nPPTX = ( pViewData ? pViewData->GetPPTX() : 0 );
     834         [ +  - ]:         22 :         double nPPTY = ( pViewData ? pViewData->GetPPTY() : 0 );
     835         [ +  - ]:         22 :         long nLeftM = ( pMarginItem ? static_cast< long >( ( pMarginItem->GetLeftMargin() + nIndent ) * nPPTX ) : 0 );
     836         [ +  - ]:         22 :         long nTopM = ( pMarginItem ? static_cast< long >( pMarginItem->GetTopMargin() * nPPTY ) : 0 );
     837         [ +  - ]:         22 :         long nRightM = ( pMarginItem ? static_cast< long >( pMarginItem->GetRightMargin() * nPPTX ) : 0 );
     838         [ +  - ]:         22 :         long nBottomM = ( pMarginItem ? static_cast< long >( pMarginItem->GetBottomMargin() * nPPTY ) : 0 );
     839                 :         22 :         long nWidth = aSize.getWidth() - nLeftM - nRightM;
     840                 :         22 :         aSize.setWidth( nWidth );
     841                 :         22 :         aSize.setHeight( aSize.getHeight() - nTopM - nBottomM );
     842                 :            : 
     843         [ +  - ]:         22 :         Window* pWin = mpViewShell->GetWindowByPos( meSplitPos );
     844         [ +  - ]:         22 :         if ( pWin )
     845                 :            :         {
     846 [ +  - ][ +  - ]:         22 :             aSize = pWin->PixelToLogic( aSize, pEditEngine->GetRefMapMode() );
                 [ +  - ]
     847                 :            :         }
     848                 :            : 
     849                 :            :         /*  #i19430# Gnopernicus reads text partly if it sticks out of the cell
     850                 :            :             boundaries. This leads to wrong results in cases where the cell text
     851                 :            :             is rotated, because rotation is not taken into account when calcu-
     852                 :            :             lating the visible part of the text. In these cases we will expand
     853                 :            :             the cell size passed as paper size to the edit engine. The function
     854                 :            :             accessibility::AccessibleStaticTextBase::GetParagraphBoundingBox()
     855                 :            :             (see svx/source/accessibility/AccessibleStaticTextBase.cxx) will
     856                 :            :             return the size of the complete text then, which is used to expand
     857                 :            :             the cell bounding box in ScAccessibleCell::GetBoundingBox()
     858                 :            :             (see sc/source/ui/Accessibility/AccessibleCell.cxx). */
     859                 :            :         const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
     860         [ +  - ]:         22 :             pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) );
     861 [ +  - ][ -  + ]:         22 :         if( pItem && (pItem->GetValue() != 0) )
                 [ -  + ]
     862                 :            :         {
     863         [ #  # ]:          0 :             pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
     864         [ #  # ]:          0 :             long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
     865         [ #  # ]:          0 :             aSize.setWidth( std::max( aSize.getWidth(), nTxtWidth + 2 ) );
     866                 :            :         }
     867                 :            :         else
     868                 :            :         {
     869                 :            :             // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
     870                 :            :             const SfxBoolItem* pLineBreakItem = static_cast< const SfxBoolItem* >(
     871         [ +  - ]:         22 :                 pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_LINEBREAK ) );
     872 [ +  - ][ -  + ]:         22 :             bool bLineBreak = ( pLineBreakItem && pLineBreakItem->GetValue() );
     873         [ +  - ]:         22 :             if ( !bLineBreak )
     874                 :            :             {
     875         [ +  - ]:         22 :                 long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
     876         [ +  - ]:         22 :                 aSize.setWidth( ::std::max( aSize.getWidth(), nTxtWidth ) );
     877                 :            :             }
     878                 :            :         }
     879                 :            : 
     880         [ +  - ]:         22 :         pEditEngine->SetPaperSize( aSize );
     881                 :            : 
     882                 :            :         // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
     883 [ +  - ][ +  - ]:         22 :         if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && pDoc->HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
         [ -  + ][ -  + ]
     884                 :            :         {
     885 [ #  # ][ #  # ]:          0 :             pEditEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
                 [ #  # ]
     886                 :            :         }
     887                 :            : 
     888                 :         22 :         Size aTextSize;
     889         [ +  - ]:         22 :         if ( pWin )
     890                 :            :         {
     891 [ +  - ][ +  - ]:         22 :             aTextSize = pWin->LogicToPixel( Size( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() ), pEditEngine->GetRefMapMode() );
         [ +  - ][ +  - ]
                 [ +  - ]
     892                 :            :         }
     893                 :         22 :         long nTextWidth = aTextSize.Width();
     894                 :         22 :         long nTextHeight = aTextSize.Height();
     895                 :            : 
     896                 :         22 :         long nOffsetX = nLeftM;
     897                 :         22 :         long nDiffX = nTextWidth - nWidth;
     898         [ -  + ]:         22 :         if ( nDiffX > 0 )
     899                 :            :         {
     900      [ #  #  # ]:          0 :             switch ( eHorJust )
     901                 :            :             {
     902                 :            :                 case SVX_HOR_JUSTIFY_RIGHT:
     903                 :            :                     {
     904                 :          0 :                         nOffsetX -= nDiffX;
     905                 :            :                     }
     906                 :          0 :                     break;
     907                 :            :                 case SVX_HOR_JUSTIFY_CENTER:
     908                 :            :                     {
     909                 :          0 :                         nOffsetX -= nDiffX / 2;
     910                 :            :                     }
     911                 :          0 :                     break;
     912                 :            :                 default:
     913                 :            :                     {
     914                 :            :                     }
     915                 :          0 :                     break;
     916                 :            :             }
     917                 :            :         }
     918                 :            : 
     919                 :         22 :         long nOffsetY = 0;
     920                 :            :         const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >(
     921         [ +  - ]:         22 :             pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) );
     922         [ +  - ]:         22 :         SvxCellVerJustify eVerJust = ( pVerJustifyItem ? static_cast< SvxCellVerJustify >( pVerJustifyItem->GetValue() ) : SVX_VER_JUSTIFY_STANDARD );
     923      [ +  -  - ]:         22 :         switch ( eVerJust )
     924                 :            :         {
     925                 :            :             case SVX_VER_JUSTIFY_STANDARD:
     926                 :            :             case SVX_VER_JUSTIFY_BOTTOM:
     927                 :            :                 {
     928                 :         22 :                     nOffsetY = nSizeY - nBottomM - nTextHeight;
     929                 :            :                 }
     930                 :         22 :                 break;
     931                 :            :             case SVX_VER_JUSTIFY_CENTER:
     932                 :            :                 {
     933                 :          0 :                     nOffsetY = ( nSizeY - nTopM - nBottomM - nTextHeight ) / 2 + nTopM;
     934                 :            :                 }
     935                 :          0 :                 break;
     936                 :            :             default:
     937                 :            :                 {
     938                 :          0 :                     nOffsetY = nTopM;
     939                 :            :                 }
     940                 :          0 :                 break;
     941                 :            :         }
     942                 :            : 
     943         [ +  - ]:         22 :         if ( mpAccessibleCell )
     944                 :            :         {
     945         [ +  - ]:         22 :             mpAccessibleCell->SetOffset( Point( nOffsetX, nOffsetY ) );
     946                 :            :         }
     947                 :            : 
     948 [ +  - ][ +  - ]:         22 :         pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) );
     949                 :            :     }
     950                 :            : 
     951                 :         22 :     return pForwarder;
     952                 :            : }
     953                 :            : 
     954                 :          0 : SvxViewForwarder* ScAccessibleCellTextData::GetViewForwarder()
     955                 :            : {
     956         [ #  # ]:          0 :     if (!mpViewForwarder)
     957         [ #  # ]:          0 :         mpViewForwarder = new ScViewForwarder(mpViewShell, meSplitPos, aCellPos);
     958                 :          0 :     return mpViewForwarder;
     959                 :            : }
     960                 :            : 
     961                 :          0 : SvxEditViewForwarder* ScAccessibleCellTextData::GetEditViewForwarder( sal_Bool /* bCreate */ )
     962                 :            : {
     963                 :            :     //#102219#; there should no EditViewForwarder be, because the cell is now readonly in this interface
     964                 :          0 :     return NULL;
     965                 :            : }
     966                 :            : 
     967                 :         15 : IMPL_LINK(ScAccessibleCellTextData, NotifyHdl, EENotify*, aNotify)
     968                 :            : {
     969         [ +  - ]:         15 :     if( aNotify )
     970                 :            :     {
     971                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     972 [ +  - ][ +  - ]:         15 :         ::std::auto_ptr< SfxHint > aHint = SvxEditSourceHelper::EENotification2Hint( aNotify );
     973                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
     974                 :            : 
     975         [ +  - ]:         15 :         if( aHint.get() )
     976 [ +  - ][ +  - ]:         15 :             GetBroadcaster().Broadcast( *aHint.get() );
                 [ +  - ]
     977                 :            :     }
     978                 :            : 
     979                 :         15 :     return 0;
     980                 :            : }
     981                 :            : 
     982                 :         11 : ScDocShell* ScAccessibleCellTextData::GetDocShell(ScTabViewShell* pViewShell)
     983                 :            : {
     984                 :         11 :     ScDocShell* pDocSh = NULL;
     985         [ +  - ]:         11 :     if (pViewShell)
     986                 :         11 :         pDocSh = pViewShell->GetViewData()->GetDocShell();
     987                 :         11 :     return pDocSh;
     988                 :            : }
     989                 :            : 
     990                 :            : 
     991                 :          0 : ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin)
     992                 :            :     :
     993                 :            :     mpViewForwarder(NULL),
     994                 :            :     mpEditViewForwarder(NULL),
     995                 :            :     mpEditView(pEditView),
     996                 :            :     mpEditEngine(pEditView ? pEditView->GetEditEngine() : 0),
     997                 :            :     mpForwarder(NULL),
     998 [ #  # ][ #  # ]:          0 :     mpWindow(pWin)
     999                 :            : {
    1000         [ #  # ]:          0 :     if (mpEditEngine)
    1001 [ #  # ][ #  # ]:          0 :         mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
    1002                 :          0 : }
    1003                 :            : 
    1004                 :          0 : ScAccessibleEditObjectTextData::~ScAccessibleEditObjectTextData()
    1005                 :            : {
    1006         [ #  # ]:          0 :     if (mpEditEngine)
    1007 [ #  # ][ #  # ]:          0 :         mpEditEngine->SetNotifyHdl(Link());
    1008         [ #  # ]:          0 :     if (mpViewForwarder)
    1009 [ #  # ][ #  # ]:          0 :         delete mpViewForwarder;
    1010         [ #  # ]:          0 :     if (mpEditViewForwarder)
    1011 [ #  # ][ #  # ]:          0 :         delete mpEditViewForwarder;
    1012         [ #  # ]:          0 :     if (mpForwarder)
    1013 [ #  # ][ #  # ]:          0 :         delete mpForwarder;
    1014         [ #  # ]:          0 : }
    1015                 :            : 
    1016                 :          0 : void ScAccessibleEditObjectTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
    1017                 :            : {
    1018         [ #  # ]:          0 :     if ( rHint.ISA( SfxSimpleHint ) )
    1019                 :            :     {
    1020                 :          0 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    1021         [ #  # ]:          0 :         if ( nId == SFX_HINT_DYING )
    1022                 :            :         {
    1023                 :          0 :             mpWindow = NULL;
    1024                 :          0 :             mpEditView = NULL;
    1025                 :          0 :             mpEditEngine = NULL;
    1026         [ #  # ]:          0 :             DELETEZ(mpForwarder);
    1027         [ #  # ]:          0 :             if (mpViewForwarder)
    1028                 :          0 :                 mpViewForwarder->SetInvalid();
    1029         [ #  # ]:          0 :             if (mpEditViewForwarder)
    1030                 :          0 :                 mpEditViewForwarder->SetInvalid();
    1031                 :            :         }
    1032                 :            :     }
    1033                 :          0 :     ScAccessibleTextData::Notify(rBC, rHint);
    1034                 :          0 : }
    1035                 :            : 
    1036                 :          0 : ScAccessibleTextData* ScAccessibleEditObjectTextData::Clone() const
    1037                 :            : {
    1038         [ #  # ]:          0 :     return new ScAccessibleEditObjectTextData(mpEditView, mpWindow);
    1039                 :            : }
    1040                 :            : 
    1041                 :          0 : SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder()
    1042                 :            : {
    1043 [ #  # ][ #  # ]:          0 :     if ((!mpForwarder && mpEditView) || (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1044                 :            :     {
    1045         [ #  # ]:          0 :         if (!mpEditEngine)
    1046                 :          0 :             mpEditEngine = mpEditView->GetEditEngine();
    1047 [ #  # ][ #  # ]:          0 :         if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet())
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1048         [ #  # ]:          0 :             mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
    1049         [ #  # ]:          0 :         if(!mpForwarder)
    1050         [ #  # ]:          0 :             mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
    1051                 :            :     }
    1052                 :          0 :     return mpForwarder;
    1053                 :            : }
    1054                 :            : 
    1055                 :          0 : SvxViewForwarder* ScAccessibleEditObjectTextData::GetViewForwarder()
    1056                 :            : {
    1057         [ #  # ]:          0 :     if (!mpViewForwarder)
    1058                 :            :     {
    1059                 :            :         // i#49561 Get right-aligned cell content to be read by screenreader.
    1060         [ #  # ]:          0 :         mpViewForwarder = new ScEditObjectViewForwarder( mpWindow, mpEditView );
    1061                 :            :     }
    1062                 :          0 :     return mpViewForwarder;
    1063                 :            : }
    1064                 :            : 
    1065                 :          0 : SvxEditViewForwarder* ScAccessibleEditObjectTextData::GetEditViewForwarder( sal_Bool bCreate )
    1066                 :            : {
    1067 [ #  # ][ #  # ]:          0 :     if (!mpEditViewForwarder && mpEditView)
    1068         [ #  # ]:          0 :         mpEditViewForwarder = new ScEditViewForwarder(mpEditView, mpWindow);
    1069         [ #  # ]:          0 :     if (bCreate)
    1070                 :            :     {
    1071 [ #  # ][ #  # ]:          0 :         if (!mpEditView && mpEditViewForwarder)
    1072                 :            :         {
    1073         [ #  # ]:          0 :             DELETEZ(mpEditViewForwarder);
    1074                 :            :         }
    1075         [ #  # ]:          0 :         else if (mpEditViewForwarder)
    1076                 :          0 :             mpEditViewForwarder->GrabFocus();
    1077                 :            :     }
    1078                 :          0 :     return mpEditViewForwarder;
    1079                 :            : }
    1080                 :            : 
    1081                 :          0 : IMPL_LINK(ScAccessibleEditObjectTextData, NotifyHdl, EENotify*, aNotify)
    1082                 :            : {
    1083         [ #  # ]:          0 :     if( aNotify )
    1084                 :            :     {
    1085                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
    1086 [ #  # ][ #  # ]:          0 :         ::std::auto_ptr< SfxHint > aHint = SvxEditSourceHelper::EENotification2Hint( aNotify );
    1087                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
    1088                 :            : 
    1089         [ #  # ]:          0 :         if( aHint.get() )
    1090 [ #  # ][ #  # ]:          0 :             GetBroadcaster().Broadcast( *aHint.get() );
                 [ #  # ]
    1091                 :            :     }
    1092                 :            : 
    1093                 :          0 :     return 0;
    1094                 :            : }
    1095                 :            : 
    1096                 :          0 : ScAccessibleEditLineTextData::ScAccessibleEditLineTextData(EditView* pEditView, Window* pWin)
    1097                 :            :     :
    1098                 :            :     ScAccessibleEditObjectTextData(pEditView, pWin),
    1099                 :          0 :     mbEditEngineCreated(false)
    1100                 :            : {
    1101         [ #  # ]:          0 :     ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>( pWin );
    1102                 :            : 
    1103         [ #  # ]:          0 :     if (pTxtWnd)
    1104         [ #  # ]:          0 :         pTxtWnd->InsertAccessibleTextData( *this );
    1105                 :          0 : }
    1106                 :            : 
    1107                 :          0 : ScAccessibleEditLineTextData::~ScAccessibleEditLineTextData()
    1108                 :            : {
    1109         [ #  # ]:          0 :     ScTextWnd* pTxtWnd = dynamic_cast< ScTextWnd* >(mpWindow);
    1110                 :            : 
    1111         [ #  # ]:          0 :     if (pTxtWnd)
    1112         [ #  # ]:          0 :         pTxtWnd->RemoveAccessibleTextData( *this );
    1113                 :            : 
    1114 [ #  # ][ #  # ]:          0 :     if (mbEditEngineCreated && mpEditEngine)
    1115                 :            :     {
    1116 [ #  # ][ #  # ]:          0 :         delete mpEditEngine;
    1117                 :          0 :         mpEditEngine = NULL;    // don't access in ScAccessibleEditObjectTextData dtor!
    1118                 :            :     }
    1119 [ #  # ][ #  # ]:          0 :     else if (pTxtWnd && pTxtWnd->GetEditView() && pTxtWnd->GetEditView()->GetEditEngine())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1120                 :            :     {
    1121                 :            :         //  the NotifyHdl also has to be removed from the ScTextWnd's EditEngine
    1122                 :            :         //  (it's set in ScAccessibleEditLineTextData::GetTextForwarder, and mpEditEngine
    1123                 :            :         //  is reset there)
    1124 [ #  # ][ #  # ]:          0 :         pTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link());
         [ #  # ][ #  # ]
    1125                 :            :     }
    1126         [ #  # ]:          0 : }
    1127                 :            : 
    1128                 :          0 : void ScAccessibleEditLineTextData::Dispose()
    1129                 :            : {
    1130         [ #  # ]:          0 :     ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow);
    1131                 :            : 
    1132         [ #  # ]:          0 :     if (pTxtWnd)
    1133                 :          0 :         pTxtWnd->RemoveAccessibleTextData( *this );
    1134                 :            : 
    1135                 :          0 :     ResetEditMode();
    1136                 :          0 :     mpWindow = NULL;
    1137                 :          0 : }
    1138                 :            : 
    1139                 :          0 : ScAccessibleTextData* ScAccessibleEditLineTextData::Clone() const
    1140                 :            : {
    1141         [ #  # ]:          0 :     return new ScAccessibleEditLineTextData(mpEditView, mpWindow);
    1142                 :            : }
    1143                 :            : 
    1144                 :          0 : SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder()
    1145                 :            : {
    1146         [ #  # ]:          0 :     ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow);
    1147                 :            : 
    1148         [ #  # ]:          0 :     if (pTxtWnd)
    1149                 :            :     {
    1150                 :          0 :         mpEditView = pTxtWnd->GetEditView();
    1151         [ #  # ]:          0 :         if (mpEditView)
    1152                 :            :         {
    1153 [ #  # ][ #  # ]:          0 :             if (mbEditEngineCreated && mpEditEngine)
    1154                 :          0 :                 ResetEditMode();
    1155                 :          0 :             mbEditEngineCreated = false;
    1156                 :            : 
    1157                 :          0 :             mpEditView = pTxtWnd->GetEditView();
    1158                 :          0 :             ScAccessibleEditObjectTextData::GetTextForwarder(); // fill the mpForwarder
    1159                 :          0 :             mpEditEngine = NULL;
    1160                 :            :         }
    1161                 :            :         else
    1162                 :            :         {
    1163 [ #  # ][ #  # ]:          0 :             if (mpEditEngine && !mbEditEngineCreated)
    1164                 :          0 :                 ResetEditMode();
    1165         [ #  # ]:          0 :             if (!mpEditEngine)
    1166                 :            :             {
    1167         [ #  # ]:          0 :                 SfxItemPool* pEnginePool = EditEngine::CreatePool();
    1168         [ #  # ]:          0 :                 pEnginePool->FreezeIdRanges();
    1169 [ #  # ][ #  # ]:          0 :                 mpEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true);
                 [ #  # ]
    1170                 :          0 :                 mbEditEngineCreated = sal_True;
    1171         [ #  # ]:          0 :                 mpEditEngine->EnableUndo( false );
    1172 [ #  # ][ #  # ]:          0 :                 mpEditEngine->SetRefMapMode( MAP_100TH_MM );
                 [ #  # ]
    1173 [ #  # ][ #  # ]:          0 :                 mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
    1174                 :            : 
    1175 [ #  # ][ #  # ]:          0 :                 mpEditEngine->SetText(pTxtWnd->GetTextString());
    1176                 :            : 
    1177         [ #  # ]:          0 :                 Size aSize(pTxtWnd->GetSizePixel());
    1178                 :            : 
    1179 [ #  # ][ #  # ]:          0 :                 aSize = pTxtWnd->PixelToLogic(aSize, mpEditEngine->GetRefMapMode());
                 [ #  # ]
    1180                 :            : 
    1181         [ #  # ]:          0 :                 mpEditEngine->SetPaperSize(aSize);
    1182                 :            : 
    1183 [ #  # ][ #  # ]:          0 :                 mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
    1184                 :            :             }
    1185                 :            :         }
    1186                 :            :     }
    1187                 :          0 :     return mpForwarder;
    1188                 :            : }
    1189                 :            : 
    1190                 :          0 : SvxEditViewForwarder* ScAccessibleEditLineTextData::GetEditViewForwarder( sal_Bool bCreate )
    1191                 :            : {
    1192         [ #  # ]:          0 :     ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow);
    1193                 :            : 
    1194         [ #  # ]:          0 :     if (pTxtWnd)
    1195                 :            :     {
    1196                 :          0 :         mpEditView = pTxtWnd->GetEditView();
    1197 [ #  # ][ #  # ]:          0 :         if (!mpEditView && bCreate)
    1198                 :            :         {
    1199         [ #  # ]:          0 :             if ( !pTxtWnd->IsInputActive() )
    1200                 :            :             {
    1201                 :          0 :                 pTxtWnd->StartEditEngine();
    1202                 :          0 :                 pTxtWnd->GrabFocus();
    1203                 :            : 
    1204                 :          0 :                 mpEditView = pTxtWnd->GetEditView();
    1205                 :            :             }
    1206                 :            :         }
    1207                 :            :     }
    1208                 :            : 
    1209                 :          0 :     return ScAccessibleEditObjectTextData::GetEditViewForwarder(bCreate);
    1210                 :            : }
    1211                 :            : 
    1212                 :          0 : void ScAccessibleEditLineTextData::ResetEditMode()
    1213                 :            : {
    1214         [ #  # ]:          0 :     ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow);
    1215                 :            : 
    1216 [ #  # ][ #  # ]:          0 :     if (mbEditEngineCreated && mpEditEngine)
    1217         [ #  # ]:          0 :         delete mpEditEngine;
    1218 [ #  # ][ #  # ]:          0 :     else if (pTxtWnd && pTxtWnd->GetEditView() && pTxtWnd->GetEditView()->GetEditEngine())
         [ #  # ][ #  # ]
    1219 [ #  # ][ #  # ]:          0 :         pTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link());
                 [ #  # ]
    1220                 :          0 :     mpEditEngine = NULL;
    1221                 :            : 
    1222         [ #  # ]:          0 :     DELETEZ(mpForwarder);
    1223         [ #  # ]:          0 :     DELETEZ(mpEditViewForwarder);
    1224         [ #  # ]:          0 :     DELETEZ(mpViewForwarder);
    1225                 :          0 :     mbEditEngineCreated = false;
    1226                 :          0 : }
    1227                 :            : 
    1228                 :          0 : void ScAccessibleEditLineTextData::TextChanged()
    1229                 :            : {
    1230 [ #  # ][ #  # ]:          0 :     if (mbEditEngineCreated && mpEditEngine)
    1231                 :            :     {
    1232         [ #  # ]:          0 :         ScTextWnd* pTxtWnd = dynamic_cast<ScTextWnd*>(mpWindow);
    1233                 :            : 
    1234         [ #  # ]:          0 :         if (pTxtWnd)
    1235                 :          0 :             mpEditEngine->SetText(pTxtWnd->GetTextString());
    1236                 :            :     }
    1237                 :          0 : }
    1238                 :            : 
    1239                 :          0 : void ScAccessibleEditLineTextData::StartEdit()
    1240                 :            : {
    1241         [ #  # ]:          0 :     ResetEditMode();
    1242                 :          0 :     mpEditView = NULL;
    1243                 :            : 
    1244                 :            :     // send HINT_BEGEDIT
    1245         [ #  # ]:          0 :     SdrHint aHint(HINT_BEGEDIT);
    1246 [ #  # ][ #  # ]:          0 :     GetBroadcaster().Broadcast( aHint );
                 [ #  # ]
    1247                 :          0 : }
    1248                 :            : 
    1249                 :          0 : void ScAccessibleEditLineTextData::EndEdit()
    1250                 :            : {
    1251                 :            :     // send HINT_ENDEDIT
    1252         [ #  # ]:          0 :     SdrHint aHint(HINT_ENDEDIT);
    1253 [ #  # ][ #  # ]:          0 :     GetBroadcaster().Broadcast( aHint );
    1254                 :            : 
    1255         [ #  # ]:          0 :     ResetEditMode();
    1256         [ #  # ]:          0 :     mpEditView = NULL;
    1257                 :          0 : }
    1258                 :            : 
    1259                 :            : 
    1260                 :            : //  ScAccessiblePreviewCellTextData: shared data between sub objects of a accessible cell text object
    1261                 :            : 
    1262                 :         19 : ScAccessiblePreviewCellTextData::ScAccessiblePreviewCellTextData(ScPreviewShell* pViewShell,
    1263                 :            :                             const ScAddress& rP)
    1264                 :            :     : ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP),
    1265                 :            :     mpViewForwarder(NULL),
    1266                 :         19 :     mpViewShell(pViewShell)
    1267                 :            : {
    1268                 :         19 : }
    1269                 :            : 
    1270                 :         19 : ScAccessiblePreviewCellTextData::~ScAccessiblePreviewCellTextData()
    1271                 :            : {
    1272         [ +  - ]:         19 :     if (pEditEngine)
    1273 [ +  - ][ +  - ]:         19 :         pEditEngine->SetNotifyHdl(Link());
    1274         [ +  + ]:         19 :     if (mpViewForwarder)
    1275 [ +  - ][ +  - ]:         15 :         delete mpViewForwarder;
    1276         [ -  + ]:         38 : }
    1277                 :            : 
    1278                 :          0 : void ScAccessiblePreviewCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
    1279                 :            : {
    1280         [ #  # ]:          0 :     if ( rHint.ISA( SfxSimpleHint ) )
    1281                 :            :     {
    1282                 :          0 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    1283         [ #  # ]:          0 :         if ( nId == SFX_HINT_DYING )
    1284                 :            :         {
    1285                 :          0 :             mpViewShell = NULL;                     // invalid now
    1286         [ #  # ]:          0 :             if (mpViewForwarder)
    1287                 :          0 :                 mpViewForwarder->SetInvalid();
    1288                 :            :         }
    1289                 :            :     }
    1290                 :          0 :     ScAccessibleCellBaseTextData::Notify(rBC, rHint);
    1291                 :          0 : }
    1292                 :            : 
    1293                 :          4 : ScAccessibleTextData* ScAccessiblePreviewCellTextData::Clone() const
    1294                 :            : {
    1295         [ +  - ]:          4 :     return new ScAccessiblePreviewCellTextData(mpViewShell, aCellPos);
    1296                 :            : }
    1297                 :            : 
    1298                 :        532 : SvxTextForwarder* ScAccessiblePreviewCellTextData::GetTextForwarder()
    1299                 :            : {
    1300                 :        532 :     sal_Bool bEditEngineBefore(pEditEngine != NULL);
    1301                 :            : 
    1302                 :        532 :     ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine
    1303                 :            : 
    1304 [ +  - ][ +  + ]:        532 :     if (!bEditEngineBefore && pEditEngine)
    1305                 :            :     {
    1306 [ +  - ][ +  - ]:         19 :         Size aSize(mpViewShell->GetLocationData().GetCellOutputRect(aCellPos).GetSize());
                 [ +  - ]
    1307                 :         19 :         Window* pWin = mpViewShell->GetWindow();
    1308         [ +  - ]:         19 :         if (pWin)
    1309 [ +  - ][ +  - ]:         19 :             aSize = pWin->PixelToLogic(aSize, pEditEngine->GetRefMapMode());
                 [ +  - ]
    1310         [ +  - ]:         19 :         pEditEngine->SetPaperSize(aSize);
    1311                 :            :     }
    1312                 :            : 
    1313         [ +  - ]:        532 :     if (pEditEngine)
    1314         [ +  - ]:        532 :         pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) );
    1315                 :            : 
    1316                 :        532 :     return pForwarder;
    1317                 :            : }
    1318                 :            : 
    1319                 :        146 : SvxViewForwarder* ScAccessiblePreviewCellTextData::GetViewForwarder()
    1320                 :            : {
    1321         [ +  + ]:        146 :     if (!mpViewForwarder)
    1322 [ +  - ][ +  - ]:         15 :         mpViewForwarder = new ScPreviewCellViewForwarder(mpViewShell, aCellPos);
    1323                 :        146 :     return mpViewForwarder;
    1324                 :            : }
    1325                 :            : 
    1326                 :         19 : ScDocShell* ScAccessiblePreviewCellTextData::GetDocShell(ScPreviewShell* pViewShell)
    1327                 :            : {
    1328                 :         19 :     ScDocShell* pDocSh = NULL;
    1329 [ +  - ][ +  - ]:         19 :     if (pViewShell && pViewShell->GetDocument())
                 [ +  - ]
    1330                 :         19 :         pDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
    1331                 :         19 :     return pDocSh;
    1332                 :            : }
    1333                 :            : 
    1334                 :            : 
    1335                 :            : //  ScAccessiblePreviewHeaderCellTextData: shared data between sub objects of a accessible cell text object
    1336                 :            : 
    1337                 :         11 : ScAccessiblePreviewHeaderCellTextData::ScAccessiblePreviewHeaderCellTextData(ScPreviewShell* pViewShell,
    1338                 :            :             const String& rText, const ScAddress& rP, sal_Bool bColHeader, sal_Bool bRowHeader)
    1339                 :            :     : ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP),
    1340                 :            :     mpViewForwarder(NULL),
    1341                 :            :     mpViewShell(pViewShell),
    1342                 :            :     maText(rText),
    1343                 :            :     mbColHeader(bColHeader),
    1344         [ +  - ]:         11 :     mbRowHeader(bRowHeader)
    1345                 :            : {
    1346                 :         11 : }
    1347                 :            : 
    1348         [ #  # ]:          0 : ScAccessiblePreviewHeaderCellTextData::~ScAccessiblePreviewHeaderCellTextData()
    1349                 :            : {
    1350         [ #  # ]:          0 :     if (pEditEngine)
    1351 [ #  # ][ #  # ]:          0 :         pEditEngine->SetNotifyHdl(Link());
    1352         [ #  # ]:          0 :     if (mpViewForwarder)
    1353 [ #  # ][ #  # ]:          0 :         delete mpViewForwarder;
    1354         [ #  # ]:          0 : }
    1355                 :            : 
    1356                 :         11 : void ScAccessiblePreviewHeaderCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
    1357                 :            : {
    1358         [ +  - ]:         11 :     if ( rHint.ISA( SfxSimpleHint ) )
    1359                 :            :     {
    1360                 :         11 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    1361         [ +  - ]:         11 :         if ( nId == SFX_HINT_DYING )
    1362                 :            :         {
    1363                 :         11 :             mpViewShell = NULL;                     // invalid now
    1364         [ +  - ]:         11 :             if (mpViewForwarder)
    1365                 :         11 :                 mpViewForwarder->SetInvalid();
    1366                 :            :         }
    1367                 :            :     }
    1368                 :         11 :     ScAccessibleCellBaseTextData::Notify(rBC, rHint);
    1369                 :         11 : }
    1370                 :            : 
    1371                 :          0 : ScAccessibleTextData* ScAccessiblePreviewHeaderCellTextData::Clone() const
    1372                 :            : {
    1373         [ #  # ]:          0 :     return new ScAccessiblePreviewHeaderCellTextData(mpViewShell, maText, aCellPos, mbColHeader, mbRowHeader);
    1374                 :            : }
    1375                 :            : 
    1376                 :        102 : SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder()
    1377                 :            : {
    1378         [ +  + ]:        102 :     if (!pEditEngine)
    1379                 :            :     {
    1380         [ +  - ]:         11 :         if ( pDocShell )
    1381                 :            :         {
    1382                 :         11 :             ScDocument* pDoc = pDocShell->GetDocument();
    1383                 :         11 :             pEditEngine = pDoc->CreateFieldEditEngine();
    1384                 :            :         }
    1385                 :            :         else
    1386                 :            :         {
    1387                 :          0 :             SfxItemPool* pEnginePool = EditEngine::CreatePool();
    1388                 :          0 :             pEnginePool->FreezeIdRanges();
    1389         [ #  # ]:          0 :             pEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true);
    1390                 :            :         }
    1391                 :         11 :         pEditEngine->EnableUndo( false );
    1392         [ +  - ]:         11 :         if (pDocShell)
    1393                 :         11 :             pEditEngine->SetRefDevice(pDocShell->GetRefDevice());
    1394                 :            :         else
    1395         [ #  # ]:          0 :             pEditEngine->SetRefMapMode( MAP_100TH_MM );
    1396         [ +  - ]:         11 :         pForwarder = new SvxEditEngineForwarder(*pEditEngine);
    1397                 :            :     }
    1398                 :            : 
    1399         [ +  + ]:        102 :     if (bDataValid)
    1400                 :         91 :         return pForwarder;
    1401                 :            : 
    1402 [ +  + ][ +  - ]:         11 :     if (maText.Len() && pEditEngine)
                 [ +  + ]
    1403                 :            :     {
    1404                 :            : 
    1405         [ +  - ]:          6 :         if ( mpViewShell  )
    1406                 :            :         {
    1407                 :          6 :             Size aOutputSize;
    1408                 :          6 :             Window* pWindow = mpViewShell->GetWindow();
    1409         [ +  - ]:          6 :             if ( pWindow )
    1410                 :          6 :                 aOutputSize = pWindow->GetOutputSizePixel();
    1411                 :          6 :             Point aPoint;
    1412         [ +  - ]:          6 :             Rectangle aVisRect( aPoint, aOutputSize );
    1413 [ +  - ][ +  - ]:          6 :             Size aSize(mpViewShell->GetLocationData().GetHeaderCellOutputRect(aVisRect, aCellPos, mbColHeader).GetSize());
                 [ +  - ]
    1414         [ +  - ]:          6 :             if (pWindow)
    1415 [ +  - ][ +  - ]:          6 :                 aSize = pWindow->PixelToLogic(aSize, pEditEngine->GetRefMapMode());
                 [ +  - ]
    1416         [ +  - ]:          6 :             pEditEngine->SetPaperSize(aSize);
    1417                 :            :         }
    1418                 :          6 :         pEditEngine->SetText( maText );
    1419                 :            :     }
    1420                 :            : 
    1421                 :         11 :     bDataValid = true;
    1422                 :            : 
    1423         [ +  - ]:         11 :     if (pEditEngine)
    1424         [ +  - ]:         11 :         pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) );
    1425                 :            : 
    1426                 :        102 :     return pForwarder;
    1427                 :            : }
    1428                 :            : 
    1429                 :         29 : SvxViewForwarder* ScAccessiblePreviewHeaderCellTextData::GetViewForwarder()
    1430                 :            : {
    1431         [ +  + ]:         29 :     if (!mpViewForwarder)
    1432 [ +  - ][ +  - ]:         11 :         mpViewForwarder = new ScPreviewHeaderCellViewForwarder(mpViewShell, aCellPos, mbColHeader, mbRowHeader);
    1433                 :         29 :     return mpViewForwarder;
    1434                 :            : }
    1435                 :            : 
    1436                 :         11 : ScDocShell* ScAccessiblePreviewHeaderCellTextData::GetDocShell(ScPreviewShell* pViewShell)
    1437                 :            : {
    1438                 :         11 :     ScDocShell* pDocSh = NULL;
    1439 [ +  - ][ +  - ]:         11 :     if (pViewShell && pViewShell->GetDocument())
                 [ +  - ]
    1440                 :         11 :         pDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
    1441                 :         11 :     return pDocSh;
    1442                 :            : }
    1443                 :            : 
    1444                 :         18 : ScAccessibleHeaderTextData::ScAccessibleHeaderTextData(ScPreviewShell* pViewShell,
    1445                 :            :                             const EditTextObject* pEditObj, sal_Bool bHeader, SvxAdjust eAdjust)
    1446                 :            :     :
    1447                 :            :     mpViewForwarder(NULL),
    1448                 :            :     mpViewShell(pViewShell),
    1449                 :            :     mpEditEngine(NULL),
    1450                 :            :     mpForwarder(NULL),
    1451                 :            :     mpDocSh(NULL),
    1452                 :            :     mpEditObj(pEditObj),
    1453                 :            :     mbHeader(bHeader),
    1454                 :            :     mbDataValid(false),
    1455                 :         18 :     meAdjust(eAdjust)
    1456                 :            : {
    1457 [ +  - ][ +  - ]:         18 :     if (pViewShell && pViewShell->GetDocument())
         [ +  - ][ +  - ]
    1458         [ +  - ]:         18 :         mpDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
    1459         [ +  - ]:         18 :     if (mpDocSh)
    1460         [ +  - ]:         18 :         mpDocSh->GetDocument()->AddUnoObject(*this);
    1461                 :         18 : }
    1462                 :            : 
    1463                 :         18 : ScAccessibleHeaderTextData::~ScAccessibleHeaderTextData()
    1464                 :            : {
    1465         [ +  - ]:         18 :     SolarMutexGuard aGuard;     //  needed for EditEngine dtor
    1466                 :            : 
    1467         [ +  - ]:         18 :     if (mpDocSh)
    1468         [ +  - ]:         18 :         mpDocSh->GetDocument()->RemoveUnoObject(*this);
    1469         [ +  - ]:         18 :     if (mpEditEngine)
    1470 [ +  - ][ +  - ]:         18 :         mpEditEngine->SetNotifyHdl(Link());
    1471 [ +  - ][ +  - ]:         18 :     delete mpEditEngine;
    1472 [ +  - ][ +  - ]:         18 :     delete mpForwarder;
                 [ +  - ]
    1473         [ -  + ]:         36 : }
    1474                 :            : 
    1475                 :          0 : ScAccessibleTextData* ScAccessibleHeaderTextData::Clone() const
    1476                 :            : {
    1477         [ #  # ]:          0 :     return new ScAccessibleHeaderTextData(mpViewShell, mpEditObj, mbHeader, meAdjust);
    1478                 :            : }
    1479                 :            : 
    1480                 :          4 : void ScAccessibleHeaderTextData::Notify( SfxBroadcaster&, const SfxHint& rHint )
    1481                 :            : {
    1482         [ +  - ]:          4 :     if ( rHint.ISA( SfxSimpleHint ) )
    1483                 :            :     {
    1484                 :          4 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    1485         [ -  + ]:          4 :         if ( nId == SFX_HINT_DYING )
    1486                 :            :         {
    1487                 :          0 :             mpViewShell = NULL;// invalid now
    1488                 :          0 :             mpDocSh = NULL;
    1489         [ #  # ]:          0 :             if (mpViewForwarder)
    1490                 :          0 :                 mpViewForwarder->SetInvalid();
    1491                 :            :         }
    1492                 :            :     }
    1493                 :          4 : }
    1494                 :            : 
    1495                 :        179 : SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder()
    1496                 :            : {
    1497         [ +  + ]:        179 :     if (!mpEditEngine)
    1498                 :            :     {
    1499         [ +  - ]:         18 :         SfxItemPool* pEnginePool = EditEngine::CreatePool();
    1500         [ +  - ]:         18 :         pEnginePool->FreezeIdRanges();
    1501 [ +  - ][ +  - ]:         18 :         ScHeaderEditEngine* pHdrEngine = new ScHeaderEditEngine( pEnginePool, sal_True );
    1502                 :            : 
    1503         [ +  - ]:         18 :         pHdrEngine->EnableUndo( false );
    1504 [ +  - ][ +  - ]:         18 :         pHdrEngine->SetRefMapMode( MAP_TWIP );
                 [ +  - ]
    1505                 :            : 
    1506                 :            :         //  default font must be set, independently of document
    1507                 :            :         //  -> use global pool from module
    1508                 :            : 
    1509 [ +  - ][ +  - ]:         18 :         SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() );
    1510 [ +  - ][ +  - ]:         18 :         const ScPatternAttr& rPattern = (const ScPatternAttr&)SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN);
    1511         [ +  - ]:         18 :         rPattern.FillEditItemSet( &aDefaults );
    1512                 :            :         //  FillEditItemSet adjusts font height to 1/100th mm,
    1513                 :            :         //  but for header/footer twips is needed, as in the PatternAttr:
    1514 [ +  - ][ +  - ]:         18 :         aDefaults.Put( rPattern.GetItem(ATTR_FONT_HEIGHT), EE_CHAR_FONTHEIGHT );
    1515 [ +  - ][ +  - ]:         18 :         aDefaults.Put( rPattern.GetItem(ATTR_CJK_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CJK );
    1516 [ +  - ][ +  - ]:         18 :         aDefaults.Put( rPattern.GetItem(ATTR_CTL_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CTL );
    1517 [ +  - ][ +  - ]:         18 :         aDefaults.Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) );
                 [ +  - ]
    1518         [ +  - ]:         18 :         pHdrEngine->SetDefaults( aDefaults );
    1519                 :            : 
    1520         [ +  - ]:         18 :         ScHeaderFieldData aData;
    1521         [ +  - ]:         18 :         if (mpViewShell)
    1522         [ +  - ]:         18 :             mpViewShell->FillFieldData(aData);
    1523                 :            :         else
    1524         [ #  # ]:          0 :             ScHeaderFooterTextObj::FillDummyFieldData( aData );
    1525         [ +  - ]:         18 :         pHdrEngine->SetData( aData );
    1526                 :            : 
    1527                 :         18 :         mpEditEngine = pHdrEngine;
    1528 [ +  - ][ +  - ]:         18 :         mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
         [ +  - ][ +  - ]
    1529                 :            :     }
    1530                 :            : 
    1531         [ +  + ]:        179 :     if (mbDataValid)
    1532                 :        161 :         return mpForwarder;
    1533                 :            : 
    1534         [ +  - ]:         18 :     if ( mpViewShell  )
    1535                 :            :     {
    1536         [ +  - ]:         18 :         Rectangle aVisRect;
    1537 [ +  - ][ +  - ]:         18 :         mpViewShell->GetLocationData().GetHeaderPosition(aVisRect);
    1538         [ +  - ]:         18 :         Size aSize(aVisRect.GetSize());
    1539                 :         18 :         Window* pWin = mpViewShell->GetWindow();
    1540         [ +  - ]:         18 :         if (pWin)
    1541 [ +  - ][ +  - ]:         18 :             aSize = pWin->PixelToLogic(aSize, mpEditEngine->GetRefMapMode());
                 [ +  - ]
    1542         [ +  - ]:         18 :         mpEditEngine->SetPaperSize(aSize);
    1543                 :            :     }
    1544         [ +  - ]:         18 :     if (mpEditObj)
    1545                 :         18 :         mpEditEngine->SetText(*mpEditObj);
    1546                 :            : 
    1547                 :         18 :     mbDataValid = sal_True;
    1548                 :        179 :     return mpForwarder;
    1549                 :            : }
    1550                 :            : 
    1551                 :         54 : SvxViewForwarder* ScAccessibleHeaderTextData::GetViewForwarder()
    1552                 :            : {
    1553         [ +  + ]:         54 :     if (!mpViewForwarder)
    1554         [ +  - ]:         18 :         mpViewForwarder = new ScPreviewHeaderFooterViewForwarder(mpViewShell, mbHeader);
    1555                 :         54 :     return mpViewForwarder;
    1556                 :            : }
    1557                 :            : 
    1558                 :          0 : ScAccessibleNoteTextData::ScAccessibleNoteTextData(ScPreviewShell* pViewShell,
    1559                 :            :                             const String& sText, const ScAddress& aCellPos, sal_Bool bMarkNote)
    1560                 :            :     :
    1561                 :            :     mpViewForwarder(NULL),
    1562                 :            :     mpViewShell(pViewShell),
    1563                 :            :     mpEditEngine(NULL),
    1564                 :            :     mpForwarder(NULL),
    1565                 :            :     mpDocSh(NULL),
    1566                 :            :     msText(sText),
    1567                 :            :     maCellPos(aCellPos),
    1568                 :            :     mbMarkNote(bMarkNote),
    1569         [ #  # ]:          0 :     mbDataValid(false)
    1570                 :            : {
    1571 [ #  # ][ #  # ]:          0 :     if (pViewShell && pViewShell->GetDocument())
         [ #  # ][ #  # ]
    1572         [ #  # ]:          0 :         mpDocSh = (ScDocShell*) pViewShell->GetDocument()->GetDocumentShell();
    1573         [ #  # ]:          0 :     if (mpDocSh)
    1574         [ #  # ]:          0 :         mpDocSh->GetDocument()->AddUnoObject(*this);
    1575                 :          0 : }
    1576                 :            : 
    1577         [ #  # ]:          0 : ScAccessibleNoteTextData::~ScAccessibleNoteTextData()
    1578                 :            : {
    1579         [ #  # ]:          0 :     SolarMutexGuard aGuard;     //  needed for EditEngine dtor
    1580                 :            : 
    1581         [ #  # ]:          0 :     if (mpDocSh)
    1582         [ #  # ]:          0 :         mpDocSh->GetDocument()->RemoveUnoObject(*this);
    1583         [ #  # ]:          0 :     if (mpEditEngine)
    1584 [ #  # ][ #  # ]:          0 :         mpEditEngine->SetNotifyHdl(Link());
    1585 [ #  # ][ #  # ]:          0 :     delete mpEditEngine;
    1586 [ #  # ][ #  # ]:          0 :     delete mpForwarder;
                 [ #  # ]
    1587         [ #  # ]:          0 : }
    1588                 :            : 
    1589                 :          0 : ScAccessibleTextData* ScAccessibleNoteTextData::Clone() const
    1590                 :            : {
    1591         [ #  # ]:          0 :     return new ScAccessibleNoteTextData(mpViewShell, msText, maCellPos, mbMarkNote);
    1592                 :            : }
    1593                 :            : 
    1594                 :          0 : void ScAccessibleNoteTextData::Notify( SfxBroadcaster&, const SfxHint& rHint )
    1595                 :            : {
    1596         [ #  # ]:          0 :     if ( rHint.ISA( SfxSimpleHint ) )
    1597                 :            :     {
    1598                 :          0 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    1599         [ #  # ]:          0 :         if ( nId == SFX_HINT_DYING )
    1600                 :            :         {
    1601                 :          0 :             mpViewShell = NULL;// invalid now
    1602                 :          0 :             mpDocSh = NULL;
    1603         [ #  # ]:          0 :             if (mpViewForwarder)
    1604                 :          0 :                 mpViewForwarder->SetInvalid();
    1605                 :            :         }
    1606                 :            :     }
    1607                 :          0 : }
    1608                 :            : 
    1609                 :          0 : SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder()
    1610                 :            : {
    1611         [ #  # ]:          0 :     if (!mpEditEngine)
    1612                 :            :     {
    1613         [ #  # ]:          0 :         if ( mpDocSh )
    1614                 :            :         {
    1615                 :          0 :             ScDocument* pDoc = mpDocSh->GetDocument();
    1616                 :          0 :             mpEditEngine = pDoc->CreateFieldEditEngine();
    1617                 :            :         }
    1618                 :            :         else
    1619                 :            :         {
    1620                 :          0 :             SfxItemPool* pEnginePool = EditEngine::CreatePool();
    1621                 :          0 :             pEnginePool->FreezeIdRanges();
    1622         [ #  # ]:          0 :             mpEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true);
    1623                 :            :         }
    1624                 :          0 :         mpEditEngine->EnableUndo( false );
    1625         [ #  # ]:          0 :         if (mpDocSh)
    1626                 :          0 :             mpEditEngine->SetRefDevice(mpDocSh->GetRefDevice());
    1627                 :            :         else
    1628         [ #  # ]:          0 :             mpEditEngine->SetRefMapMode( MAP_100TH_MM );
    1629         [ #  # ]:          0 :         mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
    1630                 :            :     }
    1631                 :            : 
    1632         [ #  # ]:          0 :     if (mbDataValid)
    1633                 :          0 :         return mpForwarder;
    1634                 :            : 
    1635 [ #  # ][ #  # ]:          0 :     if (msText.Len() && mpEditEngine)
                 [ #  # ]
    1636                 :            :     {
    1637                 :            : 
    1638         [ #  # ]:          0 :         if ( mpViewShell  )
    1639                 :            :         {
    1640                 :          0 :             Size aOutputSize;
    1641                 :          0 :             Window* pWindow = mpViewShell->GetWindow();
    1642         [ #  # ]:          0 :             if ( pWindow )
    1643                 :          0 :                 aOutputSize = pWindow->GetOutputSizePixel();
    1644                 :          0 :             Point aPoint;
    1645         [ #  # ]:          0 :             Rectangle aVisRect( aPoint, aOutputSize );
    1646 [ #  # ][ #  # ]:          0 :             Size aSize(mpViewShell->GetLocationData().GetNoteInRangeOutputRect(aVisRect, mbMarkNote, maCellPos).GetSize());
                 [ #  # ]
    1647         [ #  # ]:          0 :             if (pWindow)
    1648 [ #  # ][ #  # ]:          0 :                 aSize = pWindow->PixelToLogic(aSize, mpEditEngine->GetRefMapMode());
                 [ #  # ]
    1649         [ #  # ]:          0 :             mpEditEngine->SetPaperSize(aSize);
    1650                 :            :         }
    1651                 :          0 :         mpEditEngine->SetText( msText );
    1652                 :            :     }
    1653                 :            : 
    1654                 :          0 :     mbDataValid = sal_True;
    1655                 :            : 
    1656         [ #  # ]:          0 :     if (mpEditEngine)
    1657         [ #  # ]:          0 :         mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) );
    1658                 :            : 
    1659                 :          0 :     return mpForwarder;
    1660                 :            : }
    1661                 :            : 
    1662                 :          0 : SvxViewForwarder* ScAccessibleNoteTextData::GetViewForwarder()
    1663                 :            : {
    1664         [ #  # ]:          0 :     if (!mpViewForwarder)
    1665 [ #  # ][ #  # ]:          0 :         mpViewForwarder = new ScPreviewNoteViewForwarder(mpViewShell, maCellPos, mbMarkNote);
    1666                 :          0 :     return mpViewForwarder;
    1667                 :            : }
    1668                 :            : 
    1669                 :            : 
    1670                 :            : // CSV import =================================================================
    1671                 :            : 
    1672         [ #  # ]:          0 : class ScCsvViewForwarder : public SvxViewForwarder
    1673                 :            : {
    1674                 :            :     Rectangle                   maBoundBox;
    1675                 :            :     Window*                     mpWindow;
    1676                 :            : 
    1677                 :            : public:
    1678                 :            :     explicit                    ScCsvViewForwarder( Window* pWindow, const Rectangle& rBoundBox );
    1679                 :            : 
    1680                 :            :     virtual sal_Bool                IsValid() const;
    1681                 :            :     virtual Rectangle           GetVisArea() const;
    1682                 :            :     virtual Point               LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
    1683                 :            :     virtual Point               PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
    1684                 :            : 
    1685                 :            :     void                        SetInvalid();
    1686                 :            : };
    1687                 :            : 
    1688                 :          0 : ScCsvViewForwarder::ScCsvViewForwarder( Window* pWindow, const Rectangle& rBoundBox ) :
    1689                 :            :     maBoundBox( rBoundBox ),
    1690                 :          0 :     mpWindow( pWindow )
    1691                 :            : {
    1692                 :          0 : }
    1693                 :            : 
    1694                 :          0 : sal_Bool ScCsvViewForwarder::IsValid() const
    1695                 :            : {
    1696                 :          0 :     return mpWindow != NULL;
    1697                 :            : }
    1698                 :            : 
    1699                 :          0 : Rectangle ScCsvViewForwarder::GetVisArea() const
    1700                 :            : {
    1701                 :          0 :     return maBoundBox;
    1702                 :            : }
    1703                 :            : 
    1704                 :          0 : Point ScCsvViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
    1705                 :            : {
    1706         [ #  # ]:          0 :     if( !mpWindow ) return Point();
    1707                 :          0 :     return mpWindow->LogicToPixel( rPoint, rMapMode );
    1708                 :            : }
    1709                 :            : 
    1710                 :          0 : Point ScCsvViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
    1711                 :            : {
    1712         [ #  # ]:          0 :     if( !mpWindow ) return Point();
    1713                 :          0 :     return mpWindow->PixelToLogic( rPoint, rMapMode );
    1714                 :            : }
    1715                 :            : 
    1716                 :          0 : void ScCsvViewForwarder::SetInvalid()
    1717                 :            : {
    1718                 :          0 :     mpWindow = NULL;
    1719                 :          0 : }
    1720                 :            : 
    1721                 :          0 : ScAccessibleCsvTextData::ScAccessibleCsvTextData(
    1722                 :            :         Window* pWindow, EditEngine* pEditEngine,
    1723                 :            :         const String& rCellText, const Rectangle& rBoundBox, const Size& rCellSize ) :
    1724                 :            :     mpWindow( pWindow ),
    1725                 :            :     mpEditEngine( pEditEngine ),
    1726                 :            :     maCellText( rCellText ),
    1727                 :            :     maBoundBox( rBoundBox ),
    1728         [ #  # ]:          0 :     maCellSize( rCellSize )
    1729                 :            : {
    1730                 :          0 : }
    1731                 :            : 
    1732 [ #  # ][ #  # ]:          0 : ScAccessibleCsvTextData::~ScAccessibleCsvTextData()
                 [ #  # ]
    1733                 :            : {
    1734         [ #  # ]:          0 : }
    1735                 :            : 
    1736                 :          0 : void ScAccessibleCsvTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
    1737                 :            : {
    1738         [ #  # ]:          0 :     if ( rHint.ISA( SfxSimpleHint ) )
    1739                 :            :     {
    1740                 :          0 :         sal_uLong nId = ((const SfxSimpleHint&)rHint).GetId();
    1741         [ #  # ]:          0 :         if( nId == SFX_HINT_DYING )
    1742                 :            :         {
    1743                 :          0 :             mpWindow = NULL;
    1744                 :          0 :             mpEditEngine = NULL;
    1745         [ #  # ]:          0 :             if (mpViewForwarder.get())
    1746                 :          0 :                 mpViewForwarder->SetInvalid();
    1747                 :            :         }
    1748                 :            :     }
    1749                 :          0 :     ScAccessibleTextData::Notify( rBC, rHint );
    1750                 :          0 : }
    1751                 :            : 
    1752                 :          0 : ScAccessibleTextData* ScAccessibleCsvTextData::Clone() const
    1753                 :            : {
    1754         [ #  # ]:          0 :     return new ScAccessibleCsvTextData( mpWindow, mpEditEngine, maCellText, maBoundBox, maCellSize );
    1755                 :            : }
    1756                 :            : 
    1757                 :          0 : SvxTextForwarder* ScAccessibleCsvTextData::GetTextForwarder()
    1758                 :            : {
    1759         [ #  # ]:          0 :     if( mpEditEngine )
    1760                 :            :     {
    1761                 :          0 :         mpEditEngine->SetPaperSize( maCellSize );
    1762                 :          0 :         mpEditEngine->SetText( maCellText );
    1763         [ #  # ]:          0 :         if( !mpTextForwarder.get() )
    1764         [ #  # ]:          0 :             mpTextForwarder.reset( new SvxEditEngineForwarder( *mpEditEngine ) );
    1765                 :            :     }
    1766                 :            :     else
    1767                 :          0 :         mpTextForwarder.reset( NULL );
    1768                 :          0 :     return mpTextForwarder.get();
    1769                 :            : }
    1770                 :            : 
    1771                 :          0 : SvxViewForwarder* ScAccessibleCsvTextData::GetViewForwarder()
    1772                 :            : {
    1773         [ #  # ]:          0 :     if( !mpViewForwarder.get() )
    1774         [ #  # ]:          0 :         mpViewForwarder.reset( new ScCsvViewForwarder( mpWindow, maBoundBox ) );
    1775                 :          0 :     return mpViewForwarder.get();
    1776                 :            : }
    1777                 :            : 
    1778                 :          0 : SvxEditViewForwarder* ScAccessibleCsvTextData::GetEditViewForwarder( sal_Bool /* bCreate */ )
    1779                 :            : {
    1780                 :          0 :     return NULL;
    1781                 :            : }
    1782                 :            : 
    1783                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10