LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/inc - viewimp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 48 41.7 %
Date: 2012-12-27 Functions: 17 26 65.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef SW_VIEWIMP_HXX
      20             : #define SW_VIEWIMP_HXX
      21             : 
      22             : #include <vector>
      23             : 
      24             : #include <vcl/timer.hxx>
      25             : #include <tools/color.hxx>
      26             : 
      27             : #include <svx/svdtypes.hxx>
      28             : 
      29             : #include <tools/string.hxx>
      30             : 
      31             : #include <swtypes.hxx>
      32             : #include <swrect.hxx>
      33             : 
      34             : class ViewShell;
      35             : class SwFlyFrm;
      36             : class SwViewOption;
      37             : class SwRegionRects;
      38             : class SwFrm;
      39             : class SwLayAction;
      40             : class SwLayIdle;
      41             : class SwDrawView;
      42             : class SdrPageView;
      43             : class SwPageFrm;
      44             : class SwRegionRects;
      45             : class SwAccessibleMap;
      46             : class SdrObject;
      47             : class Fraction;
      48             : class SwPrintData;
      49             : class SwPagePreviewLayout;
      50             : struct PrevwPage;
      51             : class SwTxtFrm;
      52             : // --> OD #i76669#
      53             : namespace sdr { namespace contact {
      54             :         class ViewObjectContactRedirector;
      55             : } }
      56             : // <--
      57             : 
      58             : class SwViewImp
      59             : {
      60             :     friend class ViewShell;
      61             : 
      62             :     friend class SwLayAction;   //Lay- und IdleAction tragen sich ein und aus.
      63             :     friend class SwLayIdle;
      64             : 
      65             :     // for paint of page preview
      66             :     friend class SwPagePreviewLayout;
      67             : 
      68             :     ViewShell *pSh;             //Falls jemand einen Imp durchreicht und doch
      69             :                                 //mal eine ViewShell braucht hier die
      70             :                                 //Rueckwaertsverkettung.
      71             : 
      72             :     SwDrawView  *pDrawView;     //Unsere DrawView
      73             :     SdrPageView *pSdrPageView;  //Genau eine Seite fuer unsere DrawView
      74             : 
      75             :     SwPageFrm     *pFirstVisPage;//Zeigt immer auf die erste sichtbare Seite.
      76             :     SwRegionRects *pRegion;      //Sammler fuer Paintrects aus der LayAction.
      77             : 
      78             :     SwLayAction   *pLayAct;      //Ist gesetzt wenn ein Action-Objekt existiert
      79             :                                  //Wird vom SwLayAction-CTor ein- und vom DTor
      80             :                                  //ausgetragen.
      81             :     SwLayIdle     *pIdleAct;     //Analog zur SwLayAction fuer SwLayIdle.
      82             : 
      83             :     SwAccessibleMap *pAccMap;       // Accessible Wrappers
      84             : 
      85             :     mutable const SdrObject * pSdrObjCached;
      86             :     mutable String sSdrObjCachedComment;
      87             : 
      88             :     sal_Bool bFirstPageInvalid  :1; //Pointer auf erste Seite ungueltig?
      89             : 
      90             :     sal_Bool bResetHdlHiddenPaint:1;//  -- "" --
      91             : 
      92             :     sal_Bool bSmoothUpdate      :1; //Meber fuer SmoothScroll
      93             :     sal_Bool bStopSmooth        :1;
      94             :     sal_Bool bStopPrt           :1; // Stop Printing
      95             : 
      96             :     sal_uInt16 nRestoreActions  ; //Die Anzahl der zu restaurierenden Actions (UNO)
      97             :     SwRect aSmoothRect;
      98             : 
      99             :     SwPagePreviewLayout* mpPgPrevwLayout;
     100             : 
     101             :     /**
     102             :        Returns if printer shall be stopped.
     103             : 
     104             :        @retval sal_True The printer shall be stopped.
     105             :        @retval sal_False else
     106             :     */
     107           0 :     sal_Bool IsStopPrt() { return bStopPrt; }
     108             : 
     109             :     /**
     110             :        Resets signal for stopping printing.
     111             : 
     112             :     */
     113             :     void ResetStopPrt() { bStopPrt = sal_False; }
     114             : 
     115             :     void SetFirstVisPage();     //Neue Ermittlung der ersten sichtbaren Seite
     116             : 
     117             :     void StartAction();         //Henkel Anzeigen und verstecken.
     118             :     void EndAction();           //gerufen von ViewShell::ImplXXXAction
     119             :     void LockPaint();           //dito, gerufen von ViewShell::ImplLockPaint
     120             :     void UnlockPaint();
     121             : 
     122             : private:
     123             : 
     124             :     SwAccessibleMap *CreateAccessibleMap();
     125             : 
     126             :     /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
     127             : 
     128             :         #i27138#
     129             :         implementation for wrapper method
     130             :         <ViewShell::InvalidateAccessibleParaFlowRelation(..)>
     131             : 
     132             :         @param _pFromTxtFrm
     133             :         input parameter - paragraph frame, for which the relation CONTENT_FLOWS_FROM
     134             :         has to be invalidated.
     135             :         If NULL, no CONTENT_FLOWS_FROM relation has to be invalidated
     136             : 
     137             :         @param _pToTxtFrm
     138             :         input parameter - paragraph frame, for which the relation CONTENT_FLOWS_TO
     139             :         has to be invalidated.
     140             :         If NULL, no CONTENT_FLOWS_TO relation has to be invalidated
     141             :     */
     142             :     void _InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm,
     143             :                                                 const SwTxtFrm* _pToTxtFrm );
     144             : 
     145             :     /** invalidate text selection for paragraphs
     146             : 
     147             :         #i27301#
     148             :         implementation for wrapper method
     149             :         <ViewShell::InvalidateAccessibleParaTextSelection(..)>
     150             :     */
     151             :     void _InvalidateAccessibleParaTextSelection();
     152             : 
     153             :     /** invalidate attributes for paragraphs and paragraph's characters
     154             : 
     155             :         #i88069#
     156             :         implementation for wrapper method
     157             :         <ViewShell::InvalidateAccessibleParaAttrs(..)>
     158             :     */
     159             :     void _InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm );
     160             : 
     161             : public:
     162             :     SwViewImp( ViewShell * );
     163             :     ~SwViewImp();
     164             :     void Init( const SwViewOption * );          //nur fuer ViewShell::Init()
     165             : 
     166        1908 :     const ViewShell *GetShell() const { return pSh; }
     167       14541 :           ViewShell *GetShell()       { return pSh; }
     168             : 
     169             :     Color GetRetoucheColor() const;
     170             : 
     171             :     //Verwaltung zur ersten sichtbaren Seite
     172             :     inline const SwPageFrm *GetFirstVisPage() const;
     173             :     inline       SwPageFrm *GetFirstVisPage();
     174        1080 :     void SetFirstVisPageInvalid() { bFirstPageInvalid = sal_True; }
     175             : 
     176             :     sal_Bool AddPaintRect( const SwRect &rRect );
     177        3834 :     SwRegionRects *GetRegion()      { return pRegion; }
     178             :     void DelRegion();
     179             : 
     180             :     // neues Interface fuer StarView Drawing
     181       15962 :     inline sal_Bool HasDrawView()       const { return 0 != pDrawView; }
     182       17835 :           SwDrawView* GetDrawView()       { return pDrawView; }
     183        8602 :     const SwDrawView* GetDrawView() const { return pDrawView; }
     184        1290 :           SdrPageView*GetPageView()       { return pSdrPageView; }
     185         548 :     const SdrPageView*GetPageView() const { return pSdrPageView; }
     186             :     void MakeDrawView();
     187             : 
     188             :     // add 3rd parameter <const Color* pPageBackgrdColor> for setting this
     189             :     // color as the background color at the outliner of the draw view
     190             :     // for painting layers <hell> and <heaven>
     191             : 
     192             :     // add 4th parameter for the horizontal text
     193             :     // direction of the page in order to set the default horizontal text
     194             :     // direction at the outliner of the draw view for painting layers <hell>
     195             :     // and <heaven>.
     196             : 
     197             :     // #i76669# - added parameter <pRedirector>
     198             :     void   PaintLayer( const SdrLayerID _nLayerID,
     199             :                        SwPrintData const*const pPrintData,
     200             :                        const SwRect& _rRect,
     201             :                        const Color* _pPageBackgrdColor = 0,
     202             :                        const bool _bIsPageRightToLeft = false,
     203             :                        sdr::contact::ViewObjectContactRedirector* pRedirector = 0 ) const;
     204             : 
     205             :     //wird als Link an die DrawEngine uebergeben, entscheidet was wie
     206             :     //gepaintet wird oder nicht.
     207             : 
     208             :     // Interface Drawing
     209             :     sal_Bool IsDragPossible( const Point &rPoint );
     210             :     void NotifySizeChg( const Size &rNewSz );
     211             : 
     212             :     //SS Fuer die Lay- bzw. IdleAction und verwandtes
     213         478 :     sal_Bool  IsAction() const                   { return pLayAct  != 0; }
     214        2630 :     sal_Bool  IsIdleAction() const               { return pIdleAct != 0; }
     215         273 :           SwLayAction &GetLayAction()        { return *pLayAct; }
     216           2 :     const SwLayAction &GetLayAction() const  { return *pLayAct; }
     217             :           SwLayIdle   &GetIdleAction()       { return *pIdleAct;}
     218             :     const SwLayIdle   &GetIdleAction() const { return *pIdleAct;}
     219             : 
     220             :     //Wenn eine Aktion laueft wird diese gebeten zu pruefen ob es
     221             :     //an der zeit ist den WaitCrsr einzuschalten.
     222             :     void CheckWaitCrsr();
     223             :     sal_Bool IsCalcLayoutProgress() const;  //Fragt die LayAction wenn vorhanden.
     224             :     //sal_True wenn eine LayAction laeuft, dort wird dann auch das Flag fuer
     225             :     //ExpressionFields gesetzt.
     226             :     sal_Bool IsUpdateExpFlds();
     227             : 
     228           4 :     void    SetRestoreActions(sal_uInt16 nSet){nRestoreActions = nSet;}
     229           2 :     sal_uInt16  GetRestoreActions() const{return nRestoreActions;}
     230             : 
     231             :     void InitPagePreviewLayout();
     232             : 
     233           0 :     inline SwPagePreviewLayout* PagePreviewLayout()
     234             :     {
     235           0 :         return mpPgPrevwLayout;
     236             :     }
     237             : 
     238             :     // Is this view accessible?
     239        4024 :     sal_Bool IsAccessible() const { return pAccMap != 0; }
     240             : 
     241             :     inline SwAccessibleMap& GetAccessibleMap();
     242             : 
     243             :     // Update (this) accessible view
     244             :     void UpdateAccessible();
     245             : 
     246             :     // Remove a frame from the accessible view
     247             :     void DisposeAccessible( const SwFrm *pFrm, const SdrObject *pObj,
     248             :                             sal_Bool bRecursive );
     249             :     inline void DisposeAccessibleFrm( const SwFrm *pFrm,
     250             :                                sal_Bool bRecursive=sal_False );
     251             :     inline void DisposeAccessibleObj( const SdrObject *pObj );
     252             : 
     253             :     // Move a frame's position in the accessible view
     254             :     void MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
     255             :                          const SwRect& rOldFrm );
     256             :     inline void MoveAccessibleFrm( const SwFrm *pFrm, const SwRect& rOldFrm );
     257             : 
     258             :     // Add a frame in the accessible view
     259             :     inline void AddAccessibleFrm( const SwFrm *pFrm );
     260             : 
     261             :     inline void AddAccessibleObj( const SdrObject *pObj );
     262             : 
     263             :     // Invalidate accessible frame's frame's content
     264             :     void InvalidateAccessibleFrmContent( const SwFrm *pFrm );
     265             : 
     266             :     // Invalidate accessible frame's cursor position
     267             :     void InvalidateAccessibleCursorPosition( const SwFrm *pFrm );
     268             : 
     269             :     // Invalidate editable state for all accessible frames
     270             :     void InvalidateAccessibleEditableState( sal_Bool bAllShells=sal_True,
     271             :                                                const SwFrm *pFrm=0 );
     272             : 
     273             :     // Invalidate frame's relation set (for chained frames)
     274             :     void InvalidateAccessibleRelationSet( const SwFlyFrm *pMaster,
     275             :                                           const SwFlyFrm *pFollow );
     276             : 
     277             :     // update data for accessible preview
     278             :     // change method signature due to new page preview functionality
     279             :     void UpdateAccessiblePreview( const std::vector<PrevwPage*>& _rPrevwPages,
     280             :                                   const Fraction&  _rScale,
     281             :                                   const SwPageFrm* _pSelectedPageFrm,
     282             :                                   const Size&      _rPrevwWinSize );
     283             : 
     284             :     void InvalidateAccessiblePreViewSelection( sal_uInt16 nSelPage );
     285             : 
     286             :     // Fire all accessible events that have been collected so far
     287             :     void FireAccessibleEvents();
     288             : };
     289             : 
     290        3151 : inline SwPageFrm *SwViewImp::GetFirstVisPage()
     291             : {
     292        3151 :     if ( bFirstPageInvalid )
     293         782 :         SetFirstVisPage();
     294        3151 :     return pFirstVisPage;
     295             : }
     296             : 
     297           0 : inline const SwPageFrm *SwViewImp::GetFirstVisPage() const
     298             : {
     299           0 :     if ( bFirstPageInvalid )
     300           0 :         ((SwViewImp*)this)->SetFirstVisPage();
     301           0 :     return pFirstVisPage;
     302             : }
     303             : 
     304           0 : inline SwAccessibleMap& SwViewImp::GetAccessibleMap()
     305             : {
     306           0 :     if( !pAccMap )
     307           0 :         CreateAccessibleMap();
     308             : 
     309           0 :     return *pAccMap;
     310             : }
     311             : 
     312           0 : inline void SwViewImp::DisposeAccessibleFrm( const SwFrm *pFrm,
     313             :                                sal_Bool bRecursive )
     314             : {
     315           0 :     DisposeAccessible( pFrm, 0, bRecursive );
     316           0 : }
     317             : 
     318           0 : inline void SwViewImp::DisposeAccessibleObj( const SdrObject *pObj )
     319             : {
     320           0 :     DisposeAccessible( 0, pObj, sal_False );
     321           0 : }
     322             : 
     323           0 : inline void SwViewImp::MoveAccessibleFrm( const SwFrm *pFrm,
     324             :                                           const SwRect& rOldFrm )
     325             : {
     326           0 :     MoveAccessible( pFrm, 0, rOldFrm );
     327           0 : }
     328             : 
     329           0 : inline void SwViewImp::AddAccessibleFrm( const SwFrm *pFrm )
     330             : {
     331           0 :     SwRect aEmptyRect;
     332           0 :     MoveAccessible( pFrm, 0, aEmptyRect );
     333           0 : }
     334             : 
     335           0 : inline void SwViewImp::AddAccessibleObj( const SdrObject *pObj )
     336             : {
     337           0 :     SwRect aEmptyRect;
     338           0 :     MoveAccessible( 0, pObj, aEmptyRect );
     339           0 : }
     340             : #endif // SW_VIEWIMP_HXX
     341             : 
     342             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10