LCOV - code coverage report
Current view: top level - dbaccess/source/ui/misc - TokenWriter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 568 0.0 %
Date: 2012-08-25 Functions: 0 25 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1197 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "TokenWriter.hxx"
      21                 :            : #include <tools/debug.hxx>
      22                 :            : #include <tools/diagnose_ex.h>
      23                 :            : #include <osl/diagnose.h>
      24                 :            : #include "RtfReader.hxx"
      25                 :            : #include "HtmlReader.hxx"
      26                 :            : #include "dbustrings.hrc"
      27                 :            : #include <comphelper/componentcontext.hxx>
      28                 :            : #include <comphelper/string.hxx>
      29                 :            : #include <comphelper/types.hxx>
      30                 :            : #include <connectivity/dbtools.hxx>
      31                 :            : #include <com/sun/star/sdbc/XConnection.hpp>
      32                 :            : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      33                 :            : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
      34                 :            : #include <com/sun/star/sdbc/XRowSet.hpp>
      35                 :            : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
      36                 :            : #include <com/sun/star/sdb/XQueriesSupplier.hpp>
      37                 :            : #include <com/sun/star/sdbc/XDataSource.hpp>
      38                 :            : #include <com/sun/star/awt/FontWeight.hpp>
      39                 :            : #include <com/sun/star/awt/FontStrikeout.hpp>
      40                 :            : #include <com/sun/star/awt/FontSlant.hpp>
      41                 :            : #include <com/sun/star/awt/FontUnderline.hpp>
      42                 :            : #include <com/sun/star/document/XDocumentProperties.hpp>
      43                 :            : #include <svtools/htmlkywd.hxx>
      44                 :            : #include <svtools/rtfkeywd.hxx>
      45                 :            : #include <tools/color.hxx>
      46                 :            : #include <svtools/htmlout.hxx>
      47                 :            : #include <sfx2/frmhtmlw.hxx>
      48                 :            : #include <svl/numuno.hxx>
      49                 :            : #include <vcl/svapp.hxx>
      50                 :            : #include "UITools.hxx"
      51                 :            : #include <toolkit/helper/vclunohelper.hxx>
      52                 :            : #include <vcl/outdev.hxx>
      53                 :            : #include <svtools/rtfout.hxx>
      54                 :            : #include <svtools/htmlcfg.hxx>
      55                 :            : #include <connectivity/formattedcolumnvalue.hxx>
      56                 :            : #include <unotools/syslocale.hxx>
      57                 :            : #include <rtl/logfile.hxx>
      58                 :            : 
      59                 :            : using namespace dbaui;
      60                 :            : using namespace dbtools;
      61                 :            : using namespace svx;
      62                 :            : using namespace ::com::sun::star;
      63                 :            : using namespace ::com::sun::star::uno;
      64                 :            : using namespace ::com::sun::star::beans;
      65                 :            : using namespace ::com::sun::star::container;
      66                 :            : using namespace ::com::sun::star::sdbc;
      67                 :            : using namespace ::com::sun::star::sdb;
      68                 :            : using namespace ::com::sun::star::frame;
      69                 :            : using namespace ::com::sun::star::lang;
      70                 :            : using namespace ::com::sun::star::sdbcx;
      71                 :            : using namespace ::com::sun::star::awt;
      72                 :            : using namespace ::com::sun::star::util;
      73                 :            : using ::com::sun::star::frame::XModel;
      74                 :            : 
      75                 :            : #if defined(UNX)
      76                 :            : const char ODatabaseImportExport::sNewLine = '\012';
      77                 :            : #else
      78                 :            : const char ODatabaseImportExport::sNewLine[] = "\015\012";
      79                 :            : #endif
      80                 :            : 
      81                 :            : const static char sMyBegComment[]   = "<!-- ";
      82                 :            : const static char sMyEndComment[]   = " -->";
      83                 :            : const static char sFontFamily[]     = "font-family: ";
      84                 :            : const static char sFontSize[]       = "font-size: ";
      85                 :            : 
      86                 :            : #define SBA_FORMAT_SELECTION_COUNT  4
      87                 :            : #define CELL_X                      1437
      88                 :            : 
      89                 :            : DBG_NAME(ODatabaseImportExport)
      90                 :            : //======================================================================
      91                 :          0 : ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor& _aDataDescriptor,
      92                 :            :                                              const Reference< XMultiServiceFactory >& _rM,
      93                 :            :                                              const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
      94                 :            :                                              const String& rExchange)
      95                 :            :     :m_bBookmarkSelection( sal_False )
      96                 :            :     ,m_xFormatter(_rxNumberF)
      97                 :            :     ,m_xFactory(_rM)
      98                 :            :     ,m_nCommandType(CommandType::TABLE)
      99                 :            :     ,m_bNeedToReInitialize(sal_False)
     100                 :            :     ,m_pReader(NULL)
     101                 :            :     ,m_pRowMarker(NULL)
     102                 :            :     ,m_bInInitialize(sal_False)
     103 [ #  # ][ #  # ]:          0 :     ,m_bCheckOnly(sal_False)
     104                 :            : {
     105                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::ODatabaseImportExport" );
     106                 :            :     DBG_CTOR(ODatabaseImportExport,NULL);
     107                 :            : 
     108         [ #  # ]:          0 :     m_eDestEnc = osl_getThreadTextEncoding();
     109                 :            : 
     110         [ #  # ]:          0 :     osl_incrementInterlockedCount( &m_refCount );
     111         [ #  # ]:          0 :     impl_initFromDescriptor( _aDataDescriptor, false );
     112                 :            : 
     113 [ #  # ][ #  # ]:          0 :     xub_StrLen nCount = comphelper::string::getTokenCount(rExchange, char(11));
     114 [ #  # ][ #  # ]:          0 :     if( nCount > SBA_FORMAT_SELECTION_COUNT && rExchange.GetToken(4).Len())
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     115                 :            :     {
     116         [ #  # ]:          0 :         m_pRowMarker = new sal_Int32[nCount-SBA_FORMAT_SELECTION_COUNT];
     117         [ #  # ]:          0 :         for(xub_StrLen i=SBA_FORMAT_SELECTION_COUNT;i<nCount;++i)
     118 [ #  # ][ #  # ]:          0 :             m_pRowMarker[i-SBA_FORMAT_SELECTION_COUNT] = rExchange.GetToken(i,char(11)).ToInt32();
                 [ #  # ]
     119                 :            :     }
     120         [ #  # ]:          0 :     osl_decrementInterlockedCount( &m_refCount );
     121                 :          0 : }
     122                 :            : // -----------------------------------------------------------------------------
     123                 :            : // import data
     124                 :          0 : ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& _rxConnection,
     125                 :            :         const Reference< XNumberFormatter >& _rxNumberF, const Reference< XMultiServiceFactory >& _rM )
     126                 :            :     :m_bBookmarkSelection( sal_False )
     127                 :            :     ,m_xConnection(_rxConnection)
     128                 :            :     ,m_xFormatter(_rxNumberF)
     129                 :            :     ,m_xFactory(_rM)
     130                 :            :     ,m_nCommandType(::com::sun::star::sdb::CommandType::TABLE)
     131                 :            :     ,m_bNeedToReInitialize(sal_False)
     132                 :            :     ,m_pReader(NULL)
     133                 :            :     ,m_pRowMarker(NULL)
     134                 :            :     ,m_bInInitialize(sal_False)
     135 [ #  # ][ #  # ]:          0 :     ,m_bCheckOnly(sal_False)
     136                 :            : {
     137                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::ODatabaseImportExport" );
     138                 :            :     DBG_CTOR(ODatabaseImportExport,NULL);
     139         [ #  # ]:          0 :     m_eDestEnc = osl_getThreadTextEncoding();
     140                 :            :     try
     141                 :            :     {
     142         [ #  # ]:          0 :         SvtSysLocale aSysLocale;
     143 [ #  # ][ #  # ]:          0 :         m_aLocale = aSysLocale.GetLocaleData().getLocale();
         [ #  # ][ #  # ]
     144                 :            :     }
     145         [ #  # ]:          0 :     catch(Exception&)
     146                 :            :     {
     147                 :            :     }
     148                 :          0 : }
     149                 :            : //-------------------------------------------------------------------
     150 [ #  # ][ #  # ]:          0 : ODatabaseImportExport::~ODatabaseImportExport()
     151                 :            : {
     152                 :            :     DBG_DTOR(ODatabaseImportExport,NULL);
     153                 :          0 :     acquire();
     154                 :            : 
     155         [ #  # ]:          0 :     dispose();
     156                 :            : 
     157         [ #  # ]:          0 :     if(m_pReader)
     158         [ #  # ]:          0 :         m_pReader->release();
     159                 :          0 :     delete m_pRowMarker;
     160         [ #  # ]:          0 : }
     161                 :            : // -----------------------------------------------------------------------------
     162                 :          0 : void ODatabaseImportExport::dispose()
     163                 :            : {
     164                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::disposing" );
     165                 :            :     DBG_CHKTHIS(ODatabaseImportExport,NULL);
     166                 :            :     // remove me as listener
     167         [ #  # ]:          0 :     Reference< XComponent >  xComponent(m_xConnection, UNO_QUERY);
     168         [ #  # ]:          0 :     if (xComponent.is())
     169                 :            :     {
     170         [ #  # ]:          0 :         Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY);
     171 [ #  # ][ #  # ]:          0 :         xComponent->removeEventListener(xEvt);
     172                 :            :     }
     173         [ #  # ]:          0 :     m_xConnection.clear();
     174                 :            : 
     175         [ #  # ]:          0 :     ::comphelper::disposeComponent(m_xRow);
     176                 :            : 
     177                 :          0 :     m_xObject.clear();
     178                 :          0 :     m_xResultSetMetaData.clear();
     179                 :          0 :     m_xResultSet.clear();
     180                 :          0 :     m_xRow.clear();
     181                 :          0 :     m_xRowLocate.clear();
     182                 :          0 :     m_xFormatter.clear();
     183                 :          0 : }
     184                 :            : // -----------------------------------------------------------------------------
     185                 :          0 : void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
     186                 :            : {
     187                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::disposing" );
     188                 :            :     DBG_CHKTHIS(ODatabaseImportExport,NULL);
     189         [ #  # ]:          0 :     Reference<XConnection> xCon(Source.Source,UNO_QUERY);
     190 [ #  # ][ #  # ]:          0 :     if(m_xConnection.is() && m_xConnection == xCon)
         [ #  # ][ #  # ]
     191                 :            :     {
     192         [ #  # ]:          0 :         m_xConnection.clear();
     193         [ #  # ]:          0 :         dispose();
     194                 :          0 :         m_bNeedToReInitialize = true;
     195                 :          0 :     }
     196                 :          0 : }
     197                 :            : // -----------------------------------------------------------------------------
     198                 :          0 : void ODatabaseImportExport::initialize( const ODataAccessDescriptor& _aDataDescriptor )
     199                 :            : {
     200                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::initialize" );
     201                 :          0 :     impl_initFromDescriptor( _aDataDescriptor, true );
     202                 :          0 : }
     203                 :            : 
     204                 :            : // -----------------------------------------------------------------------------
     205                 :          0 : void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor& _aDataDescriptor, bool _bPlusDefaultInit)
     206                 :            : {
     207                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::impl_initFromDescriptor" );
     208                 :            :     DBG_CHKTHIS(ODatabaseImportExport,NULL);
     209         [ #  # ]:          0 :     if ( !_bPlusDefaultInit )
     210                 :            :     {
     211                 :          0 :         m_sDataSourceName = _aDataDescriptor.getDataSource();
     212                 :          0 :         _aDataDescriptor[daCommandType] >>= m_nCommandType;
     213                 :          0 :         _aDataDescriptor[daCommand]     >>= m_sName;
     214                 :            :         // some additonal information
     215         [ #  # ]:          0 :         if(_aDataDescriptor.has(daConnection))
     216                 :            :         {
     217 [ #  # ][ #  # ]:          0 :             Reference< XConnection > xPureConn( _aDataDescriptor[daConnection], UNO_QUERY );
     218         [ #  # ]:          0 :             m_xConnection.reset( xPureConn, SharedConnection::NoTakeOwnership );
     219         [ #  # ]:          0 :             Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY);
     220         [ #  # ]:          0 :             Reference< XComponent >  xComponent(m_xConnection, UNO_QUERY);
     221 [ #  # ][ #  # ]:          0 :             if (xComponent.is() && xEvt.is())
                 [ #  # ]
     222 [ #  # ][ #  # ]:          0 :                 xComponent->addEventListener(xEvt);
     223                 :            :         }
     224                 :            : 
     225         [ #  # ]:          0 :         if ( _aDataDescriptor.has( daSelection ) )
     226                 :          0 :             _aDataDescriptor[ daSelection ] >>= m_aSelection;
     227                 :            : 
     228         [ #  # ]:          0 :         if ( _aDataDescriptor.has( daBookmarkSelection ) )
     229                 :          0 :             _aDataDescriptor[ daBookmarkSelection ] >>= m_bBookmarkSelection;
     230                 :            : 
     231         [ #  # ]:          0 :         if ( _aDataDescriptor.has( daCursor ) )
     232                 :            :         {
     233                 :          0 :             _aDataDescriptor[ daCursor ] >>= m_xResultSet;
     234                 :          0 :             m_xRowLocate.set( m_xResultSet, UNO_QUERY );
     235                 :            :         }
     236                 :            : 
     237         [ #  # ]:          0 :         if ( m_aSelection.getLength() != 0 )
     238                 :            :         {
     239         [ #  # ]:          0 :             if ( !m_xResultSet.is() )
     240                 :            :             {
     241                 :            :                 OSL_FAIL( "ODatabaseImportExport::impl_initFromDescriptor: selection without result set is nonsense!" );
     242                 :          0 :                 m_aSelection.realloc( 0 );
     243                 :            :             }
     244                 :            :         }
     245                 :            : 
     246         [ #  # ]:          0 :         if ( m_aSelection.getLength() != 0 )
     247                 :            :         {
     248 [ #  # ][ #  # ]:          0 :             if ( m_bBookmarkSelection && !m_xRowLocate.is() )
                 [ #  # ]
     249                 :            :             {
     250                 :            :                 OSL_FAIL( "ODatabaseImportExport::impl_initFromDescriptor: no XRowLocate -> no bookmars!" );
     251                 :          0 :                 m_aSelection.realloc( 0 );
     252                 :            :             }
     253                 :            :         }
     254                 :            :     }
     255                 :            :     else
     256                 :          0 :         initialize();
     257                 :            : 
     258                 :            :     try
     259                 :            :     {
     260         [ #  # ]:          0 :         SvtSysLocale aSysLocale;
     261 [ #  # ][ #  # ]:          0 :         m_aLocale = aSysLocale.GetLocaleData().getLocale();
         [ #  # ][ #  # ]
     262                 :            :     }
     263                 :          0 :     catch(Exception&)
     264                 :            :     {
     265                 :            :     }
     266                 :          0 : }
     267                 :            : // -----------------------------------------------------------------------------
     268                 :          0 : void ODatabaseImportExport::initialize()
     269                 :            : {
     270                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::initialize" );
     271                 :            :     DBG_CHKTHIS(ODatabaseImportExport,NULL);
     272                 :          0 :     m_bInInitialize = sal_True;
     273                 :          0 :     m_bNeedToReInitialize = false;
     274                 :            : 
     275         [ #  # ]:          0 :     if ( !m_xConnection.is() )
     276                 :            :     {   // we need a connection
     277                 :            :         OSL_ENSURE(!m_sDataSourceName.isEmpty(),"There must be a datsource name!");
     278 [ #  # ][ #  # ]:          0 :         Reference<XNameAccess> xDatabaseContext = Reference< XNameAccess >(m_xFactory->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
         [ #  # ][ #  # ]
     279         [ #  # ]:          0 :         Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY);
     280                 :            : 
     281                 :          0 :         Reference< XConnection > xConnection;
     282         [ #  # ]:          0 :         SQLExceptionInfo aInfo = ::dbaui::createConnection( m_sDataSourceName, xDatabaseContext, m_xFactory, xEvt, xConnection );
     283         [ #  # ]:          0 :         m_xConnection.reset( xConnection );
     284                 :            : 
     285 [ #  # ][ #  # ]:          0 :         if(aInfo.isValid() && aInfo.getType() == SQLExceptionInfo::SQL_EXCEPTION)
                 [ #  # ]
     286 [ #  # ][ #  # ]:          0 :             throw *static_cast<const SQLException*>(aInfo);
                 [ #  # ]
     287                 :            :     }
     288                 :            : 
     289                 :          0 :     Reference<XNameAccess> xNameAccess;
     290      [ #  #  # ]:          0 :     switch(m_nCommandType)
     291                 :            :     {
     292                 :            :         case CommandType::TABLE:
     293                 :            :             {
     294                 :            :                 // only for tables
     295         [ #  # ]:          0 :                 Reference<XTablesSupplier> xSup(m_xConnection,UNO_QUERY);
     296         [ #  # ]:          0 :                 if(xSup.is())
     297 [ #  # ][ #  # ]:          0 :                     xNameAccess = xSup->getTables();
                 [ #  # ]
     298                 :            :             }
     299                 :          0 :             break;
     300                 :            :         case CommandType::QUERY:
     301                 :            :             {
     302         [ #  # ]:          0 :                 Reference<XQueriesSupplier> xSup(m_xConnection,UNO_QUERY);
     303         [ #  # ]:          0 :                 if(xSup.is())
     304 [ #  # ][ #  # ]:          0 :                     xNameAccess = xSup->getQueries();
                 [ #  # ]
     305                 :            :             }
     306                 :          0 :             break;
     307                 :            :     }
     308 [ #  # ][ #  # ]:          0 :     if(xNameAccess.is() && xNameAccess->hasByName(m_sName))
         [ #  # ][ #  # ]
                 [ #  # ]
     309                 :            :     {
     310                 :          0 :         Reference<XPropertySet> xSourceObject;
     311 [ #  # ][ #  # ]:          0 :         xNameAccess->getByName(m_sName) >>= m_xObject;
                 [ #  # ]
     312                 :            :     }
     313                 :            : 
     314         [ #  # ]:          0 :     if(m_xObject.is())
     315                 :            :     {
     316                 :            :         try
     317                 :            :         {
     318 [ #  # ][ #  # ]:          0 :             if(m_xObject->getPropertySetInfo()->hasPropertyByName(PROPERTY_FONT))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     319 [ #  # ][ #  # ]:          0 :                 m_xObject->getPropertyValue(PROPERTY_FONT) >>= m_aFont;
         [ #  # ][ #  # ]
     320                 :            : 
     321                 :            :             // the result set may be already set with the datadescriptor
     322         [ #  # ]:          0 :             if ( !m_xResultSet.is() )
     323                 :            :             {
     324 [ #  # ][ #  # ]:          0 :                 m_xResultSet.set( m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.RowSet")) ), UNO_QUERY );
         [ #  # ][ #  # ]
     325         [ #  # ]:          0 :                 Reference< XPropertySet > xProp( m_xResultSet, UNO_QUERY_THROW );
     326 [ #  # ][ #  # ]:          0 :                 xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( m_xConnection.getTyped() ) );
         [ #  # ][ #  # ]
     327 [ #  # ][ #  # ]:          0 :                 xProp->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( m_nCommandType ) );
         [ #  # ][ #  # ]
     328 [ #  # ][ #  # ]:          0 :                 xProp->setPropertyValue( PROPERTY_COMMAND, makeAny( m_sName ) );
         [ #  # ][ #  # ]
     329         [ #  # ]:          0 :                 Reference< XRowSet > xRowSet( xProp, UNO_QUERY );
     330 [ #  # ][ #  # ]:          0 :                 xRowSet->execute();
     331                 :            :             }
     332         [ #  # ]:          0 :             impl_initializeRowMember_throw();
     333                 :            :         }
     334         [ #  # ]:          0 :         catch(Exception& )
     335                 :            :         {
     336         [ #  # ]:          0 :             m_xRow = NULL;
     337         [ #  # ]:          0 :             m_xResultSetMetaData = NULL;
     338         [ #  # ]:          0 :             ::comphelper::disposeComponent(m_xResultSet);
     339                 :          0 :             throw;
     340                 :            :         }
     341                 :            :     }
     342         [ #  # ]:          0 :     if ( m_aFont.Name.isEmpty() )
     343                 :            :     {
     344                 :            :         Font aApplicationFont = OutputDevice::GetDefaultFont(
     345                 :            :             DEFAULTFONT_SANS_UNICODE,
     346 [ #  # ][ #  # ]:          0 :             Application::GetSettings().GetUILanguage(),
     347                 :            :             DEFAULTFONT_FLAGS_ONLYONE
     348         [ #  # ]:          0 :         );
     349 [ #  # ][ #  # ]:          0 :         m_aFont = VCLUnoHelper::CreateFontDescriptor( aApplicationFont );
     350                 :            :     }
     351                 :            : 
     352                 :          0 :     m_bInInitialize = sal_False;
     353                 :          0 : }
     354                 :            : // -----------------------------------------------------------------------------
     355                 :          0 : sal_Bool ODatabaseImportExport::Write()
     356                 :            : {
     357         [ #  # ]:          0 :     if ( m_bNeedToReInitialize )
     358                 :            :     {
     359         [ #  # ]:          0 :         if ( !m_bInInitialize )
     360                 :          0 :             initialize();
     361                 :            :     }
     362                 :          0 :     return sal_True;
     363                 :            : }
     364                 :            : // -----------------------------------------------------------------------------
     365                 :          0 : sal_Bool ODatabaseImportExport::Read()
     366                 :            : {
     367         [ #  # ]:          0 :     if ( m_bNeedToReInitialize )
     368                 :            :     {
     369         [ #  # ]:          0 :         if ( !m_bInInitialize )
     370                 :          0 :             initialize();
     371                 :            :     }
     372                 :          0 :     return sal_True;
     373                 :            : }
     374                 :            : // -----------------------------------------------------------------------------
     375                 :          0 : void ODatabaseImportExport::impl_initializeRowMember_throw()
     376                 :            : {
     377                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::impl_initializeRowMember_throw" );
     378 [ #  # ][ #  # ]:          0 :     if ( !m_xRow.is() && m_xResultSet.is() )
                 [ #  # ]
     379                 :            :     {
     380         [ #  # ]:          0 :         m_xRow.set( m_xResultSet, UNO_QUERY );
     381         [ #  # ]:          0 :         m_xRowLocate.set( m_xResultSet, UNO_QUERY );
     382 [ #  # ][ #  # ]:          0 :         m_xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData();
         [ #  # ][ #  # ]
     383         [ #  # ]:          0 :         Reference<XColumnsSupplier> xSup(m_xResultSet,UNO_QUERY_THROW);
     384 [ #  # ][ #  # ]:          0 :         m_xRowSetColumns.set(xSup->getColumns(),UNO_QUERY_THROW);
                 [ #  # ]
     385                 :            :     }
     386                 :          0 : }
     387                 :            : //======================================================================
     388                 :          0 : sal_Bool ORTFImportExport::Write()
     389                 :            : {
     390                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFImportExport::Write" );
     391         [ #  # ]:          0 :     ODatabaseImportExport::Write();
     392 [ #  # ][ #  # ]:          0 :     (*m_pStream) << '{'     << OOO_STRING_SVTOOLS_RTF_RTF;
     393 [ #  # ][ #  # ]:          0 :     (*m_pStream) << OOO_STRING_SVTOOLS_RTF_ANSI << ODatabaseImportExport::sNewLine;
     394                 :          0 :     rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252;
     395                 :            : 
     396                 :          0 :     sal_Bool bBold          = ( ::com::sun::star::awt::FontWeight::BOLD     == m_aFont.Weight );
     397                 :          0 :     sal_Bool bItalic        = ( ::com::sun::star::awt::FontSlant_ITALIC     == m_aFont.Slant );
     398                 :          0 :     sal_Bool bUnderline     = ( ::com::sun::star::awt::FontUnderline::NONE  != m_aFont.Underline );
     399                 :          0 :     sal_Bool bStrikeout     = ( ::com::sun::star::awt::FontStrikeout::NONE  != m_aFont.Strikeout );
     400                 :            : 
     401                 :          0 :     sal_Int32 nColor = 0;
     402         [ #  # ]:          0 :     if(m_xObject.is())
     403 [ #  # ][ #  # ]:          0 :         m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
                 [ #  # ]
     404                 :          0 :     ::Color aColor(nColor);
     405                 :            : 
     406         [ #  # ]:          0 :     rtl::OString aFonts(rtl::OUStringToOString(m_aFont.Name, eDestEnc));
     407         [ #  # ]:          0 :     if (aFonts.isEmpty())
     408                 :            :     {
     409 [ #  # ][ #  # ]:          0 :         rtl::OUString aName = Application::GetSettings().GetStyleSettings().GetAppFont().GetName();
                 [ #  # ]
     410         [ #  # ]:          0 :         aFonts = rtl::OUStringToOString(aName, eDestEnc);
     411                 :            :     }
     412                 :            : 
     413         [ #  # ]:          0 :     (*m_pStream)    << "{\\fonttbl";
     414         [ #  # ]:          0 :     xub_StrLen nTokenCount = comphelper::string::getTokenCount(aFonts, ';');
     415         [ #  # ]:          0 :     for(sal_uInt32 j=0;j<nTokenCount;++j)
     416                 :            :     {
     417         [ #  # ]:          0 :         (*m_pStream) << "\\f";
     418         [ #  # ]:          0 :         m_pStream->WriteNumber(static_cast<sal_Int32>(j));
     419         [ #  # ]:          0 :         (*m_pStream) << "\\fcharset0\\fnil ";
     420         [ #  # ]:          0 :         (*m_pStream) << comphelper::string::getToken(aFonts, j, ';').getStr();
     421         [ #  # ]:          0 :         (*m_pStream) << ';';
     422                 :            :     }
     423         [ #  # ]:          0 :     (*m_pStream) << '}' ;
     424         [ #  # ]:          0 :     (*m_pStream) << ODatabaseImportExport::sNewLine;
     425                 :            :     // write the rtf color table
     426 [ #  # ][ #  # ]:          0 :     (*m_pStream) << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL << OOO_STRING_SVTOOLS_RTF_RED;
                 [ #  # ]
     427         [ #  # ]:          0 :     m_pStream->WriteNumber(static_cast<sal_uInt32>(aColor.GetRed()));
     428         [ #  # ]:          0 :     (*m_pStream) << OOO_STRING_SVTOOLS_RTF_GREEN;
     429         [ #  # ]:          0 :     m_pStream->WriteNumber(static_cast<sal_uInt32>(aColor.GetGreen()));
     430         [ #  # ]:          0 :     (*m_pStream) << OOO_STRING_SVTOOLS_RTF_BLUE;
     431         [ #  # ]:          0 :     m_pStream->WriteNumber(static_cast<sal_uInt32>(aColor.GetBlue()));
     432                 :            : 
     433         [ #  # ]:          0 :     (*m_pStream) << ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}"
     434         [ #  # ]:          0 :                  << ODatabaseImportExport::sNewLine;
     435                 :            : 
     436                 :            :     static char const aTRRH[] = "\\trrh-270\\pard\\intbl";
     437                 :            :     static char const aFS[] = "\\fs20\\f0\\cf0\\cb2";
     438                 :            :     static char const aCell1[] = "\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx";
     439                 :            : 
     440 [ #  # ][ #  # ]:          0 :     (*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
     441         [ #  # ]:          0 :     m_pStream->WriteNumber(static_cast<sal_Int32>(40));
     442         [ #  # ]:          0 :     (*m_pStream) << ODatabaseImportExport::sNewLine;
     443                 :            : 
     444         [ #  # ]:          0 :     if(m_xObject.is())
     445                 :            :     {
     446         [ #  # ]:          0 :         Reference<XColumnsSupplier> xColSup(m_xObject,UNO_QUERY);
     447 [ #  # ][ #  # ]:          0 :         Reference<XNameAccess> xColumns = xColSup->getColumns();
     448 [ #  # ][ #  # ]:          0 :         Sequence< ::rtl::OUString> aNames(xColumns->getElementNames());
     449                 :          0 :         const ::rtl::OUString* pIter = aNames.getConstArray();
     450                 :            : 
     451                 :          0 :         sal_Int32 nCount = aNames.getLength();
     452                 :          0 :         sal_Bool bUseResultMetaData = sal_False;
     453         [ #  # ]:          0 :         if ( !nCount )
     454                 :            :         {
     455 [ #  # ][ #  # ]:          0 :             nCount = m_xResultSetMetaData->getColumnCount();
     456                 :          0 :             bUseResultMetaData = sal_True;
     457                 :            :         }
     458                 :            : 
     459         [ #  # ]:          0 :         for( sal_Int32 i=1; i<=nCount; ++i )
     460                 :            :         {
     461         [ #  # ]:          0 :             (*m_pStream) << aCell1;
     462         [ #  # ]:          0 :             m_pStream->WriteNumber(i*CELL_X);
     463         [ #  # ]:          0 :             (*m_pStream) << ODatabaseImportExport::sNewLine;
     464                 :            :         }
     465                 :            : 
     466                 :            :         // Spaltenbeschreibung
     467 [ #  # ][ #  # ]:          0 :         (*m_pStream) << '{' << ODatabaseImportExport::sNewLine;
     468         [ #  # ]:          0 :         (*m_pStream) << aTRRH;
     469                 :            : 
     470                 :            : 
     471 [ #  # ][ #  # ]:          0 :         ::rtl::OString* pHorzChar = new ::rtl::OString[nCount];
     472                 :            : 
     473         [ #  # ]:          0 :         for ( sal_Int32 i=1; i <= nCount; ++i )
     474                 :            :         {
     475                 :          0 :             sal_Int32 nAlign = 0;
     476                 :          0 :             ::rtl::OUString sColumnName;
     477         [ #  # ]:          0 :             if ( bUseResultMetaData )
     478 [ #  # ][ #  # ]:          0 :                 sColumnName = m_xResultSetMetaData->getColumnName(i);
     479                 :            :             else
     480                 :            :             {
     481                 :          0 :                 sColumnName = *pIter;
     482                 :          0 :                 Reference<XPropertySet> xColumn;
     483 [ #  # ][ #  # ]:          0 :                 xColumns->getByName(sColumnName) >>= xColumn;
                 [ #  # ]
     484 [ #  # ][ #  # ]:          0 :                 xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlign;
                 [ #  # ]
     485                 :          0 :                 ++pIter;
     486                 :            :             }
     487                 :            : 
     488                 :            :             const char* pChar;
     489      [ #  #  # ]:          0 :             switch( nAlign )
     490                 :            :             {
     491                 :          0 :                 case 1: pChar = OOO_STRING_SVTOOLS_RTF_QC;  break;
     492                 :          0 :                 case 2: pChar = OOO_STRING_SVTOOLS_RTF_QR;  break;
     493                 :            :                 case 0:
     494                 :          0 :                 default:pChar = OOO_STRING_SVTOOLS_RTF_QL;  break;
     495                 :            :             }
     496                 :            : 
     497                 :          0 :             pHorzChar[i-1] = pChar; // um sp"ater nicht immer im ITEMSET zuw"uhlen
     498                 :            : 
     499         [ #  # ]:          0 :             (*m_pStream) << ODatabaseImportExport::sNewLine;
     500         [ #  # ]:          0 :             (*m_pStream) << '{';
     501         [ #  # ]:          0 :             (*m_pStream) << OOO_STRING_SVTOOLS_RTF_QC;   // column header always centered
     502                 :            : 
     503 [ #  # ][ #  # ]:          0 :             if ( bBold )        (*m_pStream) << OOO_STRING_SVTOOLS_RTF_B;
     504 [ #  # ][ #  # ]:          0 :             if ( bItalic )      (*m_pStream) << OOO_STRING_SVTOOLS_RTF_I;
     505 [ #  # ][ #  # ]:          0 :             if ( bUnderline )   (*m_pStream) << OOO_STRING_SVTOOLS_RTF_UL;
     506 [ #  # ][ #  # ]:          0 :             if ( bStrikeout )   (*m_pStream) << OOO_STRING_SVTOOLS_RTF_STRIKE;
     507                 :            : 
     508         [ #  # ]:          0 :             (*m_pStream) << aFS;
     509         [ #  # ]:          0 :             (*m_pStream) << ' ';
     510 [ #  # ][ #  # ]:          0 :             RTFOutFuncs::Out_String(*m_pStream,sColumnName,eDestEnc);
                 [ #  # ]
     511                 :            : 
     512         [ #  # ]:          0 :             (*m_pStream) << OOO_STRING_SVTOOLS_RTF_CELL;
     513         [ #  # ]:          0 :             (*m_pStream) << '}';
     514         [ #  # ]:          0 :             (*m_pStream) << ODatabaseImportExport::sNewLine;
     515 [ #  # ][ #  # ]:          0 :             (*m_pStream) << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
     516                 :          0 :         }
     517                 :            : 
     518         [ #  # ]:          0 :         (*m_pStream) << OOO_STRING_SVTOOLS_RTF_ROW;
     519 [ #  # ][ #  # ]:          0 :         (*m_pStream) << ODatabaseImportExport::sNewLine << '}';
     520         [ #  # ]:          0 :         (*m_pStream) << ODatabaseImportExport::sNewLine;
     521                 :            : 
     522         [ #  # ]:          0 :         ::comphelper::ComponentContext aContext(m_xFactory);
     523         [ #  # ]:          0 :         Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
     524                 :          0 :         sal_Int32 k=1;
     525                 :          0 :         sal_Int32 kk=0;
     526         [ #  # ]:          0 :         if ( m_aSelection.getLength() )
     527                 :            :         {
     528                 :          0 :             const Any* pSelIter = m_aSelection.getConstArray();
     529                 :          0 :             const Any* pEnd   = pSelIter + m_aSelection.getLength();
     530                 :            : 
     531                 :          0 :             sal_Bool bContinue = sal_True;
     532 [ #  # ][ #  # ]:          0 :             for( ; pSelIter != pEnd && bContinue; ++pSelIter )
                 [ #  # ]
     533                 :            :             {
     534         [ #  # ]:          0 :                 if ( m_bBookmarkSelection )
     535                 :            :                 {
     536 [ #  # ][ #  # ]:          0 :                     bContinue = m_xRowLocate->moveToBookmark( *pSelIter );
     537                 :            :                 }
     538                 :            :                 else
     539                 :            :                 {
     540                 :          0 :                     sal_Int32 nPos = -1;
     541                 :          0 :                     OSL_VERIFY( *pSelIter >>= nPos );
     542 [ #  # ][ #  # ]:          0 :                     bContinue = ( m_xResultSet->absolute( nPos ) );
     543                 :            :                 }
     544                 :            : 
     545         [ #  # ]:          0 :                 if ( bContinue )
     546         [ #  # ]:          0 :                     appendRow( pHorzChar, nCount, k, kk );
     547                 :            :             }
     548                 :            :         }
     549                 :            :         else
     550                 :            :         {
     551 [ #  # ][ #  # ]:          0 :             m_xResultSet->beforeFirst(); // set back before the first row
     552 [ #  # ][ #  # ]:          0 :             while(m_xResultSet->next())
                 [ #  # ]
     553                 :            :             {
     554         [ #  # ]:          0 :                 appendRow(pHorzChar,nCount,k,kk);
     555                 :            :             }
     556                 :            :         }
     557 [ #  # ][ #  # ]:          0 :         delete [] pHorzChar;
         [ #  # ][ #  # ]
     558                 :            :     }
     559                 :            : 
     560 [ #  # ][ #  # ]:          0 :     (*m_pStream) << '}' << ODatabaseImportExport::sNewLine;
     561         [ #  # ]:          0 :     (*m_pStream) << (sal_uInt8) 0;
     562                 :          0 :     return ((*m_pStream).GetError() == SVSTREAM_OK);
     563                 :            : }
     564                 :            : // -----------------------------------------------------------------------------
     565                 :          0 : void ORTFImportExport::appendRow(::rtl::OString* pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk)
     566                 :            : {
     567 [ #  # ][ #  # ]:          0 :     if(!m_pRowMarker || m_pRowMarker[kk] == k)
     568                 :            :     {
     569                 :          0 :         ++kk;
     570 [ #  # ][ #  # ]:          0 :         (*m_pStream) << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH;
     571         [ #  # ]:          0 :         m_pStream->WriteNumber(static_cast<sal_Int32>(40));
     572         [ #  # ]:          0 :         (*m_pStream) << ODatabaseImportExport::sNewLine;
     573                 :            : 
     574                 :            :         static char const aCell2[] = "\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx";
     575                 :            :         static char const aTRRH[] = "\\trrh-270\\pard\\intbl";
     576                 :            : 
     577         [ #  # ]:          0 :         for ( sal_Int32 i=1; i<=_nColumnCount; ++i )
     578                 :            :         {
     579         [ #  # ]:          0 :             (*m_pStream) << aCell2;
     580         [ #  # ]:          0 :             m_pStream->WriteNumber(i*CELL_X);
     581         [ #  # ]:          0 :             (*m_pStream) << ODatabaseImportExport::sNewLine;
     582                 :            :         }
     583                 :            : 
     584                 :          0 :         const sal_Bool bBold            = ( ::com::sun::star::awt::FontWeight::BOLD     == m_aFont.Weight );
     585                 :          0 :         const sal_Bool bItalic      = ( ::com::sun::star::awt::FontSlant_ITALIC     == m_aFont.Slant );
     586                 :          0 :         const sal_Bool bUnderline       = ( ::com::sun::star::awt::FontUnderline::NONE  != m_aFont.Underline );
     587                 :          0 :         const sal_Bool bStrikeout       = ( ::com::sun::star::awt::FontStrikeout::NONE  != m_aFont.Strikeout );
     588         [ #  # ]:          0 :         ::comphelper::ComponentContext aContext(m_xFactory);
     589         [ #  # ]:          0 :         Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
     590                 :            : 
     591         [ #  # ]:          0 :         (*m_pStream) << '{';
     592         [ #  # ]:          0 :         (*m_pStream) << aTRRH;
     593         [ #  # ]:          0 :         for ( sal_Int32 i=1; i <= _nColumnCount; ++i )
     594                 :            :         {
     595         [ #  # ]:          0 :             (*m_pStream) << ODatabaseImportExport::sNewLine;
     596         [ #  # ]:          0 :             (*m_pStream) << '{';
     597         [ #  # ]:          0 :             (*m_pStream) << pHorzChar[i-1].getStr();
     598                 :            : 
     599 [ #  # ][ #  # ]:          0 :             if ( bBold )        (*m_pStream) << OOO_STRING_SVTOOLS_RTF_B;
     600 [ #  # ][ #  # ]:          0 :             if ( bItalic )      (*m_pStream) << OOO_STRING_SVTOOLS_RTF_I;
     601 [ #  # ][ #  # ]:          0 :             if ( bUnderline )   (*m_pStream) << OOO_STRING_SVTOOLS_RTF_UL;
     602 [ #  # ][ #  # ]:          0 :             if ( bStrikeout )   (*m_pStream) << OOO_STRING_SVTOOLS_RTF_STRIKE;
     603                 :            : 
     604         [ #  # ]:          0 :             (*m_pStream) << "\\fs20\\f1\\cf0\\cb1 ";
     605                 :            : 
     606                 :            :             try
     607                 :            :             {
     608 [ #  # ][ #  # ]:          0 :                 Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
                 [ #  # ]
     609         [ #  # ]:          0 :                 dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn);
     610         [ #  # ]:          0 :                 ::rtl::OUString sValue = aFormatedValue.getFormattedValue();
     611         [ #  # ]:          0 :                 if ( !sValue.isEmpty() )
     612 [ #  # ][ #  # ]:          0 :                     RTFOutFuncs::Out_String(*m_pStream,sValue,m_eDestEnc);
         [ #  # ][ #  # ]
                 [ #  # ]
     613                 :            :             }
     614         [ #  # ]:          0 :             catch (Exception&)
     615                 :            :             {
     616                 :            :                 OSL_FAIL("RTF WRITE!");
     617                 :            :             }
     618                 :            : 
     619         [ #  # ]:          0 :             (*m_pStream) << OOO_STRING_SVTOOLS_RTF_CELL;
     620         [ #  # ]:          0 :             (*m_pStream) << '}';
     621         [ #  # ]:          0 :             (*m_pStream) << ODatabaseImportExport::sNewLine;
     622 [ #  # ][ #  # ]:          0 :             (*m_pStream) << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
     623                 :            :         }
     624 [ #  # ][ #  # ]:          0 :         (*m_pStream) << OOO_STRING_SVTOOLS_RTF_ROW << ODatabaseImportExport::sNewLine;
     625 [ #  # ][ #  # ]:          0 :         (*m_pStream) << '}';
     626                 :            :     }
     627                 :          0 :     ++k;
     628                 :          0 : }
     629                 :            : //-------------------------------------------------------------------
     630                 :          0 : sal_Bool ORTFImportExport::Read()
     631                 :            : {
     632                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFImportExport::Read" );
     633                 :          0 :     ODatabaseImportExport::Read();
     634                 :          0 :     SvParserState eState = SVPAR_ERROR;
     635         [ #  # ]:          0 :     if ( m_pStream )
     636                 :            :     {
     637 [ #  # ][ #  # ]:          0 :         m_pReader = new ORTFReader((*m_pStream),m_xConnection,m_xFormatter,m_xFactory);
     638         [ #  # ]:          0 :         ((ORTFReader*)m_pReader)->AddRef();
     639         [ #  # ]:          0 :         if ( isCheckEnabled() )
     640                 :          0 :             m_pReader->enableCheckOnly();
     641 [ #  # ][ #  # ]:          0 :         eState = ((ORTFReader*)m_pReader)->CallParser();
                 [ #  # ]
     642                 :          0 :         m_pReader->release();
     643                 :          0 :         m_pReader = NULL;
     644                 :            :     }
     645                 :            : 
     646                 :          0 :     return eState != SVPAR_ERROR;
     647                 :            : }
     648                 :            : //-------------------------------------------------------------------
     649                 :            : //===================================================================
     650                 :            : const sal_Int16 OHTMLImportExport::nDefaultFontSize[SBA_HTML_FONTSIZES] =
     651                 :            : {
     652                 :            :     HTMLFONTSZ1_DFLT, HTMLFONTSZ2_DFLT, HTMLFONTSZ3_DFLT, HTMLFONTSZ4_DFLT,
     653                 :            :     HTMLFONTSZ5_DFLT, HTMLFONTSZ6_DFLT, HTMLFONTSZ7_DFLT
     654                 :            : };
     655                 :            : 
     656                 :            : sal_Int16 OHTMLImportExport::nFontSize[SBA_HTML_FONTSIZES] = { 0 };
     657                 :            : 
     658                 :            : const sal_Int16 OHTMLImportExport::nCellSpacing = 0;
     659                 :            : const char OHTMLImportExport::sIndentSource[nIndentMax+1] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
     660                 :            : 
     661                 :            : //========================================================================
     662                 :            : // Macros for HTML-Export
     663                 :            : //========================================================================
     664                 :            : #define TAG_ON( tag )       HTMLOutFuncs::Out_AsciiTag( (*m_pStream), tag )
     665                 :            : #define TAG_OFF( tag )      HTMLOutFuncs::Out_AsciiTag( (*m_pStream), tag, sal_False )
     666                 :            : #define OUT_STR( str )      HTMLOutFuncs::Out_String( (*m_pStream), str )
     667                 :            : #define OUT_LF()            (*m_pStream) << ODatabaseImportExport::sNewLine << GetIndentStr()
     668                 :            : #define TAG_ON_LF( tag )    (TAG_ON( tag ) << ODatabaseImportExport::sNewLine << GetIndentStr())
     669                 :            : #define TAG_OFF_LF( tag )   (TAG_OFF( tag ) << ODatabaseImportExport::sNewLine << GetIndentStr())
     670                 :            : 
     671                 :            : //-------------------------------------------------------------------
     672                 :          0 : OHTMLImportExport::OHTMLImportExport(const ::svx::ODataAccessDescriptor& _aDataDescriptor,
     673                 :            :                                      const Reference< XMultiServiceFactory >& _rM,
     674                 :            :                                      const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
     675                 :            :                                      const String& rExchange)
     676                 :            :         : ODatabaseImportExport(_aDataDescriptor,_rM,_rxNumberF,rExchange)
     677                 :          0 :     ,m_nIndent(0)
     678                 :            : #if OSL_DEBUG_LEVEL > 0
     679                 :            :     ,m_bCheckFont(sal_False)
     680                 :            : #endif
     681                 :            : {
     682                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::OHTMLImportExport" );
     683                 :            :     // set HTML configuration
     684         [ #  # ]:          0 :     SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
     685         [ #  # ]:          0 :     m_eDestEnc = rHtmlOptions.GetTextEncoding();
     686         [ #  # ]:          0 :     strncpy( sIndent, sIndentSource ,std::min(sizeof(sIndent),sizeof(sIndentSource)));
     687                 :          0 :     sIndent[0] = 0;
     688                 :          0 : }
     689                 :            : //-------------------------------------------------------------------
     690                 :          0 : sal_Bool OHTMLImportExport::Write()
     691                 :            : {
     692                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::Write" );
     693                 :          0 :     ODatabaseImportExport::Write();
     694         [ #  # ]:          0 :     if(m_xObject.is())
     695                 :            :     {
     696                 :          0 :         (*m_pStream) << '<' << OOO_STRING_SVTOOLS_HTML_doctype << ' ' << OOO_STRING_SVTOOLS_HTML_doctype32 << '>' << ODatabaseImportExport::sNewLine << ODatabaseImportExport::sNewLine;
     697                 :          0 :         TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_html );
     698                 :          0 :         WriteHeader();
     699                 :          0 :         OUT_LF();
     700                 :          0 :         WriteBody();
     701                 :          0 :         OUT_LF();
     702                 :          0 :         TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_html );
     703                 :            : 
     704                 :          0 :         return ((*m_pStream).GetError() == SVSTREAM_OK);
     705                 :            :     }
     706                 :          0 :     return sal_False;
     707                 :            : }
     708                 :            : //-------------------------------------------------------------------
     709                 :          0 : sal_Bool OHTMLImportExport::Read()
     710                 :            : {
     711                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::Read" );
     712                 :          0 :     ODatabaseImportExport::Read();
     713                 :          0 :     SvParserState eState = SVPAR_ERROR;
     714         [ #  # ]:          0 :     if ( m_pStream )
     715                 :            :     {
     716 [ #  # ][ #  # ]:          0 :         m_pReader = new OHTMLReader((*m_pStream),m_xConnection,m_xFormatter,m_xFactory);
     717         [ #  # ]:          0 :         ((OHTMLReader*)m_pReader)->AddRef();
     718         [ #  # ]:          0 :         if ( isCheckEnabled() )
     719                 :          0 :             m_pReader->enableCheckOnly();
     720                 :          0 :         m_pReader->SetTableName(m_sDefaultTableName);
     721 [ #  # ][ #  # ]:          0 :         eState = ((OHTMLReader*)m_pReader)->CallParser();
                 [ #  # ]
     722                 :          0 :         m_pReader->release();
     723                 :          0 :         m_pReader = NULL;
     724                 :            :     }
     725                 :            : 
     726                 :          0 :     return eState != SVPAR_ERROR;
     727                 :            : }
     728                 :            : //-------------------------------------------------------------------
     729                 :          0 : void OHTMLImportExport::WriteHeader()
     730                 :            : {
     731                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteHeader" );
     732                 :            :     uno::Reference<document::XDocumentProperties> xDocProps(
     733         [ #  # ]:          0 :         m_xFactory->createInstance(::rtl::OUString(
     734                 :          0 :             RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.DocumentProperties"))),
     735 [ #  # ][ #  # ]:          0 :         uno::UNO_QUERY);
                 [ #  # ]
     736         [ #  # ]:          0 :     if (xDocProps.is()) {
     737 [ #  # ][ #  # ]:          0 :         xDocProps->setTitle(m_sName);
     738                 :            :     }
     739                 :            : 
     740 [ #  # ][ #  # ]:          0 :     IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_head );
                 [ #  # ]
     741                 :            : 
     742                 :            :     SfxFrameHTMLWriter::Out_DocInfo( (*m_pStream), String(),
     743 [ #  # ][ #  # ]:          0 :         xDocProps, sIndent );
                 [ #  # ]
     744 [ #  # ][ #  # ]:          0 :     OUT_LF();
     745 [ #  # ][ #  # ]:          0 :     IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head );
         [ #  # ][ #  # ]
                 [ #  # ]
     746                 :          0 : }
     747                 :            : //-----------------------------------------------------------------------
     748                 :          0 : void OHTMLImportExport::WriteBody()
     749                 :            : {
     750                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteBody" );
     751                 :            : 
     752 [ #  # ][ #  # ]:          0 :     IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_style );
                 [ #  # ]
     753                 :            : 
     754 [ #  # ][ #  # ]:          0 :     (*m_pStream) << sMyBegComment; OUT_LF();
                 [ #  # ]
     755 [ #  # ][ #  # ]:          0 :     (*m_pStream) << OOO_STRING_SVTOOLS_HTML_body " { " << sFontFamily << '"' << ::rtl::OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()).getStr() << '\"';
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     756                 :            :         // TODO : think about the encoding of the font name
     757 [ #  # ][ #  # ]:          0 :     (*m_pStream) << "; " << sFontSize;
     758         [ #  # ]:          0 :     m_pStream->WriteNumber(static_cast<sal_Int32>(m_aFont.Height));
     759         [ #  # ]:          0 :     (*m_pStream) << '}';
     760                 :            : 
     761 [ #  # ][ #  # ]:          0 :     OUT_LF();
     762         [ #  # ]:          0 :     (*m_pStream) << sMyEndComment;
     763 [ #  # ][ #  # ]:          0 :     IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_style );
         [ #  # ][ #  # ]
                 [ #  # ]
     764 [ #  # ][ #  # ]:          0 :     OUT_LF();
     765                 :            : 
     766                 :            :     // default Textcolour black
     767 [ #  # ][ #  # ]:          0 :     (*m_pStream) << '<' << OOO_STRING_SVTOOLS_HTML_body << ' ' << OOO_STRING_SVTOOLS_HTML_O_text << '=';
         [ #  # ][ #  # ]
                 [ #  # ]
     768                 :          0 :     sal_Int32 nColor = 0;
     769         [ #  # ]:          0 :     if(m_xObject.is())
     770 [ #  # ][ #  # ]:          0 :         m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
                 [ #  # ]
     771                 :          0 :     ::Color aColor(nColor);
     772         [ #  # ]:          0 :     HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
     773                 :            : 
     774         [ #  # ]:          0 :     (*m_pStream) << " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=";
     775         [ #  # ]:          0 :     HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
     776                 :            : 
     777 [ #  # ][ #  # ]:          0 :     (*m_pStream) << '>'; OUT_LF();
                 [ #  # ]
     778                 :            : 
     779         [ #  # ]:          0 :     WriteTables();
     780                 :            : 
     781 [ #  # ][ #  # ]:          0 :     TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_body );
                 [ #  # ]
     782                 :          0 : }
     783                 :            : //-----------------------------------------------------------------------
     784                 :          0 : void OHTMLImportExport::WriteTables()
     785                 :            : {
     786                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteTables" );
     787                 :          0 :     ::rtl::OString aStrOut  = OOO_STRING_SVTOOLS_HTML_table;
     788                 :          0 :     aStrOut = aStrOut + " ";
     789                 :          0 :     aStrOut = aStrOut + OOO_STRING_SVTOOLS_HTML_frame;
     790                 :          0 :     aStrOut = aStrOut + "=";
     791                 :          0 :     aStrOut = aStrOut + OOO_STRING_SVTOOLS_HTML_TF_void;
     792                 :            : 
     793         [ #  # ]:          0 :     Sequence< ::rtl::OUString> aNames;
     794                 :          0 :     Reference<XNameAccess> xColumns;
     795                 :          0 :     sal_Bool bUseResultMetaData = sal_False;
     796         [ #  # ]:          0 :     if(m_xObject.is())
     797                 :            :     {
     798         [ #  # ]:          0 :         Reference<XColumnsSupplier> xColSup(m_xObject,UNO_QUERY);
     799 [ #  # ][ #  # ]:          0 :         xColumns = xColSup->getColumns();
                 [ #  # ]
     800 [ #  # ][ #  # ]:          0 :         aNames = xColumns->getElementNames();
         [ #  # ][ #  # ]
     801         [ #  # ]:          0 :         if ( !aNames.getLength() )
     802                 :            :         {
     803 [ #  # ][ #  # ]:          0 :             sal_Int32 nCount = m_xResultSetMetaData->getColumnCount();
     804         [ #  # ]:          0 :             aNames.realloc(nCount);
     805         [ #  # ]:          0 :             for (sal_Int32 i= 0; i < nCount; ++i)
     806 [ #  # ][ #  # ]:          0 :                 aNames[i] = m_xResultSetMetaData->getColumnName(i+1);
                 [ #  # ]
     807                 :          0 :             bUseResultMetaData = sal_True;
     808                 :          0 :         }
     809                 :            :     }
     810                 :            : 
     811                 :          0 :     aStrOut = aStrOut + " ";
     812                 :          0 :     aStrOut = aStrOut + OOO_STRING_SVTOOLS_HTML_O_align;
     813                 :          0 :     aStrOut = aStrOut + "=";
     814                 :          0 :     aStrOut = aStrOut + OOO_STRING_SVTOOLS_HTML_AL_left;
     815                 :          0 :     aStrOut = aStrOut + " ";
     816                 :          0 :     aStrOut = aStrOut + OOO_STRING_SVTOOLS_HTML_O_cellspacing;
     817                 :          0 :     aStrOut = aStrOut + "=";
     818                 :          0 :     aStrOut = aStrOut + ::rtl::OString::valueOf((sal_Int32)nCellSpacing);
     819                 :          0 :     aStrOut = aStrOut + " ";
     820                 :          0 :     aStrOut = aStrOut + OOO_STRING_SVTOOLS_HTML_O_cols;
     821                 :          0 :     aStrOut = aStrOut + "=";
     822                 :          0 :     aStrOut = aStrOut + ::rtl::OString::valueOf(aNames.getLength());
     823                 :          0 :     aStrOut = aStrOut + " ";
     824                 :          0 :     aStrOut = aStrOut + OOO_STRING_SVTOOLS_HTML_O_border;
     825                 :          0 :     aStrOut = aStrOut + "=1";
     826                 :            : 
     827                 :          0 :     IncIndent(1);
     828         [ #  # ]:          0 :     TAG_ON( aStrOut.getStr() );
     829                 :            : 
     830         [ #  # ]:          0 :     FontOn();
     831                 :            : 
     832         [ #  # ]:          0 :     TAG_ON( OOO_STRING_SVTOOLS_HTML_caption );
     833         [ #  # ]:          0 :     TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
     834                 :            : 
     835 [ #  # ][ #  # ]:          0 :     (*m_pStream)    << ::rtl::OUStringToOString(m_sName, osl_getThreadTextEncoding()).getStr();
                 [ #  # ]
     836                 :            :         // TODO : think about the encoding of the name
     837         [ #  # ]:          0 :     TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
     838         [ #  # ]:          0 :     TAG_OFF( OOO_STRING_SVTOOLS_HTML_caption );
     839                 :            : 
     840         [ #  # ]:          0 :     FontOff();
     841 [ #  # ][ #  # ]:          0 :     OUT_LF();
     842                 :            :     // </FONT>
     843                 :            : 
     844                 :          0 :     IncIndent(1);
     845 [ #  # ][ #  # ]:          0 :     TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_thead );
                 [ #  # ]
     846                 :            : 
     847                 :          0 :     IncIndent(1);
     848 [ #  # ][ #  # ]:          0 :     TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
                 [ #  # ]
     849                 :            : 
     850         [ #  # ]:          0 :     if(m_xObject.is())
     851                 :            :     {
     852         [ #  # ]:          0 :         sal_Int32* pFormat = new sal_Int32[aNames.getLength()];
     853                 :            : 
     854         [ #  # ]:          0 :         const char **pHorJustify = new const char*[aNames.getLength()];
     855         [ #  # ]:          0 :         sal_Int32 *pColWidth = new sal_Int32[aNames.getLength()];
     856                 :            : 
     857                 :            : 
     858                 :          0 :         sal_Int32 nHeight = 0;
     859 [ #  # ][ #  # ]:          0 :         m_xObject->getPropertyValue(PROPERTY_ROW_HEIGHT) >>= nHeight;
                 [ #  # ]
     860                 :            : 
     861                 :            :         // 1. die Spaltenbeschreibung rauspusten
     862                 :          0 :         const ::rtl::OUString* pIter = aNames.getConstArray();
     863                 :          0 :         const ::rtl::OUString* pEnd = pIter + aNames.getLength();
     864                 :            : 
     865         [ #  # ]:          0 :         for( sal_Int32 i=0;pIter != pEnd; ++pIter,++i )
     866                 :            :         {
     867                 :          0 :             sal_Int32 nAlign = 0;
     868                 :          0 :             pFormat[i] = 0;
     869                 :          0 :             pColWidth[i] = 100;
     870         [ #  # ]:          0 :             if ( !bUseResultMetaData )
     871                 :            :             {
     872                 :          0 :                 Reference<XPropertySet> xColumn;
     873 [ #  # ][ #  # ]:          0 :                 xColumns->getByName(*pIter) >>= xColumn;
                 [ #  # ]
     874 [ #  # ][ #  # ]:          0 :                 xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlign;
                 [ #  # ]
     875 [ #  # ][ #  # ]:          0 :                 pFormat[i] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_FORMATKEY));
         [ #  # ][ #  # ]
     876 [ #  # ][ #  # ]:          0 :                 pColWidth[i] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_WIDTH));
         [ #  # ][ #  # ]
     877                 :            :             }
     878                 :            : 
     879      [ #  #  # ]:          0 :             switch( nAlign )
     880                 :            :             {
     881                 :          0 :                 case 1:     pHorJustify[i] = OOO_STRING_SVTOOLS_HTML_AL_center; break;
     882                 :          0 :                 case 2:     pHorJustify[i] = OOO_STRING_SVTOOLS_HTML_AL_right;  break;
     883                 :          0 :                 default:    pHorJustify[i] = OOO_STRING_SVTOOLS_HTML_AL_left;       break;
     884                 :            :             }
     885                 :            : 
     886         [ #  # ]:          0 :             if(i == aNames.getLength()-1)
     887                 :          0 :                 IncIndent(-1);
     888                 :            : 
     889 [ #  # ][ #  # ]:          0 :             WriteCell(pFormat[i],pColWidth[i],nHeight,pHorJustify[i],*pIter,OOO_STRING_SVTOOLS_HTML_tableheader);
                 [ #  # ]
     890                 :            :         }
     891                 :            : 
     892                 :          0 :         IncIndent(-1);
     893 [ #  # ][ #  # ]:          0 :         TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
                 [ #  # ]
     894 [ #  # ][ #  # ]:          0 :         TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_thead );
                 [ #  # ]
     895                 :            : 
     896                 :          0 :         IncIndent(1);
     897 [ #  # ][ #  # ]:          0 :         TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tbody );
                 [ #  # ]
     898                 :            : 
     899                 :            :         // 2. und jetzt die Daten
     900         [ #  # ]:          0 :         ::comphelper::ComponentContext aContext(m_xFactory);
     901         [ #  # ]:          0 :         Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
     902                 :          0 :         sal_Int32 j=1;
     903                 :          0 :         sal_Int32 kk=0;
     904 [ #  # ][ #  # ]:          0 :         m_xResultSet->beforeFirst(); // set back before the first row
     905 [ #  # ][ #  # ]:          0 :         while(m_xResultSet->next())
                 [ #  # ]
     906                 :            :         {
     907                 :          0 :             IncIndent(1);
     908 [ #  # ][ #  # ]:          0 :             TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
                 [ #  # ]
     909                 :            : 
     910 [ #  # ][ #  # ]:          0 :             if(!m_pRowMarker || m_pRowMarker[kk] == j)
     911                 :            :             {
     912                 :          0 :                 ++kk;
     913         [ #  # ]:          0 :                 for(sal_Int32 i=1;i<=aNames.getLength();++i)
     914                 :            :                 {
     915         [ #  # ]:          0 :                     if(i == aNames.getLength())
     916                 :          0 :                         IncIndent(-1);
     917                 :            : 
     918         [ #  # ]:          0 :                     String aValue;
     919                 :            :                     try
     920                 :            :                     {
     921 [ #  # ][ #  # ]:          0 :                         Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
                 [ #  # ]
     922         [ #  # ]:          0 :                         dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn);
     923         [ #  # ]:          0 :                         ::rtl::OUString sValue = aFormatedValue.getFormattedValue();
     924         [ #  # ]:          0 :                         if (!sValue.isEmpty())
     925                 :            :                         {
     926         [ #  # ]:          0 :                             aValue = sValue;
     927 [ #  # ][ #  # ]:          0 :                         }
     928                 :            :                     }
     929         [ #  # ]:          0 :                     catch( const Exception& )
     930                 :            :                     {
     931                 :            :                         DBG_UNHANDLED_EXCEPTION();
     932                 :            :                     }
     933         [ #  # ]:          0 :                     WriteCell(pFormat[i-1],pColWidth[i-1],nHeight,pHorJustify[i-1],aValue,OOO_STRING_SVTOOLS_HTML_tabledata);
     934         [ #  # ]:          0 :                 }
     935                 :            :             }
     936                 :          0 :             ++j;
     937 [ #  # ][ #  # ]:          0 :             TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
                 [ #  # ]
     938                 :            :         }
     939                 :            : 
     940         [ #  # ]:          0 :         delete [] pFormat;
     941         [ #  # ]:          0 :         delete [] pHorJustify;
     942 [ #  # ][ #  # ]:          0 :         delete [] pColWidth;
     943                 :            :     }
     944                 :            :     else
     945                 :            :     {
     946                 :          0 :         IncIndent(-1);
     947 [ #  # ][ #  # ]:          0 :         TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
                 [ #  # ]
     948 [ #  # ][ #  # ]:          0 :         TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_thead );
                 [ #  # ]
     949                 :            : 
     950                 :          0 :         IncIndent(1);
     951 [ #  # ][ #  # ]:          0 :         TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tbody );
                 [ #  # ]
     952                 :            :     }
     953                 :            : 
     954 [ #  # ][ #  # ]:          0 :     IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tbody );
         [ #  # ][ #  # ]
                 [ #  # ]
     955 [ #  # ][ #  # ]:          0 :     IncIndent(-1); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_table );
         [ #  # ][ #  # ]
     956                 :          0 : }
     957                 :            : //-----------------------------------------------------------------------
     958                 :          0 : void OHTMLImportExport::WriteCell( sal_Int32 nFormat,sal_Int32 nWidthPixel,sal_Int32 nHeightPixel,const char* pChar,
     959                 :            :                                    const String& rValue,const char* pHtmlTag)
     960                 :            : {
     961                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::WriteCell" );
     962                 :          0 :     ::rtl::OString aStrTD = pHtmlTag;
     963                 :            : 
     964         [ #  # ]:          0 :     nWidthPixel  = nWidthPixel  ? nWidthPixel   : 86;
     965         [ #  # ]:          0 :     nHeightPixel = nHeightPixel ? nHeightPixel  : 17;
     966                 :            : 
     967                 :            :     // trotz der <TABLE COLS=n> und <COL WIDTH=x> Angaben noetig,
     968                 :            :     // da die nicht von Netscape beachtet werden..
     969                 :            :     // Spaltenbreite
     970                 :          0 :     aStrTD = aStrTD + " ";
     971                 :          0 :     aStrTD = aStrTD + OOO_STRING_SVTOOLS_HTML_O_width;
     972                 :          0 :     aStrTD = aStrTD + "=";
     973                 :          0 :     aStrTD = aStrTD + ::rtl::OString::valueOf((sal_Int32)nWidthPixel);
     974                 :            :     // Zeilenhoehe
     975                 :          0 :     aStrTD = aStrTD + " ";
     976                 :          0 :     aStrTD = aStrTD + OOO_STRING_SVTOOLS_HTML_O_height;
     977                 :          0 :     aStrTD = aStrTD + "=";
     978                 :          0 :     aStrTD = aStrTD + ::rtl::OString::valueOf((sal_Int32)nHeightPixel);
     979                 :            : 
     980                 :          0 :     aStrTD = aStrTD + " ";
     981                 :          0 :     aStrTD = aStrTD + OOO_STRING_SVTOOLS_HTML_O_align;
     982                 :          0 :     aStrTD = aStrTD + "=";
     983                 :          0 :     aStrTD = aStrTD + pChar;
     984                 :            : 
     985 [ #  # ][ #  # ]:          0 :     Reference< ::com::sun::star::util::XNumberFormatsSupplier >  xSupplier = m_xFormatter->getNumberFormatsSupplier();
     986         [ #  # ]:          0 :     SvNumberFormatsSupplierObj* pSupplierImpl = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
     987 [ #  # ][ #  # ]:          0 :     SvNumberFormatter* pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : NULL;
     988         [ #  # ]:          0 :     if(pFormatter)
     989                 :            :     {
     990                 :          0 :         double fVal = 0.0;
     991                 :            : 
     992                 :            :         try
     993                 :            :         {
     994 [ #  # ][ #  # ]:          0 :             fVal = m_xFormatter->convertStringToNumber(nFormat,rValue);
                 [ #  # ]
     995         [ #  # ]:          0 :             HTMLOutFuncs::CreateTableDataOptionsValNum(sal_False, fVal,nFormat, *pFormatter);
     996                 :            :         }
     997   [ #  #  #  # ]:          0 :         catch(const Exception&)
     998                 :            :         {
     999         [ #  # ]:          0 :             HTMLOutFuncs::CreateTableDataOptionsValNum(sal_False, fVal,nFormat, *pFormatter);
    1000                 :            :         }
    1001                 :            :     }
    1002                 :            : 
    1003         [ #  # ]:          0 :     TAG_ON( aStrTD.getStr() );
    1004                 :            : 
    1005         [ #  # ]:          0 :     FontOn();
    1006                 :            : 
    1007                 :          0 :     sal_Bool bBold          = ( ::com::sun::star::awt::FontWeight::BOLD     == m_aFont.Weight );
    1008                 :          0 :     sal_Bool bItalic        = ( ::com::sun::star::awt::FontSlant_ITALIC     == m_aFont.Slant );
    1009                 :          0 :     sal_Bool bUnderline     = ( ::com::sun::star::awt::FontUnderline::NONE  != m_aFont.Underline );
    1010                 :          0 :     sal_Bool bStrikeout     = ( ::com::sun::star::awt::FontStrikeout::NONE  != m_aFont.Strikeout );
    1011                 :            : 
    1012 [ #  # ][ #  # ]:          0 :     if ( bBold )        TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
    1013 [ #  # ][ #  # ]:          0 :     if ( bItalic )      TAG_ON( OOO_STRING_SVTOOLS_HTML_italic );
    1014 [ #  # ][ #  # ]:          0 :     if ( bUnderline )   TAG_ON( OOO_STRING_SVTOOLS_HTML_underline );
    1015 [ #  # ][ #  # ]:          0 :     if ( bStrikeout )   TAG_ON( OOO_STRING_SVTOOLS_HTML_strike );
    1016                 :            : 
    1017         [ #  # ]:          0 :     if ( !rValue.Len() )
    1018         [ #  # ]:          0 :         TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak );        // keine komplett leere Zelle
    1019                 :            :     else
    1020         [ #  # ]:          0 :         HTMLOutFuncs::Out_String( (*m_pStream), rValue ,m_eDestEnc);
    1021                 :            : 
    1022                 :            : 
    1023 [ #  # ][ #  # ]:          0 :     if ( bStrikeout )   TAG_OFF( OOO_STRING_SVTOOLS_HTML_strike );
    1024 [ #  # ][ #  # ]:          0 :     if ( bUnderline )   TAG_OFF( OOO_STRING_SVTOOLS_HTML_underline );
    1025 [ #  # ][ #  # ]:          0 :     if ( bItalic )      TAG_OFF( OOO_STRING_SVTOOLS_HTML_italic );
    1026 [ #  # ][ #  # ]:          0 :     if ( bBold )        TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
    1027                 :            : 
    1028         [ #  # ]:          0 :     FontOff();
    1029                 :            : 
    1030 [ #  # ][ #  # ]:          0 :     TAG_OFF_LF( pHtmlTag );
                 [ #  # ]
    1031                 :          0 : }
    1032                 :            : //-----------------------------------------------------------------------
    1033                 :          0 : void OHTMLImportExport::FontOn()
    1034                 :            : {
    1035                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::FontOn" );
    1036                 :            : #if OSL_DEBUG_LEVEL > 0
    1037                 :            :         m_bCheckFont = sal_True;
    1038                 :            : #endif
    1039                 :            : 
    1040                 :            :     // <FONT FACE="xxx">
    1041                 :          0 :     ::rtl::OString aStrOut  = "<";
    1042                 :          0 :     aStrOut  = aStrOut + OOO_STRING_SVTOOLS_HTML_font;
    1043                 :          0 :     aStrOut  = aStrOut + " ";
    1044                 :          0 :     aStrOut  = aStrOut + OOO_STRING_SVTOOLS_HTML_O_face;
    1045                 :          0 :     aStrOut  = aStrOut + "=";
    1046                 :          0 :     aStrOut  = aStrOut + "\"";
    1047 [ #  # ][ #  # ]:          0 :     aStrOut  = aStrOut + ::rtl::OUStringToOString(m_aFont.Name,osl_getThreadTextEncoding());
    1048                 :            :         // TODO : think about the encoding of the font name
    1049                 :          0 :     aStrOut  = aStrOut + "\"";
    1050                 :          0 :     aStrOut  = aStrOut + " ";
    1051                 :          0 :     aStrOut  = aStrOut + OOO_STRING_SVTOOLS_HTML_O_color;
    1052                 :          0 :     aStrOut  = aStrOut + "=";
    1053         [ #  # ]:          0 :     (*m_pStream) << aStrOut.getStr();
    1054                 :            : 
    1055                 :          0 :     sal_Int32 nColor = 0;
    1056         [ #  # ]:          0 :     if(m_xObject.is())
    1057 [ #  # ][ #  # ]:          0 :         m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
                 [ #  # ]
    1058                 :          0 :     ::Color aColor(nColor);
    1059                 :            : 
    1060         [ #  # ]:          0 :     HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
    1061         [ #  # ]:          0 :     (*m_pStream) << ">";
    1062                 :          0 : }
    1063                 :            : //-----------------------------------------------------------------------
    1064                 :          0 : inline void OHTMLImportExport::FontOff()
    1065                 :            : {
    1066                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::FontOff" );
    1067                 :            :     OSL_ENSURE(m_bCheckFont,"Kein FontOn() gerufen");
    1068                 :          0 :     TAG_OFF( OOO_STRING_SVTOOLS_HTML_font );
    1069                 :            : #if OSL_DEBUG_LEVEL > 0
    1070                 :            :     m_bCheckFont = sal_False;
    1071                 :            : #endif
    1072                 :          0 : }
    1073                 :            : //-----------------------------------------------------------------------
    1074                 :          0 : void OHTMLImportExport::IncIndent( sal_Int16 nVal )
    1075                 :            : {
    1076                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OHTMLImportExport::IncIndent" );
    1077                 :          0 :     sIndent[m_nIndent] = '\t';
    1078                 :          0 :     m_nIndent = m_nIndent + nVal;
    1079         [ #  # ]:          0 :     if ( m_nIndent < 0 )
    1080                 :          0 :         m_nIndent = 0;
    1081         [ #  # ]:          0 :     else if ( m_nIndent > nIndentMax )
    1082                 :          0 :         m_nIndent = nIndentMax;
    1083                 :          0 :     sIndent[m_nIndent] = 0;
    1084                 :          0 : }
    1085                 :            : // -----------------------------------------------------------------------------
    1086                 :            : 
    1087                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10