LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwptablelayout.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 15 53.3 %
Date: 2012-08-25 Functions: 5 12 41.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     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 - table layouts
      59                 :            :  */
      60                 :            : /*************************************************************************
      61                 :            :  * Change History
      62                 :            :  Mar 2005           Created
      63                 :            :  ************************************************************************/
      64                 :            : #ifndef _LWPTABLELAYOUT_HXX
      65                 :            : #define _LWPTABLELAYOUT_HXX
      66                 :            : #include <vector>
      67                 :            : #include <map>
      68                 :            : #include "lwplayout.hxx"
      69                 :            : 
      70                 :            : class XFTableStyle;
      71                 :            : class XFTable;
      72                 :            : class XFCell;
      73                 :            : class LwpTable;
      74                 :            : class LwpFrame;
      75                 :            : class LwpSuperTableLayout;
      76                 :            : class LwpRowLayout;
      77                 :            : class LwpCellLayout;
      78                 :            : class LwpTableHeadingLayout;
      79                 :            : class LwpRowHeadingLayout;
      80                 :            : class LwpConnectedCellLayout;
      81                 :            : class LwpColumnLayout;
      82                 :            : 
      83                 :            : /**
      84                 :            :  * @brief
      85                 :            :  * VO_TABLELAYOUT object and functions for registering styles and coverting tables
      86                 :            :  */
      87                 :            : class LwpTableLayout: public LwpLayout
      88                 :            : {
      89                 :            : public:
      90                 :            :     LwpTableLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
      91                 :            :     virtual ~LwpTableLayout();
      92                 :         27 :     virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_TABLE_LAYOUT;}
      93                 :         15 :     LwpObjectID * GetColumnLayoutHead(){return &m_ColumnLayout;}
      94                 :            :     void RegisterStyle();
      95                 :            :     LwpTable *  GetTable();
      96                 :        111 :     LwpCellLayout * GetDefaultCellLayout(){return m_pDefaultCellLayout;}
      97                 :            :     LwpSuperTableLayout * GetSuperTableLayout();
      98                 :            :     LwpObjectID * SearchCellStoryMap(sal_uInt16 nRow, sal_uInt16 nCol);
      99                 :            :     LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol);
     100                 :            :     OUString GetColumnWidth(sal_uInt16 nCol);
     101                 :          9 :     void SetWordProCellMap(sal_uInt16 nRow, sal_uInt16 nCol, LwpCellLayout * pCell)
     102                 :            :     {
     103 [ +  - ][ -  + ]:          9 :         if (nRow >= m_nRows || nCol >= m_nCols)
     104                 :          9 :             return;
     105                 :          9 :         m_WordProCellsMap[nRow * m_nCols + nCol] = pCell;
     106                 :            :     };
     107                 :            : protected:
     108                 :            :     void Read();
     109                 :            :     void TraverseTable();
     110                 :            :     void RegisterColumns();
     111                 :            :     void RegisterRows();
     112                 :            :     void ParseTable();
     113                 :            :     void PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_uInt16 nColID);
     114                 :            : 
     115                 :            :     sal_uInt16 m_nRows;
     116                 :            :     sal_uInt16 m_nCols;
     117                 :            : 
     118                 :            : private:
     119                 :            :     //CColumnLayoutHead cColumnLayout;
     120                 :            :     LwpObjectID m_ColumnLayout;
     121                 :            :     OUString m_FrameStyleName;
     122                 :            :     LwpCellLayout * m_pDefaultCellLayout;
     123                 :            :     OUString m_DefaultColumnStyleName;
     124                 :            :     OUString m_DefaultRowStyleName;
     125                 :            : 
     126                 :            :     // wordpro cell  map
     127                 :            :     std::vector<LwpCellLayout *> m_WordProCellsMap;
     128                 :            :     // column vector
     129                 :            :     LwpColumnLayout ** m_pColumns;
     130                 :            : 
     131                 :            : public:
     132                 :            :     void XFConvert(XFContentContainer* pCont);
     133                 :            :     void ConvertTable(XFTable* pXFTable,sal_uInt16 nStartRow,
     134                 :            :                 sal_uInt16 nEndRow,sal_uInt8 nStartCol,sal_uInt8 nEndCol);
     135                 :          0 :     OUString GetDefaultRowStyleName(){return m_DefaultRowStyleName;}
     136                 :            :     void SetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol,XFCell* pXFCell);
     137                 :            :     XFCell* GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol);
     138                 :          0 :     std::map<sal_uInt16,LwpRowLayout*> GetRowsMap(){return m_RowsMap;}
     139                 :            :     LwpRowLayout* GetRowLayout(sal_uInt16 nRow);
     140                 :            : private:
     141                 :            :     void ConvertDefaultRow(XFTable* pXFTable,sal_uInt8 nStartCol,
     142                 :            :                 sal_uInt8 nEndCol,sal_uInt16 nRowID);
     143                 :            :     void ConvertColumn(XFTable *pXFTable,sal_uInt8 nStartCol,sal_uInt8 nEndCol);
     144                 :            :     sal_uInt16 ConvertHeadingRow(XFTable* pXFTable,sal_uInt16 nStartHeadRow,sal_uInt16 nEndHeadRow);
     145                 :            :     sal_Bool  FindSplitColMark(XFTable* pXFTable,sal_uInt8* pCellMark,sal_uInt8& nMaxColSpan);
     146                 :            :     void SplitRowToCells(XFTable* pTmpTable,XFTable* pXFTable,
     147                 :            :                 sal_uInt8 nFirstColSpann,sal_uInt8* pCellMark);
     148                 :            : 
     149                 :            :     std::map<sal_uInt16,LwpRowLayout*> m_RowsMap;
     150                 :            :     void SplitConflictCells();
     151                 :            :     XFTable* m_pXFTable;
     152                 :            :     std::map<std::pair<sal_uInt16,sal_uInt8>,XFCell*> m_CellsMap;
     153                 :            : 
     154                 :            :     void PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID);
     155                 :            : };
     156                 :            : /**
     157                 :            :  * @brief
     158                 :            :  * VO_SUPERTABLELAYOUT object
     159                 :            :  */
     160                 :            : class LwpSuperTableLayout: public LwpPlacableLayout
     161                 :            : {
     162                 :            : public:
     163                 :            :     LwpSuperTableLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     164                 :            :     virtual ~LwpSuperTableLayout();
     165                 :         33 :     virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_SUPERTABLE_LAYOUT;}
     166                 :            :     void RegisterNewStyle();
     167                 :            :     // for table style
     168                 :            :     // add by , 06/03/2005
     169                 :            :     void ApplyPatternFill(XFTableStyle* pTableStyle);
     170                 :            :     void ApplyBackGround(XFTableStyle* pTableStyle);
     171                 :            :     // end add
     172                 :            : 
     173                 :            :     void ApplyBackColor(XFTableStyle *pTableStyle);
     174                 :            :     void ApplyShadow(XFTableStyle *pTableStyle);
     175                 :            :     double GetWidth();
     176                 :            :     double GetTableWidth();
     177                 :            :     void ApplyWatermark(XFTableStyle *pTableStyle);
     178                 :            :     void ApplyAlignment(XFTableStyle * pTableStyle);
     179                 :            :     void XFConvert(XFContentContainer* pCont);
     180                 :            :     // for frame style
     181                 :            :     virtual void XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart = 0, sal_Int32 nEnd = 0, sal_Bool bAll = sal_False);
     182                 :            :     void RegisterFrameStyle();
     183                 :            :     LwpTableHeadingLayout* GetTableHeadingLayout();
     184                 :            : protected:
     185                 :            :     void Read();
     186                 :            :     LwpTableLayout* GetTableLayout();
     187                 :            :     sal_Bool IsSizeRightToContent();
     188                 :            :     sal_Bool IsJustifiable();
     189                 :            :     LwpFrame* m_pFrame;
     190                 :            : 
     191                 :            : private:
     192                 :            : };
     193                 :            : /**
     194                 :            :  * @brief
     195                 :            :  * VO_COLUMNLAYOUT object
     196                 :            :  */
     197                 :            : class LwpColumnLayout : public LwpVirtualLayout
     198                 :            : {
     199                 :            : public:
     200                 :            :     LwpColumnLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     201                 :            :     virtual ~LwpColumnLayout();
     202                 :          0 :     virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_COLUMN_LAYOUT;}
     203                 :          0 :     sal_uInt32 GetColumnID(){return ccolid;}
     204                 :          0 :     double GetWidth(){return LwpTools::ConvertFromUnitsToMetric(cwidth);}
     205                 :            :     using LwpVirtualLayout::RegisterStyle;
     206                 :            :     void RegisterStyle(double dCalculatedWidth);
     207                 :          0 :     sal_Bool IsJustifiable(){return (( m_nAttributes2 & STYLE2_JUSTIFIABLE) != 0);}
     208                 :            : protected:
     209                 :            :     void Read();
     210                 :            :     sal_uInt8 ccolid;
     211                 :            :     sal_Int32 cwidth;
     212                 :            : 
     213                 :            : };
     214                 :            : /**
     215                 :            :  * @brief
     216                 :            :  * VO_TABLEHEADINGLAYOUT object
     217                 :            :  */
     218                 :            : class LwpTableHeadingLayout : public LwpTableLayout
     219                 :            : {
     220                 :            : public:
     221                 :            :     LwpTableHeadingLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     222                 :            :     virtual ~LwpTableHeadingLayout();
     223                 :          0 :     virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_TABLE_HEADING_LAYOUT;}
     224                 :            :     void GetStartEndRow(sal_uInt16& nStartRow, sal_uInt16& nEndRow);
     225                 :            :     LwpRowHeadingLayout * GetFirstRowHeadingLayout();
     226                 :            : protected:
     227                 :            :     void Read();
     228                 :            :     sal_uInt16 cStartRow;
     229                 :            :     sal_uInt16 cEndRow;
     230                 :            : };
     231                 :            : /**
     232                 :            :  * @brief
     233                 :            :  * VO_SUPERPARALLELCOLUMNLAYOUT object
     234                 :            :  */
     235                 :            : class LwpSuperParallelColumnLayout : public LwpSuperTableLayout
     236                 :            : {
     237                 :            : public:
     238                 :            :     LwpSuperParallelColumnLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     239                 :            :     virtual ~LwpSuperParallelColumnLayout();
     240                 :            : protected:
     241                 :            :     void Read();
     242                 :            : };
     243                 :            : 
     244                 :            : /**
     245                 :            :  * @brief
     246                 :            :  * VO_PCOLLAYOUT object
     247                 :            :  */
     248                 :            : class LwpParallelColumnsLayout : public LwpTableLayout
     249                 :            : {
     250                 :            : public:
     251                 :            :     LwpParallelColumnsLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     252                 :            :     virtual ~LwpParallelColumnsLayout();
     253                 :            : protected:
     254                 :            :     void Read();
     255                 :            : };
     256                 :            : 
     257                 :            : class LwpSuperGlossaryLayout : public LwpSuperTableLayout
     258                 :            : {
     259                 :            : public:
     260                 :            :     LwpSuperGlossaryLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     261                 :            :     virtual ~LwpSuperGlossaryLayout();
     262                 :            : protected:
     263                 :            :     void Read();
     264                 :            : };
     265                 :            : 
     266                 :            : #include "lwpcelllayout.hxx"
     267                 :            : #include "lwprowlayout.hxx"
     268                 :            : 
     269                 :            : #endif
     270                 :            : 
     271                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10