Tag: cws_dev300_dba30c
User: oj      
Date: 2008-05-07 12:50:22+0000
Modified:
   dba/dbaccess/source/ui/inc/TokenWriter.hxx
   dba/dbaccess/source/ui/misc/TokenWriter.cxx

Log:
 #i88454# use formatted string

File Changes:

Directory: /dba/dbaccess/source/ui/inc/
=======================================

File [changed]: TokenWriter.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/TokenWriter.hxx?r1=1.22&r2=1.22.8.1
Delta lines:  +6 -2
-------------------
--- TokenWriter.hxx     2008-04-10 15:21:05+0000        1.22
+++ TokenWriter.hxx     2008-05-07 12:50:19+0000        1.22.8.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TokenWriter.hxx,v $
- * $Revision: 1.22 $
+ * $Revision: 1.22.8.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -94,6 +94,7 @@
        {
     private:
                void disposing();
+        void impl_initializeRowMember_throw();
 
     protected:
         typedef ::utl::SharedUNOComponent   <   ::com::sun::star::frame::XModel
@@ -101,6 +102,7 @@
                                             >   SharedModel;
 
     protected:
+        ::com::sun::star::lang::Locale                                         
        m_aLocale;
                ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>    
                                m_aSelection;
                SvStream*                                                       
                                                                                
        m_pStream;
                ::com::sun::star::awt::FontDescriptor                           
                                                        m_aFont;
@@ -109,6 +111,7 @@
                ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSet >                  m_xResultSet;   // 
                ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow 
>                                m_xRow; // 
                ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSetMetaData >  m_xResultSetMetaData;   // 
+        ::com::sun::star::uno::Reference< 
::com::sun::star::container::XIndexAccess >   m_xRowSetColumns;
                ::com::sun::star::uno::Reference< 
::com::sun::star::util::XNumberFormatter >    m_xFormatter;   // a number 
formatter working with the connection's NumberFormatsSupplier
                ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory> m_xFactory;
         SharedModel                                                            
         m_aKeepModelAlive;
@@ -129,6 +132,7 @@
 
                ODatabaseExport*        m_pReader;
                sal_Int32*                      m_pRowMarker; // wenn gesetzt, 
dann nur diese Rows kopieren
+        rtl_TextEncoding    m_eDestEnc;
                sal_Bool                        m_bInInitialize;
                sal_Bool                        m_bCheckOnly;
 

Directory: /dba/dbaccess/source/ui/misc/
========================================

File [changed]: TokenWriter.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/TokenWriter.cxx?r1=1.37&r2=1.37.4.1
Delta lines:  +64 -25
---------------------
--- TokenWriter.cxx     2008-04-10 15:56:17+0000        1.37
+++ TokenWriter.cxx     2008-05-07 12:50:20+0000        1.37.4.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TokenWriter.cxx,v $
- * $Revision: 1.37 $
+ * $Revision: 1.37.4.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -118,6 +118,10 @@
 #ifndef _RTFOUT_HXX
 #include <svtools/rtfout.hxx>
 #endif
+#include <svx/htmlcfg.hxx>
+#include <connectivity/formattedcolumnvalue.hxx>
+#include <svtools/syslocale.hxx>
+#include <comphelper/componentcontext.hxx>
 
 using namespace dbaui;
 using namespace dbtools;
@@ -161,9 +165,10 @@
        ,m_bInInitialize(sal_False)
        ,m_bCheckOnly(sal_False)
 {
-
        DBG_CTOR(ODatabaseImportExport,NULL);
 
+    m_eDestEnc = osl_getThreadTextEncoding();
+
        osl_incrementInterlockedCount( &m_refCount );
     impl_initFromDescriptor( _aDataDescriptor, false );
 
@@ -190,6 +195,15 @@
        ,m_bCheckOnly(sal_False)
 {
        DBG_CTOR(ODatabaseImportExport,NULL);
+    m_eDestEnc = osl_getThreadTextEncoding();
+    try
+       {
+               SvtSysLocale aSysLocale;
+               m_aLocale = aSysLocale.GetLocaleData().getLocale();
+       }
+       catch(Exception&)
+       {
+       }
 }
 //-------------------------------------------------------------------
 ODatabaseImportExport::~ODatabaseImportExport()
@@ -274,6 +288,15 @@
 
     if ( _bPlusDefaultInit )
            initialize();
+
+    try
+       {
+               SvtSysLocale aSysLocale;
+               m_aLocale = aSysLocale.GetLocaleData().getLocale();
+       }
+       catch(Exception&)
+       {
+       }
 }
 // 
-----------------------------------------------------------------------------
 void ODatabaseImportExport::initialize()
@@ -347,12 +370,7 @@
                                m_xObject->getPropertyValue(PROPERTY_FONT) >>= 
m_aFont;
 
                        // the result set may be already set with the 
datadescriptor
-                       if ( m_xResultSet.is() )
-                       {
-                               m_xRow.set(m_xResultSet,UNO_QUERY);
-                               m_xResultSetMetaData = 
Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData();
-                       }
-                       else
+                       if ( !m_xResultSet.is() )
                        {
                                
m_xResultSet.set(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.RowSet")),UNO_QUERY);
                                Reference<XPropertySet > 
xProp(m_xResultSet,UNO_QUERY);
@@ -363,12 +381,11 @@
                                        
xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(m_sName));
                                        Reference<XRowSet> 
xRowSet(xProp,UNO_QUERY);
                                        xRowSet->execute();
-                                       m_xRow.set(xRowSet,UNO_QUERY);
-                                       m_xResultSetMetaData = 
Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData();
                                }
                                else
                                        OSL_ENSURE(sal_False, 
"ODatabaseImportExport::initialize: could not instantiate a rowset!");
-                       }
+                       } // if ( !m_xResultSet.is() )
+            impl_initializeRowMember_throw();
                }
                catch(Exception& )
                {
@@ -390,6 +407,17 @@
 
        m_bInInitialize = sal_False;
 }
