LCOV - code coverage report
Current view: top level - sw/source/core/doc - tblafmt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 604 0.0 %
Date: 2012-08-25 Functions: 0 40 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1190 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <tools/resid.hxx>
      30                 :            : #include <tools/stream.hxx>
      31                 :            : #include <tools/shl.hxx>
      32                 :            : #include <vcl/svapp.hxx>
      33                 :            : #include <sfx2/docfile.hxx>
      34                 :            : #include <svl/urihelper.hxx>
      35                 :            : #include <svl/zforlist.hxx>
      36                 :            : #include <svl/zformat.hxx>
      37                 :            : #include <unotools/pathoptions.hxx>
      38                 :            : #include <sfx2/app.hxx>
      39                 :            : #include <svx/dialmgr.hxx>
      40                 :            : #include <svx/dialogs.hrc>
      41                 :            : #include <swtable.hxx>
      42                 :            : #include <swtblfmt.hxx>
      43                 :            : #include <com/sun/star/text/VertOrientation.hpp>
      44                 :            : #include <swtypes.hxx>
      45                 :            : #include <doc.hxx>
      46                 :            : #include <poolfmt.hxx>
      47                 :            : #include <tblafmt.hxx>
      48                 :            : #include <cellatr.hxx>
      49                 :            : #include <SwStyleNameMapper.hxx>
      50                 :            : #include <hintids.hxx>
      51                 :            : #include <fmtornt.hxx>
      52                 :            : #include <editsh.hxx>
      53                 :            : 
      54                 :            : using ::editeng::SvxBorderLine;
      55                 :            : 
      56                 :            : // until SO5PF
      57                 :            : const sal_uInt16 AUTOFORMAT_ID_X        = 9501;
      58                 :            : const sal_uInt16 AUTOFORMAT_ID_358      = 9601;
      59                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_X   = 9502;
      60                 :            : 
      61                 :            : // from SO5
      62                 :            : //! In follow-up versions these IDs' values need to increase
      63                 :            : const sal_uInt16 AUTOFORMAT_ID_504      = 9801;
      64                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802;
      65                 :            : 
      66                 :            : const sal_uInt16 AUTOFORMAT_ID_552      = 9901;
      67                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_552 = 9902;
      68                 :            : 
      69                 :            : // --- from 641 on: CJK and CTL font settings
      70                 :            : const sal_uInt16 AUTOFORMAT_ID_641      = 10001;
      71                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002;
      72                 :            : 
      73                 :            : // --- from 680/dr14 on: diagonal frame lines
      74                 :            : const sal_uInt16 AUTOFORMAT_ID_680DR14      = 10011;
      75                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012;
      76                 :            : 
      77                 :            : // --- from 680/dr25 on: store strings as UTF-8
      78                 :            : const sal_uInt16 AUTOFORMAT_ID_680DR25      = 10021;
      79                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_680DR25 = 10022;
      80                 :            : 
      81                 :            : // --- from DEV300/overline2 on: overline
      82                 :            : const sal_uInt16 AUTOFORMAT_ID_300OVRLN      = 10031;
      83                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032;
      84                 :            : 
      85                 :            : // --- Bug fix to fdo#31005: Table Autoformats does not save/apply all properties (Writer and Calc)
      86                 :            : const sal_uInt16 AUTOFORMAT_ID_31005      = 10041;
      87                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID_31005 = 10042;
      88                 :            : 
      89                 :            : // current version
      90                 :            : const sal_uInt16 AUTOFORMAT_ID          = AUTOFORMAT_ID_31005;
      91                 :            : const sal_uInt16 AUTOFORMAT_DATA_ID     = AUTOFORMAT_DATA_ID_31005;
      92                 :            : const sal_uInt16 AUTOFORMAT_FILE_VERSION= SOFFICE_FILEFORMAT_50;
      93                 :            : 
      94                 :            : SwBoxAutoFmt* SwTableAutoFmt::pDfltBoxAutoFmt = 0;
      95                 :            : 
      96                 :            : #define sAutoTblFmtName "autotbl.fmt"
      97                 :            : 
      98                 :            : namespace
      99                 :            : {
     100                 :            :     /// Begins a writer-specific data block. Call before serializing any writer-specific properties.
     101                 :          0 :     sal_uInt64 BeginSwBlock(SvStream& rStream)
     102                 :            :     {
     103                 :            :         // We need to write down the offset of the end of the writer-specific data, so that
     104                 :            :         // calc can skip it. We'll only have that value after writing the data, so we
     105                 :            :         // write a placeholder value first, write the data, then jump back and write the
     106                 :            :         // real offset.
     107                 :            : 
     108                 :            :         // Note that we explicitly use sal_uInt64 instead of sal_Size (which can be 32
     109                 :            :         // or 64 depending on platform) to ensure 64-bit portability on this front. I don't
     110                 :            :         // actually know if autotbl.fmt as a whole is portable, since that requires all serialization
     111                 :            :         // logic to be written with portability in mind.
     112                 :          0 :         sal_uInt64 whereToWriteEndOfSwBlock = rStream.Tell();
     113                 :            : 
     114                 :          0 :         sal_uInt64 endOfSwBlock = 0;
     115                 :          0 :         rStream << endOfSwBlock;
     116                 :            : 
     117                 :          0 :         return whereToWriteEndOfSwBlock;
     118                 :            :     }
     119                 :            : 
     120                 :            :     /// Ends a writer-specific data block. Call after serializing writer-specific properties.
     121                 :            :     /// Closes a corresponding BeginSwBlock call.
     122                 :          0 :     void EndSwBlock(SvStream& rStream, sal_uInt64 whereToWriteEndOfSwBlock)
     123                 :            :     {
     124                 :          0 :         sal_uInt64 endOfSwBlock = rStream.Tell();
     125                 :          0 :         rStream.Seek(whereToWriteEndOfSwBlock);
     126                 :          0 :         rStream << endOfSwBlock;
     127                 :          0 :         rStream.Seek(endOfSwBlock);
     128                 :          0 :     }
     129                 :            : 
     130                 :            :     /**
     131                 :            :     Helper class for writer-specific blocks. Begins a writer-specific block on construction,
     132                 :            :     and closes it on destruction.
     133                 :            : 
     134                 :            :     See also: BeginSwBlock and EndSwBlock.
     135                 :            :     */
     136                 :            :     class WriterSpecificAutoFormatBlock : ::boost::noncopyable
     137                 :            :     {
     138                 :            :     public:
     139                 :          0 :         WriterSpecificAutoFormatBlock(SvStream &rStream) : _rStream(rStream)
     140                 :            :         {
     141         [ #  # ]:          0 :             _whereToWriteEndOfBlock = BeginSwBlock(rStream);
     142                 :          0 :         }
     143                 :            : 
     144                 :          0 :         ~WriterSpecificAutoFormatBlock()
     145                 :          0 :         {
     146         [ #  # ]:          0 :             EndSwBlock(_rStream, _whereToWriteEndOfBlock);
     147                 :          0 :         }
     148                 :            : 
     149                 :            :     private:
     150                 :            :         SvStream &_rStream;
     151                 :            :         sal_uInt64 _whereToWriteEndOfBlock;
     152                 :            :     };
     153                 :            : 
     154                 :            :     /// Checks whether a writer-specific block exists (i.e. size is not zero)
     155                 :          0 :     sal_Bool WriterSpecificBlockExists(SvStream &stream)
     156                 :            :     {
     157                 :          0 :         sal_uInt64 endOfSwBlock = 0;
     158         [ #  # ]:          0 :         stream >> endOfSwBlock;
     159                 :            : 
     160                 :            :         // end-of-block pointing to itself indicates a zero-size block.
     161                 :          0 :         return endOfSwBlock != stream.Tell();
     162                 :            :     }
     163                 :            : }
     164                 :            : 
     165                 :            : 
     166                 :            : // Struct with version numbers of the Items
     167                 :            : 
     168                 :            : struct SwAfVersions
     169                 :            : {
     170                 :            : public:
     171                 :            :     sal_uInt16 nFontVersion;
     172                 :            :     sal_uInt16 nFontHeightVersion;
     173                 :            :     sal_uInt16 nWeightVersion;
     174                 :            :     sal_uInt16 nPostureVersion;
     175                 :            :     sal_uInt16 nUnderlineVersion;
     176                 :            :     sal_uInt16 nOverlineVersion;
     177                 :            :     sal_uInt16 nCrossedOutVersion;
     178                 :            :     sal_uInt16 nContourVersion;
     179                 :            :     sal_uInt16 nShadowedVersion;
     180                 :            :     sal_uInt16 nColorVersion;
     181                 :            :     sal_uInt16 nBoxVersion;
     182                 :            :     sal_uInt16 nLineVersion;
     183                 :            :     sal_uInt16 nBrushVersion;
     184                 :            : 
     185                 :            :     sal_uInt16 nAdjustVersion;
     186                 :            :     sal_uInt16 m_nTextOrientationVersion;
     187                 :            :     sal_uInt16 m_nVerticalAlignmentVersion;
     188                 :            : 
     189                 :            :     sal_uInt16 nHorJustifyVersion;
     190                 :            :     sal_uInt16 nVerJustifyVersion;
     191                 :            :     sal_uInt16 nOrientationVersion;
     192                 :            :     sal_uInt16 nMarginVersion;
     193                 :            :     sal_uInt16 nBoolVersion;
     194                 :            :     sal_uInt16 nInt32Version;
     195                 :            :     sal_uInt16 nRotateModeVersion;
     196                 :            : 
     197                 :            :     sal_uInt16 nNumFmtVersion;
     198                 :            : 
     199                 :            :     SwAfVersions();
     200                 :            :     void Load( SvStream& rStream, sal_uInt16 nVer );
     201                 :            : };
     202                 :            : 
     203                 :          0 : SwAfVersions::SwAfVersions() :
     204                 :            :     nFontVersion(0),
     205                 :            :     nFontHeightVersion(0),
     206                 :            :     nWeightVersion(0),
     207                 :            :     nPostureVersion(0),
     208                 :            :     nUnderlineVersion(0),
     209                 :            :     nOverlineVersion(0),
     210                 :            :     nCrossedOutVersion(0),
     211                 :            :     nContourVersion(0),
     212                 :            :     nShadowedVersion(0),
     213                 :            :     nColorVersion(0),
     214                 :            :     nBoxVersion(0),
     215                 :            :     nLineVersion(0),
     216                 :            :     nBrushVersion(0),
     217                 :            :     nAdjustVersion(0),
     218                 :            :     m_nTextOrientationVersion(0),
     219                 :            :     m_nVerticalAlignmentVersion(0),
     220                 :            :     nHorJustifyVersion(0),
     221                 :            :     nVerJustifyVersion(0),
     222                 :            :     nOrientationVersion(0),
     223                 :            :     nMarginVersion(0),
     224                 :            :     nBoolVersion(0),
     225                 :            :     nInt32Version(0),
     226                 :            :     nRotateModeVersion(0),
     227                 :          0 :     nNumFmtVersion(0)
     228                 :            : {
     229                 :          0 : }
     230                 :            : 
     231                 :          0 : void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer )
     232                 :            : {
     233                 :          0 :     rStream >> nFontVersion;
     234                 :          0 :     rStream >> nFontHeightVersion;
     235                 :          0 :     rStream >> nWeightVersion;
     236                 :          0 :     rStream >> nPostureVersion;
     237                 :          0 :     rStream >> nUnderlineVersion;
     238         [ #  # ]:          0 :     if ( nVer >= AUTOFORMAT_ID_300OVRLN )
     239                 :          0 :         rStream >> nOverlineVersion;
     240                 :          0 :     rStream >> nCrossedOutVersion;
     241                 :          0 :     rStream >> nContourVersion;
     242                 :          0 :     rStream >> nShadowedVersion;
     243                 :          0 :     rStream >> nColorVersion;
     244                 :          0 :     rStream >> nBoxVersion;
     245         [ #  # ]:          0 :     if ( nVer >= AUTOFORMAT_ID_680DR14 )
     246                 :          0 :         rStream >> nLineVersion;
     247                 :          0 :     rStream >> nBrushVersion;
     248                 :          0 :     rStream >> nAdjustVersion;
     249 [ #  # ][ #  # ]:          0 :     if (nVer >= AUTOFORMAT_ID_31005 && WriterSpecificBlockExists(rStream))
                 [ #  # ]
     250                 :            :     {
     251                 :          0 :         rStream >> m_nTextOrientationVersion;
     252                 :          0 :         rStream >> m_nVerticalAlignmentVersion;
     253                 :            :     }
     254                 :            : 
     255                 :          0 :     rStream >> nHorJustifyVersion;
     256                 :          0 :     rStream >> nVerJustifyVersion;
     257                 :          0 :     rStream >> nOrientationVersion;
     258                 :          0 :     rStream >> nMarginVersion;
     259                 :          0 :     rStream >> nBoolVersion;
     260         [ #  # ]:          0 :     if ( nVer >= AUTOFORMAT_ID_504 )
     261                 :            :     {
     262                 :          0 :         rStream >> nInt32Version;
     263                 :          0 :         rStream >> nRotateModeVersion;
     264                 :            :     }
     265                 :          0 :     rStream >> nNumFmtVersion;
     266                 :          0 : }
     267                 :            : 
     268                 :            : //  ---------------------------------------------------------------------------
     269                 :            : 
     270                 :          0 : SwBoxAutoFmt::SwBoxAutoFmt()
     271                 :          0 :     : aFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ) ),
     272                 :            :     aHeight( 240, 100, RES_CHRATR_FONTSIZE ),
     273                 :            :     aWeight( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ),
     274                 :            :     aPosture( ITALIC_NONE, RES_CHRATR_POSTURE ),
     275                 :            : 
     276         [ #  # ]:          0 :     aCJKFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CJK_FONT ) ),
     277                 :            :     aCJKHeight( 240, 100, RES_CHRATR_CJK_FONTSIZE ),
     278                 :            :     aCJKWeight( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ),
     279                 :            :     aCJKPosture( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ),
     280                 :            : 
     281         [ #  # ]:          0 :     aCTLFont( *(SvxFontItem*)GetDfltAttr( RES_CHRATR_CTL_FONT ) ),
     282                 :            :     aCTLHeight( 240, 100, RES_CHRATR_CTL_FONTSIZE ),
     283                 :            :     aCTLWeight( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ),
     284                 :            :     aCTLPosture( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ),
     285                 :            : 
     286                 :            :     aUnderline( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ),
     287                 :            :     aOverline( UNDERLINE_NONE, RES_CHRATR_OVERLINE ),
     288                 :            :     aCrossedOut( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ),
     289                 :            :     aContour( sal_False, RES_CHRATR_CONTOUR ),
     290                 :            :     aShadowed( sal_False, RES_CHRATR_SHADOWED ),
     291                 :            :     aColor( RES_CHRATR_COLOR ),
     292                 :            :     aBox( RES_BOX ),
     293                 :            :     aTLBR( 0 ),
     294                 :            :     aBLTR( 0 ),
     295                 :            :     aBackground( RES_BACKGROUND ),
     296                 :            :     aAdjust( SVX_ADJUST_LEFT, RES_PARATR_ADJUST ),
     297                 :            :     m_aTextOrientation(FRMDIR_ENVIRONMENT, RES_FRAMEDIR),
     298                 :            :     m_aVerticalAlignment(0, com::sun::star::text::VertOrientation::NONE, com::sun::star::text::RelOrientation::FRAME),
     299                 :            :     aHorJustify( SVX_HOR_JUSTIFY_STANDARD, 0),
     300                 :            :     aVerJustify( SVX_VER_JUSTIFY_STANDARD, 0),
     301                 :            :     aStacked( 0 ),
     302                 :            :     aMargin( 0 ),
     303                 :            :     aLinebreak( 0 ),
     304                 :            :     aRotateAngle( 0 ),
     305                 :            : 
     306                 :            : // FIXME - add attribute IDs for the diagonal line items
     307                 :            : //    aTLBR( RES_... ),
     308                 :            : //    aBLTR( RES_... ),
     309 [ #  # ][ #  # ]:          0 :     aRotateMode( SVX_ROTATE_MODE_STANDARD, 0 )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     310                 :            : {
     311         [ #  # ]:          0 :     eSysLanguage = eNumFmtLanguage = static_cast<LanguageType>(::GetAppLanguage());
     312                 :          0 :     aBox.SetDistance( 55 );
     313                 :          0 : }
     314                 :            : 
     315                 :            : 
     316                 :          0 : SwBoxAutoFmt::SwBoxAutoFmt( const SwBoxAutoFmt& rNew )
     317                 :            :     : aFont( rNew.aFont ),
     318                 :            :     aHeight( rNew.aHeight ),
     319                 :            :     aWeight( rNew.aWeight ),
     320                 :            :     aPosture( rNew.aPosture ),
     321                 :            :     aCJKFont( rNew.aCJKFont ),
     322                 :            :     aCJKHeight( rNew.aCJKHeight ),
     323                 :            :     aCJKWeight( rNew.aCJKWeight ),
     324                 :            :     aCJKPosture( rNew.aCJKPosture ),
     325                 :            :     aCTLFont( rNew.aCTLFont ),
     326                 :            :     aCTLHeight( rNew.aCTLHeight ),
     327                 :            :     aCTLWeight( rNew.aCTLWeight ),
     328                 :            :     aCTLPosture( rNew.aCTLPosture ),
     329                 :            :     aUnderline( rNew.aUnderline ),
     330                 :            :     aOverline( rNew.aOverline ),
     331                 :            :     aCrossedOut( rNew.aCrossedOut ),
     332                 :            :     aContour( rNew.aContour ),
     333                 :            :     aShadowed( rNew.aShadowed ),
     334                 :            :     aColor( rNew.aColor ),
     335                 :            :     aBox( rNew.aBox ),
     336                 :            :     aTLBR( rNew.aTLBR ),
     337                 :            :     aBLTR( rNew.aBLTR ),
     338                 :            :     aBackground( rNew.aBackground ),
     339                 :            :     aAdjust( rNew.aAdjust ),
     340                 :            :     m_aTextOrientation(rNew.m_aTextOrientation),
     341                 :            :     m_aVerticalAlignment(rNew.m_aVerticalAlignment),
     342                 :            :     aHorJustify( rNew.aHorJustify ),
     343                 :            :     aVerJustify( rNew.aVerJustify ),
     344                 :            :     aStacked( rNew.aStacked ),
     345                 :            :     aMargin( rNew.aMargin ),
     346                 :            :     aLinebreak( rNew.aLinebreak ),
     347                 :            :     aRotateAngle( rNew.aRotateAngle ),
     348                 :            :     aRotateMode( rNew.aRotateMode ),
     349                 :            :     sNumFmtString( rNew.sNumFmtString ),
     350                 :            :     eSysLanguage( rNew.eSysLanguage ),
     351 [ #  # ][ #  # ]:          0 :     eNumFmtLanguage( rNew.eNumFmtLanguage )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     352                 :            : {
     353                 :          0 : }
     354                 :            : 
     355                 :            : 
     356 [ #  # ][ #  # ]:          0 : SwBoxAutoFmt::~SwBoxAutoFmt()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     357                 :            : {
     358                 :          0 : }
     359                 :            : 
     360                 :          0 : SwBoxAutoFmt& SwBoxAutoFmt::operator=( const SwBoxAutoFmt& rNew )
     361                 :            : {
     362                 :          0 :     aFont = rNew.aFont;
     363                 :          0 :     aHeight = rNew.aHeight;
     364                 :          0 :     aWeight = rNew.aWeight;
     365                 :          0 :     aPosture = rNew.aPosture;
     366                 :          0 :     aCJKFont = rNew.aCJKFont;
     367                 :          0 :     aCJKHeight = rNew.aCJKHeight;
     368                 :          0 :     aCJKWeight = rNew.aCJKWeight;
     369                 :          0 :     aCJKPosture = rNew.aCJKPosture;
     370                 :          0 :     aCTLFont = rNew.aCTLFont;
     371                 :          0 :     aCTLHeight = rNew.aCTLHeight;
     372                 :          0 :     aCTLWeight = rNew.aCTLWeight;
     373                 :          0 :     aCTLPosture = rNew.aCTLPosture;
     374                 :          0 :     aUnderline = rNew.aUnderline;
     375                 :          0 :     aOverline = rNew.aOverline;
     376                 :          0 :     aCrossedOut = rNew.aCrossedOut;
     377                 :          0 :     aContour = rNew.aContour;
     378                 :          0 :     aShadowed = rNew.aShadowed;
     379                 :          0 :     aColor = rNew.aColor;
     380                 :          0 :     SetAdjust( rNew.aAdjust );
     381                 :          0 :     m_aTextOrientation = rNew.m_aTextOrientation;
     382                 :          0 :     m_aVerticalAlignment = rNew.m_aVerticalAlignment;
     383                 :          0 :     aBox = rNew.aBox;
     384                 :          0 :     aTLBR = rNew.aTLBR;
     385                 :          0 :     aBLTR = rNew.aBLTR;
     386                 :          0 :     aBackground = rNew.aBackground;
     387                 :            : 
     388                 :          0 :     aHorJustify = rNew.aHorJustify;
     389                 :          0 :     aVerJustify = rNew.aVerJustify;
     390                 :          0 :     aStacked.SetValue( rNew.aStacked.GetValue() );
     391                 :          0 :     aMargin = rNew.aMargin;
     392                 :          0 :     aLinebreak.SetValue( rNew.aLinebreak.GetValue() );
     393                 :          0 :     aRotateAngle.SetValue( rNew.aRotateAngle.GetValue() );
     394                 :          0 :     aRotateMode.SetValue( rNew.aRotateMode.GetValue() );
     395                 :            : 
     396                 :          0 :     sNumFmtString = rNew.sNumFmtString;
     397                 :          0 :     eSysLanguage = rNew.eSysLanguage;
     398                 :          0 :     eNumFmtLanguage = rNew.eNumFmtLanguage;
     399                 :            : 
     400                 :          0 :     return *this;
     401                 :            : }
     402                 :            : 
     403                 :            : 
     404                 :            : #define READ( aItem, aItemType, nVers )\
     405                 :            :     pNew = aItem.Create(rStream, nVers ); \
     406                 :            :     aItem = *(aItemType*)pNew; \
     407                 :            :     delete pNew;
     408                 :            : 
     409                 :          0 : sal_Bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer )
     410                 :            : {
     411                 :            :     SfxPoolItem* pNew;
     412         [ #  # ]:          0 :     SvxOrientationItem aOrientation( SVX_ORIENTATION_STANDARD, 0);
     413                 :            : 
     414 [ #  # ][ #  # ]:          0 :     READ( aFont,        SvxFontItem            , rVersions.nFontVersion)
         [ #  # ][ #  # ]
     415                 :            : 
     416         [ #  # ]:          0 :     if( rStream.GetStreamCharSet() == aFont.GetCharSet() )
     417         [ #  # ]:          0 :         aFont.SetCharSet(::osl_getThreadTextEncoding());
     418                 :            : 
     419 [ #  # ][ #  # ]:          0 :     READ( aHeight,      SvxFontHeightItem  , rVersions.nFontHeightVersion)
         [ #  # ][ #  # ]
     420 [ #  # ][ #  # ]:          0 :     READ( aWeight,      SvxWeightItem      , rVersions.nWeightVersion)
                 [ #  # ]
     421 [ #  # ][ #  # ]:          0 :     READ( aPosture,     SvxPostureItem     , rVersions.nPostureVersion)
                 [ #  # ]
     422                 :            :     // --- from 641 on: CJK and CTL font settings
     423         [ #  # ]:          0 :     if( AUTOFORMAT_DATA_ID_641 <= nVer )
     424                 :            :     {
     425 [ #  # ][ #  # ]:          0 :         READ( aCJKFont,                        SvxFontItem         , rVersions.nFontVersion)
         [ #  # ][ #  # ]
     426 [ #  # ][ #  # ]:          0 :         READ( aCJKHeight,       SvxFontHeightItem   , rVersions.nFontHeightVersion)
         [ #  # ][ #  # ]
     427 [ #  # ][ #  # ]:          0 :         READ( aCJKWeight,     SvxWeightItem       , rVersions.nWeightVersion)
                 [ #  # ]
     428 [ #  # ][ #  # ]:          0 :         READ( aCJKPosture,   SvxPostureItem      , rVersions.nPostureVersion)
                 [ #  # ]
     429 [ #  # ][ #  # ]:          0 :         READ( aCTLFont,                        SvxFontItem         , rVersions.nFontVersion)
         [ #  # ][ #  # ]
     430 [ #  # ][ #  # ]:          0 :         READ( aCTLHeight,        SvxFontHeightItem   , rVersions.nFontHeightVersion)
         [ #  # ][ #  # ]
     431 [ #  # ][ #  # ]:          0 :         READ( aCTLWeight,       SvxWeightItem       , rVersions.nWeightVersion)
                 [ #  # ]
     432 [ #  # ][ #  # ]:          0 :         READ( aCTLPosture,   SvxPostureItem      , rVersions.nPostureVersion)
                 [ #  # ]
     433                 :            :     }
     434 [ #  # ][ #  # ]:          0 :     READ( aUnderline,   SvxUnderlineItem   , rVersions.nUnderlineVersion)
         [ #  # ][ #  # ]
     435         [ #  # ]:          0 :     if( nVer >= AUTOFORMAT_DATA_ID_300OVRLN )
     436                 :            :     {
     437 [ #  # ][ #  # ]:          0 :         READ( aOverline,       SvxOverlineItem     , rVersions.nOverlineVersion)
         [ #  # ][ #  # ]
     438                 :            :     }
     439 [ #  # ][ #  # ]:          0 :     READ( aCrossedOut,  SvxCrossedOutItem  , rVersions.nCrossedOutVersion)
                 [ #  # ]
     440 [ #  # ][ #  # ]:          0 :     READ( aContour,     SvxContourItem     , rVersions.nContourVersion)
                 [ #  # ]
     441 [ #  # ][ #  # ]:          0 :     READ( aShadowed,    SvxShadowedItem       , rVersions.nShadowedVersion)
                 [ #  # ]
     442 [ #  # ][ #  # ]:          0 :     READ( aColor,       SvxColorItem       , rVersions.nColorVersion)
         [ #  # ][ #  # ]
     443                 :            : 
     444 [ #  # ][ #  # ]:          0 :     READ( aBox,         SvxBoxItem         , rVersions.nBoxVersion)
         [ #  # ][ #  # ]
     445                 :            : 
     446                 :            :     // --- from 680/dr14 on: diagonal frame lines
     447         [ #  # ]:          0 :     if( nVer >= AUTOFORMAT_DATA_ID_680DR14 )
     448                 :            :     {
     449 [ #  # ][ #  # ]:          0 :         READ( aTLBR, SvxLineItem, rVersions.nLineVersion)
         [ #  # ][ #  # ]
     450 [ #  # ][ #  # ]:          0 :         READ( aBLTR, SvxLineItem, rVersions.nLineVersion)
         [ #  # ][ #  # ]
     451                 :            :     }
     452                 :            : 
     453 [ #  # ][ #  # ]:          0 :     READ( aBackground,  SvxBrushItem        , rVersions.nBrushVersion)
         [ #  # ][ #  # ]
     454                 :            : 
     455         [ #  # ]:          0 :     pNew = aAdjust.Create(rStream, rVersions.nAdjustVersion );
     456                 :          0 :     SetAdjust( *(SvxAdjustItem*)pNew );
     457 [ #  # ][ #  # ]:          0 :     delete pNew;
     458                 :            : 
     459 [ #  # ][ #  # ]:          0 :     if (nVer >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
         [ #  # ][ #  # ]
     460                 :            :     {
     461 [ #  # ][ #  # ]:          0 :         READ(m_aTextOrientation, SvxFrameDirectionItem, rVersions.m_nTextOrientationVersion);
                 [ #  # ]
     462 [ #  # ][ #  # ]:          0 :         READ(m_aVerticalAlignment, SwFmtVertOrient, rVersions.m_nVerticalAlignmentVersion);
                 [ #  # ]
     463                 :            :     }
     464                 :            : 
     465 [ #  # ][ #  # ]:          0 :     READ( aHorJustify,  SvxHorJustifyItem , rVersions.nHorJustifyVersion)
                 [ #  # ]
     466 [ #  # ][ #  # ]:          0 :     READ( aVerJustify,  SvxVerJustifyItem   , rVersions.nVerJustifyVersion)
                 [ #  # ]
     467                 :            : 
     468 [ #  # ][ #  # ]:          0 :     READ( aOrientation, SvxOrientationItem  , rVersions.nOrientationVersion)
                 [ #  # ]
     469 [ #  # ][ #  # ]:          0 :     READ( aMargin, SvxMarginItem       , rVersions.nMarginVersion)
                 [ #  # ]
     470                 :            : 
     471         [ #  # ]:          0 :     pNew = aLinebreak.Create(rStream, rVersions.nBoolVersion );
     472                 :          0 :     aLinebreak.SetValue( ((SfxBoolItem*)pNew)->GetValue() );
     473 [ #  # ][ #  # ]:          0 :     delete pNew;
     474                 :            : 
     475         [ #  # ]:          0 :     if ( nVer >= AUTOFORMAT_DATA_ID_504 )
     476                 :            :     {
     477         [ #  # ]:          0 :         pNew = aRotateAngle.Create( rStream, rVersions.nInt32Version );
     478                 :          0 :         aRotateAngle.SetValue( ((SfxInt32Item*)pNew)->GetValue() );
     479 [ #  # ][ #  # ]:          0 :         delete pNew;
     480         [ #  # ]:          0 :         pNew = aRotateMode.Create( rStream, rVersions.nRotateModeVersion );
     481                 :          0 :         aRotateMode.SetValue( ((SvxRotateModeItem*)pNew)->GetValue() );
     482 [ #  # ][ #  # ]:          0 :         delete pNew;
     483                 :            :     }
     484                 :            : 
     485         [ #  # ]:          0 :     if( 0 == rVersions.nNumFmtVersion )
     486                 :            :     {
     487                 :            :         sal_uInt16 eSys, eLge;
     488                 :            :         // --- from 680/dr25 on: store strings as UTF-8
     489         [ #  # ]:          0 :         CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
     490 [ #  # ][ #  # ]:          0 :         sNumFmtString = rStream.ReadUniOrByteString( eCharSet );
     491 [ #  # ][ #  # ]:          0 :         rStream >> eSys >> eLge;
     492                 :          0 :         eSysLanguage = (LanguageType) eSys;
     493                 :          0 :         eNumFmtLanguage = (LanguageType) eLge;
     494         [ #  # ]:          0 :         if ( eSysLanguage == LANGUAGE_SYSTEM )      // from old versions (Calc)
     495         [ #  # ]:          0 :             eSysLanguage = static_cast<LanguageType>(::GetAppLanguage());
     496                 :            :     }
     497                 :            : 
     498         [ #  # ]:          0 :     aStacked.SetValue( aOrientation.IsStacked() );
     499         [ #  # ]:          0 :     aRotateAngle.SetValue( aOrientation.GetRotation( aRotateAngle.GetValue() ) );
     500                 :            : 
     501         [ #  # ]:          0 :     return 0 == rStream.GetError();
     502                 :            : }
     503                 :            : 
     504                 :          0 : sal_Bool SwBoxAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
     505                 :            : {
     506         [ #  # ]:          0 :     SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 );
     507                 :            : 
     508 [ #  # ][ #  # ]:          0 :     aFont.Store( rStream, aFont.GetVersion(fileVersion)  );
     509 [ #  # ][ #  # ]:          0 :     aHeight.Store( rStream, aHeight.GetVersion(fileVersion) );
     510 [ #  # ][ #  # ]:          0 :     aWeight.Store( rStream, aWeight.GetVersion(fileVersion) );
     511 [ #  # ][ #  # ]:          0 :     aPosture.Store( rStream, aPosture.GetVersion(fileVersion) );
     512 [ #  # ][ #  # ]:          0 :     aCJKFont.Store( rStream, aCJKFont.GetVersion(fileVersion)  );
     513 [ #  # ][ #  # ]:          0 :     aCJKHeight.Store( rStream, aCJKHeight.GetVersion(fileVersion) );
     514 [ #  # ][ #  # ]:          0 :     aCJKWeight.Store( rStream, aCJKWeight.GetVersion(fileVersion) );
     515 [ #  # ][ #  # ]:          0 :     aCJKPosture.Store( rStream, aCJKPosture.GetVersion(fileVersion) );
     516 [ #  # ][ #  # ]:          0 :     aCTLFont.Store( rStream, aCTLFont.GetVersion(fileVersion)  );
     517 [ #  # ][ #  # ]:          0 :     aCTLHeight.Store( rStream, aCTLHeight.GetVersion(fileVersion) );
     518 [ #  # ][ #  # ]:          0 :     aCTLWeight.Store( rStream, aCTLWeight.GetVersion(fileVersion) );
     519 [ #  # ][ #  # ]:          0 :     aCTLPosture.Store( rStream, aCTLPosture.GetVersion(fileVersion) );
     520 [ #  # ][ #  # ]:          0 :     aUnderline.Store( rStream, aUnderline.GetVersion(fileVersion) );
     521 [ #  # ][ #  # ]:          0 :     aOverline.Store( rStream, aOverline.GetVersion(fileVersion) );
     522 [ #  # ][ #  # ]:          0 :     aCrossedOut.Store( rStream, aCrossedOut.GetVersion(fileVersion) );
     523 [ #  # ][ #  # ]:          0 :     aContour.Store( rStream, aContour.GetVersion(fileVersion) );
     524 [ #  # ][ #  # ]:          0 :     aShadowed.Store( rStream, aShadowed.GetVersion(fileVersion) );
     525 [ #  # ][ #  # ]:          0 :     aColor.Store( rStream, aColor.GetVersion(fileVersion) );
     526 [ #  # ][ #  # ]:          0 :     aBox.Store( rStream, aBox.GetVersion(fileVersion) );
     527 [ #  # ][ #  # ]:          0 :     aTLBR.Store( rStream, aTLBR.GetVersion(fileVersion) );
     528 [ #  # ][ #  # ]:          0 :     aBLTR.Store( rStream, aBLTR.GetVersion(fileVersion) );
     529 [ #  # ][ #  # ]:          0 :     aBackground.Store( rStream, aBackground.GetVersion(fileVersion) );
     530                 :            : 
     531 [ #  # ][ #  # ]:          0 :     aAdjust.Store( rStream, aAdjust.GetVersion(fileVersion) );
     532         [ #  # ]:          0 :     if (fileVersion >= SOFFICE_FILEFORMAT_50)
     533                 :            :     {
     534         [ #  # ]:          0 :         WriterSpecificAutoFormatBlock block(rStream);
     535                 :            : 
     536 [ #  # ][ #  # ]:          0 :         m_aTextOrientation.Store(rStream, m_aTextOrientation.GetVersion(fileVersion));
     537 [ #  # ][ #  # ]:          0 :         m_aVerticalAlignment.Store(rStream, m_aVerticalAlignment.GetVersion(fileVersion));
                 [ #  # ]
     538                 :            :     }
     539                 :            : 
     540 [ #  # ][ #  # ]:          0 :     aHorJustify.Store( rStream, aHorJustify.GetVersion(fileVersion) );
     541 [ #  # ][ #  # ]:          0 :     aVerJustify.Store( rStream, aVerJustify.GetVersion(fileVersion) );
     542 [ #  # ][ #  # ]:          0 :     aOrientation.Store( rStream, aOrientation.GetVersion(fileVersion) );
     543 [ #  # ][ #  # ]:          0 :     aMargin.Store( rStream, aMargin.GetVersion(fileVersion) );
     544 [ #  # ][ #  # ]:          0 :     aLinebreak.Store( rStream, aLinebreak.GetVersion(fileVersion) );
     545                 :            :     // Calc Rotation from SO5
     546 [ #  # ][ #  # ]:          0 :     aRotateAngle.Store( rStream, aRotateAngle.GetVersion(fileVersion) );
     547 [ #  # ][ #  # ]:          0 :     aRotateMode.Store( rStream, aRotateMode.GetVersion(fileVersion) );
     548                 :            : 
     549                 :            :     // --- from 680/dr25 on: store strings as UTF-8
     550                 :            :     write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, sNumFmtString,
     551 [ #  # ][ #  # ]:          0 :         RTL_TEXTENCODING_UTF8);
     552 [ #  # ][ #  # ]:          0 :     rStream << (sal_uInt16)eSysLanguage << (sal_uInt16)eNumFmtLanguage;
     553                 :            : 
     554         [ #  # ]:          0 :     return 0 == rStream.GetError();
     555                 :            : }
     556                 :            : 
     557                 :            : 
     558                 :          0 : sal_Bool SwBoxAutoFmt::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const
     559                 :            : {
     560                 :          0 :     rStream << aFont.GetVersion( fileVersion );
     561                 :          0 :     rStream << aHeight.GetVersion( fileVersion );
     562                 :          0 :     rStream << aWeight.GetVersion( fileVersion );
     563                 :          0 :     rStream << aPosture.GetVersion( fileVersion );
     564                 :          0 :     rStream << aUnderline.GetVersion( fileVersion );
     565                 :          0 :     rStream << aOverline.GetVersion( fileVersion );
     566                 :          0 :     rStream << aCrossedOut.GetVersion( fileVersion );
     567                 :          0 :     rStream << aContour.GetVersion( fileVersion );
     568                 :          0 :     rStream << aShadowed.GetVersion( fileVersion );
     569                 :          0 :     rStream << aColor.GetVersion( fileVersion );
     570                 :          0 :     rStream << aBox.GetVersion( fileVersion );
     571                 :          0 :     rStream << aTLBR.GetVersion( fileVersion );
     572                 :          0 :     rStream << aBackground.GetVersion( fileVersion );
     573                 :            : 
     574                 :          0 :     rStream << aAdjust.GetVersion( fileVersion );
     575                 :            : 
     576         [ #  # ]:          0 :     if (fileVersion >= SOFFICE_FILEFORMAT_50)
     577                 :            :     {
     578         [ #  # ]:          0 :         WriterSpecificAutoFormatBlock block(rStream);
     579                 :            : 
     580 [ #  # ][ #  # ]:          0 :         rStream << m_aTextOrientation.GetVersion(fileVersion);
     581 [ #  # ][ #  # ]:          0 :         rStream << m_aVerticalAlignment.GetVersion(fileVersion);
                 [ #  # ]
     582                 :            :     }
     583                 :            : 
     584                 :          0 :     rStream << aHorJustify.GetVersion( fileVersion );
     585                 :          0 :     rStream << aVerJustify.GetVersion( fileVersion );
     586 [ #  # ][ #  # ]:          0 :     rStream << SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0).GetVersion( fileVersion );
     587                 :          0 :     rStream << aMargin.GetVersion( fileVersion );
     588                 :          0 :     rStream << aLinebreak.GetVersion( fileVersion );
     589                 :          0 :     rStream << aRotateAngle.GetVersion( fileVersion );
     590                 :          0 :     rStream << aRotateMode.GetVersion( fileVersion );
     591                 :            : 
     592                 :          0 :     rStream << (sal_uInt16)0;       // NumberFormat
     593                 :            : 
     594                 :          0 :     return 0 == rStream.GetError();
     595                 :            : }
     596                 :            : 
     597                 :            : 
     598                 :            : 
     599                 :          0 : SwTableAutoFmt::SwTableAutoFmt( const String& rName )
     600                 :            :     : aName( rName )
     601                 :            :     , nStrResId( USHRT_MAX )
     602                 :            :     , m_aBreak( SVX_BREAK_NONE, RES_BREAK )
     603                 :            :     , m_aKeepWithNextPara( sal_False, RES_KEEP )
     604                 :            :     , m_aRepeatHeading( 0 )
     605                 :            :     , m_bLayoutSplit( sal_True )
     606                 :            :     , m_bRowSplit( sal_True )
     607                 :            :     , m_bCollapsingBorders(sal_True)
     608 [ #  # ][ #  # ]:          0 :     , m_aShadow( RES_SHADOW )
         [ #  # ][ #  # ]
     609                 :            : {
     610                 :          0 :     bInclFont = sal_True;
     611                 :          0 :     bInclJustify = sal_True;
     612                 :          0 :     bInclFrame = sal_True;
     613                 :          0 :     bInclBackground = sal_True;
     614                 :          0 :     bInclValueFormat = sal_True;
     615                 :          0 :     bInclWidthHeight = sal_True;
     616                 :            : 
     617                 :          0 :     memset( aBoxAutoFmt, 0, sizeof( aBoxAutoFmt ) );
     618                 :          0 : }
     619                 :            : 
     620                 :            : 
     621                 :          0 : SwTableAutoFmt::SwTableAutoFmt( const SwTableAutoFmt& rNew )
     622                 :            :     : m_aBreak( rNew.m_aBreak )
     623                 :            :     , m_aKeepWithNextPara( sal_False, RES_KEEP )
     624 [ #  # ][ #  # ]:          0 :     , m_aShadow( RES_SHADOW )
         [ #  # ][ #  # ]
     625                 :            : {
     626         [ #  # ]:          0 :     for( sal_uInt8 n = 0; n < 16; ++n )
     627                 :          0 :         aBoxAutoFmt[ n ] = 0;
     628         [ #  # ]:          0 :     *this = rNew;
     629                 :          0 : }
     630                 :            : 
     631                 :          0 : SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
     632                 :            : {
     633         [ #  # ]:          0 :     for( sal_uInt8 n = 0; n < 16; ++n )
     634                 :            :     {
     635         [ #  # ]:          0 :         if( aBoxAutoFmt[ n ] )
     636         [ #  # ]:          0 :             delete aBoxAutoFmt[ n ];
     637                 :            : 
     638                 :          0 :         SwBoxAutoFmt* pFmt = rNew.aBoxAutoFmt[ n ];
     639         [ #  # ]:          0 :         if( pFmt )      // if is set -> copy
     640         [ #  # ]:          0 :             aBoxAutoFmt[ n ] = new SwBoxAutoFmt( *pFmt );
     641                 :            :         else            // else default
     642                 :          0 :             aBoxAutoFmt[ n ] = 0;
     643                 :            :     }
     644                 :            : 
     645                 :          0 :     aName = rNew.aName;
     646                 :          0 :     nStrResId = rNew.nStrResId;
     647                 :          0 :     bInclFont = rNew.bInclFont;
     648                 :          0 :     bInclJustify = rNew.bInclJustify;
     649                 :          0 :     bInclFrame = rNew.bInclFrame;
     650                 :          0 :     bInclBackground = rNew.bInclBackground;
     651                 :          0 :     bInclValueFormat = rNew.bInclValueFormat;
     652                 :          0 :     bInclWidthHeight = rNew.bInclWidthHeight;
     653                 :            : 
     654                 :          0 :     m_aBreak = rNew.m_aBreak;
     655                 :          0 :     m_aPageDesc = rNew.m_aPageDesc;
     656                 :          0 :     m_aKeepWithNextPara = rNew.m_aKeepWithNextPara;
     657                 :          0 :     m_aRepeatHeading = rNew.m_aRepeatHeading;
     658                 :          0 :     m_bLayoutSplit = rNew.m_bLayoutSplit;
     659                 :          0 :     m_bRowSplit = rNew.m_bRowSplit;
     660                 :          0 :     m_bCollapsingBorders = rNew.m_bCollapsingBorders;
     661                 :          0 :     m_aShadow = rNew.m_aShadow;
     662                 :            : 
     663                 :          0 :     return *this;
     664                 :            : }
     665                 :            : 
     666                 :            : 
     667 [ #  # ][ #  # ]:          0 : SwTableAutoFmt::~SwTableAutoFmt()
         [ #  # ][ #  # ]
     668                 :            : {
     669                 :          0 :     SwBoxAutoFmt** ppFmt = aBoxAutoFmt;
     670         [ #  # ]:          0 :     for( sal_uInt8 n = 0; n < 16; ++n, ++ppFmt )
     671         [ #  # ]:          0 :         if( *ppFmt )
     672 [ #  # ][ #  # ]:          0 :             delete *ppFmt;
     673                 :          0 : }
     674                 :            : 
     675                 :            : 
     676                 :          0 : void SwTableAutoFmt::SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos )
     677                 :            : {
     678                 :            :     OSL_ENSURE( nPos < 16, "wrong area" );
     679                 :            : 
     680                 :          0 :     SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
     681         [ #  # ]:          0 :     if( pFmt )      // if is set -> copy
     682                 :          0 :         *aBoxAutoFmt[ nPos ] = rNew;
     683                 :            :     else            // else set anew
     684         [ #  # ]:          0 :         aBoxAutoFmt[ nPos ] = new SwBoxAutoFmt( rNew );
     685                 :          0 : }
     686                 :            : 
     687                 :            : 
     688                 :          0 : const SwBoxAutoFmt& SwTableAutoFmt::GetBoxFmt( sal_uInt8 nPos ) const
     689                 :            : {
     690                 :            :     OSL_ENSURE( nPos < 16, "wrong area" );
     691                 :            : 
     692                 :          0 :     SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
     693         [ #  # ]:          0 :     if( pFmt )      // if is set -> copy
     694                 :          0 :         return *pFmt;
     695                 :            :     else            // else return the default
     696                 :            :     {
     697                 :            :         // If it doesn't exist yet:
     698         [ #  # ]:          0 :         if( !pDfltBoxAutoFmt )
     699         [ #  # ]:          0 :             pDfltBoxAutoFmt = new SwBoxAutoFmt;
     700                 :          0 :         return *pDfltBoxAutoFmt;
     701                 :            :     }
     702                 :            : }
     703                 :            : 
     704                 :            : 
     705                 :            : 
     706                 :          0 : void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos,
     707                 :            :                                     const SfxItemSet& rSet,
     708                 :            :                                     UpdateFlags eFlags,
     709                 :            :                                     SvNumberFormatter* pNFmtr)
     710                 :            : {
     711                 :            :     OSL_ENSURE( nPos < 16, "wrong area" );
     712                 :            : 
     713                 :          0 :     SwBoxAutoFmt* pFmt = aBoxAutoFmt[ nPos ];
     714         [ #  # ]:          0 :     if( !pFmt )     // if is set -> copy
     715                 :            :     {
     716         [ #  # ]:          0 :         pFmt = new SwBoxAutoFmt;
     717                 :          0 :         aBoxAutoFmt[ nPos ] = pFmt;
     718                 :            :     }
     719                 :            : 
     720         [ #  # ]:          0 :     if( UPDATE_CHAR & eFlags )
     721                 :            :     {
     722                 :          0 :         pFmt->SetFont( (SvxFontItem&)rSet.Get( RES_CHRATR_FONT ) );
     723                 :          0 :         pFmt->SetHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_FONTSIZE ) );
     724                 :          0 :         pFmt->SetWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_WEIGHT ) );
     725                 :          0 :         pFmt->SetPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_POSTURE ) );
     726                 :          0 :         pFmt->SetCJKFont( (SvxFontItem&)rSet.Get( RES_CHRATR_CJK_FONT ) );
     727                 :          0 :         pFmt->SetCJKHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_CJK_FONTSIZE ) );
     728                 :          0 :         pFmt->SetCJKWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_CJK_WEIGHT ) );
     729                 :          0 :         pFmt->SetCJKPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_CJK_POSTURE ) );
     730                 :          0 :         pFmt->SetCTLFont( (SvxFontItem&)rSet.Get( RES_CHRATR_CTL_FONT ) );
     731                 :          0 :         pFmt->SetCTLHeight( (SvxFontHeightItem&)rSet.Get( RES_CHRATR_CTL_FONTSIZE ) );
     732                 :          0 :         pFmt->SetCTLWeight( (SvxWeightItem&)rSet.Get( RES_CHRATR_CTL_WEIGHT ) );
     733                 :          0 :         pFmt->SetCTLPosture( (SvxPostureItem&)rSet.Get( RES_CHRATR_CTL_POSTURE ) );
     734                 :          0 :         pFmt->SetUnderline( (SvxUnderlineItem&)rSet.Get( RES_CHRATR_UNDERLINE ) );
     735                 :          0 :         pFmt->SetOverline( (SvxOverlineItem&)rSet.Get( RES_CHRATR_OVERLINE ) );
     736                 :          0 :         pFmt->SetCrossedOut( (SvxCrossedOutItem&)rSet.Get( RES_CHRATR_CROSSEDOUT ) );
     737                 :          0 :         pFmt->SetContour( (SvxContourItem&)rSet.Get( RES_CHRATR_CONTOUR ) );
     738                 :          0 :         pFmt->SetShadowed( (SvxShadowedItem&)rSet.Get( RES_CHRATR_SHADOWED ) );
     739                 :          0 :         pFmt->SetColor( (SvxColorItem&)rSet.Get( RES_CHRATR_COLOR ) );
     740                 :          0 :         pFmt->SetAdjust( (SvxAdjustItem&)rSet.Get( RES_PARATR_ADJUST ) );
     741                 :            :     }
     742         [ #  # ]:          0 :     if( UPDATE_BOX & eFlags )
     743                 :            :     {
     744 [ #  # ][ #  # ]:          0 :         pFmt->SetBox( (SvxBoxItem&)rSet.Get( RES_BOX ) );
     745                 :            : // FIXME - add attribute IDs for the diagonal line items
     746                 :            : //        pFmt->SetTLBR( (SvxLineItem&)rSet.Get( RES_... ) );
     747                 :            : //        pFmt->SetBLTR( (SvxLineItem&)rSet.Get( RES_... ) );
     748 [ #  # ][ #  # ]:          0 :         pFmt->SetBackground( (SvxBrushItem&)rSet.Get( RES_BACKGROUND ) );
     749         [ #  # ]:          0 :         pFmt->SetTextOrientation(static_cast<const SvxFrameDirectionItem&>(rSet.Get(RES_FRAMEDIR)));
     750         [ #  # ]:          0 :         pFmt->SetVerticalAlignment(static_cast<const SwFmtVertOrient&>(rSet.Get(RES_VERT_ORIENT)));
     751                 :            : 
     752                 :            :         const SwTblBoxNumFormat* pNumFmtItem;
     753                 :          0 :         const SvNumberformat* pNumFormat = 0;
     754         [ #  # ]:          0 :         if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, sal_True,
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     755         [ #  # ]:          0 :             (const SfxPoolItem**)&pNumFmtItem ) && pNFmtr &&
     756                 :          0 :             0 != (pNumFormat = pNFmtr->GetEntry( pNumFmtItem->GetValue() )) )
     757                 :          0 :             pFmt->SetValueFormat( ((SvNumberformat*)pNumFormat)->GetFormatstring(),
     758                 :          0 :                                     pNumFormat->GetLanguage(),
     759   [ #  #  #  # ]:          0 :                                     static_cast<LanguageType>(::GetAppLanguage()));
     760                 :            :         else
     761                 :            :         {
     762                 :            :             // default
     763                 :            :             pFmt->SetValueFormat( aEmptyStr, LANGUAGE_SYSTEM,
     764 [ #  # ][ #  # ]:          0 :                                   static_cast<LanguageType>(::GetAppLanguage() ));
     765                 :            :         }
     766                 :            :     }
     767                 :            : 
     768                 :            :     // we cannot handle the rest, that's specific to StarCalc
     769                 :          0 : }
     770                 :            : 
     771                 :            : 
     772                 :          0 : void SwTableAutoFmt::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
     773                 :            :                                  UpdateFlags eFlags, SvNumberFormatter* pNFmtr) const
     774                 :            : {
     775                 :          0 :     const SwBoxAutoFmt& rChg = GetBoxFmt( nPos );
     776                 :            : 
     777         [ #  # ]:          0 :     if( UPDATE_CHAR & eFlags )
     778                 :            :     {
     779         [ #  # ]:          0 :         if( IsFont() )
     780                 :            :         {
     781                 :          0 :             rSet.Put( rChg.GetFont() );
     782                 :          0 :             rSet.Put( rChg.GetHeight() );
     783                 :          0 :             rSet.Put( rChg.GetWeight() );
     784                 :          0 :             rSet.Put( rChg.GetPosture() );
     785                 :            :             // do not insert empty CJK font
     786                 :          0 :             const SvxFontItem& rCJKFont = rChg.GetCJKFont();
     787         [ #  # ]:          0 :             if( rCJKFont.GetStyleName().Len() )
     788                 :            :             {
     789                 :          0 :                 rSet.Put( rChg.GetCJKFont() );
     790                 :          0 :                 rSet.Put( rChg.GetCJKHeight() );
     791                 :          0 :                 rSet.Put( rChg.GetCJKWeight() );
     792                 :          0 :                 rSet.Put( rChg.GetCJKPosture() );
     793                 :            :             }
     794                 :            :             else
     795                 :            :             {
     796                 :          0 :                 rSet.Put( rChg.GetHeight(), RES_CHRATR_CJK_FONTSIZE );
     797                 :          0 :                 rSet.Put( rChg.GetWeight(), RES_CHRATR_CJK_WEIGHT );
     798                 :          0 :                 rSet.Put( rChg.GetPosture(), RES_CHRATR_CJK_POSTURE );
     799                 :            :             }
     800                 :            :             // do not insert empty CTL font
     801                 :          0 :             const SvxFontItem& rCTLFont = rChg.GetCTLFont();
     802         [ #  # ]:          0 :             if( rCTLFont.GetStyleName().Len() )
     803                 :            :             {
     804                 :          0 :                 rSet.Put( rChg.GetCTLFont() );
     805                 :          0 :                 rSet.Put( rChg.GetCTLHeight() );
     806                 :          0 :                 rSet.Put( rChg.GetCTLWeight() );
     807                 :          0 :                 rSet.Put( rChg.GetCTLPosture() );
     808                 :            :             }
     809                 :            :             else
     810                 :            :             {
     811                 :          0 :                 rSet.Put( rChg.GetHeight(), RES_CHRATR_CTL_FONTSIZE );
     812                 :          0 :                 rSet.Put( rChg.GetWeight(), RES_CHRATR_CTL_WEIGHT );
     813                 :          0 :                 rSet.Put( rChg.GetPosture(), RES_CHRATR_CTL_POSTURE );
     814                 :            :             }
     815                 :          0 :             rSet.Put( rChg.GetUnderline() );
     816                 :          0 :             rSet.Put( rChg.GetOverline() );
     817                 :          0 :             rSet.Put( rChg.GetCrossedOut() );
     818                 :          0 :             rSet.Put( rChg.GetContour() );
     819                 :          0 :             rSet.Put( rChg.GetShadowed() );
     820                 :          0 :             rSet.Put( rChg.GetColor() );
     821                 :            :         }
     822         [ #  # ]:          0 :         if( IsJustify() )
     823                 :          0 :             rSet.Put( rChg.GetAdjust() );
     824                 :            :     }
     825                 :            : 
     826         [ #  # ]:          0 :     if( UPDATE_BOX & eFlags )
     827                 :            :     {
     828         [ #  # ]:          0 :         if( IsFrame() )
     829                 :            :         {
     830                 :          0 :             rSet.Put( rChg.GetBox() );
     831                 :            : // FIXME - uncomment the lines to put the diagonal line items
     832                 :            : //            rSet.Put( rChg.GetTLBR() );
     833                 :            : //            rSet.Put( rChg.GetBLTR() );
     834                 :            :         }
     835         [ #  # ]:          0 :         if( IsBackground() )
     836                 :          0 :             rSet.Put( rChg.GetBackground() );
     837                 :            : 
     838                 :          0 :         rSet.Put(rChg.GetTextOrientation());
     839                 :          0 :         rSet.Put(rChg.GetVerticalAlignment());
     840                 :            : 
     841 [ #  # ][ #  # ]:          0 :         if( IsValueFormat() && pNFmtr )
                 [ #  # ]
     842                 :            :         {
     843         [ #  # ]:          0 :             String sFmt; LanguageType eLng, eSys;
     844         [ #  # ]:          0 :             rChg.GetValueFormat( sFmt, eLng, eSys );
     845         [ #  # ]:          0 :             if( sFmt.Len() )
     846                 :            :             {
     847                 :            :                 short nType;
     848                 :            :                 bool bNew;
     849                 :            :                 xub_StrLen nCheckPos;
     850                 :            :                 sal_uInt32 nKey = pNFmtr->GetIndexPuttingAndConverting( sFmt, eLng,
     851         [ #  # ]:          0 :                         eSys, nType, bNew, nCheckPos);
     852 [ #  # ][ #  # ]:          0 :                 rSet.Put( SwTblBoxNumFormat( nKey ));
                 [ #  # ]
     853                 :            :             }
     854                 :            :             else
     855 [ #  # ][ #  # ]:          0 :                 rSet.ClearItem( RES_BOXATR_FORMAT );
     856                 :            :         }
     857                 :            :     }
     858                 :            : 
     859                 :            :     // we cannot handle the rest, that's specific to StarCalc
     860                 :          0 : }
     861                 :            : 
     862                 :          0 : void SwTableAutoFmt::RestoreTableProperties(SwTable &table) const
     863                 :            : {
     864                 :          0 :     SwTableFmt *pFormat = table.GetTableFmt();
     865         [ #  # ]:          0 :     if (!pFormat)
     866                 :            :         return;
     867                 :            : 
     868                 :          0 :     SwDoc *pDoc = pFormat->GetDoc();
     869         [ #  # ]:          0 :     if (!pDoc)
     870                 :            :         return;
     871                 :            : 
     872         [ #  # ]:          0 :     SfxItemSet rSet(pDoc->GetAttrPool(), aTableSetRange);
     873                 :            : 
     874         [ #  # ]:          0 :     rSet.Put(m_aBreak);
     875         [ #  # ]:          0 :     rSet.Put(m_aPageDesc);
     876 [ #  # ][ #  # ]:          0 :     rSet.Put(SwFmtLayoutSplit(m_bLayoutSplit));
                 [ #  # ]
     877 [ #  # ][ #  # ]:          0 :     rSet.Put(SfxBoolItem(RES_COLLAPSING_BORDERS, m_bCollapsingBorders));
                 [ #  # ]
     878         [ #  # ]:          0 :     rSet.Put(m_aKeepWithNextPara);
     879         [ #  # ]:          0 :     rSet.Put(m_aShadow);
     880                 :            : 
     881         [ #  # ]:          0 :     pFormat->SetFmtAttr(rSet);
     882                 :            : 
     883         [ #  # ]:          0 :     SwEditShell *pShell = pDoc->GetEditShell();
     884 [ #  # ][ #  # ]:          0 :     pDoc->SetRowSplit(*pShell->getShellCrsr(false), SwFmtRowSplit(m_bRowSplit));
         [ #  # ][ #  # ]
     885                 :            : 
     886         [ #  # ]:          0 :     table.SetRowsToRepeat(m_aRepeatHeading);
     887                 :            : }
     888                 :            : 
     889                 :          0 : void SwTableAutoFmt::StoreTableProperties(const SwTable &table)
     890                 :            : {
     891                 :          0 :     SwTableFmt *pFormat = table.GetTableFmt();
     892         [ #  # ]:          0 :     if (!pFormat)
     893                 :            :         return;
     894                 :            : 
     895                 :          0 :     SwDoc *pDoc = pFormat->GetDoc();
     896         [ #  # ]:          0 :     if (!pDoc)
     897                 :            :         return;
     898                 :            : 
     899         [ #  # ]:          0 :     SwEditShell *pShell = pDoc->GetEditShell();
     900                 :          0 :     SwFmtRowSplit *pRowSplit = 0;
     901 [ #  # ][ #  # ]:          0 :     pDoc->GetRowSplit(*pShell->getShellCrsr(false), pRowSplit);
     902         [ #  # ]:          0 :     m_bRowSplit = pRowSplit ? pRowSplit->GetValue() : sal_False;
     903 [ #  # ][ #  # ]:          0 :     delete pRowSplit;
     904                 :          0 :     pRowSplit = 0;
     905                 :            : 
     906                 :          0 :     const SfxItemSet &rSet = pFormat->GetAttrSet();
     907                 :            : 
     908         [ #  # ]:          0 :     m_aBreak = static_cast<const SvxFmtBreakItem&>(rSet.Get(RES_BREAK));
     909 [ #  # ][ #  # ]:          0 :     m_aPageDesc = static_cast<const SwFmtPageDesc&>(rSet.Get(RES_PAGEDESC));
     910         [ #  # ]:          0 :     const SwFmtLayoutSplit &layoutSplit = static_cast<const SwFmtLayoutSplit&>(rSet.Get(RES_LAYOUT_SPLIT));
     911                 :          0 :     m_bLayoutSplit = layoutSplit.GetValue();
     912         [ #  # ]:          0 :     m_bCollapsingBorders = static_cast<const SfxBoolItem&>(rSet.Get(RES_COLLAPSING_BORDERS)).GetValue();
     913                 :            : 
     914         [ #  # ]:          0 :     m_aKeepWithNextPara = static_cast<const SvxFmtKeepItem&>(rSet.Get(RES_KEEP));
     915         [ #  # ]:          0 :     m_aRepeatHeading = table.GetRowsToRepeat();
     916         [ #  # ]:          0 :     m_aShadow = static_cast<const SvxShadowItem&>(rSet.Get(RES_SHADOW));
     917                 :            : }
     918                 :            : 
     919                 :          0 : sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions )
     920                 :            : {
     921                 :          0 :     sal_Bool    bRet = sal_True;
     922                 :          0 :     sal_uInt16  nVal = 0;
     923         [ #  # ]:          0 :     rStream >> nVal;
     924                 :          0 :     bRet = 0 == rStream.GetError();
     925                 :            : 
     926 [ #  # ][ #  # ]:          0 :     if( bRet && (nVal == AUTOFORMAT_DATA_ID_X ||
         [ #  # ][ #  # ]
     927                 :            :             (AUTOFORMAT_DATA_ID_504 <= nVal && nVal <= AUTOFORMAT_DATA_ID)) )
     928                 :            :     {
     929                 :            :         sal_Bool b;
     930                 :            :         // --- from 680/dr25 on: store strings as UTF-8
     931         [ #  # ]:          0 :         CharSet eCharSet = (nVal >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
     932 [ #  # ][ #  # ]:          0 :         aName = rStream.ReadUniOrByteString( eCharSet );
     933         [ #  # ]:          0 :         if( AUTOFORMAT_DATA_ID_552 <= nVal )
     934                 :            :         {
     935         [ #  # ]:          0 :             rStream >> nStrResId;
     936                 :          0 :             sal_uInt16 nId = RID_SVXSTR_TBLAFMT_BEGIN + nStrResId;
     937 [ #  # ][ #  # ]:          0 :             if( RID_SVXSTR_TBLAFMT_BEGIN <= nId &&
     938                 :            :                 nId < RID_SVXSTR_TBLAFMT_END )
     939                 :            :             {
     940 [ #  # ][ #  # ]:          0 :                 aName = SVX_RESSTR( nId );
                 [ #  # ]
     941                 :            :             }
     942                 :            :             else
     943                 :          0 :                 nStrResId = USHRT_MAX;
     944                 :            :         }
     945         [ #  # ]:          0 :         rStream >> b; bInclFont = b;
     946         [ #  # ]:          0 :         rStream >> b; bInclJustify = b;
     947         [ #  # ]:          0 :         rStream >> b; bInclFrame = b;
     948         [ #  # ]:          0 :         rStream >> b; bInclBackground = b;
     949         [ #  # ]:          0 :         rStream >> b; bInclValueFormat = b;
     950         [ #  # ]:          0 :         rStream >> b; bInclWidthHeight = b;
     951                 :            : 
     952 [ #  # ][ #  # ]:          0 :         if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
         [ #  # ][ #  # ]
     953                 :            :         {
     954                 :          0 :             SfxPoolItem* pNew = 0;
     955                 :            : 
     956 [ #  # ][ #  # ]:          0 :             READ(m_aBreak, SvxFmtBreakItem, AUTOFORMAT_FILE_VERSION);
                 [ #  # ]
     957 [ #  # ][ #  # ]:          0 :             READ(m_aPageDesc, SwFmtPageDesc, AUTOFORMAT_FILE_VERSION);
         [ #  # ][ #  # ]
     958 [ #  # ][ #  # ]:          0 :             READ(m_aKeepWithNextPara, SvxFmtKeepItem, AUTOFORMAT_FILE_VERSION);
                 [ #  # ]
     959                 :            : 
     960 [ #  # ][ #  # ]:          0 :             rStream >> m_aRepeatHeading >> m_bLayoutSplit >> m_bRowSplit >> m_bCollapsingBorders;
         [ #  # ][ #  # ]
     961                 :            : 
     962 [ #  # ][ #  # ]:          0 :             READ(m_aShadow, SvxShadowItem, AUTOFORMAT_FILE_VERSION);
                 [ #  # ]
     963                 :            :         }
     964                 :            : 
     965                 :          0 :         bRet = 0 == rStream.GetError();
     966                 :            : 
     967 [ #  # ][ #  # ]:          0 :         for( sal_uInt8 i = 0; bRet && i < 16; ++i )
                 [ #  # ]
     968                 :            :         {
     969 [ #  # ][ #  # ]:          0 :             SwBoxAutoFmt* pFmt = new SwBoxAutoFmt;
     970         [ #  # ]:          0 :             bRet = pFmt->Load( rStream, rVersions, nVal );
     971         [ #  # ]:          0 :             if( bRet )
     972                 :          0 :                 aBoxAutoFmt[ i ] = pFmt;
     973                 :            :             else
     974                 :            :             {
     975 [ #  # ][ #  # ]:          0 :                 delete pFmt;
     976                 :          0 :                 break;
     977                 :            :             }
     978                 :            :         }
     979                 :            :     }
     980                 :          0 :     return bRet;
     981                 :            : }
     982                 :            : 
     983                 :          0 : sal_Bool SwTableAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
     984                 :            : {
     985                 :          0 :     sal_uInt16 nVal = AUTOFORMAT_DATA_ID;
     986                 :            :     sal_Bool b;
     987                 :          0 :     rStream << nVal;
     988                 :            :     // --- from 680/dr25 on: store strings as UTF-8
     989                 :            :     write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, aName,
     990         [ #  # ]:          0 :         RTL_TEXTENCODING_UTF8 );
     991                 :          0 :     rStream << nStrResId;
     992                 :          0 :     rStream << ( b = bInclFont );
     993                 :          0 :     rStream << ( b = bInclJustify );
     994                 :          0 :     rStream << ( b = bInclFrame );
     995                 :          0 :     rStream << ( b = bInclBackground );
     996                 :          0 :     rStream << ( b = bInclValueFormat );
     997                 :          0 :     rStream << ( b = bInclWidthHeight );
     998                 :            : 
     999                 :            :     {
    1000         [ #  # ]:          0 :         WriterSpecificAutoFormatBlock block(rStream);
    1001                 :            : 
    1002 [ #  # ][ #  # ]:          0 :         m_aBreak.Store(rStream, m_aBreak.GetVersion(fileVersion));
    1003 [ #  # ][ #  # ]:          0 :         m_aPageDesc.Store(rStream, m_aPageDesc.GetVersion(fileVersion));
    1004 [ #  # ][ #  # ]:          0 :         m_aKeepWithNextPara.Store(rStream, m_aKeepWithNextPara.GetVersion(fileVersion));
    1005 [ #  # ][ #  # ]:          0 :         rStream << m_aRepeatHeading << m_bLayoutSplit << m_bRowSplit << m_bCollapsingBorders;
         [ #  # ][ #  # ]
    1006 [ #  # ][ #  # ]:          0 :         m_aShadow.Store(rStream, m_aShadow.GetVersion(fileVersion));
                 [ #  # ]
    1007                 :            :     }
    1008                 :            : 
    1009                 :          0 :     sal_Bool bRet = 0 == rStream.GetError();
    1010                 :            : 
    1011 [ #  # ][ #  # ]:          0 :     for( int i = 0; bRet && i < 16; ++i )
                 [ #  # ]
    1012                 :            :     {
    1013                 :          0 :         SwBoxAutoFmt* pFmt = aBoxAutoFmt[ i ];
    1014         [ #  # ]:          0 :         if( !pFmt )     // if not set -> write default
    1015                 :            :         {
    1016                 :            :             // If it doesn't exist yet:
    1017         [ #  # ]:          0 :             if( !pDfltBoxAutoFmt )
    1018         [ #  # ]:          0 :                 pDfltBoxAutoFmt = new SwBoxAutoFmt;
    1019                 :          0 :             pFmt = pDfltBoxAutoFmt;
    1020                 :            :         }
    1021                 :          0 :         bRet = pFmt->Save( rStream, fileVersion );
    1022                 :            :     }
    1023                 :          0 :     return bRet;
    1024                 :            : }
    1025                 :            : 
    1026                 :            : 
    1027                 :          0 : struct SwTableAutoFmtTbl::Impl
    1028                 :            : {
    1029                 :            :     boost::ptr_vector<SwTableAutoFmt> m_AutoFormats;
    1030                 :            : };
    1031                 :            : 
    1032                 :          0 : size_t SwTableAutoFmtTbl::size() const
    1033                 :            : {
    1034                 :          0 :     return m_pImpl->m_AutoFormats.size();
    1035                 :            : }
    1036                 :            : 
    1037                 :          0 : SwTableAutoFmt const& SwTableAutoFmtTbl::operator[](size_t const i) const
    1038                 :            : {
    1039                 :          0 :     return m_pImpl->m_AutoFormats[i];
    1040                 :            : }
    1041                 :          0 : SwTableAutoFmt      & SwTableAutoFmtTbl::operator[](size_t const i)
    1042                 :            : {
    1043                 :          0 :     return m_pImpl->m_AutoFormats[i];
    1044                 :            : }
    1045                 :            : 
    1046                 :            : void
    1047                 :          0 : SwTableAutoFmtTbl::InsertAutoFmt(size_t const i, SwTableAutoFmt *const pFmt)
    1048                 :            : {
    1049                 :          0 :     m_pImpl->m_AutoFormats.insert(m_pImpl->m_AutoFormats.begin() + i, pFmt);
    1050                 :          0 : }
    1051                 :            : 
    1052                 :          0 : void SwTableAutoFmtTbl::EraseAutoFmt(size_t const i)
    1053                 :            : {
    1054                 :          0 :     m_pImpl->m_AutoFormats.erase(m_pImpl->m_AutoFormats.begin() + i);
    1055                 :          0 : }
    1056                 :            : 
    1057                 :          0 : void SwTableAutoFmtTbl::MoveAutoFmt(size_t const target, size_t source)
    1058                 :            : {
    1059                 :          0 :     m_pImpl->m_AutoFormats.transfer(m_pImpl->m_AutoFormats.begin() + target,
    1060                 :          0 :             m_pImpl->m_AutoFormats.begin() + source, m_pImpl->m_AutoFormats);
    1061                 :          0 : }
    1062                 :            : 
    1063                 :          0 : SwTableAutoFmtTbl::~SwTableAutoFmtTbl()
    1064                 :            : {
    1065                 :          0 : }
    1066                 :            : 
    1067                 :          0 : SwTableAutoFmtTbl::SwTableAutoFmtTbl()
    1068         [ #  # ]:          0 :     : m_pImpl(new Impl)
    1069                 :            : {
    1070         [ #  # ]:          0 :     String sNm;
    1071                 :            :     SwTableAutoFmt* pNew = new SwTableAutoFmt(
    1072 [ #  # ][ #  # ]:          0 :                             SwStyleNameMapper::GetUIName( RES_POOLCOLL_STANDARD, sNm ) );
                 [ #  # ]
    1073                 :            : 
    1074         [ #  # ]:          0 :     SwBoxAutoFmt aNew;
    1075                 :            : 
    1076                 :            :     sal_uInt8 i;
    1077                 :            : 
    1078                 :          0 :     Color aColor( COL_BLUE );
    1079         [ #  # ]:          0 :     SvxBrushItem aBrushItem( aColor, RES_BACKGROUND );
    1080         [ #  # ]:          0 :     aNew.SetBackground( aBrushItem );
    1081 [ #  # ][ #  # ]:          0 :     aNew.SetColor( SvxColorItem(Color( COL_WHITE ), RES_CHRATR_COLOR) );
                 [ #  # ]
    1082                 :            : 
    1083         [ #  # ]:          0 :     for( i = 0; i < 4; ++i )
    1084         [ #  # ]:          0 :         pNew->SetBoxFmt( aNew, i );
    1085                 :            : 
    1086                 :            :     // 70% gray
    1087                 :          0 :     aBrushItem.SetColor( RGB_COLORDATA( 0x4d, 0x4d, 0x4d ) );
    1088         [ #  # ]:          0 :     aNew.SetBackground( aBrushItem );
    1089         [ #  # ]:          0 :     for( i = 4; i <= 12; i += 4 )
    1090         [ #  # ]:          0 :         pNew->SetBoxFmt( aNew, i );
    1091                 :            : 
    1092                 :            :     // 20% gray
    1093                 :          0 :     aBrushItem.SetColor( RGB_COLORDATA( 0xcc, 0xcc, 0xcc ) );
    1094         [ #  # ]:          0 :     aNew.SetBackground( aBrushItem );
    1095                 :          0 :     aColor.SetColor( COL_BLACK );
    1096 [ #  # ][ #  # ]:          0 :     aNew.SetColor( SvxColorItem( aColor, RES_CHRATR_COLOR) );
                 [ #  # ]
    1097         [ #  # ]:          0 :     for( i = 7; i <= 15; i += 4 )
    1098         [ #  # ]:          0 :         pNew->SetBoxFmt( aNew, i );
    1099         [ #  # ]:          0 :     for( i = 13; i <= 14; ++i )
    1100         [ #  # ]:          0 :         pNew->SetBoxFmt( aNew, i );
    1101                 :            : 
    1102                 :          0 :     aBrushItem.SetColor( Color( COL_WHITE ) );
    1103         [ #  # ]:          0 :     aNew.SetBackground( aBrushItem );
    1104         [ #  # ]:          0 :     for( i = 5; i <= 6; ++i )
    1105         [ #  # ]:          0 :         pNew->SetBoxFmt( aNew, i );
    1106         [ #  # ]:          0 :     for( i = 9; i <= 10; ++i )
    1107         [ #  # ]:          0 :         pNew->SetBoxFmt( aNew, i );
    1108                 :            : 
    1109                 :            : 
    1110         [ #  # ]:          0 :     SvxBoxItem aBox( RES_BOX );
    1111                 :          0 :     aBox.SetDistance( 55 );
    1112         [ #  # ]:          0 :     SvxBorderLine aLn( &aColor, DEF_LINE_WIDTH_0 );
    1113         [ #  # ]:          0 :     aBox.SetLine( &aLn, BOX_LINE_LEFT );
    1114         [ #  # ]:          0 :     aBox.SetLine( &aLn, BOX_LINE_BOTTOM );
    1115                 :            : 
    1116         [ #  # ]:          0 :     for( i = 0; i <= 15; ++i )
    1117                 :            :     {
    1118 [ #  # ][ #  # ]:          0 :         aBox.SetLine( i <= 3 ? &aLn : 0, BOX_LINE_TOP );
    1119 [ #  # ][ #  # ]:          0 :         aBox.SetLine( (3 == ( i & 3 )) ? &aLn : 0, BOX_LINE_RIGHT );
    1120 [ #  # ][ #  # ]:          0 :         ((SwBoxAutoFmt&)pNew->GetBoxFmt( i )).SetBox( aBox );
    1121                 :            :     }
    1122                 :            : 
    1123 [ #  # ][ #  # ]:          0 :     m_pImpl->m_AutoFormats.push_back(pNew);
         [ #  # ][ #  # ]
                 [ #  # ]
    1124                 :          0 : }
    1125                 :            : 
    1126                 :          0 : sal_Bool SwTableAutoFmtTbl::Load()
    1127                 :            : {
    1128                 :          0 :     sal_Bool bRet = sal_False;
    1129         [ #  # ]:          0 :     String sNm(rtl::OUString(sAutoTblFmtName));
    1130         [ #  # ]:          0 :     SvtPathOptions aOpt;
    1131 [ #  # ][ #  # ]:          0 :     if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG ))
    1132                 :            :     {
    1133         [ #  # ]:          0 :         SfxMedium aStream( sNm, STREAM_STD_READ );
    1134 [ #  # ][ #  # ]:          0 :         bRet = Load( *aStream.GetInStream() );
                 [ #  # ]
    1135                 :            :     }
    1136                 :            :     else
    1137                 :          0 :         bRet = sal_False;
    1138 [ #  # ][ #  # ]:          0 :     return bRet;
    1139                 :            : }
    1140                 :            : 
    1141                 :          0 : sal_Bool SwTableAutoFmtTbl::Save() const
    1142                 :            : {
    1143         [ #  # ]:          0 :     SvtPathOptions aPathOpt;
    1144 [ #  # ][ #  # ]:          0 :     String sNm( aPathOpt.GetUserConfigPath() );
    1145         [ #  # ]:          0 :     sNm += INET_PATH_TOKEN;
    1146         [ #  # ]:          0 :     sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sAutoTblFmtName ));
    1147         [ #  # ]:          0 :     SfxMedium aStream(sNm, STREAM_STD_WRITE );
    1148 [ #  # ][ #  # ]:          0 :     return Save( *aStream.GetOutStream() ) && aStream.Commit();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1149                 :            : }
    1150                 :            : 
    1151                 :          0 : sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
    1152                 :            : {
    1153                 :          0 :     sal_Bool bRet = 0 == rStream.GetError();
    1154         [ #  # ]:          0 :     if (bRet)
    1155                 :            :     {
    1156                 :            :         // Attention: We need to read a general Header here
    1157                 :          0 :         sal_uInt16 nVal = 0;
    1158         [ #  # ]:          0 :         rStream >> nVal;
    1159                 :          0 :         bRet = 0 == rStream.GetError();
    1160                 :            : 
    1161         [ #  # ]:          0 :         if( bRet )
    1162                 :            :         {
    1163                 :          0 :             SwAfVersions aVersions;
    1164                 :            : 
    1165                 :            :             // Default version is 5.0, unless we detect an old format ID.
    1166                 :          0 :             sal_uInt16 nFileVers = SOFFICE_FILEFORMAT_50;
    1167         [ #  # ]:          0 :             if(nVal < AUTOFORMAT_ID_31005)
    1168                 :          0 :                 nFileVers = SOFFICE_FILEFORMAT_40;
    1169                 :            : 
    1170 [ #  # ][ #  # ]:          0 :             if( nVal == AUTOFORMAT_ID_358 ||
                 [ #  # ]
    1171                 :            :                     (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) )
    1172                 :            :             {
    1173                 :            :                 sal_uInt8 nChrSet, nCnt;
    1174                 :          0 :                 long nPos = rStream.Tell();
    1175 [ #  # ][ #  # ]:          0 :                 rStream >> nCnt >> nChrSet;
    1176         [ #  # ]:          0 :                 if( rStream.Tell() != sal_uLong(nPos + nCnt) )
    1177                 :            :                 {
    1178                 :            :                     OSL_ENSURE( !this, "The Header contains more or newer Data" );
    1179         [ #  # ]:          0 :                     rStream.Seek( nPos + nCnt );
    1180                 :            :                 }
    1181                 :          0 :                 rStream.SetStreamCharSet( (CharSet)nChrSet );
    1182                 :          0 :                 rStream.SetVersion( nFileVers );
    1183                 :            :             }
    1184                 :            : 
    1185 [ #  # ][ #  # ]:          0 :             if( nVal == AUTOFORMAT_ID_358 || nVal == AUTOFORMAT_ID_X ||
         [ #  # ][ #  # ]
    1186                 :            :                     (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) )
    1187                 :            :             {
    1188         [ #  # ]:          0 :                 aVersions.Load( rStream, nVal );        // Item versions
    1189                 :            : 
    1190                 :            :                 SwTableAutoFmt* pNew;
    1191                 :          0 :                 sal_uInt16 nAnz = 0;
    1192         [ #  # ]:          0 :                 rStream >> nAnz;
    1193                 :            : 
    1194                 :          0 :                 bRet = 0 == rStream.GetError();
    1195                 :            : 
    1196         [ #  # ]:          0 :                 for( sal_uInt16 i = 0; i < nAnz; ++i )
    1197                 :            :                 {
    1198 [ #  # ][ #  # ]:          0 :                     pNew = new SwTableAutoFmt( aEmptyStr );
    1199         [ #  # ]:          0 :                     bRet = pNew->Load( rStream, aVersions );
    1200         [ #  # ]:          0 :                     if( bRet )
    1201                 :            :                     {
    1202         [ #  # ]:          0 :                         m_pImpl->m_AutoFormats.push_back(pNew);
    1203                 :            :                     }
    1204                 :            :                     else
    1205                 :            :                     {
    1206 [ #  # ][ #  # ]:          0 :                         delete pNew;
    1207                 :          0 :                         break;
    1208                 :            :                     }
    1209                 :          0 :                 }
    1210                 :            :             }
    1211                 :            :             else
    1212                 :            :             {
    1213                 :          0 :                 bRet = false;
    1214                 :            :             }
    1215                 :            :         }
    1216                 :            :     }
    1217                 :          0 :     return bRet;
    1218                 :            : }
    1219                 :            : 
    1220                 :            : 
    1221                 :          0 : sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const
    1222                 :            : {
    1223                 :          0 :     sal_Bool bRet = 0 == rStream.GetError();
    1224         [ #  # ]:          0 :     if (bRet)
    1225                 :            :     {
    1226                 :          0 :         rStream.SetVersion(AUTOFORMAT_FILE_VERSION);
    1227                 :            : 
    1228                 :            :         // Attention: We need to save a general Header here
    1229                 :          0 :         sal_uInt16 nVal = AUTOFORMAT_ID;
    1230                 :          0 :         rStream << nVal
    1231                 :          0 :                 << (sal_uInt8)2 // Character count of the Header including this value
    1232                 :          0 :                 << (sal_uInt8)GetStoreCharSet( ::osl_getThreadTextEncoding() );
    1233                 :            : 
    1234                 :          0 :         bRet = 0 == rStream.GetError();
    1235                 :            : 
    1236                 :            :         // Write this version number for all attributes
    1237                 :          0 :         m_pImpl->m_AutoFormats[0].GetBoxFmt(0).SaveVersionNo(
    1238                 :          0 :                 rStream, AUTOFORMAT_FILE_VERSION);
    1239                 :            : 
    1240                 :          0 :         rStream << static_cast<sal_uInt16>(m_pImpl->m_AutoFormats.size() - 1);
    1241                 :          0 :         bRet = 0 == rStream.GetError();
    1242                 :            : 
    1243 [ #  # ][ #  # ]:          0 :         for (sal_uInt16 i = 1; bRet && i < m_pImpl->m_AutoFormats.size(); ++i)
                 [ #  # ]
    1244                 :            :         {
    1245                 :          0 :             SwTableAutoFmt const& rFmt = m_pImpl->m_AutoFormats[i];
    1246                 :          0 :             bRet = rFmt.Save(rStream, AUTOFORMAT_FILE_VERSION);
    1247                 :            :         }
    1248                 :            :     }
    1249                 :          0 :     rStream.Flush();
    1250                 :          0 :     return bRet;
    1251                 :            : }
    1252                 :            : 
    1253                 :            : 
    1254                 :            : 
    1255                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10