LCOV - code coverage report
Current view: top level - sw/source/core/inc - pagefrm.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 90 0.0 %
Date: 2014-04-14 Functions: 0 48 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_PAGEFRM_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_PAGEFRM_HXX
      21             : 
      22             : #include <viewsh.hxx>
      23             : #include "ftnboss.hxx"
      24             : #include <tools/mempool.hxx>
      25             : 
      26             : #include <SidebarWindowsTypes.hxx>
      27             : 
      28             : class SwFlyFrm;
      29             : class SwFlyFrmFmt;
      30             : class SwPageDesc;
      31             : class SwCntntFrm;
      32             : struct SwPosition;
      33             : struct SwCrsrMoveState;
      34             : class SwAttrSetChg;
      35             : class Font;
      36             : class SwSortedObjs;
      37             : class SwAnchoredObject;
      38             : 
      39             : enum SwPageChg
      40             : {
      41             :     CHG_NEWPAGE,
      42             :     CHG_CUTPAGE,
      43             :     CHG_CHGPAGE
      44             : };
      45             : 
      46             : /// A page of the document layout.
      47             : class SwPageFrm: public SwFtnBossFrm
      48             : {
      49             :     friend class SwFrm;
      50             : 
      51             :     SwSortedObjs *pSortedObjs;
      52             : 
      53             :     SwPageDesc *pDesc;      //PageDesc der die Seite beschreibt.
      54             : 
      55             :     sal_uInt16  nPhyPageNum;        //Physikalische Seitennummer.
      56             : 
      57             :     sal_Bool bInvalidCntnt      :1;
      58             :     sal_Bool bInvalidLayout     :1;
      59             :     sal_Bool bInvalidFlyCntnt   :1;
      60             :     sal_Bool bInvalidFlyLayout  :1;
      61             :     sal_Bool bInvalidFlyInCnt   :1;
      62             :     sal_Bool bFtnPage           :1; //Diese Seite ist fuer Dokumentende-Fussnoten.
      63             :     sal_Bool bEmptyPage         :1; //Dies ist eine explizite Leerseite
      64             :     sal_Bool bEndNotePage       :1; //'Fussnotenseite' fuer Endnoten
      65             :     sal_Bool bInvalidSpelling   :1; //Das Online-Spelling ist gefordert
      66             :     sal_Bool bInvalidSmartTags :1;  //checking for smarttags is needed
      67             :     sal_Bool bInvalidAutoCmplWrds :1; //Auto-Complete Wordliste aktualisieren
      68             :     sal_Bool bInvalidWordCount  :1;
      69             :     sal_Bool bHasGrid           :1; // Grid for Asian layout
      70             : 
      71             :     static const sal_Int8 mnShadowPxWidth;
      72             : 
      73             :     void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
      74             :                       SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
      75             : 
      76             :     // Anpassen der max. Fussnotenhoehen in den einzelnen Spalten
      77             :     void SetColMaxFtnHeight();
      78             : 
      79             :     /** determine rectangle for horizontal page shadow
      80             : 
      81             :         #i9719#
      82             : 
      83             :         @param _rPageRect
      84             :         input parameter - constant instance reference of the page rectangle.
      85             :         Generally, it's the frame area of the page, but for empty pages in print
      86             :         preview, this parameter is useful.
      87             : 
      88             :         @param _pViewShell
      89             :         input parameter - instance of the view shell, for which the rectangle
      90             :         has to be generated.
      91             : 
      92             :         @param _orBottomShadowRect
      93             :         output parameter - instance reference of the bottom shadow rectangle for
      94             :         the given page rectangle
      95             :     */
      96             : 
      97             :     static void GetHorizontalShadowRect( const SwRect& _rPageRect,
      98             :                                      const SwViewShell*    _pViewShell,
      99             :                                      SwRect&       _orBottomShadowRect,
     100             :                                      bool bPaintLeftShadow,
     101             :                                      bool bPaintRightShadow,
     102             :                                      bool bRightSidebar );
     103             : 
     104             : protected:
     105             :     virtual void MakeAll() SAL_OVERRIDE;
     106             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
     107             : 
     108             : public:
     109           0 :     DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm)
     110             : 
     111             :     SwPageFrm( SwFrmFmt*, SwFrm*, SwPageDesc* );
     112             :     virtual ~SwPageFrm();
     113             : 
     114             :     //public, damit die SwViewShell beim Umschalten vom BrowseMode darauf
     115             :     //zugreifen kann.
     116             :     void PrepareHeader();   //Kopf-/Fusszeilen anlegen/entfernen.
     117             :     void PrepareFooter();
     118             : 
     119           0 :     const SwSortedObjs  *GetSortedObjs() const  { return pSortedObjs; }
     120           0 :           SwSortedObjs  *GetSortedObjs()          { return pSortedObjs; }
     121             : 
     122             :     void AppendDrawObjToPage( SwAnchoredObject& _rNewObj );
     123             :     void RemoveDrawObjFromPage( SwAnchoredObject& _rToRemoveObj );
     124             : 
     125             :     void AppendFlyToPage( SwFlyFrm *pNew );
     126             :     void RemoveFlyFromPage( SwFlyFrm *pToRemove );
     127             :     void MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest );//optimiertes Remove/Append
     128             : 
     129             :     void  SetPageDesc( SwPageDesc *, SwFrmFmt * );
     130           0 :           SwPageDesc *GetPageDesc() { return pDesc; }
     131           0 :     const SwPageDesc *GetPageDesc() const { return pDesc; }
     132             :           SwPageDesc *FindPageDesc();
     133             : 
     134             :                  SwCntntFrm  *FindLastBodyCntnt();
     135             :     inline       SwCntntFrm  *FindFirstBodyCntnt();
     136             :     inline const SwCntntFrm  *FindFirstBodyCntnt() const;
     137             :     inline const SwCntntFrm  *FindLastBodyCntnt() const;
     138             : 
     139             :     SwRect GetBoundRect() const;
     140             : 
     141             :     //Spezialisiertes GetCntntPos() fuer Felder in Rahmen.
     142             :     void GetCntntPosition( const Point &rPt, SwPosition &rPos ) const;
     143             : 
     144           0 :     sal_Bool IsEmptyPage() const { return bEmptyPage; } //explizite Leerseite.
     145             : 
     146             :     void    UpdateFtnNum();
     147             : 
     148             :     //Immer nach dem Paste rufen. Erzeugt die Seitengeb. Rahmen und Formatiert
     149             :     //generischen Inhalt.
     150             :     void PreparePage( sal_Bool bFtn );
     151             : 
     152             :     //Schickt an alle ContentFrames ein Prepare wg. geaenderter Registervorlage
     153             :     void PrepareRegisterChg();
     154             : 
     155             :     // Appends a fly frame - the given one or a new one - at the page frame.
     156             :     // Needed for <Modify> and <MakeFrms>
     157             :     // - return value not needed any more
     158             :     // - second parameter is of type <SwFlyFrmFmt*>
     159             :     // - third parameter only needed for assertion, but calling method assures
     160             :     //   this assertion. Thus, delete it.
     161             :     void PlaceFly( SwFlyFrm* pFly, SwFlyFrmFmt* pFmt );
     162             : 
     163             :     virtual bool GetCrsrOfst( SwPosition *, Point&,
     164             :                               SwCrsrMoveState* = 0, bool bTestBackground = false ) const SAL_OVERRIDE;
     165             :         // erfrage vom Client Informationen
     166             :     virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
     167             : 
     168             :     virtual void Cut() SAL_OVERRIDE;
     169             :     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
     170             :     virtual void CheckDirection( bool bVert ) SAL_OVERRIDE;
     171             :     void CheckGrid( sal_Bool bInvalidate );
     172             :     void PaintGrid( OutputDevice* pOut, SwRect &rRect ) const;
     173           0 :     sal_Bool HasGrid() const { return bHasGrid; }
     174             : 
     175             :     void PaintDecorators( ) const;
     176             :     virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const SAL_OVERRIDE;
     177             :     virtual void PaintBreak() const SAL_OVERRIDE;
     178             : 
     179             :     //Zeilennummern usw malen
     180             :     void RefreshExtraData( const SwRect & ) const;
     181             : 
     182             :     //Hilfslinien malen.
     183             :     void RefreshSubsidiary( const SwRect& ) const;
     184             : 
     185             :     //Fussnotenschnittstelle
     186           0 :     sal_Bool IsFtnPage() const                                  { return bFtnPage; }
     187           0 :     sal_Bool IsEndNotePage() const                              { return bEndNotePage; }
     188           0 :     void SetFtnPage( sal_Bool b )                               { bFtnPage = b; }
     189           0 :     void SetEndNotePage( sal_Bool b )                           { bEndNotePage = b; }
     190             : 
     191           0 :     inline  sal_uInt16 GetPhyPageNum() const        { return nPhyPageNum;}
     192           0 :     inline  void SetPhyPageNum( sal_uInt16 nNum )   { nPhyPageNum = nNum;}
     193           0 :     inline  void DecrPhyPageNum()               { --nPhyPageNum;     }
     194           0 :     inline  void IncrPhyPageNum()               { ++nPhyPageNum;     }
     195             : 
     196             :     //Validieren, invalidieren und abfragen des Status der Seite.
     197             :     //Layout/Cntnt und jeweils Fly/nicht Fly werden getrennt betrachtet.
     198             :     inline void InvalidateFlyLayout() const;
     199             :     inline void InvalidateFlyCntnt() const;
     200             :     inline void InvalidateFlyInCnt() const;
     201             :     inline void InvalidateLayout() const;
     202             :     inline void InvalidateCntnt() const;
     203             :     inline void InvalidateSpelling() const;
     204             :     inline void InvalidateSmartTags() const;
     205             :     inline void InvalidateAutoCompleteWords() const;
     206             :     inline void InvalidateWordCount() const;
     207             :     inline void ValidateFlyLayout() const;
     208             :     inline void ValidateFlyCntnt() const;
     209             :     inline void ValidateFlyInCnt() const;
     210             :     inline void ValidateLayout() const;
     211             :     inline void ValidateCntnt() const;
     212             :     inline void ValidateSpelling()  const;
     213             :     inline void ValidateSmartTags() const;
     214             :     inline void ValidateAutoCompleteWords() const;
     215             :     inline void ValidateWordCount() const;
     216             :     inline sal_Bool IsInvalid() const;
     217             :     inline sal_Bool IsInvalidFly() const;
     218             :     sal_Bool IsRightShadowNeeded() const;
     219             :     sal_Bool IsLeftShadowNeeded() const;
     220           0 :     sal_Bool IsInvalidFlyLayout() const { return bInvalidFlyLayout; }
     221           0 :     sal_Bool IsInvalidFlyCntnt() const { return bInvalidFlyCntnt; }
     222           0 :     sal_Bool IsInvalidFlyInCnt() const { return bInvalidFlyInCnt; }
     223           0 :     sal_Bool IsInvalidLayout() const { return bInvalidLayout; }
     224           0 :     sal_Bool IsInvalidCntnt() const { return (bInvalidCntnt || bInvalidFlyInCnt); }
     225           0 :     sal_Bool IsInvalidSpelling() const { return bInvalidSpelling; }
     226           0 :     sal_Bool IsInvalidSmartTags() const { return bInvalidSmartTags; }
     227           0 :     sal_Bool IsInvalidAutoCompleteWords() const { return bInvalidAutoCmplWrds; }
     228           0 :     sal_Bool IsInvalidWordCount() const { return bInvalidWordCount; }
     229             : 
     230             :     /** SwPageFrm::GetDrawBackgrdColor
     231             : 
     232             :         determine the color, that is respectively will be drawn as background
     233             :         for the page frame.
     234             : 
     235             :         @return reference to an instance of class Color
     236             :     */
     237             :     const Color& GetDrawBackgrdColor() const;
     238             : 
     239             :     /** paint margin area of a page
     240             : 
     241             :         implement paint of margin area; margin area will be painted for a
     242             :         view shell with a window and if the document is not in online layout.
     243             : 
     244             :         @param _rOutputRect
     245             :         input parameter - constant instance reference of the rectangle, for
     246             :         which an output has to be generated.
     247             : 
     248             :         @param _pViewShell
     249             :         input parameter - instance of the view shell, on which the output
     250             :         has to be generated.
     251             :     */
     252             :     void PaintMarginArea( const SwRect& _rOutputRect,
     253             :                           SwViewShell* _pViewShell ) const;
     254             : 
     255             :     /** paint page border and shadow
     256             : 
     257             :         @param _rPageRect
     258             :         input parameter - constant instance reference of the page rectangle.
     259             :         Generally, it's the frame area of the page, but for empty pages in print
     260             :         preview, this parameter is useful.
     261             : 
     262             :         @param _pViewShell
     263             :         input parameter - instance of the view shell, on which the output
     264             :         has to be generated.
     265             : 
     266             :         @param bPaintRightShadow
     267             :         Should we paint shadow on the right or not (used in book mode)
     268             : 
     269             :         @param bFullBottomShadow
     270             :         Should we have a bottom shadow of the same size as the pages or
     271             :         not (for right pages in book mode in a LTR environment).
     272             : 
     273             :         @param bRightSidebar
     274             :         Is the note sidebar on the right or not (used to adjust the
     275             :         shadow with & position).
     276             :     */
     277             :     static void PaintBorderAndShadow( const SwRect& _rPageRect,
     278             :                                       const SwViewShell*    _pViewShell,
     279             :                                       bool bPaintLeftShadow,
     280             :                                       bool bPaintRightShadow,
     281             :                                       bool bRightSidebar );
     282             : 
     283             :     /** get bound rectangle of border and shadow for repaints
     284             : 
     285             :         @param _rPageRect
     286             :         input parameter - constant instance reference of the page rectangle.
     287             :         Generally, it's the frame area of the page, but for empty pages in print
     288             :         preview, this parameter is useful.
     289             : 
     290             :         @param _pViewShell
     291             :         input parameter - instance of the view shell, for which the rectangle
     292             :         has to be generated.
     293             : 
     294             :         @param _orBorderAndShadowBoundRect
     295             :         output parameter - instance reference of the bounded border and shadow
     296             :         rectangle for the given page rectangle
     297             :     */
     298             :     static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
     299             :                                              const SwViewShell*    _pViewShell,
     300             :                                              SwRect& _orBorderAndShadowBoundRect,
     301             :                                              const bool bLeftShadow,
     302             :                                              const bool bRightShadow,
     303             :                                              const bool bRightSidebar
     304             :                                             );
     305             : 
     306             :     static void PaintNotesSidebar(const SwRect& _rPageRect, SwViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight);
     307             :     static void PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, SwViewShell* _pViewShell, const Color aColorUp, const Color aColorDown);
     308             :     /**
     309             :         asks the page on which side a margin should be shown, e.g for notes
     310             :         returns true for left side, false for right side
     311             :     */
     312             :     sw::sidebarwindows::SidebarPosition SidebarPosition() const;
     313             : 
     314             :     virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const SAL_OVERRIDE;
     315             : 
     316             :     inline sal_Int8 ShadowPxWidth() const
     317             :     {
     318             :         return mnShadowPxWidth;
     319             :     }
     320             : 
     321             :     const SwRect PrtWithoutHeaderAndFooter() const;
     322             : 
     323             :     // in case this is am empty page, this function returns the 'reference' page
     324             :     const SwPageFrm& GetFormatPage() const;
     325             : 
     326             :     /// If in header or footer area, it also indicates the exact area in rControl.
     327             :     bool IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rControl ) const;
     328             : 
     329             :     // return font used to paint the "empty page" string
     330             :     static const Font& GetEmptyPageFont();
     331             : 
     332             :     static SwTwips GetSidebarBorderWidth( const SwViewShell* );
     333             : };
     334             : 
     335           0 : inline SwCntntFrm *SwPageFrm::FindFirstBodyCntnt()
     336             : {
     337           0 :     SwLayoutFrm *pBody = FindBodyCont();
     338           0 :     return pBody ? pBody->ContainsCntnt() : 0;
     339             : }
     340           0 : inline const SwCntntFrm *SwPageFrm::FindFirstBodyCntnt() const
     341             : {
     342           0 :     const SwLayoutFrm *pBody = FindBodyCont();
     343           0 :     return pBody ? pBody->ContainsCntnt() : 0;
     344             : }
     345           0 : inline const SwCntntFrm *SwPageFrm::FindLastBodyCntnt() const
     346             : {
     347           0 :     return ((SwPageFrm*)this)->FindLastBodyCntnt();
     348             : }
     349           0 : inline void SwPageFrm::InvalidateFlyLayout() const
     350             : {
     351           0 :     ((SwPageFrm*)this)->bInvalidFlyLayout = sal_True;
     352           0 : }
     353           0 : inline void SwPageFrm::InvalidateFlyCntnt() const
     354             : {
     355           0 :     ((SwPageFrm*)this)->bInvalidFlyCntnt = sal_True;
     356           0 : }
     357           0 : inline void SwPageFrm::InvalidateFlyInCnt() const
     358             : {
     359           0 :     ((SwPageFrm*)this)->bInvalidFlyInCnt = sal_True;
     360           0 : }
     361           0 : inline void SwPageFrm::InvalidateLayout() const
     362             : {
     363           0 :     ((SwPageFrm*)this)->bInvalidLayout = sal_True;
     364           0 : }
     365           0 : inline void SwPageFrm::InvalidateCntnt() const
     366             : {
     367           0 :     ((SwPageFrm*)this)->bInvalidCntnt = sal_True;
     368           0 : }
     369           0 : inline void SwPageFrm::InvalidateSpelling() const
     370             : {
     371           0 :     ((SwPageFrm*)this)->bInvalidSpelling = sal_True;
     372           0 : }
     373             : 
     374           0 : inline void SwPageFrm::InvalidateSmartTags() const
     375             : {
     376           0 :    ((SwPageFrm*)this)->bInvalidSmartTags = sal_True;
     377           0 : }
     378           0 : inline void SwPageFrm::InvalidateAutoCompleteWords() const
     379             : {
     380           0 :     ((SwPageFrm*)this)->bInvalidAutoCmplWrds = sal_True;
     381           0 : }
     382           0 : inline void SwPageFrm::InvalidateWordCount() const
     383             : {
     384           0 :     ((SwPageFrm*)this)->bInvalidWordCount = sal_True;
     385           0 : }
     386           0 : inline void SwPageFrm::ValidateFlyLayout() const
     387             : {
     388           0 :     ((SwPageFrm*)this)->bInvalidFlyLayout = sal_False;
     389           0 : }
     390           0 : inline void SwPageFrm::ValidateFlyCntnt() const
     391             : {
     392           0 :     ((SwPageFrm*)this)->bInvalidFlyCntnt = sal_False;
     393           0 : }
     394           0 : inline void SwPageFrm::ValidateFlyInCnt() const
     395             : {
     396           0 :     ((SwPageFrm*)this)->bInvalidFlyInCnt = sal_False;
     397           0 : }
     398           0 : inline void SwPageFrm::ValidateLayout() const
     399             : {
     400           0 :     ((SwPageFrm*)this)->bInvalidLayout = sal_False;
     401           0 : }
     402           0 : inline void SwPageFrm::ValidateCntnt() const
     403             : {
     404           0 :     ((SwPageFrm*)this)->bInvalidCntnt = sal_False;
     405           0 : }
     406           0 : inline void SwPageFrm::ValidateSpelling() const
     407             : {
     408           0 :     ((SwPageFrm*)this)->bInvalidSpelling = sal_False;
     409           0 : }
     410             : 
     411           0 : inline void SwPageFrm::ValidateSmartTags() const
     412             : {
     413           0 :    ((SwPageFrm*)this)->bInvalidSmartTags = sal_False;
     414           0 : }
     415           0 : inline void SwPageFrm::ValidateAutoCompleteWords() const
     416             : {
     417           0 :     ((SwPageFrm*)this)->bInvalidAutoCmplWrds = sal_False;
     418           0 : }
     419           0 : inline void SwPageFrm::ValidateWordCount() const
     420             : {
     421           0 :     ((SwPageFrm*)this)->bInvalidWordCount = sal_False;
     422           0 : }
     423             : 
     424           0 : inline sal_Bool SwPageFrm::IsInvalid() const
     425             : {
     426           0 :     return (bInvalidCntnt || bInvalidLayout || bInvalidFlyInCnt);
     427             : }
     428           0 : inline sal_Bool SwPageFrm::IsInvalidFly() const
     429             : {
     430           0 :     return bInvalidFlyLayout || bInvalidFlyCntnt;
     431             : }
     432             : 
     433             : 
     434             : class SwTextGridItem;
     435             : 
     436             : SwTextGridItem const* GetGridItem(SwPageFrm const*const);
     437             : 
     438             : sal_uInt16 GetGridWidth(SwTextGridItem const&, SwDoc const&);
     439             : 
     440             : #endif // INCLUDED_SW_SOURCE_CORE_INC_PAGEFRM_HXX
     441             : 
     442             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10