Tag: cws_src680_reportdesign02 User: oj Date: 2007-12-20 08:42:15+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 dba/reportdesign/source/filter/xml/xmlHelper.hxx dba/reportdesign/source/filter/xml/xmlfilter.cxx
Log: #i83193# merge from reportdesign03 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.36.2&r2=1.5.36.3 Delta lines: +56 -54 --------------------- --- xmlExport.cxx 2007-12-20 07:48:16+0000 1.5.36.2 +++ xmlExport.cxx 2007-12-20 08:42:12+0000 1.5.36.3 @@ -4,9 +4,9 @@ * * $RCSfile: xmlExport.cxx,v $ * - * $Revision: 1.5.36.2 $ + * $Revision: 1.5.36.3 $ * - * last change: $Author: oj $ $Date: 2007/12/20 07:48:16 $ + * last change: $Author: oj $ $Date: 2007/12/20 08:42:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.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, xImage->getPreserveIRI() ? XML_TRUE : XML_FALSE ); } - if ( !bPageSet ) + //if ( !bPageSet ) { // start <report:eToken> SvXMLElementExport aComponents(*this,XML_NAMESPACE_REPORT, eToken, sal_False, sal_False); @@ -1300,12 +1258,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 ); } @@ -1314,7 +1272,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) ); @@ -1414,7 +1372,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(); @@ -1671,6 +1629,50 @@ GetTextParagraphExport()->exportText(sExpr,bPrevCharIsSpace); } } + 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 ); + } + } // ----------------------------------------------------------------------------- XMLShapeExport* ORptExport::CreateShapeExport() { File [changed]: xmlFixedContent.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlFixedContent.cxx?r1=1.4&r2=1.4.16.1 Delta lines: +51 -11 --------------------- --- xmlFixedContent.cxx 2007-11-20 19:01:24+0000 1.4 +++ xmlFixedContent.cxx 2007-12-20 08:42:12+0000 1.4.16.1 @@ -4,9 +4,9 @@ * * $RCSfile: xmlFixedContent.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.4.16.1 $ * - * last change: $Author: ihi $ $Date: 2007/11/20 19:01:24 $ + * last change: $Author: oj $ $Date: 2007/12/20 08:42:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.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 ) { const 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.44.1 Delta lines: +8 -6 ------------------- --- xmlFixedContent.hxx 2007-07-09 11:56:17+0000 1.2 +++ xmlFixedContent.hxx 2007-12-20 08:42:12+0000 1.2.44.1 @@ -6,9 +6,9 @@ * * $RCSfile: xmlFixedContent.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.44.1 $ * - * last change: $Author: rt $ $Date: 2007/07/09 11:56:17 $ + * last change: $Author: oj $ $Date: 2007/12/20 08:42:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.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.36.1 Delta lines: +42 -17 --------------------- --- xmlHelper.cxx 2007-08-03 09:57:18+0000 1.4 +++ xmlHelper.cxx 2007-12-20 08:42:12+0000 1.4.36.1 @@ -4,9 +4,9 @@ * * $RCSfile: xmlHelper.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.4.36.1 $ * - * last change: $Author: hr $ $Date: 2007/08/03 09:57:18 $ + * last change: $Author: oj $ $Date: 2007/12/20 08:42:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -175,12 +175,18 @@ #define MAP_CONST_C( name, prefix, token, type, context ) { name, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TABLE_CELL, context } #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0 ,0} // ----------------------------------------------------------------------------- -UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap() +UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _bOldFormat) { + if ( _bOldFormat ) + { static const XMLPropertyMapEntry s_aXMLCellStylesProperties[] = { MAP_CONST_C( PROPERTY_FORMATKEY, STYLE, DATA_STYLE_NAME, XML_TYPE_NUMBER | MID_FLAG_SPECIAL_ITEM, CTF_RPT_NUMBERFORMAT ), + MAP_CONST_C( PROPERTY_CONTROLBACKGROUND, + FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), + MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, + FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), MAP_CONST_P( PROPERTY_CONTROLBACKGROUND, FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), MAP_CONST_P( PROPERTY_CONTROLBACKGROUNDTRANSPARENT, @@ -192,6 +198,25 @@ MAP_END() }; return new XMLPropertySetMapper((XMLPropertyMapEntry*)s_aXMLCellStylesProperties,new OPropertyHandlerFactory()); + } + else + { + static const XMLPropertyMapEntry s_aXMLCellStylesProperties[] = + { + MAP_CONST_C( PROPERTY_FORMATKEY, STYLE, DATA_STYLE_NAME, XML_TYPE_NUMBER | MID_FLAG_SPECIAL_ITEM, CTF_RPT_NUMBERFORMAT ), + + MAP_CONST_C( PROPERTY_CONTROLBACKGROUND, + FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), + 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 ), + MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ), + MAP_CONST_C_ASCII( "BorderBottom", FO, BORDER_BOTTOM, XML_TYPE_BORDER, 0 ), + MAP_END() + }; + return new XMLPropertySetMapper((XMLPropertyMapEntry*)s_aXMLCellStylesProperties,new OPropertyHandlerFactory()); + } } // ----------------------------------------------------------------------------- const XMLPropertyMapEntry* OXMLHelper::GetTableStyleProps() File [changed]: xmlHelper.hxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlHelper.hxx?r1=1.2&r2=1.2.44.1 Delta lines: +3 -3 ------------------- --- xmlHelper.hxx 2007-07-09 11:56:17+0000 1.2 +++ xmlHelper.hxx 2007-12-20 08:42:12+0000 1.2.44.1 @@ -6,9 +6,9 @@ * * $RCSfile: xmlHelper.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.44.1 $ * - * last change: $Author: rt $ $Date: 2007/07/09 11:56:17 $ + * last change: $Author: oj $ $Date: 2007/12/20 08:42:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -86,7 +86,7 @@ class OXMLHelper { public: - static UniReference < XMLPropertySetMapper > GetCellStylePropertyMap(); + static UniReference < XMLPropertySetMapper > GetCellStylePropertyMap(bool _bOldFormat = false); static const SvXMLEnumMapEntry* GetReportPrintOptions(); static const SvXMLEnumMapEntry* GetForceNewPageOptions(); File [changed]: xmlfilter.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlfilter.cxx?r1=1.5&r2=1.5.16.1 Delta lines: +4 -4 ------------------- --- xmlfilter.cxx 2007-11-20 19:04:32+0000 1.5 +++ xmlfilter.cxx 2007-12-20 08:42:12+0000 1.5.16.1 @@ -4,9 +4,9 @@ * * $RCSfile: xmlfilter.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.5.16.1 $ * - * last change: $Author: ihi $ $Date: 2007/11/20 19:04:32 $ + * last change: $Author: oj $ $Date: 2007/12/20 08:42:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -433,7 +433,7 @@ XML_NAMESPACE_REPORT ); m_xPropHdlFactory = new OXMLRptPropHdlFactory; - m_xCellStylesPropertySetMapper = OXMLHelper::GetCellStylePropertyMap(); + m_xCellStylesPropertySetMapper = OXMLHelper::GetCellStylePropertyMap(true); m_xColumnStylesPropertySetMapper = new XMLPropertySetMapper(OXMLHelper::GetColumnStyleProps(), m_xPropHdlFactory); m_xRowStylesPropertySetMapper = new XMLPropertySetMapper(OXMLHelper::GetRowStyleProps(), m_xPropHdlFactory); m_xTableStylesPropertySetMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_TABLE_DEFAULTS ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
