LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwplayout.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 16 42 38.1 %
Date: 2014-11-03 Functions: 14 39 35.9 %
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             :  *
       4             :  *  The Contents of this file are made available subject to the terms of
       5             :  *  either of the following licenses
       6             :  *
       7             :  *         - GNU Lesser General Public License Version 2.1
       8             :  *         - Sun Industry Standards Source License Version 1.1
       9             :  *
      10             :  *  Sun Microsystems Inc., October, 2000
      11             :  *
      12             :  *  GNU Lesser General Public License Version 2.1
      13             :  *  =============================================
      14             :  *  Copyright 2000 by Sun Microsystems, Inc.
      15             :  *  901 San Antonio Road, Palo Alto, CA 94303, USA
      16             :  *
      17             :  *  This library is free software; you can redistribute it and/or
      18             :  *  modify it under the terms of the GNU Lesser General Public
      19             :  *  License version 2.1, as published by the Free Software Foundation.
      20             :  *
      21             :  *  This library is distributed in the hope that it will be useful,
      22             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      23             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      24             :  *  Lesser General Public License for more details.
      25             :  *
      26             :  *  You should have received a copy of the GNU Lesser General Public
      27             :  *  License along with this library; if not, write to the Free Software
      28             :  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      29             :  *  MA  02111-1307  USA
      30             :  *
      31             :  *
      32             :  *  Sun Industry Standards Source License Version 1.1
      33             :  *  =================================================
      34             :  *  The contents of this file are subject to the Sun Industry Standards
      35             :  *  Source License Version 1.1 (the "License"); You may not use this file
      36             :  *  except in compliance with the License. You may obtain a copy of the
      37             :  *  License at http://www.openoffice.org/license.html.
      38             :  *
      39             :  *  Software provided under this License is provided on an "AS IS" basis,
      40             :  *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
      41             :  *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
      42             :  *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
      43             :  *  See the License for the specific provisions governing your rights and
      44             :  *  obligations concerning the Software.
      45             :  *
      46             :  *  The Initial Developer of the Original Code is: IBM Corporation
      47             :  *
      48             :  *  Copyright: 2008 by IBM Corporation
      49             :  *
      50             :  *  All Rights Reserved.
      51             :  *
      52             :  *  Contributor(s): _______________________________________
      53             :  *
      54             :  *
      55             :  ************************************************************************/
      56             : /*************************************************************************
      57             :  * @file
      58             :  *  For LWP filter architecture prototype
      59             :  ************************************************************************/
      60             : /*************************************************************************
      61             :  * Change History
      62             :  Jan 2005           Created
      63             :  ************************************************************************/
      64             : 
      65             : #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUT_HXX
      66             : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYOUT_HXX
      67             : 
      68             : #include <sal/config.h>
      69             : 
      70             : #include <rtl/ref.hxx>
      71             : 
      72             : #include "lwpheader.hxx"
      73             : #include "lwpobj.hxx"
      74             : #include "lwpobjhdr.hxx"
      75             : #include "lwpobjstrm.hxx"
      76             : #include "lwpobjid.hxx"
      77             : #include "lwpdlvlist.hxx"
      78             : #include "lwpfilehdr.hxx"
      79             : 
      80             : #include "lwplayoutdef.hxx"
      81             : #include "xfilter/xfdefs.hxx"
      82             : #include "xfilter/xffont.hxx"
      83             : #include "xfilter/xfpagemaster.hxx"
      84             : #include "xfilter/xfcolumns.hxx"
      85             : #include "xfilter/xfborders.hxx"
      86             : #include "xfilter/xfframestyle.hxx"
      87             : #include "xfilter/xfframe.hxx"
      88             : #include "xfilter/xfbgimage.hxx"
      89             : #include "lwpusewhen.hxx"
      90             : 
      91             : #define FIRST_LAYOUTPAGENO  0x0001
      92             : #define LAST_LAYOUTPAGENO       0xffff
      93             : 
      94             : #define LAY_BUOYNEUTRAL     0x02
      95             : #define LAY_BUOYLAYER       0x80
      96             : 
      97             : class LwpPara;
      98             : class LwpVirtualLayout : public LwpDLNFPVList
      99             : {
     100             : public:
     101             :     LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     102         266 :     virtual ~LwpVirtualLayout(){}
     103             :     virtual bool MarginsSameAsParent();
     104           0 :     inline virtual sal_uInt16 GetNumCols(){return 1;}
     105             :     virtual double GetColWidth(sal_uInt16 nIndex);
     106             :     virtual double GetColGap(sal_uInt16 nIndex);
     107          10 :     virtual double GetMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
     108           0 :     virtual double GetExtMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
     109           0 :     virtual bool IsAutoGrow(){ return false;}
     110           0 :     virtual bool IsAutoGrowUp(){ return false;}
     111           0 :     virtual bool IsAutoGrowDown(){ return false;}
     112           0 :     virtual bool IsAutoGrowLeft(){ return false;}
     113           0 :     virtual bool IsAutoGrowRight(){ return false;}
     114             :     virtual bool IsFitGraphic();
     115             :     virtual bool IsAutoGrowWidth();
     116             :     virtual bool IsInlineToMargin();
     117           0 :     virtual sal_uInt8 GetContentOrientation(){ return TEXT_ORIENT_LRTB;}
     118             :     virtual bool HonorProtection();
     119             :     virtual bool IsProtected();
     120             :     virtual bool HasProtection();
     121           8 :     virtual OUString GetStyleName(){ return m_StyleName;}
     122             :     virtual bool IsComplex();
     123           0 :     virtual bool IsAnchorPage(){ return false;}
     124           0 :     virtual bool IsAnchorFrame(){ return false;}
     125           0 :     virtual bool IsAnchorCell(){ return false;}
     126             :     virtual bool IsPage();
     127             :     virtual bool IsHeader();
     128             :     virtual bool IsFooter();
     129             :     virtual bool IsFrame();
     130             :     virtual bool IsCell();
     131             :     virtual bool IsSuperTable();
     132             :     virtual bool IsGroupHead();
     133             :     virtual sal_uInt8 GetRelativeType();
     134             :     virtual bool IsRelativeAnchored();
     135             :     virtual LwpUseWhen* GetUseWhen();
     136           0 :     virtual LwpUseWhen* VirtualGetUseWhen(){ return NULL;}
     137           0 :     virtual bool IsUseOnAllPages(){ return false;}
     138           0 :     virtual bool IsUseOnAllEvenPages(){ return false;}
     139           0 :     virtual bool IsUseOnAllOddPages(){ return false;}
     140           0 :     virtual bool IsUseOnPage(){ return false;}
     141           0 :     virtual sal_Int32 GetPageNumber(sal_uInt16 /*nLayoutNumber*/ = 0){ return -1;}
     142             :     virtual bool IsMinimumHeight();
     143          34 :     virtual bool IsForWaterMark(){ return false;}
     144           0 :     virtual LwpPara* GetLastParaOfPreviousStory() { return NULL; }
     145             :     virtual LwpVirtualLayout* GetParentLayout();
     146           0 :     virtual LwpVirtualLayout* GetContainerLayout(){ return NULL;}
     147             :     virtual void RegisterChildStyle();
     148             :     virtual bool NoContentReference();
     149             :     virtual bool IsStyleLayout();
     150         144 :     virtual enumXFAlignType GetVerticalAlignmentType()
     151             :     {
     152         144 :         if (m_nAttributes & STYLE_CENTEREDVERTICALLY)
     153             :         {
     154           0 :             return enumXFAlignMiddle;
     155             :         }
     156         144 :         else if (m_nAttributes & STYLE_BOTTOMALIGNED)
     157             :         {
     158           0 :             return enumXFAlignBottom;
     159             :         }
     160         144 :         return enumXFAlignTop;
     161             :     };
     162          50 :     virtual void SetStyleName(const OUString & str){ m_StyleName = str;}
     163           0 :     virtual double GetWidth(){return -1;}
     164             : 
     165             :     //Check whether there are contents in the layout
     166           0 :     virtual bool HasContent(){return false;}
     167             :     //End by
     168             : protected:
     169             :     void Read() SAL_OVERRIDE;
     170             : protected:
     171             :     sal_uInt32 m_nAttributes;
     172             :     sal_uInt32 m_nAttributes2;
     173             :     sal_uInt32 m_nAttributes3;
     174             :     sal_uInt32 m_nOverrideFlag;
     175             :     sal_uInt16 m_nDirection;
     176             :     sal_uInt16 m_nEditorID;
     177             :     LwpObjectID m_NextEnumerated;
     178             :     LwpObjectID m_PreviousEnumerated;
     179             :     OUString m_StyleName;
     180             :     enum LWP_LAYOUT_TYPE
     181             :     {
     182             :         LWP_VIRTUAL_LAYOUT,
     183             :         LWP_HEAD_LAYOUT,
     184             :         LWP_PAGE_LAYOUT,
     185             :         LWP_HEADER_LAYOUT,
     186             :         LWP_FOOTER_LAYOUT,
     187             :         LWP_FRAME_LAYOUT,
     188             :         LWP_SUPERTABLE_LAYOUT,
     189             :         LWP_TABLE_LAYOUT,
     190             :         LWP_ROW_LAYOUT,
     191             :         LWP_COLUMN_LAYOUT,
     192             :         LWP_CELL_LAYOUT,
     193             :         LWP_CONNECTED_CELL_LAYOUT,
     194             :         LWP_HIDDEN_CELL_LAYOUT,
     195             :         LWP_TABLE_HEADING_LAYOUT,
     196             :         LWP_ROW_HEADING_LAYOUT,
     197             :         LWP_DROPCAP_LAYOUT,
     198             :         LWP_GROUP_LAYOUT,
     199             :         LWP_TOC_SUPERTABLE_LAYOUT,
     200             :         LWP_FOOTNOTE_LAYOUT,
     201             :         LWP_FOOTNOTE_ROW_LAYOUT,
     202             :         LWP_FOOTNOTE_CELL_LAYOUT,
     203             :         LWP_ENDNOTE_LAYOUT,
     204             :         LWP_ENDNOTE_SUPERTABLE_LAYOUT,
     205             :         LWP_FOOTNOTE_SUPERTABLE_LAYOUT,
     206             :         LWP_NOTE_LAYOUT,
     207             :         LWP_NOTEHEADER_LAYOUT,
     208             :         LWP_NOTETEXT_LAYOUT,
     209             :         LWP_VIEWPORT_LAYOUT
     210             :     };
     211             :     enum LayoutDirection
     212             :     {
     213             :         LAY_USEDIRECTION    = 0x01,
     214             :         LAY_AUTOGROW        = 0x02,
     215             :         LAY_AUTOSIZE        = 0x04,
     216             :         LAY_TOCONTAINER     = 0x08,
     217             :         LAY_DIRALLBITS      = 0x0f
     218             :     };
     219             :     enum    {SHIFT_UP = 0, SHIFT_DOWN = 4, SHIFT_LEFT = 8, SHIFT_RIGHT =12};
     220             : public:
     221           0 :     virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_VIRTUAL_LAYOUT;}
     222             :     virtual LwpVirtualLayout* FindChildByType(LWP_LAYOUT_TYPE eType);
     223             : };
     224             : 
     225             : class LwpAssociatedLayouts
     226             : {
     227             : public:
     228         168 :     LwpAssociatedLayouts(){}
     229             : public:
     230             :     void Read(LwpObjectStream* pStrm);
     231          12 :     LwpObjectID& GetOnlyLayout() { return m_OnlyLayout;}
     232             :     LwpDLVListHeadTail& GetLayouts() { return m_Layouts;}
     233             :     LwpVirtualLayout* GetLayout(LwpVirtualLayout* pStartLayout);
     234             : protected:
     235             :     LwpObjectID m_OnlyLayout; //LwpVirtualLayout
     236             :     LwpDLVListHeadTail m_Layouts;
     237             : };
     238             : 
     239             : class LwpHeadLayout : public LwpVirtualLayout
     240             : {
     241             : public:
     242             :     LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     243         128 :     virtual ~LwpHeadLayout(){}
     244             :     void RegisterStyle() SAL_OVERRIDE;
     245             :     LwpVirtualLayout* FindEnSuperTableLayout();
     246             : protected:
     247             :     void Read() SAL_OVERRIDE;
     248         266 :     virtual LWP_LAYOUT_TYPE GetLayoutType () SAL_OVERRIDE { return LWP_HEAD_LAYOUT;}
     249             : };
     250             : 
     251             : class LwpLayoutStyle
     252             : {
     253             : public:
     254             :     LwpLayoutStyle();
     255             :     virtual ~LwpLayoutStyle();
     256             :     void Read(LwpObjectStream* pStrm);
     257             : private:
     258             :     sal_uInt32      m_nStyleDefinition;
     259             :     LwpAtomHolder*  m_pDescription;
     260             :     sal_uInt16      m_nKey;
     261             : };
     262             : 
     263             : class LwpLayoutMisc
     264             : {
     265             : public:
     266             :     LwpLayoutMisc();
     267             :     virtual ~LwpLayoutMisc();
     268             :     void Read(LwpObjectStream* pStrm);
     269             : private:
     270             :     sal_Int32   m_nGridDistance;
     271             :     sal_uInt16 m_nGridType;
     272             :     LwpAtomHolder* m_pContentStyle;
     273             : };
     274             : 
     275             : #include "lwplaypiece.hxx"
     276             : 
     277             : class LwpMiddleLayout : public LwpVirtualLayout
     278             : {
     279             : public:
     280             :     LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
     281             :     virtual ~LwpMiddleLayout();
     282             :     virtual bool MarginsSameAsParent() SAL_OVERRIDE;
     283             :     virtual double GetMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
     284             :     virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
     285             :     LwpLayoutGeometry* GetGeometry();
     286             :     double GetGeometryHeight();
     287             :     double GetGeometryWidth();
     288             :     LwpBorderStuff* GetBorderStuff();
     289             :     LwpBackgroundStuff* GetBackgroundStuff();
     290             :     enumXFTextDir GetTextDirection();
     291             :     XFBorders* GetXFBorders();
     292             :     LwpColor* GetBackColor();
     293             :     virtual bool IsAutoGrow() SAL_OVERRIDE;
     294             :     virtual bool IsAutoGrowUp() SAL_OVERRIDE;
     295             :     virtual bool IsAutoGrowDown() SAL_OVERRIDE;
     296             :     virtual bool IsAutoGrowLeft() SAL_OVERRIDE;
     297             :     virtual bool IsAutoGrowRight() SAL_OVERRIDE;
     298             :     virtual sal_uInt8 GetContentOrientation() SAL_OVERRIDE;
     299             :     virtual bool HonorProtection() SAL_OVERRIDE;
     300             :     virtual bool IsProtected() SAL_OVERRIDE;
     301             :     virtual LwpVirtualLayout* GetWaterMarkLayout();
     302             :     XFBGImage* GetXFBGImage();
     303             :     virtual bool GetUsePrinterSettings();
     304             : 
     305          56 :     LwpLayoutScale* GetLayoutScale(){return dynamic_cast<LwpLayoutScale*>(m_LayScale.obj().get());}
     306             :         sal_uInt16 GetScaleMode(void);
     307             :     sal_uInt16 GetScaleTile(void);
     308             :     sal_uInt16 GetScaleCenter(void);
     309             :     sal_uInt32 GetScalePercentage(void);
     310             :     double GetScaleWidth(void);
     311             :     double GetScaleHeight(void);
     312             : 
     313             :     bool CanSizeRight(void);
     314             :     virtual double GetWidth() SAL_OVERRIDE;
     315             :     virtual sal_Int32 GetMinimumWidth();
     316             :     bool IsSizeRightToContent(void);
     317             :     bool IsSizeRightToContainer(void);
     318             :     sal_Int32 DetermineWidth();
     319             :     virtual double GetHeight();
     320             :     virtual LwpPoint GetOrigin();
     321             : 
     322             :     bool IsPatternFill();
     323             :     XFBGImage* GetFillPattern();
     324             : 
     325             :     //Check whether there are contents in the layout
     326             :     virtual bool HasContent() SAL_OVERRIDE;
     327             :     //End by
     328             : 
     329             : protected:
     330             :     void Read() SAL_OVERRIDE;
     331             : protected:
     332             :     enum
     333             :     {
     334             :         DISK_GOT_STYLE_STUFF        = 0x01,
     335             :         DISK_GOT_MISC_STUFF         = 0x02
     336             :     };
     337             : 
     338             :     LwpObjectID m_Content;
     339             :     LwpObjectID m_BasedOnStyle;
     340             : 
     341             :     LwpObjectID     m_TabPiece;
     342             :     LwpLayoutStyle* m_pStyleStuff;
     343             :     LwpLayoutMisc*  m_pMiscStuff;
     344             :     LwpObjectID     m_LayGeometry;
     345             :     LwpObjectID     m_LayScale;
     346             :     LwpObjectID     m_LayMargins;
     347             :     LwpObjectID     m_LayBorderStuff;
     348             :     LwpObjectID     m_LayBackgroundStuff;
     349             :     LwpObjectID     m_LayExtBorderStuff;
     350             : public:
     351          40 :     LwpObjectID& GetContent() { return m_Content; }
     352             :     LwpTabOverride* GetTabOverride();
     353             : };
     354             : 
     355             : class LwpLayout : public LwpMiddleLayout
     356             : {
     357             : public:
     358             :     LwpLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
     359             :     virtual ~LwpLayout();
     360             :     XFColumns* GetXFColumns();
     361             :     XFColumnSep* GetColumnSep();
     362             :     LwpShadow* GetShadow();
     363             :     XFShadow* GetXFShadow();
     364             : protected:
     365             :     void Read() SAL_OVERRIDE;
     366             : protected:
     367             :     LwpUseWhen* m_pUseWhen;
     368             :     LwpObjectID m_Positon;
     369             :     LwpObjectID m_LayColumns;
     370             :     LwpObjectID m_LayGutterStuff;
     371             :     LwpObjectID m_LayJoinStuff;
     372             :     LwpObjectID m_LayShadow;
     373             :     LwpObjectID m_LayExtJoinStuff;
     374             : 
     375             : public:
     376             :     LwpUseWhen* VirtualGetUseWhen() SAL_OVERRIDE;
     377             :     virtual sal_uInt16 GetNumCols() SAL_OVERRIDE;
     378             :     virtual double GetColWidth(sal_uInt16 nIndex) SAL_OVERRIDE;
     379             :     virtual double GetColGap(sal_uInt16 nIndex) SAL_OVERRIDE;
     380             :     virtual sal_uInt16 GetUsePage();
     381             : public:
     382             :     enum UseWhenType
     383             :     {
     384             :         StartWithinColume,
     385             :         StartWithinPage,
     386             :         StartOnNextPage,
     387             :         StartOnOddPage,
     388             :         StartOnEvenPage
     389             :     };
     390             : public:
     391             :     virtual UseWhenType GetUseWhenType();
     392             :     virtual bool IsUseOnAllPages() SAL_OVERRIDE;
     393             :     virtual bool IsUseOnAllEvenPages() SAL_OVERRIDE;
     394             :     virtual bool IsUseOnAllOddPages() SAL_OVERRIDE;
     395             :     virtual bool IsUseOnPage() SAL_OVERRIDE;
     396         134 :     LwpObjectID& GetPosition(){ return m_Positon;}
     397             :     virtual LwpVirtualLayout* GetContainerLayout() SAL_OVERRIDE;
     398             : };
     399             : 
     400             : class LwpPlacableLayout : public LwpLayout
     401             : {
     402             : public:
     403             :     LwpPlacableLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
     404             :     virtual ~LwpPlacableLayout();
     405             :     virtual sal_uInt8 GetWrapType();
     406             :     virtual LwpLayoutRelativity* GetRelativityPiece();
     407             :     virtual sal_uInt8 GetRelativeType() SAL_OVERRIDE;
     408             :     virtual sal_Int32 GetBaseLineOffset();
     409             :     virtual bool IsAnchorPage() SAL_OVERRIDE;
     410             :     virtual bool IsAnchorFrame() SAL_OVERRIDE;
     411             :     virtual bool IsAnchorCell() SAL_OVERRIDE;
     412           0 :     virtual void XFConvertFrame(XFContentContainer* /*pCont*/, sal_Int32 /*nStart*/ = 0, sal_Int32 /*nEnd*/ = 0, bool /*bAll*/ = false) {}
     413             :     /**
     414             :      * @descr:   Get font style for setting position of frame
     415             :      *
     416             :      */
     417           0 :     rtl::Reference<XFFont> GetFont() { return m_pFont; }
     418             :     void SetFont(rtl::Reference<XFFont> const & pFont);
     419             :     enum WrapType
     420             :     {
     421             :         LAY_WRAP_AROUND = 1,
     422             :         LAY_NO_WRAP_BESIDE,
     423             :         LAY_NO_WRAP_AROUND,
     424             :         LAY_WRAP_LEFT,
     425             :         LAY_WRAP_RIGHT,
     426             :         LAY_WRAP_BOTH,
     427             :         LAY_WRAP_IRREG_BOTH,
     428             :         LAY_WRAP_IRREG_LEFT,
     429             :         LAY_WRAP_IRREG_RIGHT,
     430             :         LAY_WRAP_IRREG_BIGGEST
     431             :     };
     432             : protected:
     433             :     void Read() SAL_OVERRIDE;
     434             : protected:
     435             :     sal_uInt8 m_nWrapType;
     436             :     sal_uInt8 m_nBuoyancy;
     437             :     sal_Int32 m_nBaseLineOffset;
     438             :     LwpAtomHolder m_Script;
     439             :     LwpObjectID m_LayRelativity;
     440             :     sal_uInt16 m_nPageNumber;//for frame anchored to page
     441             :     rtl::Reference<XFFont> m_pFont;//for frame position
     442             : };
     443             : #endif
     444             : 
     445             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10