LCOV - code coverage report
Current view: top level - sc/source/filter/excel - xeescher.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 746 0.1 %
Date: 2012-08-25 Functions: 2 80 2.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 1392 0.1 %

           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                 :            : 
      30                 :            : #include "xeescher.hxx"
      31                 :            : 
      32                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      33                 :            : #include <com/sun/star/frame/XModel.hpp>
      34                 :            : #include <com/sun/star/form/FormComponentType.hpp>
      35                 :            : #include <com/sun/star/awt/VisualEffect.hpp>
      36                 :            : #include <com/sun/star/awt/ScrollBarOrientation.hpp>
      37                 :            : #include <com/sun/star/drawing/XShape.hpp>
      38                 :            : #include <com/sun/star/form/binding/XBindableValue.hpp>
      39                 :            : #include <com/sun/star/form/binding/XValueBinding.hpp>
      40                 :            : #include <com/sun/star/form/binding/XListEntrySink.hpp>
      41                 :            : #include <com/sun/star/form/binding/XListEntrySource.hpp>
      42                 :            : #include <com/sun/star/script/ScriptEventDescriptor.hpp>
      43                 :            : #include <com/sun/star/chart2/XChartDocument.hpp>
      44                 :            : #include <com/sun/star/awt/Point.hpp>
      45                 :            : #include <com/sun/star/awt/Size.hpp>
      46                 :            : #include <com/sun/star/container/XNamed.hpp>
      47                 :            : 
      48                 :            : #include <set>
      49                 :            : #include <rtl/ustrbuf.h>
      50                 :            : #include <vcl/bmpacc.hxx>
      51                 :            : #include <svx/svdoole2.hxx>
      52                 :            : #include <svx/svdocapt.hxx>
      53                 :            : #include <editeng/outlobj.hxx>
      54                 :            : #include <editeng/editobj.hxx>
      55                 :            : #include <unotools/tempfile.hxx>
      56                 :            : #include <unotools/ucbstreamhelper.hxx>
      57                 :            : 
      58                 :            : #include "editutil.hxx"
      59                 :            : #include "unonames.hxx"
      60                 :            : #include "convuno.hxx"
      61                 :            : #include "postit.hxx"
      62                 :            : 
      63                 :            : #include "fapihelper.hxx"
      64                 :            : #include "xechart.hxx"
      65                 :            : #include "xeformula.hxx"
      66                 :            : #include "xelink.hxx"
      67                 :            : #include "xename.hxx"
      68                 :            : #include "xestyle.hxx"
      69                 :            : #include "userdat.hxx"
      70                 :            : #include "drwlayer.hxx"
      71                 :            : #include "svx/unoapi.hxx"
      72                 :            : #include "svx/algitem.hxx"
      73                 :            : #include "scitems.hxx"
      74                 :            : #include <editeng/justifyitem.hxx>
      75                 :            : #include "svx/sdtaitm.hxx"
      76                 :            : #include "attrib.hxx"
      77                 :            : #include "document.hxx"
      78                 :            : #include <svx/svdattr.hxx>
      79                 :            : #include "svx/sdr/properties/properties.hxx"
      80                 :            : #include "detfunc.hxx"
      81                 :            : #include "svx/xflclit.hxx"
      82                 :            : #include "svx/xlnstwit.hxx"
      83                 :            : #include "svx/xlnstit.hxx"
      84                 :            : #include "svx/sxmspitm.hxx"
      85                 :            : 
      86                 :            : #include <oox/token/tokens.hxx>
      87                 :            : #include <oox/export/drawingml.hxx>
      88                 :            : #include <oox/export/chartexport.hxx>
      89                 :            : #include <oox/export/utils.hxx>
      90                 :            : #include <boost/shared_ptr.hpp>
      91                 :            : 
      92                 :            : using ::rtl::OString;
      93                 :            : using ::rtl::OUString;
      94                 :            : using ::rtl::OUStringBuffer;
      95                 :            : using ::com::sun::star::uno::UNO_QUERY;
      96                 :            : using ::com::sun::star::uno::Reference;
      97                 :            : using ::com::sun::star::uno::Sequence;
      98                 :            : using ::com::sun::star::lang::XServiceInfo;
      99                 :            : using ::com::sun::star::beans::XPropertySet;
     100                 :            : using ::com::sun::star::drawing::XShape;
     101                 :            : using ::com::sun::star::drawing::XShapes;
     102                 :            : using ::com::sun::star::frame::XModel;
     103                 :            : using ::com::sun::star::embed::XEmbeddedObject;
     104                 :            : using ::com::sun::star::awt::XControlModel;
     105                 :            : using ::com::sun::star::form::binding::XBindableValue;
     106                 :            : using ::com::sun::star::form::binding::XValueBinding;
     107                 :            : using ::com::sun::star::form::binding::XListEntrySink;
     108                 :            : using ::com::sun::star::form::binding::XListEntrySource;
     109                 :            : using ::com::sun::star::script::ScriptEventDescriptor;
     110                 :            : using ::com::sun::star::table::CellAddress;
     111                 :            : using ::com::sun::star::table::CellRangeAddress;
     112                 :            : using ::com::sun::star::chart2::XChartDocument;
     113                 :            : using ::com::sun::star::container::XNamed;
     114                 :            : using ::oox::drawingml::DrawingML;
     115                 :            : using ::oox::drawingml::ChartExport;
     116                 :            : using namespace oox;
     117                 :            : 
     118                 :            : #define  HMM2XL(x)        ((x)/26.5)+0.5
     119                 :            : 
     120                 :            : #if 1//def XLSX_OOXML_FUTURE
     121                 :            : // these function are only used within that context
     122                 :            : // Static Function Helpers
     123                 :          0 : static const char *ToHorizAlign( SdrTextHorzAdjust eAdjust )
     124                 :            : {
     125   [ #  #  #  # ]:          0 :     switch( eAdjust )
     126                 :            :     {
     127                 :            :         case SDRTEXTHORZADJUST_CENTER:
     128                 :          0 :             return "center";
     129                 :            :         case SDRTEXTHORZADJUST_RIGHT:
     130                 :          0 :             return "right";
     131                 :            :         case SDRTEXTHORZADJUST_BLOCK:
     132                 :          0 :             return "justify";
     133                 :            :         case SDRTEXTHORZADJUST_LEFT:
     134                 :            :         default:
     135                 :          0 :             return "left";
     136                 :            :     }
     137                 :            : }
     138                 :            : 
     139                 :          0 : static const char *ToVertAlign( SdrTextVertAdjust eAdjust )
     140                 :            : {
     141   [ #  #  #  # ]:          0 :     switch( eAdjust )
     142                 :            :     {
     143                 :            :         case SDRTEXTVERTADJUST_CENTER:
     144                 :          0 :             return "center";
     145                 :            :         case SDRTEXTVERTADJUST_BOTTOM:
     146                 :          0 :             return "bottom";
     147                 :            :         case SDRTEXTVERTADJUST_BLOCK:
     148                 :          0 :             return "justify";
     149                 :            :         case SDRTEXTVERTADJUST_TOP:
     150                 :            :         default:
     151                 :          0 :             return "top";
     152                 :            :     }
     153                 :            : }
     154                 :            : 
     155                 :          0 : static void lcl_WriteAnchorVertex( sax_fastparser::FSHelperPtr rComments, Rectangle &aRect )
     156                 :            : {
     157                 :          0 :     rComments->startElement( FSNS( XML_xdr, XML_col ), FSEND );
     158         [ #  # ]:          0 :     rComments->writeEscaped( OUString::valueOf( aRect.Left() ) );
     159                 :          0 :     rComments->endElement( FSNS( XML_xdr, XML_col ) );
     160                 :          0 :     rComments->startElement( FSNS( XML_xdr, XML_colOff ), FSEND );
     161         [ #  # ]:          0 :     rComments->writeEscaped( OUString::valueOf( aRect.Top() ) );
     162                 :          0 :     rComments->endElement( FSNS( XML_xdr, XML_colOff ) );
     163                 :          0 :     rComments->startElement( FSNS( XML_xdr, XML_row ), FSEND );
     164         [ #  # ]:          0 :     rComments->writeEscaped( OUString::valueOf( aRect.Right() ) );
     165                 :          0 :     rComments->endElement( FSNS( XML_xdr, XML_row ) );
     166                 :          0 :     rComments->startElement( FSNS( XML_xdr, XML_rowOff ), FSEND );
     167         [ #  # ]:          0 :     rComments->writeEscaped( OUString::valueOf( aRect.Bottom() ) );
     168                 :          0 :     rComments->endElement( FSNS( XML_xdr, XML_rowOff ) );
     169                 :          0 : }
     170                 :            : #endif
     171                 :            : 
     172                 :          0 : static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_Int32 nTab, Rectangle &aFrom, Rectangle &aTo )
     173                 :            : {
     174                 :          0 :     bool bTo = false;
     175                 :          0 :     sal_Int32 nCol = 0, nRow = 0;
     176                 :          0 :     sal_Int32 nColOff = 0, nRowOff= 0;
     177                 :            : 
     178                 :          0 :     while(1)
     179                 :            :     {
     180         [ #  # ]:          0 :         Rectangle r = rRoot.GetDocPtr()->GetMMRect( nCol,nRow,nCol,nRow,nTab );
     181         [ #  # ]:          0 :         if( !bTo )
     182                 :            :         {
     183         [ #  # ]:          0 :             if( r.Left() <= aRect.Left() )
     184                 :            :             {
     185                 :          0 :                 nCol++;
     186                 :          0 :                 nColOff = aRect.Left() - r.Left();
     187                 :            :             }
     188         [ #  # ]:          0 :             if( r.Top() <= aRect.Top() )
     189                 :            :             {
     190                 :          0 :                 nRow++;
     191                 :          0 :                 nRowOff = aRect.Top() - r.Top();
     192                 :            :             }
     193 [ #  # ][ #  # ]:          0 :             if( r.Left() > aRect.Left() && r.Top() > aRect.Top() )
                 [ #  # ]
     194                 :            :             {
     195                 :            :                 aFrom = Rectangle( nCol-1, static_cast<long>(HMM2XL( nColOff )),
     196         [ #  # ]:          0 :                                    nRow-1, static_cast<long>(HMM2XL( nRowOff )) );
     197                 :          0 :                 bTo=true;
     198                 :            :             }
     199                 :            :         }
     200         [ #  # ]:          0 :         if( bTo )
     201                 :            :         {
     202         [ #  # ]:          0 :             if( r.Right() < aRect.Right() )
     203                 :          0 :                 nCol++;
     204         [ #  # ]:          0 :             if( r.Bottom() < aRect.Bottom() )
     205                 :          0 :                 nRow++;
     206 [ #  # ][ #  # ]:          0 :             if( r.Right() >= aRect.Right() && r.Bottom() >= aRect.Bottom() )
                 [ #  # ]
     207                 :            :             {
     208                 :          0 :                 aTo = Rectangle( nCol, static_cast<long>(HMM2XL( aRect.Right() - r.Left() )),
     209         [ #  # ]:          0 :                                  nRow, static_cast<long>(HMM2XL( aRect.Bottom() - r.Top() )));
     210                 :            :                 break;
     211                 :            :             }
     212                 :            :         }
     213                 :            :     }
     214                 :          0 :     return;
     215                 :            : }
     216                 :            : 
     217                 :            : // Escher client anchor =======================================================
     218                 :            : 
     219                 :          0 : XclExpDffAnchorBase::XclExpDffAnchorBase( const XclExpRoot& rRoot, sal_uInt16 nFlags ) :
     220                 :            :     XclExpRoot( rRoot ),
     221 [ #  # ][ #  # ]:          0 :     mnFlags( nFlags )
     222                 :            : {
     223                 :          0 : }
     224                 :            : 
     225                 :          0 : void XclExpDffAnchorBase::SetFlags( const SdrObject& rSdrObj )
     226                 :            : {
     227                 :          0 :     ImplSetFlags( rSdrObj );
     228                 :          0 : }
     229                 :            : 
     230                 :          0 : void XclExpDffAnchorBase::SetSdrObject( const SdrObject& rSdrObj )
     231                 :            : {
     232                 :          0 :     ImplSetFlags( rSdrObj );
     233                 :          0 :     ImplCalcAnchorRect( rSdrObj.GetCurrentBoundRect(), MAP_100TH_MM );
     234                 :          0 : }
     235                 :            : 
     236                 :          0 : void XclExpDffAnchorBase::WriteDffData( EscherEx& rEscherEx ) const
     237                 :            : {
     238                 :          0 :     rEscherEx.AddAtom( 18, ESCHER_ClientAnchor );
     239                 :          0 :     rEscherEx.GetStream() << mnFlags << maAnchor;
     240                 :          0 : }
     241                 :            : 
     242                 :          0 : void XclExpDffAnchorBase::WriteData( EscherEx& rEscherEx, const Rectangle& rRect )
     243                 :            : {
     244                 :            :     // the passed rectangle is in twips
     245                 :          0 :     ImplCalcAnchorRect( rRect, MAP_TWIP );
     246                 :          0 :     WriteDffData( rEscherEx );
     247                 :          0 : }
     248                 :            : 
     249                 :          0 : void XclExpDffAnchorBase::ImplSetFlags( const SdrObject& )
     250                 :            : {
     251                 :            :     OSL_FAIL( "XclExpDffAnchorBase::ImplSetFlags - not implemented" );
     252                 :          0 : }
     253                 :            : 
     254                 :          0 : void XclExpDffAnchorBase::ImplCalcAnchorRect( const Rectangle&, MapUnit )
     255                 :            : {
     256                 :            :     OSL_FAIL( "XclExpDffAnchorBase::ImplCalcAnchorRect - not implemented" );
     257                 :          0 : }
     258                 :            : 
     259                 :            : // ----------------------------------------------------------------------------
     260                 :            : 
     261                 :          0 : XclExpDffSheetAnchor::XclExpDffSheetAnchor( const XclExpRoot& rRoot ) :
     262                 :            :     XclExpDffAnchorBase( rRoot ),
     263                 :          0 :     mnScTab( rRoot.GetCurrScTab() )
     264                 :            : {
     265                 :          0 : }
     266                 :            : 
     267                 :          0 : void XclExpDffSheetAnchor::ImplSetFlags( const SdrObject& rSdrObj )
     268                 :            : {
     269                 :            :     // Special case "page anchor" (X==0,Y==1) -> lock pos and size.
     270                 :          0 :     const Point& rPos = rSdrObj.GetAnchorPos();
     271 [ #  # ][ #  # ]:          0 :     mnFlags = ((rPos.X() == 0) && (rPos.Y() == 1)) ? EXC_ESC_ANCHOR_LOCKED : 0;
     272                 :          0 : }
     273                 :            : 
     274                 :          0 : void XclExpDffSheetAnchor::ImplCalcAnchorRect( const Rectangle& rRect, MapUnit eMapUnit )
     275                 :            : {
     276                 :          0 :     maAnchor.SetRect( GetRoot(), mnScTab, rRect, eMapUnit );
     277                 :          0 : }
     278                 :            : 
     279                 :            : // ----------------------------------------------------------------------------
     280                 :            : 
     281                 :          0 : XclExpDffEmbeddedAnchor::XclExpDffEmbeddedAnchor( const XclExpRoot& rRoot,
     282                 :            :         const Size& rPageSize, sal_Int32 nScaleX, sal_Int32 nScaleY ) :
     283                 :            :     XclExpDffAnchorBase( rRoot ),
     284                 :            :     maPageSize( rPageSize ),
     285                 :            :     mnScaleX( nScaleX ),
     286                 :          0 :     mnScaleY( nScaleY )
     287                 :            : {
     288                 :          0 : }
     289                 :            : 
     290                 :          0 : void XclExpDffEmbeddedAnchor::ImplSetFlags( const SdrObject& /*rSdrObj*/ )
     291                 :            : {
     292                 :            :     // TODO (unsupported feature): fixed size
     293                 :          0 : }
     294                 :            : 
     295                 :          0 : void XclExpDffEmbeddedAnchor::ImplCalcAnchorRect( const Rectangle& rRect, MapUnit eMapUnit )
     296                 :            : {
     297                 :          0 :     maAnchor.SetRect( maPageSize, mnScaleX, mnScaleY, rRect, eMapUnit, true );
     298                 :          0 : }
     299                 :            : 
     300                 :            : // ----------------------------------------------------------------------------
     301                 :            : 
     302                 :          0 : XclExpDffNoteAnchor::XclExpDffNoteAnchor( const XclExpRoot& rRoot, const Rectangle& rRect ) :
     303                 :          0 :     XclExpDffAnchorBase( rRoot, EXC_ESC_ANCHOR_SIZELOCKED )
     304                 :            : {
     305         [ #  # ]:          0 :     maAnchor.SetRect( rRoot, rRoot.GetCurrScTab(), rRect, MAP_100TH_MM );
     306                 :          0 : }
     307                 :            : 
     308                 :            : // ----------------------------------------------------------------------------
     309                 :            : 
     310                 :          0 : XclExpDffDropDownAnchor::XclExpDffDropDownAnchor( const XclExpRoot& rRoot, const ScAddress& rScPos ) :
     311                 :          0 :     XclExpDffAnchorBase( rRoot, EXC_ESC_ANCHOR_POSLOCKED )
     312                 :            : {
     313 [ #  # ][ #  # ]:          0 :     GetAddressConverter().ConvertAddress( maAnchor.maFirst, rScPos, true );
     314                 :          0 :     maAnchor.maLast.mnCol = maAnchor.maFirst.mnCol + 1;
     315                 :          0 :     maAnchor.maLast.mnRow = maAnchor.maFirst.mnRow + 1;
     316                 :          0 :     maAnchor.mnLX = maAnchor.mnTY = maAnchor.mnRX = maAnchor.mnBY = 0;
     317                 :          0 : }
     318                 :            : 
     319                 :            : // MSODRAWING* records ========================================================
     320                 :            : 
     321                 :          0 : XclExpMsoDrawingBase::XclExpMsoDrawingBase( XclEscherEx& rEscherEx, sal_uInt16 nRecId ) :
     322                 :            :     XclExpRecord( nRecId ),
     323                 :            :     mrEscherEx( rEscherEx ),
     324         [ #  # ]:          0 :     mnFragmentKey( rEscherEx.InitNextDffFragment() )
     325                 :            : {
     326                 :          0 : }
     327                 :            : 
     328                 :          0 : void XclExpMsoDrawingBase::WriteBody( XclExpStream& rStrm )
     329                 :            : {
     330                 :            :     OSL_ENSURE( mrEscherEx.GetStreamPos() == mrEscherEx.GetDffFragmentPos( mnFragmentKey ),
     331                 :            :         "XclExpMsoDrawingBase::WriteBody - DFF stream position mismatch" );
     332                 :          0 :     rStrm.CopyFromStream( mrEscherEx.GetStream(), mrEscherEx.GetDffFragmentSize( mnFragmentKey ) );
     333                 :          0 : }
     334                 :            : 
     335                 :            : // ----------------------------------------------------------------------------
     336                 :            : 
     337                 :          0 : XclExpMsoDrawingGroup::XclExpMsoDrawingGroup( XclEscherEx& rEscherEx ) :
     338                 :          0 :     XclExpMsoDrawingBase( rEscherEx, EXC_ID_MSODRAWINGGROUP )
     339                 :            : {
     340                 :          0 :     SvStream& rDffStrm = mrEscherEx.GetStream();
     341                 :            : 
     342                 :            :     // write the DGGCONTAINER with some default settings
     343         [ #  # ]:          0 :     mrEscherEx.OpenContainer( ESCHER_DggContainer );
     344                 :            : 
     345                 :            :     // TODO: stuff the OPT atom with our own document defaults?
     346                 :            :     static const sal_uInt8 spnDffOpt[] = {
     347                 :            :         0xBF, 0x00, 0x08, 0x00, 0x08, 0x00, 0x81, 0x01,
     348                 :            :         0x09, 0x00, 0x00, 0x08, 0xC0, 0x01, 0x40, 0x00,
     349                 :            :         0x00, 0x08
     350                 :            :     };
     351         [ #  # ]:          0 :     mrEscherEx.AddAtom( sizeof( spnDffOpt ), ESCHER_OPT, 3, 3 );
     352         [ #  # ]:          0 :     rDffStrm.Write( spnDffOpt, sizeof( spnDffOpt ) );
     353                 :            : 
     354                 :            :     // SPLITMENUCOLORS contains colors in toolbar
     355                 :            :     static const sal_uInt8 spnDffSplitMenuColors[] = {
     356                 :            :         0x0D, 0x00, 0x00, 0x08, 0x0C, 0x00, 0x00, 0x08,
     357                 :            :         0x17, 0x00, 0x00, 0x08, 0xF7, 0x00, 0x00, 0x10
     358                 :            :     };
     359         [ #  # ]:          0 :     mrEscherEx.AddAtom( sizeof( spnDffSplitMenuColors ), ESCHER_SplitMenuColors, 0, 4 );
     360         [ #  # ]:          0 :     rDffStrm.Write( spnDffSplitMenuColors, sizeof( spnDffSplitMenuColors ) );
     361                 :            : 
     362                 :            :     // close the DGGCONTAINER
     363         [ #  # ]:          0 :     mrEscherEx.CloseContainer();
     364         [ #  # ]:          0 :     mrEscherEx.UpdateDffFragmentEnd();
     365                 :          0 : }
     366                 :            : 
     367                 :            : // ----------------------------------------------------------------------------
     368                 :            : 
     369                 :          0 : XclExpMsoDrawing::XclExpMsoDrawing( XclEscherEx& rEscherEx ) :
     370                 :          0 :     XclExpMsoDrawingBase( rEscherEx, EXC_ID_MSODRAWING )
     371                 :            : {
     372                 :          0 : }
     373                 :            : 
     374                 :            : // ============================================================================
     375                 :            : 
     376                 :          0 : XclExpImgData::XclExpImgData( const Graphic& rGraphic, sal_uInt16 nRecId ) :
     377                 :            :     maGraphic( rGraphic ),
     378         [ #  # ]:          0 :     mnRecId( nRecId )
     379                 :            : {
     380                 :          0 : }
     381                 :            : 
     382                 :          0 : void XclExpImgData::Save( XclExpStream& rStrm )
     383                 :            : {
     384         [ #  # ]:          0 :     Bitmap aBmp = maGraphic.GetBitmap();
     385 [ #  # ][ #  # ]:          0 :     if( aBmp.GetBitCount() != 24 )
     386         [ #  # ]:          0 :         aBmp.Convert( BMP_CONVERSION_24BIT );
     387                 :            : 
     388 [ #  # ][ #  # ]:          0 :     if( BitmapReadAccess* pAccess = aBmp.AcquireReadAccess() )
     389                 :            :     {
     390         [ #  # ]:          0 :         sal_Int32 nWidth = ::std::min< sal_Int32 >( pAccess->Width(), 0xFFFF );
     391         [ #  # ]:          0 :         sal_Int32 nHeight = ::std::min< sal_Int32 >( pAccess->Height(), 0xFFFF );
     392 [ #  # ][ #  # ]:          0 :         if( (nWidth > 0) && (nHeight > 0) )
     393                 :            :         {
     394                 :          0 :             sal_uInt8 nPadding = static_cast< sal_uInt8 >( nWidth & 0x03 );
     395                 :          0 :             sal_uInt32 nTmpSize = static_cast< sal_uInt32 >( (nWidth * 3 + nPadding) * nHeight + 12 );
     396                 :            : 
     397         [ #  # ]:          0 :             rStrm.StartRecord( mnRecId, nTmpSize + 4 );
     398                 :            : 
     399         [ #  # ]:          0 :             rStrm   << EXC_IMGDATA_BMP                      // BMP format
     400         [ #  # ]:          0 :                     << EXC_IMGDATA_WIN                      // Windows
     401         [ #  # ]:          0 :                     << nTmpSize                             // size after _this_ field
     402         [ #  # ]:          0 :                     << sal_uInt32( 12 )                     // BITMAPCOREHEADER size
     403         [ #  # ]:          0 :                     << static_cast< sal_uInt16 >( nWidth )  // width
     404         [ #  # ]:          0 :                     << static_cast< sal_uInt16 >( nHeight ) // height
     405         [ #  # ]:          0 :                     << sal_uInt16( 1 )                      // planes
     406         [ #  # ]:          0 :                     << sal_uInt16( 24 );                    // bits per pixel
     407                 :            : 
     408         [ #  # ]:          0 :             for( sal_Int32 nY = nHeight - 1; nY >= 0; --nY )
     409                 :            :             {
     410         [ #  # ]:          0 :                 for( sal_Int32 nX = 0; nX < nWidth; ++nX )
     411                 :            :                 {
     412         [ #  # ]:          0 :                     const BitmapColor& rBmpColor = pAccess->GetPixel( nY, nX );
     413 [ #  # ][ #  # ]:          0 :                     rStrm << rBmpColor.GetBlue() << rBmpColor.GetGreen() << rBmpColor.GetRed();
                 [ #  # ]
     414                 :          0 :                 }
     415         [ #  # ]:          0 :                 rStrm.WriteZeroBytes( nPadding );
     416                 :            :             }
     417                 :            : 
     418         [ #  # ]:          0 :             rStrm.EndRecord();
     419                 :            :         }
     420         [ #  # ]:          0 :         aBmp.ReleaseAccess( pAccess );
     421         [ #  # ]:          0 :     }
     422                 :          0 : }
     423                 :            : 
     424                 :          0 : void XclExpImgData::SaveXml( XclExpXmlStream& rStrm )
     425                 :            : {
     426 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pWorksheet = rStrm.GetCurrentStream();
     427                 :            : 
     428 [ #  # ][ #  # ]:          0 :     DrawingML aDML( pWorksheet, &rStrm, DrawingML::DOCUMENT_XLSX );
                 [ #  # ]
     429         [ #  # ]:          0 :     OUString rId = aDML.WriteImage( maGraphic );
     430                 :            :     pWorksheet->singleElement( XML_picture,
     431                 :            :             FSNS( XML_r, XML_id ),  XclXmlUtils::ToOString( rId ).getStr(),
     432 [ #  # ][ #  # ]:          0 :             FSEND );
         [ #  # ][ #  # ]
     433                 :          0 : }
     434                 :            : 
     435                 :            : // ============================================================================
     436                 :            : 
     437                 :          0 : XclExpControlHelper::XclExpControlHelper( const XclExpRoot& rRoot ) :
     438                 :            :     XclExpRoot( rRoot ),
     439 [ #  # ][ #  # ]:          0 :     mnEntryCount( 0 )
     440                 :            : {
     441                 :          0 : }
     442                 :            : 
     443 [ #  # ][ #  # ]:          0 : XclExpControlHelper::~XclExpControlHelper()
     444                 :            : {
     445         [ #  # ]:          0 : }
     446                 :            : 
     447                 :          0 : void XclExpControlHelper::ConvertSheetLinks( Reference< XShape > xShape )
     448                 :            : {
     449         [ #  # ]:          0 :     mxCellLink.reset();
     450         [ #  # ]:          0 :     mxSrcRange.reset();
     451                 :          0 :     mnEntryCount = 0;
     452                 :            : 
     453                 :            :     // get control model
     454         [ #  # ]:          0 :     Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( xShape );
     455         [ #  # ]:          0 :     if( !xCtrlModel.is() )
     456                 :          0 :         return;
     457                 :            : 
     458                 :            :     // *** cell link *** ------------------------------------------------------
     459                 :            : 
     460         [ #  # ]:          0 :     Reference< XBindableValue > xBindable( xCtrlModel, UNO_QUERY );
     461         [ #  # ]:          0 :     if( xBindable.is() )
     462                 :            :     {
     463 [ #  # ][ #  # ]:          0 :         Reference< XServiceInfo > xServInfo( xBindable->getValueBinding(), UNO_QUERY );
                 [ #  # ]
     464 [ #  # ][ #  # ]:          0 :         if( xServInfo.is() && xServInfo->supportsService( CREATE_OUSTRING( SC_SERVICENAME_VALBIND ) ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     465                 :            :         {
     466         [ #  # ]:          0 :             ScfPropertySet aBindProp( xServInfo );
     467                 :          0 :             CellAddress aApiAddress;
     468 [ #  # ][ #  # ]:          0 :             if( aBindProp.GetProperty( aApiAddress, CREATE_OUSTRING( SC_UNONAME_BOUNDCELL ) ) )
                 [ #  # ]
     469                 :            :             {
     470                 :          0 :                 ScAddress aCellLink;
     471                 :          0 :                 ScUnoConversion::FillScAddress( aCellLink, aApiAddress );
     472 [ #  # ][ #  # ]:          0 :                 if( GetTabInfo().IsExportTab( aCellLink.Tab() ) )
                 [ #  # ]
     473 [ #  # ][ #  # ]:          0 :                     mxCellLink = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_CONTROL, aCellLink );
         [ #  # ][ #  # ]
     474         [ #  # ]:          0 :             }
     475                 :          0 :         }
     476                 :            :     }
     477                 :            : 
     478                 :            :     // *** source range *** ---------------------------------------------------
     479                 :            : 
     480         [ #  # ]:          0 :     Reference< XListEntrySink > xEntrySink( xCtrlModel, UNO_QUERY );
     481         [ #  # ]:          0 :     if( xEntrySink.is() )
     482                 :            :     {
     483 [ #  # ][ #  # ]:          0 :         Reference< XServiceInfo > xServInfo( xEntrySink->getListEntrySource(), UNO_QUERY );
                 [ #  # ]
     484 [ #  # ][ #  # ]:          0 :         if( xServInfo.is() && xServInfo->supportsService( CREATE_OUSTRING( SC_SERVICENAME_LISTSOURCE ) ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     485                 :            :         {
     486         [ #  # ]:          0 :             ScfPropertySet aSinkProp( xServInfo );
     487                 :          0 :             CellRangeAddress aApiRange;
     488 [ #  # ][ #  # ]:          0 :             if( aSinkProp.GetProperty( aApiRange, CREATE_OUSTRING( SC_UNONAME_CELLRANGE ) ) )
                 [ #  # ]
     489                 :            :             {
     490                 :          0 :                 ScRange aSrcRange;
     491                 :          0 :                 ScUnoConversion::FillScRange( aSrcRange, aApiRange );
     492 [ #  # ][ #  # ]:          0 :                 if( (aSrcRange.aStart.Tab() == aSrcRange.aEnd.Tab()) && GetTabInfo().IsExportTab( aSrcRange.aStart.Tab() ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     493 [ #  # ][ #  # ]:          0 :                     mxSrcRange = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_CONTROL, aSrcRange );
         [ #  # ][ #  # ]
     494                 :          0 :                 mnEntryCount = static_cast< sal_uInt16 >( aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1 );
     495         [ #  # ]:          0 :             }
     496                 :          0 :         }
     497         [ #  # ]:          0 :     }
     498                 :            : }
     499                 :            : 
     500                 :          0 : void XclExpControlHelper::WriteFormula( XclExpStream& rStrm, const XclTokenArray& rTokArr ) const
     501                 :            : {
     502                 :          0 :     sal_uInt16 nFmlaSize = rTokArr.GetSize();
     503                 :          0 :     rStrm << nFmlaSize << sal_uInt32( 0 );
     504                 :          0 :     rTokArr.WriteArray( rStrm );
     505         [ #  # ]:          0 :     if( nFmlaSize & 1 )             // pad to 16-bit
     506                 :          0 :         rStrm << sal_uInt8( 0 );
     507                 :          0 : }
     508                 :            : 
     509                 :          0 : void XclExpControlHelper::WriteFormulaSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId, const XclTokenArray& rTokArr ) const
     510                 :            : {
     511                 :          0 :     rStrm.StartRecord( nSubRecId, (rTokArr.GetSize() + 5) & ~1 );
     512                 :          0 :     WriteFormula( rStrm, rTokArr );
     513                 :          0 :     rStrm.EndRecord();
     514                 :          0 : }
     515                 :            : 
     516                 :            : // ----------------------------------------------------------------------------
     517                 :            : 
     518                 :            : #if EXC_EXP_OCX_CTRL
     519                 :            : 
     520                 :            : XclExpOcxControlObj::XclExpOcxControlObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape,
     521                 :            :         const Rectangle* pChildAnchor, const String& rClassName, sal_uInt32 nStrmStart, sal_uInt32 nStrmSize ) :
     522                 :            :     XclObj( rObjMgr, EXC_OBJTYPE_PICTURE, true ),
     523                 :            :     XclExpControlHelper( rObjMgr.GetRoot() ),
     524                 :            :     maClassName( rClassName ),
     525                 :            :     mnStrmStart( nStrmStart ),
     526                 :            :     mnStrmSize( nStrmSize )
     527                 :            : {
     528                 :            :     ScfPropertySet aCtrlProp( XclControlHelper::GetControlModel( xShape ) );
     529                 :            : 
     530                 :            :     // OBJ record flags
     531                 :            :     SetLocked( sal_True );
     532                 :            :     SetPrintable( aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "Printable" ) ) );
     533                 :            :     SetAutoFill( false );
     534                 :            :     SetAutoLine( false );
     535                 :            : 
     536                 :            :     // fill DFF property set
     537                 :            :     mrEscherEx.OpenContainer( ESCHER_SpContainer );
     538                 :            :     mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE );
     539                 :            :     Rectangle aDummyRect;
     540                 :            :     EscherPropertyContainer aPropOpt( mrEscherEx, mrEscherEx.QueryPicStream(), aDummyRect );
     541                 :            :     aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape,    0x00080008 );   // bool field
     542                 :            :     aPropOpt.AddOpt( ESCHER_Prop_lineColor,         0x08000040 );
     543                 :            :     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash,   0x00080000 );   // bool field
     544                 :            : 
     545                 :            :     // #i51348# name of the control, may overwrite shape name
     546                 :            :     OUString aCtrlName;
     547                 :            :     if( aCtrlProp.GetProperty( aCtrlName, CREATE_OUSTRING( "Name" ) ) && !aCtrlName.isEmpty() )
     548                 :            :         aPropOpt.AddOpt( ESCHER_Prop_wzName, aCtrlName );
     549                 :            : 
     550                 :            :     // meta file
     551                 :            :     //! TODO - needs check
     552                 :            :     Reference< XPropertySet > xShapePS( xShape, UNO_QUERY );
     553                 :            :     if( xShapePS.is() && aPropOpt.CreateGraphicProperties( xShapePS, CREATE_STRING( "MetaFile" ), false ) )
     554                 :            :     {
     555                 :            :         sal_uInt32 nBlipId;
     556                 :            :         if( aPropOpt.GetOpt( ESCHER_Prop_pib, nBlipId ) )
     557                 :            :             aPropOpt.AddOpt( ESCHER_Prop_pictureId, nBlipId );
     558                 :            :     }
     559                 :            : 
     560                 :            :     // write DFF property set to stream
     561                 :            :     aPropOpt.Commit( mrEscherEx.GetStream() );
     562                 :            : 
     563                 :            :     // anchor
     564                 :            :     ImplWriteAnchor( GetRoot(), SdrObject::getSdrObjectFromXShape( xShape ), pChildAnchor );
     565                 :            : 
     566                 :            :     mrEscherEx.AddAtom( 0, ESCHER_ClientData );                       // OBJ record
     567                 :            :     mrEscherEx.CloseContainer();  // ESCHER_SpContainer
     568                 :            :     mrEscherEx.UpdateDffFragmentEnd();
     569                 :            : 
     570                 :            :     // spreadsheet links
     571                 :            :     ConvertSheetLinks( xShape );
     572                 :            : }
     573                 :            : 
     574                 :            : void XclExpOcxControlObj::WriteSubRecs( XclExpStream& rStrm )
     575                 :            : {
     576                 :            :     // OBJCF - clipboard format
     577                 :            :     rStrm.StartRecord( EXC_ID_OBJCF, 2 );
     578                 :            :     rStrm << sal_uInt16( 2 );
     579                 :            :     rStrm.EndRecord();
     580                 :            : 
     581                 :            :     // OBJFLAGS
     582                 :            :     rStrm.StartRecord( EXC_ID_OBJFLAGS, 2 );
     583                 :            :     rStrm << sal_uInt16( 0x0031 );
     584                 :            :     rStrm.EndRecord();
     585                 :            : 
     586                 :            :     // OBJPICTFMLA
     587                 :            :     XclExpString aClass( maClassName );
     588                 :            :     sal_uInt16 nClassNameSize = static_cast< sal_uInt16 >( aClass.GetSize() );
     589                 :            :     sal_uInt16 nClassNamePad = nClassNameSize & 1;
     590                 :            :     sal_uInt16 nFirstPartSize = 12 + nClassNameSize + nClassNamePad;
     591                 :            : 
     592                 :            :     const XclTokenArray* pCellLink = GetCellLinkTokArr();
     593                 :            :     sal_uInt16 nCellLinkSize = pCellLink ? ((pCellLink->GetSize() + 7) & 0xFFFE) : 0;
     594                 :            : 
     595                 :            :     const XclTokenArray* pSrcRange = GetSourceRangeTokArr();
     596                 :            :     sal_uInt16 nSrcRangeSize = pSrcRange ? ((pSrcRange->GetSize() + 7) & 0xFFFE) : 0;
     597                 :            : 
     598                 :            :     sal_uInt16 nPictFmlaSize = nFirstPartSize + nCellLinkSize + nSrcRangeSize + 18;
     599                 :            :     rStrm.StartRecord( EXC_ID_OBJPICTFMLA, nPictFmlaSize );
     600                 :            : 
     601                 :            :     rStrm   << sal_uInt16( nFirstPartSize )             // size of first part
     602                 :            :             << sal_uInt16( 5 )                          // formula size
     603                 :            :             << sal_uInt32( 0 )                          // unknown ID
     604                 :            :             << sal_uInt8( 0x02 ) << sal_uInt32( 0 )     // tTbl token with unknown ID
     605                 :            :             << sal_uInt8( 3 )                           // pad to word
     606                 :            :             << aClass;                                  // "Forms.***.1"
     607                 :            :     rStrm.WriteZeroBytes( nClassNamePad );              // pad to word
     608                 :            :     rStrm   << mnStrmStart                              // start in 'Ctls' stream
     609                 :            :             << mnStrmSize                               // size in 'Ctls' stream
     610                 :            :             << sal_uInt32( 0 );                         // class ID size
     611                 :            :     // cell link
     612                 :            :     rStrm << nCellLinkSize;
     613                 :            :     if( pCellLink )
     614                 :            :         WriteFormula( rStrm, *pCellLink );
     615                 :            :     // list source range
     616                 :            :     rStrm << nSrcRangeSize;
     617                 :            :     if( pSrcRange )
     618                 :            :         WriteFormula( rStrm, *pSrcRange );
     619                 :            : 
     620                 :            :     rStrm.EndRecord();
     621                 :            : }
     622                 :            : 
     623                 :            : #else
     624                 :            : 
     625                 :          0 : XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< XShape > xShape , const Rectangle* pChildAnchor ) :
     626                 :            :     XclObj( rRoot, EXC_OBJTYPE_UNKNOWN, true ),
     627                 :            :     XclMacroHelper( rRoot ),
     628                 :            :     mnHeight( 0 ),
     629                 :            :     mnState( 0 ),
     630                 :            :     mnLineCount( 0 ),
     631                 :            :     mnSelEntry( 0 ),
     632                 :            :     mnScrollValue( 0 ),
     633                 :            :     mnScrollMin( 0 ),
     634                 :            :     mnScrollMax( 100 ),
     635                 :            :     mnScrollStep( 1 ),
     636                 :            :     mnScrollPage( 10 ),
     637                 :            :     mbFlatButton( false ),
     638                 :            :     mbFlatBorder( false ),
     639                 :            :     mbMultiSel( false ),
     640 [ #  # ][ #  # ]:          0 :     mbScrollHor( false )
     641                 :            : {
     642                 :            :     namespace FormCompType = ::com::sun::star::form::FormComponentType;
     643                 :            :     namespace AwtVisualEffect = ::com::sun::star::awt::VisualEffect;
     644                 :            :     namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
     645                 :            : 
     646 [ #  # ][ #  # ]:          0 :     ScfPropertySet aCtrlProp( XclControlHelper::GetControlModel( xShape ) );
     647 [ #  # ][ #  # ]:          0 :     if( !xShape.is() || !aCtrlProp.Is() )
                 [ #  # ]
     648                 :            :         return;
     649                 :            : 
     650 [ #  # ][ #  # ]:          0 :     mnHeight = xShape->getSize().Height;
     651         [ #  # ]:          0 :     if( mnHeight <= 0 )
     652                 :            :         return;
     653                 :            : 
     654                 :            :     // control type
     655                 :          0 :     sal_Int16 nClassId = 0;
     656 [ #  # ][ #  # ]:          0 :     if( aCtrlProp.GetProperty( nClassId, CREATE_OUSTRING( "ClassId" ) ) )
                 [ #  # ]
     657                 :            :     {
     658   [ #  #  #  #  :          0 :         switch( nClassId )
          #  #  #  #  #  
                      # ]
     659                 :            :         {
     660                 :          0 :             case FormCompType::COMMANDBUTTON:   mnObjType = EXC_OBJTYPE_BUTTON;       meEventType = EXC_TBX_EVENT_ACTION; break;
     661                 :          0 :             case FormCompType::RADIOBUTTON:     mnObjType = EXC_OBJTYPE_OPTIONBUTTON; meEventType = EXC_TBX_EVENT_ACTION; break;
     662                 :          0 :             case FormCompType::CHECKBOX:        mnObjType = EXC_OBJTYPE_CHECKBOX;     meEventType = EXC_TBX_EVENT_ACTION; break;
     663                 :          0 :             case FormCompType::LISTBOX:         mnObjType = EXC_OBJTYPE_LISTBOX;      meEventType = EXC_TBX_EVENT_CHANGE; break;
     664                 :          0 :             case FormCompType::COMBOBOX:        mnObjType = EXC_OBJTYPE_DROPDOWN;     meEventType = EXC_TBX_EVENT_CHANGE; break;
     665                 :          0 :             case FormCompType::GROUPBOX:        mnObjType = EXC_OBJTYPE_GROUPBOX;     meEventType = EXC_TBX_EVENT_MOUSE;  break;
     666                 :          0 :             case FormCompType::FIXEDTEXT:       mnObjType = EXC_OBJTYPE_LABEL;        meEventType = EXC_TBX_EVENT_MOUSE;  break;
     667                 :          0 :             case FormCompType::SCROLLBAR:       mnObjType = EXC_OBJTYPE_SCROLLBAR;    meEventType = EXC_TBX_EVENT_VALUE;  break;
     668                 :          0 :             case FormCompType::SPINBUTTON:      mnObjType = EXC_OBJTYPE_SPIN;         meEventType = EXC_TBX_EVENT_VALUE;  break;
     669                 :            :         }
     670                 :            :     }
     671         [ #  # ]:          0 :     if( mnObjType == EXC_OBJTYPE_UNKNOWN )
     672                 :            :         return;
     673                 :            : 
     674                 :            :     // OBJ record flags
     675                 :          0 :     SetLocked( sal_True );
     676 [ #  # ][ #  # ]:          0 :     SetPrintable( aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "Printable" ) ) );
     677                 :          0 :     SetAutoFill( false );
     678                 :          0 :     SetAutoLine( false );
     679                 :            : 
     680                 :            :     // fill DFF property set
     681         [ #  # ]:          0 :     mrEscherEx.OpenContainer( ESCHER_SpContainer );
     682         [ #  # ]:          0 :     mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_HAVESPT );
     683         [ #  # ]:          0 :     EscherPropertyContainer aPropOpt;
     684 [ #  # ][ #  # ]:          0 :     bool bVisible = aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "EnableVisible" ) );
     685 [ #  # ][ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fPrint, bVisible ? 0x00080000 : 0x00080002 ); // visible flag
     686                 :            : 
     687         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01000100 ); // bool field
     688         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_lTxid, 0 );                        // Text ID
     689         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_WrapText, 0x00000001 );
     690         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x001A0008 );      // bool field
     691         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00100000 );      // bool field
     692         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080000 );     // bool field
     693                 :            : 
     694                 :            :     // #i51348# name of the control, may overwrite shape name
     695                 :          0 :     OUString aCtrlName;
     696 [ #  # ][ #  # ]:          0 :     if( aCtrlProp.GetProperty( aCtrlName, CREATE_OUSTRING( "Name" ) ) && !aCtrlName.isEmpty() )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     697         [ #  # ]:          0 :         aPropOpt.AddOpt( ESCHER_Prop_wzName, aCtrlName );
     698                 :            : 
     699                 :            :     // write DFF property set to stream
     700         [ #  # ]:          0 :     aPropOpt.Commit( mrEscherEx.GetStream() );
     701                 :            : 
     702                 :            :     // anchor
     703 [ #  # ][ #  # ]:          0 :     ImplWriteAnchor( GetRoot(), SdrObject::getSdrObjectFromXShape( xShape ), pChildAnchor );
     704                 :            : 
     705         [ #  # ]:          0 :     mrEscherEx.AddAtom( 0, ESCHER_ClientData );                       // OBJ record
     706         [ #  # ]:          0 :     mrEscherEx.UpdateDffFragmentEnd();
     707                 :            : 
     708                 :            :     // control label
     709                 :          0 :     OUString aString;
     710 [ #  # ][ #  # ]:          0 :     if( aCtrlProp.GetProperty( aString, CREATE_OUSTRING( "Label" ) ) )
                 [ #  # ]
     711                 :            :     {
     712                 :            :         /*  Be sure to construct the MSODRAWING record containing the
     713                 :            :             ClientTextbox atom after the base OBJ's MSODRAWING record data is
     714                 :            :             completed. */
     715 [ #  # ][ #  # ]:          0 :         pClientTextbox = new XclExpMsoDrawing( mrEscherEx );
     716         [ #  # ]:          0 :         mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox );  // TXO record
     717         [ #  # ]:          0 :         mrEscherEx.UpdateDffFragmentEnd();
     718                 :            : 
     719                 :          0 :         sal_uInt16 nXclFont = EXC_FONT_APP;
     720         [ #  # ]:          0 :         if( !aString.isEmpty() )
     721                 :            :         {
     722         [ #  # ]:          0 :             XclFontData aFontData;
     723 [ #  # ][ #  # ]:          0 :             GetFontPropSetHelper().ReadFontProperties( aFontData, aCtrlProp, EXC_FONTPROPSET_CONTROL );
     724 [ #  # ][ #  # ]:          0 :             if( (aFontData.maName.Len() > 0) && (aFontData.mnHeight > 0) )
                 [ #  # ]
     725 [ #  # ][ #  # ]:          0 :                 nXclFont = GetFontBuffer().Insert( aFontData, EXC_COLOR_CTRLTEXT );
                 [ #  # ]
     726                 :            :         }
     727                 :            : 
     728 [ #  # ][ #  # ]:          0 :         pTxo = new XclTxo( aString, nXclFont );
         [ #  # ][ #  # ]
     729         [ #  # ]:          0 :         pTxo->SetHorAlign( (mnObjType == EXC_OBJTYPE_BUTTON) ? EXC_OBJ_HOR_CENTER : EXC_OBJ_HOR_LEFT );
     730                 :          0 :         pTxo->SetVerAlign( EXC_OBJ_VER_CENTER );
     731                 :            :     }
     732                 :            : 
     733         [ #  # ]:          0 :     mrEscherEx.CloseContainer();  // ESCHER_SpContainer
     734                 :            : 
     735                 :            :     // other properties
     736 [ #  # ][ #  # ]:          0 :     aCtrlProp.GetProperty( mnLineCount, CREATE_OUSTRING( "LineCount" ) );
     737                 :            : 
     738                 :            :     // border style
     739                 :          0 :     sal_Int16 nApiButton = AwtVisualEffect::LOOK3D;
     740                 :          0 :     sal_Int16 nApiBorder = AwtVisualEffect::LOOK3D;
     741   [ #  #  #  #  :          0 :     switch( nClassId )
                #  #  # ]
     742                 :            :     {
     743                 :            :         case FormCompType::LISTBOX:
     744                 :            :         case FormCompType::COMBOBOX:
     745 [ #  # ][ #  # ]:          0 :             aCtrlProp.GetProperty( nApiBorder, CREATE_OUSTRING( "Border" ) );
     746                 :          0 :         break;
     747                 :            :         case FormCompType::CHECKBOX:
     748                 :            :         case FormCompType::RADIOBUTTON:
     749 [ #  # ][ #  # ]:          0 :             aCtrlProp.GetProperty( nApiButton, CREATE_OUSTRING( "VisualEffect" ) );
     750                 :          0 :             nApiBorder = AwtVisualEffect::NONE;
     751                 :          0 :         break;
     752                 :            :         // Push button cannot be set to flat in Excel
     753                 :            :         case FormCompType::COMMANDBUTTON:
     754                 :          0 :             nApiBorder = AwtVisualEffect::LOOK3D;
     755                 :          0 :         break;
     756                 :            :         // Label does not support a border in Excel
     757                 :            :         case FormCompType::FIXEDTEXT:
     758                 :          0 :             nApiBorder = AwtVisualEffect::NONE;
     759                 :          0 :         break;
     760                 :            :         /*  Scroll bar and spin button have a "Border" property, but it is
     761                 :            :             really used for a border, and not for own 3D/flat look (#i34712#). */
     762                 :            :         case FormCompType::SCROLLBAR:
     763                 :            :         case FormCompType::SPINBUTTON:
     764                 :          0 :             nApiButton = AwtVisualEffect::LOOK3D;
     765                 :          0 :             nApiBorder = AwtVisualEffect::NONE;
     766                 :          0 :         break;
     767                 :            :         // Group box does not support flat style (#i34712#)
     768                 :            :         case FormCompType::GROUPBOX:
     769                 :          0 :             nApiBorder = AwtVisualEffect::LOOK3D;
     770                 :          0 :         break;
     771                 :            :     }
     772                 :          0 :     mbFlatButton = nApiButton != AwtVisualEffect::LOOK3D;
     773                 :          0 :     mbFlatBorder = nApiBorder != AwtVisualEffect::LOOK3D;
     774                 :            : 
     775                 :            :     // control state
     776                 :          0 :     sal_Int16 nApiState = 0;
     777 [ #  # ][ #  # ]:          0 :     if( aCtrlProp.GetProperty( nApiState, CREATE_OUSTRING( "State" ) ) )
                 [ #  # ]
     778                 :            :     {
     779   [ #  #  #  # ]:          0 :         switch( nApiState )
     780                 :            :         {
     781                 :          0 :             case 0: mnState = EXC_OBJ_CHECKBOX_UNCHECKED;  break;
     782                 :          0 :             case 1: mnState = EXC_OBJ_CHECKBOX_CHECKED;    break;
     783                 :          0 :             case 2: mnState = EXC_OBJ_CHECKBOX_TRISTATE;   break;
     784                 :            :         }
     785                 :            :     }
     786                 :            : 
     787                 :            :     // special control contents
     788   [ #  #  #  #  :          0 :     switch( nClassId )
                      # ]
     789                 :            :     {
     790                 :            :         case FormCompType::LISTBOX:
     791                 :            :         {
     792 [ #  # ][ #  # ]:          0 :             mbMultiSel = aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "MultiSelection" ) );
     793         [ #  # ]:          0 :             Sequence< sal_Int16 > aSelection;
     794 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( aSelection, CREATE_OUSTRING( "SelectedItems" ) ) )
                 [ #  # ]
     795                 :            :             {
     796                 :          0 :                 sal_Int32 nLen = aSelection.getLength();
     797         [ #  # ]:          0 :                 if( nLen > 0 )
     798                 :            :                 {
     799         [ #  # ]:          0 :                     mnSelEntry = aSelection[ 0 ] + 1;
     800         [ #  # ]:          0 :                     maMultiSel.resize( nLen );
     801                 :          0 :                     const sal_Int16* pnBegin = aSelection.getConstArray();
     802         [ #  # ]:          0 :                     ::std::copy( pnBegin, pnBegin + nLen, maMultiSel.begin() );
     803                 :            :                 }
     804                 :            :             }
     805                 :            : 
     806                 :            :             // convert listbox with dropdown button to Excel dropdown
     807 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "Dropdown" ) ) )
                 [ #  # ]
     808         [ #  # ]:          0 :                 mnObjType = EXC_OBJTYPE_DROPDOWN;
     809                 :            :         }
     810                 :          0 :         break;
     811                 :            : 
     812                 :            :         case FormCompType::COMBOBOX:
     813                 :            :         {
     814         [ #  # ]:          0 :             Sequence< OUString > aStringList;
     815                 :          0 :             OUString aDefText;
     816 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( aStringList, CREATE_OUSTRING( "StringItemList" ) ) &&
           [ #  #  #  #  
           #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     817 [ #  # ][ #  # ]:          0 :                 aCtrlProp.GetProperty( aDefText, CREATE_OUSTRING( "Text" ) ) &&
         [ #  # ][ #  # ]
     818                 :          0 :                 aStringList.getLength() && !aDefText.isEmpty() )
     819                 :            :             {
     820                 :          0 :                 const OUString* pBegin = aStringList.getConstArray();
     821                 :          0 :                 const OUString* pEnd = pBegin + aStringList.getLength();
     822         [ #  # ]:          0 :                 const OUString* pString = ::std::find( pBegin, pEnd, aDefText );
     823         [ #  # ]:          0 :                 if( pString != pEnd )
     824                 :          0 :                     mnSelEntry = static_cast< sal_Int16 >( pString - pBegin + 1 );  // 1-based
     825         [ #  # ]:          0 :                 if( mnSelEntry > 0 )
     826         [ #  # ]:          0 :                     maMultiSel.resize( 1, mnSelEntry - 1 );
     827                 :            :             }
     828                 :            : 
     829                 :            :             // convert combobox without dropdown button to Excel listbox
     830 [ #  # ][ #  # ]:          0 :             if( !aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "Dropdown" ) ) )
                 [ #  # ]
     831         [ #  # ]:          0 :                 mnObjType = EXC_OBJTYPE_LISTBOX;
     832                 :            :         }
     833                 :          0 :         break;
     834                 :            : 
     835                 :            :         case FormCompType::SCROLLBAR:
     836                 :            :         {
     837                 :          0 :             sal_Int32 nApiValue = 0;
     838 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "ScrollValueMin" ) ) )
                 [ #  # ]
     839         [ #  # ]:          0 :                 mnScrollMin = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
     840 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "ScrollValueMax" ) ) )
                 [ #  # ]
     841         [ #  # ]:          0 :                 mnScrollMax = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, EXC_OBJ_SCROLLBAR_MIN );
     842 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "ScrollValue" ) ) )
                 [ #  # ]
     843         [ #  # ]:          0 :                 mnScrollValue = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, mnScrollMax );
     844 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "LineIncrement" ) ) )
                 [ #  # ]
     845         [ #  # ]:          0 :                 mnScrollStep = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
     846 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "BlockIncrement" ) ) )
                 [ #  # ]
     847         [ #  # ]:          0 :                 mnScrollPage = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
     848 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "Orientation" ) ) )
                 [ #  # ]
     849                 :          0 :                 mbScrollHor = nApiValue == AwtScrollOrient::HORIZONTAL;
     850                 :            :         }
     851                 :          0 :         break;
     852                 :            : 
     853                 :            :         case FormCompType::SPINBUTTON:
     854                 :            :         {
     855                 :          0 :             sal_Int32 nApiValue = 0;
     856 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "SpinValueMin" ) ) )
                 [ #  # ]
     857         [ #  # ]:          0 :                 mnScrollMin = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
     858 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "SpinValueMax" ) ) )
                 [ #  # ]
     859         [ #  # ]:          0 :                 mnScrollMax = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, EXC_OBJ_SCROLLBAR_MAX );
     860 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "SpinValue" ) ) )
                 [ #  # ]
     861         [ #  # ]:          0 :                 mnScrollValue = limit_cast< sal_uInt16 >( nApiValue, mnScrollMin, mnScrollMax );
     862 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "SpinIncrement" ) ) )
                 [ #  # ]
     863         [ #  # ]:          0 :                 mnScrollStep = limit_cast< sal_uInt16 >( nApiValue, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
     864 [ #  # ][ #  # ]:          0 :             if( aCtrlProp.GetProperty( nApiValue, CREATE_OUSTRING( "Orientation" ) ) )
                 [ #  # ]
     865                 :          0 :                 mbScrollHor = nApiValue == AwtScrollOrient::HORIZONTAL;
     866                 :            :         }
     867                 :          0 :         break;
     868                 :            :     }
     869                 :            : 
     870                 :            :     // spreadsheet links
     871 [ #  # ][ #  # ]:          0 :     ConvertSheetLinks( xShape );
         [ #  # ][ #  # ]
     872                 :            : }
     873                 :            : 
     874                 :          0 : bool XclExpTbxControlObj::SetMacroLink( const ScriptEventDescriptor& rEvent )
     875                 :            : {
     876                 :          0 :     return XclMacroHelper::SetMacroLink( rEvent, meEventType );
     877                 :            : }
     878                 :            : 
     879                 :          0 : void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm )
     880                 :            : {
     881   [ #  #  #  #  :          0 :     switch( mnObjType )
                   #  # ]
     882                 :            :     {
     883                 :            :         // *** Push buttons, labels ***
     884                 :            : 
     885                 :            :         case EXC_OBJTYPE_BUTTON:
     886                 :            :         case EXC_OBJTYPE_LABEL:
     887                 :            :             // ftMacro - macro link
     888                 :          0 :             WriteMacroSubRec( rStrm );
     889                 :          0 :         break;
     890                 :            : 
     891                 :            :         // *** Check boxes, option buttons ***
     892                 :            : 
     893                 :            :         case EXC_OBJTYPE_CHECKBOX:
     894                 :            :         case EXC_OBJTYPE_OPTIONBUTTON:
     895                 :            :         {
     896                 :            :             // ftCbls - box properties
     897                 :          0 :             sal_uInt16 nStyle = 0;
     898                 :          0 :             ::set_flag( nStyle, EXC_OBJ_CHECKBOX_FLAT, mbFlatButton );
     899                 :            : 
     900         [ #  # ]:          0 :             rStrm.StartRecord( EXC_ID_OBJCBLS, 12 );
     901         [ #  # ]:          0 :             rStrm << mnState;
     902         [ #  # ]:          0 :             rStrm.WriteZeroBytes( 8 );
     903         [ #  # ]:          0 :             rStrm << nStyle;
     904         [ #  # ]:          0 :             rStrm.EndRecord();
     905                 :            : 
     906                 :            :             // ftMacro - macro link
     907         [ #  # ]:          0 :             WriteMacroSubRec( rStrm );
     908                 :            :             // ftCblsFmla subrecord - cell link
     909         [ #  # ]:          0 :             WriteCellLinkSubRec( rStrm, EXC_ID_OBJCBLSFMLA );
     910                 :            : 
     911                 :            :             // ftCblsData subrecord - box properties, again
     912         [ #  # ]:          0 :             rStrm.StartRecord( EXC_ID_OBJCBLS, 8 );
     913         [ #  # ]:          0 :             rStrm << mnState;
     914         [ #  # ]:          0 :             rStrm.WriteZeroBytes( 4 );
     915         [ #  # ]:          0 :             rStrm << nStyle;
     916         [ #  # ]:          0 :             rStrm.EndRecord();
     917                 :            :         }
     918                 :          0 :         break;
     919                 :            : 
     920                 :            :         // *** List boxes, combo boxes ***
     921                 :            : 
     922                 :            :         case EXC_OBJTYPE_LISTBOX:
     923                 :            :         case EXC_OBJTYPE_DROPDOWN:
     924                 :            :         {
     925                 :          0 :             sal_uInt16 nEntryCount = GetSourceEntryCount();
     926                 :            : 
     927                 :            :             // ftSbs subrecord - Scroll bars
     928         [ #  # ]:          0 :             sal_Int32 nLineHeight = XclTools::GetHmmFromTwips( 200 );   // always 10pt
     929         [ #  # ]:          0 :             if( mnObjType == EXC_OBJTYPE_LISTBOX )
     930                 :          0 :                 mnLineCount = static_cast< sal_uInt16 >( mnHeight / nLineHeight );
     931                 :          0 :             mnScrollValue = 0;
     932                 :          0 :             mnScrollMin = 0;
     933         [ #  # ]:          0 :             sal_uInt16 nInvisLines = (nEntryCount >= mnLineCount) ? (nEntryCount - mnLineCount) : 0;
     934         [ #  # ]:          0 :             mnScrollMax = limit_cast< sal_uInt16 >( nInvisLines, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
     935                 :          0 :             mnScrollStep = 1;
     936         [ #  # ]:          0 :             mnScrollPage = limit_cast< sal_uInt16 >( mnLineCount, EXC_OBJ_SCROLLBAR_MIN, EXC_OBJ_SCROLLBAR_MAX );
     937                 :          0 :             mbScrollHor = false;
     938         [ #  # ]:          0 :             WriteSbs( rStrm );
     939                 :            : 
     940                 :            :             // ftMacro - macro link
     941         [ #  # ]:          0 :             WriteMacroSubRec( rStrm );
     942                 :            :             // ftSbsFmla subrecord - cell link
     943         [ #  # ]:          0 :             WriteCellLinkSubRec( rStrm, EXC_ID_OBJSBSFMLA );
     944                 :            : 
     945                 :            :             // ftLbsData - source data range and box properties
     946                 :          0 :             sal_uInt16 nStyle = 0;
     947         [ #  # ]:          0 :             ::insert_value( nStyle, mbMultiSel ? EXC_OBJ_LISTBOX_MULTI : EXC_OBJ_LISTBOX_SINGLE, 4, 2 );
     948                 :          0 :             ::set_flag( nStyle, EXC_OBJ_LISTBOX_FLAT, mbFlatBorder );
     949                 :            : 
     950         [ #  # ]:          0 :             rStrm.StartRecord( EXC_ID_OBJLBSDATA, 0 );
     951                 :            : 
     952 [ #  # ][ #  # ]:          0 :             if( const XclTokenArray* pSrcRange = GetSourceRangeTokArr() )
     953                 :            :             {
     954 [ #  # ][ #  # ]:          0 :                 rStrm << static_cast< sal_uInt16 >( (pSrcRange->GetSize() + 7) & 0xFFFE );
     955         [ #  # ]:          0 :                 WriteFormula( rStrm, *pSrcRange );
     956                 :            :             }
     957                 :            :             else
     958         [ #  # ]:          0 :                 rStrm << sal_uInt16( 0 );
     959                 :            : 
     960 [ #  # ][ #  # ]:          0 :             rStrm << nEntryCount << mnSelEntry << nStyle << sal_uInt16( 0 );
         [ #  # ][ #  # ]
     961         [ #  # ]:          0 :             if( mnObjType == EXC_OBJTYPE_LISTBOX )
     962                 :            :             {
     963         [ #  # ]:          0 :                 if( nEntryCount )
     964                 :            :                 {
     965         [ #  # ]:          0 :                     ScfUInt8Vec aSelEx( nEntryCount, 0 );
     966 [ #  # ][ #  # ]:          0 :                     for( ScfInt16Vec::const_iterator aIt = maMultiSel.begin(), aEnd = maMultiSel.end(); aIt != aEnd; ++aIt )
         [ #  # ][ #  # ]
                 [ #  # ]
     967 [ #  # ][ #  # ]:          0 :                         if( *aIt < nEntryCount )
     968 [ #  # ][ #  # ]:          0 :                             aSelEx[ *aIt ] = 1;
     969 [ #  # ][ #  # ]:          0 :                     rStrm.Write( &aSelEx[ 0 ], aSelEx.size() );
     970                 :            :                 }
     971                 :            :             }
     972         [ #  # ]:          0 :             else if( mnObjType == EXC_OBJTYPE_DROPDOWN )
     973                 :            :             {
     974 [ #  # ][ #  # ]:          0 :                 rStrm << sal_uInt16( 0 ) << mnLineCount << sal_uInt16( 0 ) << sal_uInt16( 0 );
         [ #  # ][ #  # ]
     975                 :            :             }
     976                 :            : 
     977         [ #  # ]:          0 :             rStrm.EndRecord();
     978                 :            :         }
     979                 :          0 :         break;
     980                 :            : 
     981                 :            :         // *** Spin buttons, scrollbars ***
     982                 :            : 
     983                 :            :         case EXC_OBJTYPE_SPIN:
     984                 :            :         case EXC_OBJTYPE_SCROLLBAR:
     985                 :            :         {
     986                 :            :             // ftSbs subrecord - scroll bars
     987                 :          0 :             WriteSbs( rStrm );
     988                 :            :             // ftMacro - macro link
     989                 :          0 :             WriteMacroSubRec( rStrm );
     990                 :            :             // ftSbsFmla subrecord - cell link
     991                 :          0 :             WriteCellLinkSubRec( rStrm, EXC_ID_OBJSBSFMLA );
     992                 :            :         }
     993                 :          0 :         break;
     994                 :            : 
     995                 :            :         // *** Group boxes ***
     996                 :            : 
     997                 :            :         case EXC_OBJTYPE_GROUPBOX:
     998                 :            :         {
     999                 :            :             // ftMacro - macro link
    1000         [ #  # ]:          0 :             WriteMacroSubRec( rStrm );
    1001                 :            : 
    1002                 :            :             // ftGboData subrecord - group box properties
    1003                 :          0 :             sal_uInt16 nStyle = 0;
    1004                 :          0 :             ::set_flag( nStyle, EXC_OBJ_GROUPBOX_FLAT, mbFlatBorder );
    1005                 :            : 
    1006         [ #  # ]:          0 :             rStrm.StartRecord( EXC_ID_OBJGBODATA, 6 );
    1007         [ #  # ]:          0 :             rStrm   << sal_uInt32( 0 )
    1008         [ #  # ]:          0 :                     << nStyle;
    1009         [ #  # ]:          0 :             rStrm.EndRecord();
    1010                 :            :         }
    1011                 :          0 :         break;
    1012                 :            :     }
    1013                 :          0 : }
    1014                 :            : 
    1015                 :          0 : void XclExpTbxControlObj::WriteCellLinkSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId )
    1016                 :            : {
    1017         [ #  # ]:          0 :     if( const XclTokenArray* pCellLink = GetCellLinkTokArr() )
    1018                 :          0 :         WriteFormulaSubRec( rStrm, nSubRecId, *pCellLink );
    1019                 :          0 : }
    1020                 :            : 
    1021                 :          0 : void XclExpTbxControlObj::WriteSbs( XclExpStream& rStrm )
    1022                 :            : {
    1023                 :          0 :     sal_uInt16 nOrient = 0;
    1024                 :          0 :     ::set_flag( nOrient, EXC_OBJ_SCROLLBAR_HOR, mbScrollHor );
    1025                 :          0 :     sal_uInt16 nStyle = EXC_OBJ_SCROLLBAR_DEFFLAGS;
    1026                 :          0 :     ::set_flag( nStyle, EXC_OBJ_SCROLLBAR_FLAT, mbFlatButton );
    1027                 :            : 
    1028         [ #  # ]:          0 :     rStrm.StartRecord( EXC_ID_OBJSBS, 20 );
    1029         [ #  # ]:          0 :     rStrm   << sal_uInt32( 0 )              // reserved
    1030         [ #  # ]:          0 :             << mnScrollValue                // thumb position
    1031         [ #  # ]:          0 :             << mnScrollMin                  // thumb min pos
    1032         [ #  # ]:          0 :             << mnScrollMax                  // thumb max pos
    1033         [ #  # ]:          0 :             << mnScrollStep                 // line increment
    1034         [ #  # ]:          0 :             << mnScrollPage                 // page increment
    1035         [ #  # ]:          0 :             << nOrient                      // 0 = vertical, 1 = horizontal
    1036         [ #  # ]:          0 :             << sal_uInt16( 15 )             // thumb width
    1037         [ #  # ]:          0 :             << nStyle;                      // flags/style
    1038         [ #  # ]:          0 :     rStrm.EndRecord();
    1039                 :          0 : }
    1040                 :            : 
    1041                 :            : #endif
    1042                 :            : 
    1043                 :            : // ----------------------------------------------------------------------------
    1044                 :            : 
    1045                 :          0 : XclExpChartObj::XclExpChartObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape, const Rectangle* pChildAnchor ) :
    1046                 :            :     XclObj( rObjMgr, EXC_OBJTYPE_CHART ),
    1047 [ #  # ][ #  # ]:          0 :     XclExpRoot( rObjMgr.GetRoot() ), mxShape( xShape )
    1048                 :            : {
    1049                 :            :     // create the MSODRAWING record contents for the chart object
    1050         [ #  # ]:          0 :     mrEscherEx.OpenContainer( ESCHER_SpContainer );
    1051         [ #  # ]:          0 :     mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_HAVESPT );
    1052         [ #  # ]:          0 :     EscherPropertyContainer aPropOpt;
    1053         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01040104 );
    1054         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 );
    1055         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x0800004E );
    1056         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x0800004D );
    1057         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00110010 );
    1058         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x0800004D );
    1059         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080008 );
    1060         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured, 0x00020000 );
    1061         [ #  # ]:          0 :     aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080000 );
    1062         [ #  # ]:          0 :     aPropOpt.Commit( mrEscherEx.GetStream() );
    1063                 :            : 
    1064                 :            :     // anchor
    1065         [ #  # ]:          0 :     SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape( xShape );
    1066         [ #  # ]:          0 :     ImplWriteAnchor( GetRoot(), pSdrObj, pChildAnchor );
    1067                 :            : 
    1068                 :            :     // client data (the following OBJ record)
    1069         [ #  # ]:          0 :     mrEscherEx.AddAtom( 0, ESCHER_ClientData );
    1070         [ #  # ]:          0 :     mrEscherEx.CloseContainer();  // ESCHER_SpContainer
    1071         [ #  # ]:          0 :     mrEscherEx.UpdateDffFragmentEnd();
    1072                 :            : 
    1073                 :            :     // load the chart OLE object
    1074 [ #  # ][ #  # ]:          0 :     if( SdrOle2Obj* pSdrOleObj = dynamic_cast< SdrOle2Obj* >( pSdrObj ) )
    1075 [ #  # ][ #  # ]:          0 :         svt::EmbeddedObjectRef::TryRunningState( pSdrOleObj->GetObjRef() );
    1076                 :            : 
    1077                 :            :     // create the chart substream object
    1078         [ #  # ]:          0 :     ScfPropertySet aShapeProp( xShape );
    1079                 :          0 :     Reference< XModel > xModel;
    1080 [ #  # ][ #  # ]:          0 :     aShapeProp.GetProperty( xModel, CREATE_OUSTRING( "Model" ) );
    1081         [ #  # ]:          0 :     mxChartDoc.set( xModel,UNO_QUERY );
    1082                 :          0 :     ::com::sun::star::awt::Rectangle aBoundRect;
    1083 [ #  # ][ #  # ]:          0 :     aShapeProp.GetProperty( aBoundRect, CREATE_OUSTRING( "BoundRect" ) );
    1084         [ #  # ]:          0 :     Rectangle aChartRect( Point( aBoundRect.X, aBoundRect.Y ), Size( aBoundRect.Width, aBoundRect.Height ) );
    1085 [ #  # ][ #  # ]:          0 :     mxChart.reset( new XclExpChart( GetRoot(), xModel, aChartRect ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1086                 :          0 : }
    1087                 :            : 
    1088 [ #  # ][ #  # ]:          0 : XclExpChartObj::~XclExpChartObj()
    1089                 :            : {
    1090         [ #  # ]:          0 : }
    1091                 :            : 
    1092                 :          0 : void XclExpChartObj::Save( XclExpStream& rStrm )
    1093                 :            : {
    1094                 :            :     // content of OBJ record
    1095                 :          0 :     XclObj::Save( rStrm );
    1096                 :            :     // chart substream
    1097                 :          0 :     mxChart->Save( rStrm );
    1098                 :          0 : }
    1099                 :            : 
    1100                 :          0 : void XclExpChartObj::SaveXml( XclExpXmlStream& rStrm )
    1101                 :            : {
    1102                 :            :     OSL_TRACE("XclExpChartObj::SaveXml -- Entry point to export chart");
    1103 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream();
    1104                 :            : 
    1105                 :            :     // FIXME: two cell? it seems the two cell anchor is incorrect.
    1106                 :            :     pDrawing->startElement( FSNS( XML_xdr, XML_twoCellAnchor ), // OOXTODO: oneCellAnchor, absoluteAnchor
    1107                 :            :             XML_editAs, "oneCell",
    1108         [ #  # ]:          0 :             FSEND );
    1109         [ #  # ]:          0 :     Reference< XPropertySet > xPropSet( mxShape, UNO_QUERY );
    1110         [ #  # ]:          0 :     if (xPropSet.is())
    1111                 :            :     {
    1112         [ #  # ]:          0 :         XclObjAny::WriteFromTo( rStrm, mxShape, GetTab() );
    1113         [ #  # ]:          0 :         Reference< XModel > xModel( mxChartDoc, UNO_QUERY );
    1114 [ #  # ][ #  # ]:          0 :         ChartExport aChartExport( XML_xdr, pDrawing, xModel, &rStrm, DrawingML::DOCUMENT_XLSX );
                 [ #  # ]
    1115                 :            :         static sal_Int32 nChartCount = 0;
    1116                 :          0 :         nChartCount++;
    1117 [ #  # ][ #  # ]:          0 :         aChartExport.WriteChartObj( mxShape, nChartCount );
    1118                 :            :         // TODO: get the correcto chart number
    1119                 :            :     }
    1120                 :            : 
    1121                 :            :     pDrawing->singleElement( FSNS( XML_xdr, XML_clientData),
    1122                 :            :             // OOXTODO: XML_fLocksWithSheet
    1123                 :            :             // OOXTODO: XML_fPrintsWithSheet
    1124         [ #  # ]:          0 :             FSEND );
    1125 [ #  # ][ #  # ]:          0 :     pDrawing->endElement( FSNS( XML_xdr, XML_twoCellAnchor ) );
    1126                 :          0 : }
    1127                 :            : 
    1128                 :          0 : void XclExpChartObj::WriteChartObj( sax_fastparser::FSHelperPtr pDrawing, XclExpXmlStream& rStrm )
    1129                 :            : {
    1130         [ #  # ]:          0 :     pDrawing->startElement(  FSNS( XML_xdr, XML_graphicFrame ), FSEND );
    1131                 :            : 
    1132         [ #  # ]:          0 :     pDrawing->startElement(  FSNS( XML_xdr, XML_nvGraphicFramePr ), FSEND );
    1133                 :            : 
    1134                 :            :     // TODO: get the correct chart name chart id
    1135         [ #  # ]:          0 :     OUString sName = CREATE_OUSTRING("Object 1");
    1136         [ #  # ]:          0 :     Reference< XNamed > xNamed( mxShape, UNO_QUERY );
    1137         [ #  # ]:          0 :     if (xNamed.is())
    1138                 :            :     {
    1139 [ #  # ][ #  # ]:          0 :         sName = xNamed->getName();
    1140                 :            :     }
    1141                 :          0 :     sal_Int32 nID = rStrm.GetUniqueId();
    1142                 :            : 
    1143                 :            :     pDrawing->singleElement( FSNS( XML_xdr, XML_cNvPr ),
    1144                 :            :                           XML_id,     I32S( nID ),
    1145                 :            :                           XML_name,   USS( sName ),
    1146 [ #  # ][ #  # ]:          0 :                           FSEND );
    1147                 :            : 
    1148                 :            :     pDrawing->singleElement( FSNS( XML_xdr, XML_cNvGraphicFramePr ),
    1149         [ #  # ]:          0 :                           FSEND );
    1150                 :            : 
    1151         [ #  # ]:          0 :     pDrawing->endElement( FSNS( XML_xdr, XML_nvGraphicFramePr ) );
    1152                 :            : 
    1153                 :            :     // visual chart properties
    1154 [ #  # ][ #  # ]:          0 :     WriteShapeTransformation( pDrawing, mxShape );
                 [ #  # ]
    1155                 :            : 
    1156                 :            :     // writer chart object
    1157         [ #  # ]:          0 :     pDrawing->startElement( FSNS( XML_a, XML_graphic ), FSEND );
    1158                 :            :     pDrawing->startElement( FSNS( XML_a, XML_graphicData ),
    1159                 :            :                        XML_uri, "http://schemas.openxmlformats.org/drawingml/2006/chart",
    1160         [ #  # ]:          0 :                        FSEND );
    1161                 :          0 :     OUString sId;
    1162                 :            :     // TODO:
    1163                 :            :     static sal_Int32 nChartCount = 0;
    1164                 :          0 :     nChartCount++;
    1165                 :            :     sax_fastparser::FSHelperPtr pChart = rStrm.CreateOutputStream(
    1166                 :            :             XclXmlUtils::GetStreamName( "xl/", "charts/chart", nChartCount ),
    1167                 :            :             XclXmlUtils::GetStreamName( "../", "charts/chart", nChartCount ),
    1168         [ #  # ]:          0 :             rStrm.GetCurrentStream()->getOutputStream(),
    1169                 :            :             "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
    1170                 :            :             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
    1171 [ #  # ][ #  # ]:          0 :             &sId );
         [ #  # ][ #  # ]
    1172                 :            : 
    1173                 :            :     pDrawing->singleElement(  FSNS( XML_c, XML_chart ),
    1174                 :            :             FSNS( XML_xmlns, XML_c ), "http://schemas.openxmlformats.org/drawingml/2006/chart",
    1175                 :            :             FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
    1176                 :            :             FSNS( XML_r, XML_id ), XclXmlUtils::ToOString( sId ).getStr(),
    1177 [ #  # ][ #  # ]:          0 :             FSEND );
    1178                 :            : 
    1179 [ #  # ][ #  # ]:          0 :     rStrm.PushStream( pChart );
                 [ #  # ]
    1180         [ #  # ]:          0 :     Reference< XModel > xModel( mxChartDoc, UNO_QUERY );
    1181 [ #  # ][ #  # ]:          0 :     ChartExport aChartExport( XML_xdr, pChart, xModel, &rStrm, DrawingML::DOCUMENT_XLSX );
                 [ #  # ]
    1182         [ #  # ]:          0 :     aChartExport.ExportContent();
    1183                 :            : 
    1184         [ #  # ]:          0 :     rStrm.PopStream();
    1185                 :            : 
    1186         [ #  # ]:          0 :     pDrawing->endElement( FSNS( XML_a, XML_graphicData ) );
    1187         [ #  # ]:          0 :     pDrawing->endElement( FSNS( XML_a, XML_graphic ) );
    1188 [ #  # ][ #  # ]:          0 :     pDrawing->endElement( FSNS( XML_xdr, XML_graphicFrame ) );
                 [ #  # ]
    1189                 :            : 
    1190                 :          0 : }
    1191                 :            : 
    1192                 :          0 : void XclExpChartObj::WriteShapeTransformation( sax_fastparser::FSHelperPtr pFS, const XShapeRef& rXShape, sal_Bool bFlipH, sal_Bool bFlipV, sal_Int32 nRotation )
    1193                 :            : {
    1194 [ #  # ][ #  # ]:          0 :     ::com::sun::star::awt::Point aPos = rXShape->getPosition();
    1195 [ #  # ][ #  # ]:          0 :     ::com::sun::star::awt::Size aSize = rXShape->getSize();
    1196                 :            : 
    1197                 :            :     pFS->startElementNS( XML_xdr, XML_xfrm,
    1198                 :            :                           XML_flipH, bFlipH ? "1" : NULL,
    1199                 :            :                           XML_flipV, bFlipV ? "1" : NULL,
    1200 [ #  # ][ #  # ]:          0 :                           XML_rot, nRotation ? I32S( nRotation ) : NULL,
    1201 [ #  # ][ #  # ]:          0 :                           FSEND );
         [ #  # ][ #  # ]
    1202                 :            : 
    1203         [ #  # ]:          0 :     pFS->singleElementNS( XML_a, XML_off, XML_x, IS( MM100toEMU( aPos.X ) ), XML_y, IS( MM100toEMU( aPos.Y ) ), FSEND );
    1204         [ #  # ]:          0 :     pFS->singleElementNS( XML_a, XML_ext, XML_cx, IS( MM100toEMU( aSize.Width ) ), XML_cy, IS( MM100toEMU( aSize.Height ) ), FSEND );
    1205                 :            : 
    1206         [ #  # ]:          0 :     pFS->endElementNS( XML_xdr, XML_xfrm );
    1207                 :          0 : }
    1208                 :            : 
    1209                 :            : // ============================================================================
    1210                 :            : 
    1211                 :          0 : XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
    1212                 :            :         const ScPostIt* pScNote, const String& rAddText ) :
    1213                 :            :     XclExpRecord( EXC_ID_NOTE ),
    1214                 :            :     maScPos( rScPos ),
    1215                 :            :     mnObjId( EXC_OBJ_INVALID_ID ),
    1216 [ #  # ][ #  # ]:          0 :     mbVisible( pScNote && pScNote->IsCaptionShown() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1217                 :            : {
    1218                 :            :     // get the main note text
    1219         [ #  # ]:          0 :     String aNoteText;
    1220         [ #  # ]:          0 :     if( pScNote )
    1221                 :            :     {
    1222 [ #  # ][ #  # ]:          0 :         aNoteText = pScNote->GetText();
    1223         [ #  # ]:          0 :         const EditTextObject *pEditObj = pScNote->GetEditTextObject();
    1224         [ #  # ]:          0 :         if( pEditObj )
    1225 [ #  # ][ #  # ]:          0 :             mpNoteContents = XclExpStringHelper::CreateString( rRoot, *pEditObj );
                 [ #  # ]
    1226                 :            :     }
    1227                 :            :     // append additional text
    1228         [ #  # ]:          0 :     ScGlobal::AddToken( aNoteText, rAddText, '\n', 2 );
    1229         [ #  # ]:          0 :     maOrigNoteText = aNoteText;
    1230                 :            : 
    1231                 :            :     // initialize record dependent on BIFF type
    1232      [ #  #  # ]:          0 :     switch( rRoot.GetBiff() )
    1233                 :            :     {
    1234                 :            :         case EXC_BIFF5:
    1235 [ #  # ][ #  # ]:          0 :             maNoteText = rtl::OUStringToOString(aNoteText, rRoot.GetTextEncoding());
    1236                 :          0 :         break;
    1237                 :            : 
    1238                 :            :         case EXC_BIFF8:
    1239                 :            :         {
    1240                 :            :             // TODO: additional text
    1241         [ #  # ]:          0 :             if( pScNote )
    1242 [ #  # ][ #  # ]:          0 :                 if( SdrCaptionObj* pCaption = pScNote->GetOrCreateCaption( maScPos ) )
    1243                 :            :                 {
    1244 [ #  # ][ #  # ]:          0 :                     lcl_GetFromTo( rRoot, pCaption->GetLogicRect(), maScPos.Tab(), maCommentFrom, maCommentTo );
    1245 [ #  # ][ #  # ]:          0 :                     if( const OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
    1246 [ #  # ][ #  # ]:          0 :                         mnObjId = rRoot.GetObjectManager().AddObj( new XclObjComment( rRoot.GetObjectManager(), pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible, maScPos, maCommentFrom, maCommentTo ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1247                 :            : 
    1248 [ #  # ][ #  # ]:          0 :                     SfxItemSet aItemSet = pCaption->GetMergedItemSet();
    1249         [ #  # ]:          0 :                     meTVA       = pCaption->GetTextVerticalAdjust();
    1250         [ #  # ]:          0 :                     meTHA       = pCaption->GetTextHorizontalAdjust();
    1251         [ #  # ]:          0 :                     mbAutoScale = pCaption->GetFitToSize()?true:false;
    1252 [ #  # ][ #  # ]:          0 :                     mbLocked    = pCaption->IsMoveProtect() | pCaption->IsResizeProtect();
    1253                 :            : 
    1254                 :            :                     // AutoFill style would change if Postit.cxx object creation values are changed
    1255 [ #  # ][ #  # ]:          0 :                     OUString aCol(((XFillColorItem &)GETITEM(aItemSet, XFillColorItem , XATTR_FILLCOLOR)).GetValue());
    1256 [ #  # ][ #  # ]:          0 :                     mbAutoFill  = aCol.isEmpty() && (GETITEMVALUE(aItemSet, XFillStyleItem, XATTR_FILLSTYLE, sal_uLong) == XFILL_SOLID);
                 [ #  # ]
    1257                 :          0 :                     mbAutoLine  = true;
    1258         [ #  # ]:          0 :                     mbRowHidden = (rRoot.GetDoc().RowHidden(maScPos.Row(),maScPos.Tab()));
    1259 [ #  # ][ #  # ]:          0 :                     mbColHidden = (rRoot.GetDoc().ColHidden(maScPos.Col(),maScPos.Tab()));
    1260                 :            :                 }
    1261                 :            : 
    1262         [ #  # ]:          0 :             SetRecSize( 9 + maAuthor.GetSize() );
    1263                 :            :         }
    1264                 :          0 :         break;
    1265                 :            : 
    1266                 :            :         default:    DBG_ERROR_BIFF();
    1267         [ #  # ]:          0 :     }
    1268                 :          0 : }
    1269                 :            : 
    1270                 :          0 : void XclExpNote::Save( XclExpStream& rStrm )
    1271                 :            : {
    1272      [ #  #  # ]:          0 :     switch( rStrm.GetRoot().GetBiff() )
    1273                 :            :     {
    1274                 :            :         case EXC_BIFF5:
    1275                 :            :         {
    1276                 :            :             // write the NOTE record directly, there may be the need to create more than one
    1277                 :          0 :             const sal_Char* pcBuffer = maNoteText.getStr();
    1278                 :          0 :             sal_uInt16 nCharsLeft = static_cast< sal_uInt16 >( maNoteText.getLength() );
    1279                 :            : 
    1280         [ #  # ]:          0 :             while( nCharsLeft )
    1281                 :            :             {
    1282         [ #  # ]:          0 :                 sal_uInt16 nWriteChars = ::std::min( nCharsLeft, EXC_NOTE5_MAXLEN );
    1283                 :            : 
    1284         [ #  # ]:          0 :                 rStrm.StartRecord( EXC_ID_NOTE, 6 + nWriteChars );
    1285         [ #  # ]:          0 :                 if( pcBuffer == maNoteText.getStr() )
    1286                 :            :                 {
    1287                 :            :                     // first record: row, col, length of complete text
    1288         [ #  # ]:          0 :                     rStrm   << static_cast< sal_uInt16 >( maScPos.Row() )
    1289         [ #  # ]:          0 :                             << static_cast< sal_uInt16 >( maScPos.Col() )
    1290         [ #  # ]:          0 :                             << nCharsLeft;  // still contains full length
    1291                 :            :                 }
    1292                 :            :                 else
    1293                 :            :                 {
    1294                 :            :                     // next records: -1, 0, length of current text segment
    1295         [ #  # ]:          0 :                     rStrm   << sal_uInt16( 0xFFFF )
    1296         [ #  # ]:          0 :                             << sal_uInt16( 0 )
    1297         [ #  # ]:          0 :                             << nWriteChars;
    1298                 :            :                 }
    1299         [ #  # ]:          0 :                 rStrm.Write( pcBuffer, nWriteChars );
    1300         [ #  # ]:          0 :                 rStrm.EndRecord();
    1301                 :            : 
    1302                 :          0 :                 pcBuffer += nWriteChars;
    1303                 :          0 :                 nCharsLeft = nCharsLeft - nWriteChars;
    1304                 :            :             }
    1305                 :            :         }
    1306                 :          0 :         break;
    1307                 :            : 
    1308                 :            :         case EXC_BIFF8:
    1309         [ #  # ]:          0 :             if( mnObjId != EXC_OBJ_INVALID_ID )
    1310                 :          0 :                 XclExpRecord::Save( rStrm );
    1311                 :          0 :         break;
    1312                 :            : 
    1313                 :            :         default:    DBG_ERROR_BIFF();
    1314                 :            :     }
    1315                 :          0 : }
    1316                 :            : 
    1317                 :          0 : void XclExpNote::WriteBody( XclExpStream& rStrm )
    1318                 :            : {
    1319                 :            :     // BIFF5/BIFF7 is written separately
    1320                 :            :     OSL_ENSURE_BIFF( rStrm.GetRoot().GetBiff() == EXC_BIFF8 );
    1321                 :            : 
    1322                 :          0 :     sal_uInt16 nFlags = 0;
    1323                 :          0 :     ::set_flag( nFlags, EXC_NOTE_VISIBLE, mbVisible );
    1324                 :            : 
    1325         [ #  # ]:          0 :     rStrm   << static_cast< sal_uInt16 >( maScPos.Row() )
    1326         [ #  # ]:          0 :             << static_cast< sal_uInt16 >( maScPos.Col() )
    1327         [ #  # ]:          0 :             << nFlags
    1328         [ #  # ]:          0 :             << mnObjId
    1329         [ #  # ]:          0 :             << maAuthor
    1330         [ #  # ]:          0 :             << sal_uInt8( 0 );
    1331                 :          0 : }
    1332                 :            : 
    1333                 :          0 : void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
    1334                 :            : {
    1335 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr rComments = rStrm.GetCurrentStream();
    1336                 :            : 
    1337                 :            :     rComments->startElement( XML_comment,
    1338                 :            :             XML_ref,        XclXmlUtils::ToOString( maScPos ).getStr(),
    1339                 :            :             XML_authorId,   OString::valueOf( nAuthorId ).getStr(),
    1340                 :            :             // OOXTODO: XML_guid,
    1341 [ #  # ][ #  # ]:          0 :             FSEND );
    1342         [ #  # ]:          0 :     rComments->startElement( XML_text, FSEND );
    1343                 :            :     // OOXTODO: phoneticPr, rPh, r
    1344         [ #  # ]:          0 :     if( mpNoteContents )
    1345         [ #  # ]:          0 :         mpNoteContents->WriteXml( rStrm );
    1346         [ #  # ]:          0 :     rComments->endElement( XML_text );
    1347                 :            : 
    1348                 :            : /*
    1349                 :            :    Export of commentPr is disabled, since the current (Oct 2010)
    1350                 :            :    version of MSO 2010 doesn't yet support commentPr
    1351                 :            :  */
    1352                 :            : #if 1//def XLSX_OOXML_FUTURE
    1353 [ #  # ][ #  # ]:          0 :     if( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 )
    1354                 :            :     {
    1355         [ #  # ]:          0 :         rComments->startElement( FSNS( XML_mc, XML_AlternateContent ), FSEND );
    1356         [ #  # ]:          0 :         rComments->startElement( FSNS( XML_mc, XML_Choice ), XML_Requires, "v2", FSEND );
    1357                 :            :         rComments->startElement( XML_commentPr,
    1358                 :            :                 XML_autoFill,       XclXmlUtils::ToPsz( mbAutoFill ),
    1359                 :            :                 XML_autoScale,      XclXmlUtils::ToPsz( mbAutoScale ),
    1360                 :            :                 XML_colHidden,      XclXmlUtils::ToPsz( mbColHidden ),
    1361                 :            :                 XML_locked,         XclXmlUtils::ToPsz( mbLocked ),
    1362                 :            :                 XML_rowHidden,      XclXmlUtils::ToPsz( mbRowHidden ),
    1363                 :            :                 XML_textHAlign,     ToHorizAlign( meTHA ),
    1364                 :            :                 XML_textVAlign,     ToVertAlign( meTVA ) ,
    1365 [ #  # ][ #  # ]:          0 :                 FSEND );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1366                 :            :         rComments->startElement( XML_anchor,
    1367                 :            :                 XML_moveWithCells, "false",
    1368                 :            :                 XML_sizeWithCells, "false",
    1369         [ #  # ]:          0 :                 FSEND );
    1370         [ #  # ]:          0 :         rComments->startElement( FSNS( XML_xdr, XML_from ), FSEND );
    1371 [ #  # ][ #  # ]:          0 :         lcl_WriteAnchorVertex( rComments, maCommentFrom );
                 [ #  # ]
    1372         [ #  # ]:          0 :         rComments->endElement( FSNS( XML_xdr, XML_from ) );
    1373         [ #  # ]:          0 :         rComments->startElement( FSNS( XML_xdr, XML_to ), FSEND );
    1374 [ #  # ][ #  # ]:          0 :         lcl_WriteAnchorVertex( rComments, maCommentTo );
                 [ #  # ]
    1375         [ #  # ]:          0 :         rComments->endElement( FSNS( XML_xdr, XML_to ) );
    1376         [ #  # ]:          0 :         rComments->endElement( XML_anchor );
    1377         [ #  # ]:          0 :         rComments->endElement( XML_commentPr );
    1378                 :            : 
    1379         [ #  # ]:          0 :         rComments->endElement( FSNS( XML_mc, XML_Choice ) );
    1380         [ #  # ]:          0 :         rComments->startElement( FSNS( XML_mc, XML_Fallback ), FSEND );
    1381                 :            :         // Any fallback code ?
    1382         [ #  # ]:          0 :         rComments->endElement( FSNS( XML_mc, XML_Fallback ) );
    1383         [ #  # ]:          0 :         rComments->endElement( FSNS( XML_mc, XML_AlternateContent ) );
    1384                 :            :     }
    1385                 :            : #endif
    1386 [ #  # ][ #  # ]:          0 :     rComments->endElement( XML_comment );
    1387                 :          0 : }
    1388                 :            : 
    1389                 :            : // ============================================================================
    1390                 :            : 
    1391                 :          0 : XclMacroHelper::XclMacroHelper( const XclExpRoot& rRoot ) :
    1392         [ #  # ]:          0 :     XclExpControlHelper( rRoot )
    1393                 :            : {
    1394                 :          0 : }
    1395                 :            : 
    1396         [ #  # ]:          0 : XclMacroHelper::~XclMacroHelper()
    1397                 :            : {
    1398         [ #  # ]:          0 : }
    1399                 :            : 
    1400                 :          0 : void XclMacroHelper::WriteMacroSubRec( XclExpStream& rStrm )
    1401                 :            : {
    1402         [ #  # ]:          0 :     if( mxMacroLink )
    1403                 :          0 :         WriteFormulaSubRec( rStrm, EXC_ID_OBJMACRO, *mxMacroLink );
    1404                 :          0 : }
    1405                 :            : 
    1406                 :            : bool
    1407                 :          0 : XclMacroHelper::SetMacroLink( const ScriptEventDescriptor& rEvent, const XclTbxEventType& nEventType )
    1408                 :            : {
    1409 [ #  # ][ #  # ]:          0 :     String aMacroName = XclControlHelper::ExtractFromMacroDescriptor( rEvent, nEventType, GetDocShell() );
    1410         [ #  # ]:          0 :     if( aMacroName.Len() )
    1411                 :            :     {
    1412         [ #  # ]:          0 :         return SetMacroLink( aMacroName );
    1413                 :            :     }
    1414         [ #  # ]:          0 :     return false;
    1415                 :            : }
    1416                 :            : 
    1417                 :            : bool
    1418                 :          0 : XclMacroHelper::SetMacroLink( const String& rMacroName )
    1419                 :            : {
    1420                 :            :     OSL_TRACE("SetMacroLink( macroname:=%s )", rtl::OUStringToOString( rMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
    1421         [ #  # ]:          0 :     if( rMacroName.Len() )
    1422                 :            :     {
    1423                 :          0 :         sal_uInt16 nExtSheet = GetLocalLinkManager().FindExtSheet( EXC_EXTSH_OWNDOC );
    1424                 :          0 :         sal_uInt16 nNameIdx = GetNameManager().InsertMacroCall( rMacroName, true, false );
    1425         [ #  # ]:          0 :         mxMacroLink = GetFormulaCompiler().CreateNameXFormula( nExtSheet, nNameIdx );
    1426                 :          0 :         return true;
    1427                 :            :     }
    1428                 :          0 :     return false;
    1429                 :            : }
    1430                 :            : 
    1431                 :          0 : XclExpShapeObj::XclExpShapeObj( XclExpObjectManager& rRoot, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) :
    1432                 :            :     XclObjAny( rRoot, xShape ),
    1433         [ #  # ]:          0 :     XclMacroHelper( rRoot )
    1434                 :            : {
    1435         [ #  # ]:          0 :     if( SdrObject* pSdrObj = ::GetSdrObjectFromXShape( xShape ) )
    1436                 :            :     {
    1437         [ #  # ]:          0 :         ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pSdrObj );
    1438 [ #  # ][ #  # ]:          0 :         if ( pInfo && !pInfo->GetMacro().isEmpty() )
                 [ #  # ]
    1439                 :            : // FIXME ooo330-m2: XclControlHelper::GetXclMacroName was removed in upstream sources; they started to call XclTools::GetXclMacroName instead; is this enough? it has only one parameter
    1440                 :            : //            SetMacroLink( XclControlHelper::GetXclMacroName( pInfo->GetMacro(), rRoot.GetDocShell() ) );
    1441 [ #  # ][ #  # ]:          0 :             SetMacroLink( XclTools::GetXclMacroName( pInfo->GetMacro() ) );
         [ #  # ][ #  # ]
    1442                 :            :     }
    1443                 :          0 : }
    1444                 :            : 
    1445         [ #  # ]:          0 : XclExpShapeObj::~XclExpShapeObj()
    1446                 :            : {
    1447         [ #  # ]:          0 : }
    1448                 :            : 
    1449                 :          0 : void XclExpShapeObj::WriteSubRecs( XclExpStream& rStrm )
    1450                 :            : {
    1451                 :          0 :     XclObjAny::WriteSubRecs( rStrm );
    1452                 :          0 :     WriteMacroSubRec( rStrm );
    1453                 :          0 : }
    1454                 :            : 
    1455                 :            : // ============================================================================
    1456                 :            : 
    1457                 :          0 : XclExpComments::XclExpComments( SCTAB nTab, XclExpRecordList< XclExpNote >& rNotes )
    1458                 :          0 :     : mnTab( nTab ), mrNotes( rNotes )
    1459                 :            : {
    1460                 :          0 : }
    1461                 :            : 
    1462                 :            : struct OUStringLess : public std::binary_function<OUString, OUString, bool>
    1463                 :            : {
    1464                 :          0 :     bool operator()(const OUString& x, const OUString& y) const
    1465                 :            :     {
    1466                 :          0 :         return x.compareTo( y ) < 0;
    1467                 :            :     }
    1468                 :            : };
    1469                 :            : 
    1470                 :          0 : void XclExpComments::SaveXml( XclExpXmlStream& rStrm )
    1471                 :            : {
    1472         [ #  # ]:          0 :     if( mrNotes.IsEmpty() )
    1473                 :          0 :         return;
    1474                 :            : 
    1475                 :            :     sax_fastparser::FSHelperPtr rComments = rStrm.CreateOutputStream(
    1476                 :            :             XclXmlUtils::GetStreamName( "xl/", "comments", mnTab + 1 ),
    1477                 :            :             XclXmlUtils::GetStreamName( "../", "comments", mnTab + 1 ),
    1478         [ #  # ]:          0 :             rStrm.GetCurrentStream()->getOutputStream(),
    1479                 :            :             "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
    1480 [ #  # ][ #  # ]:          0 :             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" );
         [ #  # ][ #  # ]
    1481 [ #  # ][ #  # ]:          0 :     rStrm.PushStream( rComments );
                 [ #  # ]
    1482                 :            : 
    1483 [ #  # ][ #  # ]:          0 :     if( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 )
    1484                 :            :         rComments->startElement( XML_comments,
    1485                 :            :             XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
    1486                 :            :             FSNS( XML_xmlns, XML_mc ), "http://schemas.openxmlformats.org/markup-compatibility/2006",
    1487                 :            :             FSNS( XML_xmlns, XML_xdr ), "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
    1488                 :            :             FSNS( XML_xmlns, XML_v2 ), "http://schemas.openxmlformats.org/spreadsheetml/2006/main/v2",
    1489                 :            :             FSNS( XML_mc, XML_Ignorable ), "v2",
    1490         [ #  # ]:          0 :             FSEND );
    1491                 :            :     else
    1492                 :            :         rComments->startElement( XML_comments,
    1493                 :            :             XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
    1494                 :            :             FSNS( XML_xmlns, XML_xdr ), "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
    1495         [ #  # ]:          0 :             FSEND );
    1496                 :            : 
    1497         [ #  # ]:          0 :     rComments->startElement( XML_authors, FSEND );
    1498                 :            : 
    1499                 :            :     typedef std::set< OUString, OUStringLess > Authors;
    1500         [ #  # ]:          0 :     Authors aAuthors;
    1501                 :            : 
    1502                 :          0 :     size_t nNotes = mrNotes.GetSize();
    1503         [ #  # ]:          0 :     for( size_t i = 0; i < nNotes; ++i )
    1504                 :            :     {
    1505 [ #  # ][ #  # ]:          0 :         aAuthors.insert( XclXmlUtils::ToOUString( mrNotes.GetRecord( i )->GetAuthor() ) );
         [ #  # ][ #  # ]
    1506                 :            :     }
    1507                 :            : 
    1508         [ #  # ]:          0 :     for( Authors::const_iterator b = aAuthors.begin(), e = aAuthors.end(); b != e; ++b )
    1509                 :            :     {
    1510         [ #  # ]:          0 :         rComments->startElement( XML_author, FSEND );
    1511         [ #  # ]:          0 :         rComments->writeEscaped( *b );
    1512         [ #  # ]:          0 :         rComments->endElement( XML_author );
    1513                 :            :     }
    1514                 :            : 
    1515         [ #  # ]:          0 :     rComments->endElement( XML_authors );
    1516         [ #  # ]:          0 :     rComments->startElement( XML_commentList, FSEND );
    1517                 :            : 
    1518         [ #  # ]:          0 :     for( size_t i = 0; i < nNotes; ++i )
    1519                 :            :     {
    1520         [ #  # ]:          0 :         XclExpNoteList::RecordRefType xNote = mrNotes.GetRecord( i );
    1521                 :            :         Authors::iterator aAuthor = aAuthors.find(
    1522 [ #  # ][ #  # ]:          0 :                 XclXmlUtils::ToOUString( xNote->GetAuthor() ) );
    1523         [ #  # ]:          0 :         sal_Int32 nAuthorId = distance( aAuthors.begin(), aAuthor );
    1524         [ #  # ]:          0 :         xNote->WriteXml( nAuthorId, rStrm );
    1525         [ #  # ]:          0 :     }
    1526                 :            : 
    1527         [ #  # ]:          0 :     rComments->endElement( XML_commentList );
    1528         [ #  # ]:          0 :     rComments->endElement( XML_comments );
    1529                 :            : 
    1530 [ #  # ][ #  # ]:          0 :     rStrm.PopStream();
    1531                 :            : }
    1532                 :            : 
    1533                 :            : // object manager =============================================================
    1534                 :            : 
    1535                 :          0 : XclExpObjectManager::XclExpObjectManager( const XclExpRoot& rRoot ) :
    1536 [ #  # ][ #  # ]:          0 :     XclExpRoot( rRoot )
         [ #  # ][ #  # ]
    1537                 :            : {
    1538         [ #  # ]:          0 :     InitStream( true );
    1539 [ #  # ][ #  # ]:          0 :     mxEscherEx.reset( new XclEscherEx( GetRoot(), *this, *mxDffStrm ) );
                 [ #  # ]
    1540                 :          0 : }
    1541                 :            : 
    1542                 :          0 : XclExpObjectManager::XclExpObjectManager( const XclExpObjectManager& rParent ) :
    1543 [ #  # ][ #  # ]:          0 :     XclExpRoot( rParent.GetRoot() )
         [ #  # ][ #  # ]
    1544                 :            : {
    1545         [ #  # ]:          0 :     InitStream( false );
    1546 [ #  # ][ #  # ]:          0 :     mxEscherEx.reset( new XclEscherEx( GetRoot(), *this, *mxDffStrm, rParent.mxEscherEx.get() ) );
                 [ #  # ]
    1547                 :          0 : }
    1548                 :            : 
    1549 [ #  # ][ #  # ]:          0 : XclExpObjectManager::~XclExpObjectManager()
         [ #  # ][ #  # ]
    1550                 :            : {
    1551         [ #  # ]:          0 : }
    1552                 :            : 
    1553                 :          0 : XclExpDffAnchorBase* XclExpObjectManager::CreateDffAnchor() const
    1554                 :            : {
    1555         [ #  # ]:          0 :     return new XclExpDffSheetAnchor( GetRoot() );
    1556                 :            : }
    1557                 :            : 
    1558                 :          0 : boost::shared_ptr< XclExpRecordBase > XclExpObjectManager::CreateDrawingGroup()
    1559                 :            : {
    1560         [ #  # ]:          0 :     return boost::shared_ptr< XclExpRecordBase >( new XclExpMsoDrawingGroup( *mxEscherEx ) );
    1561                 :            : }
    1562                 :            : 
    1563                 :          0 : void XclExpObjectManager::StartSheet()
    1564                 :            : {
    1565         [ #  # ]:          0 :     mxObjList.reset( new XclExpObjList( GetRoot(), *mxEscherEx ) );
    1566                 :          0 : }
    1567                 :            : 
    1568                 :          0 : boost::shared_ptr< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( SdrPage* pSdrPage )
    1569                 :            : {
    1570         [ #  # ]:          0 :     if( pSdrPage )
    1571                 :          0 :         mxEscherEx->AddSdrPage( *pSdrPage );
    1572                 :            :     // the first dummy object may still be open
    1573                 :            :     OSL_ENSURE( mxEscherEx->GetGroupLevel() <= 1, "XclExpObjectManager::ProcessDrawing - still groups open?" );
    1574         [ #  # ]:          0 :     while( mxEscherEx->GetGroupLevel() )
    1575                 :          0 :         mxEscherEx->LeaveGroup();
    1576                 :          0 :     mxObjList->EndSheet();
    1577         [ #  # ]:          0 :     return mxObjList;
    1578                 :            : }
    1579                 :            : 
    1580                 :          0 : boost::shared_ptr< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const Reference< XShapes >& rxShapes )
    1581                 :            : {
    1582         [ #  # ]:          0 :     if( rxShapes.is() )
    1583                 :          0 :         mxEscherEx->AddUnoShapes( rxShapes );
    1584                 :            :     // the first dummy object may still be open
    1585                 :            :     OSL_ENSURE( mxEscherEx->GetGroupLevel() <= 1, "XclExpObjectManager::ProcessDrawing - still groups open?" );
    1586         [ #  # ]:          0 :     while( mxEscherEx->GetGroupLevel() )
    1587                 :          0 :         mxEscherEx->LeaveGroup();
    1588                 :          0 :     mxObjList->EndSheet();
    1589         [ #  # ]:          0 :     return mxObjList;
    1590                 :            : }
    1591                 :            : 
    1592                 :          0 : void XclExpObjectManager::EndDocument()
    1593                 :            : {
    1594                 :          0 :     mxEscherEx->EndDocument();
    1595                 :          0 : }
    1596                 :            : 
    1597                 :          0 : XclExpMsoDrawing* XclExpObjectManager::GetMsodrawingPerSheet()
    1598                 :            : {
    1599                 :          0 :     return mxObjList->GetMsodrawingPerSheet();
    1600                 :            : }
    1601                 :            : 
    1602                 :          0 : bool XclExpObjectManager::HasObj() const
    1603                 :            : {
    1604                 :          0 :     return !mxObjList->empty();
    1605                 :            : }
    1606                 :            : 
    1607                 :          0 : sal_uInt16 XclExpObjectManager::AddObj( XclObj* pObjRec )
    1608                 :            : {
    1609                 :          0 :     return mxObjList->Add( pObjRec );
    1610                 :            : }
    1611                 :            : 
    1612                 :          0 : XclObj* XclExpObjectManager::RemoveLastObj()
    1613                 :            : {
    1614                 :          0 :     XclObj* pLastObj = mxObjList->back();
    1615                 :          0 :     mxObjList->pop_back();
    1616                 :          0 :     return pLastObj;
    1617                 :            : }
    1618                 :            : 
    1619                 :          0 : void XclExpObjectManager::InitStream( bool bTempFile )
    1620                 :            : {
    1621         [ #  # ]:          0 :     if( bTempFile )
    1622                 :            :     {
    1623         [ #  # ]:          0 :         mxTempFile.reset( new ::utl::TempFile );
    1624         [ #  # ]:          0 :         if( mxTempFile->IsValid() )
    1625                 :            :         {
    1626                 :          0 :             mxTempFile->EnableKillingFile();
    1627 [ #  # ][ #  # ]:          0 :             mxDffStrm.reset( ::utl::UcbStreamHelper::CreateStream( mxTempFile->GetURL(), STREAM_STD_READWRITE ) );
    1628                 :            :         }
    1629                 :            :     }
    1630                 :            : 
    1631         [ #  # ]:          0 :     if( !mxDffStrm.get() )
    1632         [ #  # ]:          0 :         mxDffStrm.reset( new SvMemoryStream );
    1633                 :            : 
    1634                 :          0 :     mxDffStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
    1635                 :          0 : }
    1636                 :            : 
    1637                 :            : // ----------------------------------------------------------------------------
    1638                 :            : 
    1639                 :          0 : XclExpEmbeddedObjectManager::XclExpEmbeddedObjectManager(
    1640                 :            :         const XclExpObjectManager& rParent, const Size& rPageSize, sal_Int32 nScaleX, sal_Int32 nScaleY ) :
    1641                 :            :     XclExpObjectManager( rParent ),
    1642                 :            :     maPageSize( rPageSize ),
    1643                 :            :     mnScaleX( nScaleX ),
    1644                 :          0 :     mnScaleY( nScaleY )
    1645                 :            : {
    1646                 :          0 : }
    1647                 :            : 
    1648                 :          0 : XclExpDffAnchorBase* XclExpEmbeddedObjectManager::CreateDffAnchor() const
    1649                 :            : {
    1650         [ #  # ]:          0 :     return new XclExpDffEmbeddedAnchor( GetRoot(), maPageSize, mnScaleX, mnScaleY );
    1651 [ +  - ][ +  - ]:         24 : }
    1652                 :            : 
    1653                 :            : // ============================================================================
    1654                 :            : 
    1655                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10