+// 
-----------------------------------------------------------------------------
+void ODatabaseImportExport::impl_initializeRowMember_throw()
+{
+    if ( !m_xRow.is() && m_xResultSet.is() )
+    {
+        m_xRow.set(m_xResultSet,UNO_QUERY);
+           m_xResultSetMetaData = 
Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData();
+        Reference<XColumnsSupplier> xSup(m_xResultSet,UNO_QUERY_THROW);
+        m_xRowSetColumns.set(xSup->getColumns(),UNO_QUERY_THROW);
+    }
+}
 //======================================================================
 BOOL ORTFImportExport::Write()
 {
@@ -576,6 +604,8 @@
                (*m_pStream) << ODatabaseImportExport::sNewLine << '}';
                (*m_pStream) << ODatabaseImportExport::sNewLine;
 
+        ::comphelper::ComponentContext aContext(m_xFactory);
+        Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
                sal_Int32 k=1;
                sal_Int32 kk=0;
                m_xResultSet->beforeFirst(); // set back before the first row
@@ -613,9 +643,13 @@
 
                                        try
                                        {
-                                               ::rtl::OUString sValue = 
m_xRow->getString(i);
-                                               if (!m_xRow->wasNull())
-                                                       
RTFOutFuncs::Out_String(*m_pStream,sValue,eDestEnc);
+                        Reference<XPropertySet> 
xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
+                        dbtools::FormattedColumnValue 
aFormatedValue(aContext,xRowSet,xColumn);
+                        ::rtl::OUString sValue = 
aFormatedValue.getFormattedValue();
+                                               // m_xRow->getString(i);
+                                               //if (!m_xRow->wasNull())
+                        if ( sValue.getLength() )
+                                                       
RTFOutFuncs::Out_String(*m_pStream,sValue,m_eDestEnc);
                                        }
                                        catch (Exception&)
                                        {
@@ -696,6 +730,9 @@
        ,m_bCheckFont(FALSE)
 #endif
 {
+    // set HTML configuration
+    SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+    m_eDestEnc = pHtmlOptions->GetTextEncoding();
        strncpy( sIndent, sIndentSource 
,std::min(sizeof(sIndent),sizeof(sIndentSource)));
        sIndent[0] = 0;
 }
@@ -908,7 +945,8 @@
                TAG_ON_LF( sHTML_tbody );
 
                // 2. und jetzt die Daten
-
+        ::comphelper::ComponentContext aContext(m_xFactory);
+        Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
                sal_Int32 j=1;
                sal_Int32 kk=0;
                m_xResultSet->beforeFirst(); // set back before the first row
@@ -928,8 +966,10 @@
                                        String aValue;
                                        try
                                        {
-                                               ::rtl::OUString sValue = 
m_xRow->getString(i);
-                                               if (!m_xRow->wasNull())
+                        Reference<XPropertySet> 
xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW);
+                        dbtools::FormattedColumnValue 
aFormatedValue(aContext,xRowSet,xColumn);
+                        ::rtl::OUString sValue = 
aFormatedValue.getFormattedValue();
+                        if (sValue.getLength())
                                                {
                                                        aValue = sValue;
                                                }
@@ -963,11 +1003,9 @@
        IncIndent(-1); TAG_OFF_LF( sHTML_table );
 }
 //-----------------------------------------------------------------------
-void OHTMLImportExport::WriteCell( sal_Int32 nFormat,sal_Int32 
nWidthPixel,sal_Int32 nHeightPixel,const char* pChar,const String& rValue,const 
char* pHtmlTag)
+void OHTMLImportExport::WriteCell( sal_Int32 nFormat,sal_Int32 
nWidthPixel,sal_Int32 nHeightPixel,const char* pChar,
+                                   const String& rValue,const char* pHtmlTag)
 {
-       BOOL bValueData;
-       bValueData = FALSE;
-
        ::rtl::OString aStrTD = pHtmlTag;
 
        nWidthPixel  = nWidthPixel      ? nWidthPixel   : 86;
@@ -1002,12 +1040,12 @@
                {
                        fVal = 
m_xFormatter->convertStringToNumber(nFormat,rValue);
             ByteString aTmpString(aStrTD);
-                       HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, 
bValueData, fVal,nFormat, *pFormatter );
+                       HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, 
FALSE, fVal,nFormat, *pFormatter );
                }
                catch(Exception&)
                {
             ByteString aTmpString(aStrTD);
-                       HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, 
bValueData, fVal,nFormat, *pFormatter );
+                       HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, 
FALSE, fVal,nFormat, *pFormatter );
                }
        }
 
@@ -1028,7 +1066,8 @@
        if ( !rValue.Len() )
                TAG_ON( sHTML_linebreak );              // #42573# keine 
komplett leere Zelle
        else
-               OUT_STR( rValue );
+        HTMLOutFuncs::Out_String( (*m_pStream), rValue ,m_eDestEnc);
+        
 
        if ( bStrikeout )       TAG_OFF( sHTML_strike );
        if ( bUnderline )       TAG_OFF( sHTML_underline );




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to