Tag: cws_src680_reportdesign03
User: oj      
Date: 2007-11-29 14:49:47+0000
Modified:
   dba/reportdesign/source/filter/xml/xmlExport.cxx
   dba/reportdesign/source/filter/xml/xmlFixedContent.cxx
   dba/reportdesign/source/filter/xml/xmlFixedContent.hxx
   dba/reportdesign/source/filter/xml/xmlHelper.cxx

Log:
 #i83193# set color at table-cell

File Changes:

Directory: /dba/reportdesign/source/filter/xml/
===============================================

File [changed]: xmlExport.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlExport.cxx?r1=1.5&r2=1.5.44.1
Delta lines:  +59 -59
---------------------
--- xmlExport.cxx       2007-08-06 10:47:23+0000        1.5
+++ xmlExport.cxx       2007-11-29 14:49:45+0000        1.5.44.1
@@ -788,11 +788,11 @@
 // 
-----------------------------------------------------------------------------
 void ORptExport::exportReportComponentAutoStyles(const Reference<XSection>& 
_xProp)
 {
-    sal_Int32 nCount = _xProp->getCount();
+    const sal_Int32 nCount = _xProp->getCount();
     for (sal_Int32 i = 0 ; i< nCount ; ++i)
        {
-        Reference<XReportComponent> 
xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
-        Reference< report::XShape > xShape(xReportElement,uno::UNO_QUERY);
+        const Reference<XReportComponent> 
xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
+        const Reference< report::XShape > 
xShape(xReportElement,uno::UNO_QUERY);
         if ( xShape.is() )
         {
             UniReference< XMLShapeExport > xShapeExport = GetShapeExport();
@@ -1034,54 +1034,12 @@
                             {
                                 bPageSet = 
exportFormula(XML_FORMULA,xReportElement->getDataField());
                                 if ( bPageSet )
-                                {
-                                    ::rtl::OUString sFieldData = 
xReportElement->getDataField();
-                                    static const ::rtl::OUString 
s_sPageNumber(RTL_CONSTASCII_USTRINGPARAM("PageNumber()"));
-                                    static const ::rtl::OUString 
s_sPageCount(RTL_CONSTASCII_USTRINGPARAM("PageCount()"));
-                                    static const ::rtl::OUString 
s_sReportPrefix(RTL_CONSTASCII_USTRINGPARAM("rpt:"));
-                                    static const ::rtl::OUString 
s_sConcatOperator(RTL_CONSTASCII_USTRINGPARAM("&"));
-                                    sFieldData = 
sFieldData.copy(s_sReportPrefix.getLength(),sFieldData.getLength() - 
s_sReportPrefix.getLength());
-                                    sal_Int32 nPageNumberIndex = 
sFieldData.indexOf(s_sPageNumber);
-                                    if ( nPageNumberIndex != -1 )
-                                    {
-                                        sal_Int32 nIndex = 0;
-                                        do
-                                        {
-                                            ::rtl::OUString sToken = 
sFieldData.getToken( 0, '&', nIndex );
-                                            sToken = sToken.trim();
-                                            if ( sToken.getLength() )
-                                            {
-                                                if ( sToken == s_sPageNumber )
-                                                {
-                                                    static const 
::rtl::OUString s_sCurrent(RTL_CONSTASCII_USTRINGPARAM("current"));
-                                                    
AddAttribute(XML_NAMESPACE_TEXT, XML_SELECT_PAGE, s_sCurrent );
-                                                    SvXMLElementExport 
aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, sal_False, sal_False);
-                                                    
Characters(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
-                                                }
-                                                else if ( sToken == 
s_sPageCount )
-                                                {
-                                                    SvXMLElementExport 
aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_COUNT, sal_False, sal_False);
-                                                    
Characters(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
-                                                }
-                                                else
-                                                {
-                                                    
-                                                    if ( sToken.indexOf('"') 
== 0 && sToken.lastIndexOf('"') == sToken.getLength()-1 )
-                                                        sToken = 
sToken.copy(1,sToken.getLength()-2);
-                                                                               
         
-                                                    sal_Bool bPrevCharIsSpace 
= sal_False;
-                                                    
GetTextParagraphExport()->exportText(sToken,bPrevCharIsSpace);
-                                                }
-                                            }
-                                        }
-                                        while ( nIndex >= 0 );
-                                    }                                    
-                                }
+                                    eToken = XML_FIXED_CONTENT;
                                 else if ( eToken == XML_IMAGE )
                                     AddAttribute(XML_NAMESPACE_REPORT, 
XML_PRESERVE_IRI, XML_TRUE );
                             }
 
-                            if ( !bPageSet )
+                            //if ( !bPageSet )
                             {
                                 // start <report:eToken>
                                        SvXMLElementExport 
aComponents(*this,XML_NAMESPACE_REPORT, eToken, sal_False, sal_False);
@@ -1292,12 +1250,12 @@
 // 
-----------------------------------------------------------------------------
 void ORptExport::exportAutoStyle(XPropertySet* _xProp)
 {
-    uno::Reference<report::XReportControlFormat> 
xFormat(_xProp,uno::UNO_QUERY);
+    const uno::Reference<report::XReportControlFormat> 
xFormat(_xProp,uno::UNO_QUERY);
        if ( xFormat.is() )
     {
         try
         {
-                       awt::FontDescriptor aFont = 
xFormat->getFontDescriptor();
+                       const awt::FontDescriptor aFont = 
xFormat->getFontDescriptor();
             OSL_ENSURE(aFont.Name.getLength(),"No Font Name !");
                        
GetFontAutoStylePool()->Add(aFont.Name,aFont.StyleName,aFont.Family,aFont.Pitch,aFont.CharSet
 );
         }
@@ -1306,7 +1264,7 @@
             // not interested in
         }
        }
-    uno::Reference< report::XShape> xShape(_xProp,uno::UNO_QUERY);
+    const uno::Reference< report::XShape> xShape(_xProp,uno::UNO_QUERY);
     if ( xShape.is() )
     {
         ::std::vector< XMLPropertyState > aPropertyStates( 
m_xParaPropMapper->Filter(_xProp) );
@@ -1406,7 +1364,7 @@
                 }
             }
         }
-        Reference<XFormattedField> xFormattedField(_xProp,uno::UNO_QUERY);
+        const Reference<XFormattedField> 
xFormattedField(_xProp,uno::UNO_QUERY);
         if ( xFormattedField.is() && !aPropertyStates.empty() )
         {
             sal_Int32 nNumberFormat = xFormattedField->getFormatKey();
@@ -1647,6 +1605,50 @@
     OSL_PRECOND(_xReportElement.is(),"Element is null!");
     // start <text:p>
     SvXMLElementExport aParagraphContent(*this,XML_NAMESPACE_TEXT, XML_P, 
sal_False, sal_False);
+    if ( Reference<XFormattedField>(_xReportElement,uno::UNO_QUERY).is() )
+    {
+        ::rtl::OUString sFieldData = _xReportElement->getDataField();
+        static const ::rtl::OUString 
s_sPageNumber(RTL_CONSTASCII_USTRINGPARAM("PageNumber()"));
+        static const ::rtl::OUString 
s_sPageCount(RTL_CONSTASCII_USTRINGPARAM("PageCount()"));
+        static const ::rtl::OUString 
s_sReportPrefix(RTL_CONSTASCII_USTRINGPARAM("rpt:"));
+        static const ::rtl::OUString 
s_sConcatOperator(RTL_CONSTASCII_USTRINGPARAM("&"));
+        sFieldData = 
sFieldData.copy(s_sReportPrefix.getLength(),sFieldData.getLength() - 
s_sReportPrefix.getLength());
+        sal_Int32 nPageNumberIndex = sFieldData.indexOf(s_sPageNumber);
+        if ( nPageNumberIndex != -1 )
+        {
+            sal_Int32 nIndex = 0;
+            do
+            {
+                ::rtl::OUString sToken = sFieldData.getToken( 0, '&', nIndex );
+                sToken = sToken.trim();
+                if ( sToken.getLength() )
+                {
+                    if ( sToken == s_sPageNumber )
+                    {
+                        static const ::rtl::OUString 
s_sCurrent(RTL_CONSTASCII_USTRINGPARAM("current"));
+                        AddAttribute(XML_NAMESPACE_TEXT, XML_SELECT_PAGE, 
s_sCurrent );
+                        SvXMLElementExport 
aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, sal_False, sal_False);
+                        
Characters(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
+                    }
+                    else if ( sToken == s_sPageCount )
+                    {
+                        SvXMLElementExport 
aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_COUNT, sal_False, sal_False);
+                        
Characters(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
+                    }
+                    else
+                    {
+                        
+                        if ( sToken.indexOf('"') == 0 && 
sToken.lastIndexOf('"') == sToken.getLength()-1 )
+                            sToken = sToken.copy(1,sToken.getLength()-2);
+                                                            
+                        sal_Bool bPrevCharIsSpace = sal_False;
+                        
GetTextParagraphExport()->exportText(sToken,bPrevCharIsSpace);
+                    }
+                }
+            }
+            while ( nIndex >= 0 );
+        }                                    
+    }
     Reference< XFixedText > xFT(_xReportElement,UNO_QUERY);
     if ( xFT.is() )
     {
@@ -1667,17 +1669,15 @@
     UniReference< XMLShapeExport > xShapeExport = GetShapeExport();
     const sal_Int32 nCount = _xSection->getCount();
     awt::Point aRefPoint;
+    ::std::auto_ptr<SvXMLElementExport> pParagraphContent;
+    if ( _bAddParagraph )
+        pParagraphContent.reset(new 
SvXMLElementExport(*this,XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False));
     aRefPoint.X = 
rptui::getStyleProperty<sal_Int32>(_xSection->getReportDefinition(),PROPERTY_LEFTMARGIN);
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
         uno::Reference< XShape > 
xShape(_xSection->getByIndex(i),uno::UNO_QUERY);
         if ( xShape.is() )
         {
-            ::std::auto_ptr<SvXMLElementExport> pParagraphContent;
-            if ( _bAddParagraph )
-            {
-                pParagraphContent.reset(new 
SvXMLElementExport(*this,XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False));
-            }
             AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, XML_PARAGRAPH );
             
xShapeExport->exportShape(xShape.get(),SEF_DEFAULT|SEF_EXPORT_NO_WS,&aRefPoint);
         }

File [changed]: xmlFixedContent.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlFixedContent.cxx?r1=1.3&r2=1.3.20.1
Delta lines:  +48 -8
--------------------
--- xmlFixedContent.cxx 2007-09-26 14:21:43+0000        1.3
+++ xmlFixedContent.cxx 2007-11-29 14:49:45+0000        1.3.20.1
@@ -73,6 +73,7 @@
 #ifndef _COM_SUN_STAR_REPORT_XSHAPE_HPP_
 #include <com/sun/star/report/XShape.hpp>
 #endif
+#include <com/sun/star/report/XFormattedField.hpp>
 #include <com/sun/star/text/ControlCharacter.hpp>
 #ifndef RPT_XMLTABLE_HXX
 #include "xmlTable.hxx"
@@ -158,10 +159,11 @@
                                sal_uInt16 nPrfx, const ::rtl::OUString& rLName
                                ,OXMLCell& _rCell
                 ,OXMLTable* _pContainer
-                ,bool _bInP) :
+                ,OXMLFixedContent* _pInP) :
        OXMLReportElementBase( rImport, nPrfx, rLName,NULL,_pContainer)
 ,m_rCell(_rCell)
-,m_bInP(_bInP)
+,m_pInP(_pInP)
+,m_bFormattedField(false)
 {
     DBG_CTOR( rpt_OXMLFixedContent,NULL);
 }
@@ -182,6 +184,8 @@
        SvXMLImportContext *pContext = 
OXMLReportElementBase::_CreateChildContext(nPrefix,rLocalName,xAttrList);
     if ( pContext )
         return pContext;
+
+    static const ::rtl::OUString s_sStringConcat(RTL_CONSTASCII_USTRINGPARAM(" 
& "));
        const SvXMLTokenMap&    rTokenMap       = 
m_rImport.GetCellElemTokenMap();
     Reference<XMultiServiceFactory> xFactor = m_rImport.getServiceFactory();
 
@@ -190,7 +194,7 @@
     switch( nToken )
        {
         case XML_TOK_P:
-            pContext = new OXMLFixedContent(m_rImport,nPrefix, 
rLocalName,m_rCell,m_pContainer,true);
+            pContext = new OXMLFixedContent(m_rImport,nPrefix, 
rLocalName,m_rCell,m_pContainer,this);
             break;
         case XML_TOK_TEXT_TAB_STOP:
                    pContext = new OXMLCharContent( m_rImport, this,nPrefix,
@@ -209,21 +213,46 @@
                                                                                
            rLocalName, xAttrList,
                                                                                
            0x0020, sal_True );
                    break;
+        case XML_TOK_PAGE_NUMBER:
+            m_sPageText += s_sStringConcat + 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PageNumber()"));
+            m_bFormattedField = true;
+            break;
+        case XML_TOK_PAGE_COUNT:
+            m_sPageText += s_sStringConcat + 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PageCount()"));
+            m_bFormattedField = true;
+            break;
+        default:
+            ;
     }
     return pContext;
 }
 // 
-----------------------------------------------------------------------------
 void OXMLFixedContent::EndElement()
 {
-    if ( m_bInP )
+    if ( m_pInP )
     {
         Reference<XMultiServiceFactory> 
xFactor(m_rImport.GetModel(),uno::UNO_QUERY);
+        if ( m_bFormattedField )
+        {
+            uno::Reference< uno::XInterface> xInt = 
xFactor->createInstance(SERVICE_FORMATTEDFIELD);
+            Reference< report::XFormattedField > xControl(xInt,uno::UNO_QUERY);
+            
xControl->setDataField(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + 
m_sPageText);
+                   OSL_ENSURE(xControl.is(),"Could not create 
FormattedField!");
+            m_pInP->m_xComponent = xControl.get();
+            m_xComponent = xControl.get();
+        }
+        else
+        {
         Reference< XFixedText > 
xControl(xFactor->createInstance(SERVICE_FIXEDTEXT),uno::UNO_QUERY);
                OSL_ENSURE(xControl.is(),"Could not create FixedContent!");
+            m_pInP->m_xComponent = xControl.get();
         m_xComponent = xControl.get();
+            xControl->setLabel(m_sLabel);
+        }
+        
         m_pContainer->addCell(m_xComponent);
         m_rCell.setComponent(m_xComponent);
-        xControl->setLabel(m_sLabel);
+        
         OXMLReportElementBase::EndElement();
     }
 }
@@ -231,6 +260,17 @@
 void OXMLFixedContent::Characters( const ::rtl::OUString& rChars )
 {
        m_sLabel += rChars;
+    if ( rChars.getLength() )
+    {
+        static const ::rtl::OUString 
s_Quote(RTL_CONSTASCII_USTRINGPARAM("\""));
+        if ( m_sPageText.getLength() )
+        {
+            static const ::rtl::OUString 
s_sStringConcat(RTL_CONSTASCII_USTRINGPARAM(" & "));
+            m_sPageText += s_sStringConcat;
+        }
+        
+        m_sPageText += s_Quote + rChars + s_Quote;
+    }
 }
 
 //----------------------------------------------------------------------------

File [changed]: xmlFixedContent.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlFixedContent.hxx?r1=1.2&r2=1.2.52.1
Delta lines:  +9 -7
-------------------
--- xmlFixedContent.hxx 2007-07-09 11:56:17+0000        1.2
+++ xmlFixedContent.hxx 2007-11-29 14:49:45+0000        1.2.52.1
@@ -49,9 +49,11 @@
     class OXMLCell;
        class OXMLFixedContent : public OXMLReportElementBase
        {
+        ::rtl::OUString     m_sPageText; // page count and page number
         ::rtl::OUString m_sLabel;
         OXMLCell&       m_rCell;
-        bool            m_bInP;
+        OXMLFixedContent*   m_pInP; // if set than we are in text-p element
+        bool                m_bFormattedField;
 
     protected:
         virtual SvXMLImportContext* _CreateChildContext( sal_uInt16 nPrefix,
@@ -65,7 +67,7 @@
                                        const ::rtl::OUString& rLName
                                        ,OXMLCell& _rCell
                     ,OXMLTable* _pContainer
-                    ,bool _bInP = false);
+                    ,OXMLFixedContent* _pInP = NULL);
                virtual ~OXMLFixedContent();
 
         // This method is called for all characters that are contained in the

File [changed]: xmlHelper.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlHelper.cxx?r1=1.4&r2=1.4.44.1
Delta lines:  +2 -2
-------------------
--- xmlHelper.cxx       2007-08-03 09:57:18+0000        1.4
+++ xmlHelper.cxx       2007-11-29 14:49:45+0000        1.4.44.1
@@ -181,9 +181,9 @@
     {
         MAP_CONST_C(      PROPERTY_FORMATKEY,      STYLE,     DATA_STYLE_NAME, 
       XML_TYPE_NUMBER | MID_FLAG_SPECIAL_ITEM, CTF_RPT_NUMBERFORMAT ),
 
-        MAP_CONST_P(      PROPERTY_CONTROLBACKGROUND, 
+        MAP_CONST_C(      PROPERTY_CONTROLBACKGROUND, 
                                               FO,        BACKGROUND_COLOR,     
        XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
-        MAP_CONST_P(      PROPERTY_CONTROLBACKGROUNDTRANSPARENT,
+        MAP_CONST_C(      PROPERTY_CONTROLBACKGROUNDTRANSPARENT,
                                               FO,        BACKGROUND_COLOR,     
        XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
         MAP_CONST_C_ASCII(      "BorderLeft",       FO,     BORDER_LEFT,       
    XML_TYPE_BORDER, 0 ),
         MAP_CONST_C_ASCII(      "BorderRight",      FO,     BORDER_RIGHT,      
    XML_TYPE_BORDER, 0 ),




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

Reply via email to