[Libreoffice-commits] core.git: 2 commits - filter/source

Andras Timar andras.timar at collabora.com
Mon Dec 7 12:24:07 PST 2015


 filter/source/svg/svgexport.cxx |  433 +++++++++++++++++++++++-----------------
 filter/source/svg/svgfilter.cxx |    2 
 filter/source/svg/svgfilter.hxx |    2 
 3 files changed, 255 insertions(+), 182 deletions(-)

New commits:
commit 48f0ba92a6e9828805ce6f5d87147b9d0dcefe3b
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Dec 7 21:24:32 2015 +0100

    Revert "svg export: no more an experimental feature"
    
    This reverts commit 59cd3f4ddb88ef1326166902ffe61d6050bfcd99.

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 7005d92..6824d95 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -716,14 +716,17 @@ bool SVGFilter::implExportDocument()
     bool         bRet = false;
     sal_Int32        nLastPage = mSelectedPages.getLength() - 1;
 
-    mbSinglePage = (nLastPage == 0);
+    SvtMiscOptions aMiscOptions;
+    const bool bExperimentalMode = aMiscOptions.IsExperimentalMode();
+
+    mbSinglePage = ((nLastPage == 0) || !bExperimentalMode) && !comphelper::LibreOfficeKit::isActive();
     mnVisiblePage = -1;
 
     const Reference< XPropertySet >             xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
     const Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
 
     // #i124608#
-    mbExportShapeSelection = mbSinglePage && maShapeSelection.is() && maShapeSelection->getCount();
+    mbExportSelection = mbSinglePage && maShapeSelection.is() && maShapeSelection->getCount();
 
     if(xDefaultPagePropertySet.is())
     {
@@ -731,7 +734,7 @@ bool SVGFilter::implExportDocument()
         xDefaultPagePropertySet->getPropertyValue( "Height" ) >>= nDocHeight;
     }
 
-    if(mbExportShapeSelection)
+    if(mbExportSelection)
     {
         // #i124608# create BoundRange and set nDocX, nDocY, nDocWidth and nDocHeight
         basegfx::B2DRange aShapeRange;
@@ -791,7 +794,7 @@ bool SVGFilter::implExportDocument()
     // instead of centered.
     #define _SVG_WRITE_EXTENTS
     #ifdef _SVG_WRITE_EXTENTS
-    if( !mbPresentation )
+    if( mbSinglePage )
     {
         aAttr = OUString::number( nDocWidth * 0.01 ) + "mm";
         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
@@ -802,7 +805,7 @@ bool SVGFilter::implExportDocument()
     #endif
 
     // #i124608# set viewBox explicitely to the exported content
-    if (mbExportShapeSelection)
+    if (mbExportSelection)
     {
         aAttr = OUString::number(nDocX) + " " + OUString::number(nDocY) + " ";
     }
@@ -851,10 +854,11 @@ bool SVGFilter::implExportDocument()
 
     if( implLookForFirstVisiblePage() )  // OK! We found at least one visible page.
     {
-        if( mbPresentation )
+        if( !mbSinglePage )
         {
             implGenerateMetaData();
-            implExportAnimations();
+            if( bExperimentalMode )
+                implExportAnimations();
         }
         else
         {
@@ -893,7 +897,7 @@ bool SVGFilter::implExportDocument()
                 implExportMasterPages( mMasterPageTargets, 0, mMasterPageTargets.size() - 1 );
             implExportDrawPages( mSelectedPages, 0, nLastPage );
 
-            if( mbPresentation )
+            if( !mbSinglePage )
             {
                 implGenerateScript();
             }
@@ -1484,7 +1488,7 @@ bool SVGFilter::implExportMasterPages( const std::vector< Reference< XDrawPage >
 
     // When the exported slides are more than one we wrap master page elements
     // with a svg <defs> element.
-    OUString aContainerTag = (!mbPresentation) ? OUString( "g" ) : OUString( "defs" );
+    OUString aContainerTag = (mbSinglePage) ? OUString( "g" ) : OUString( "defs" );
     SvXMLElementExport aContainerElement( *mpSVGExport, XML_NAMESPACE_NONE, aContainerTag, true, true );
 
     bool bRet = false;
@@ -1524,7 +1528,7 @@ bool SVGFilter::implExportDrawPages( const SVGFilter::XDrawPageSequence & rxPage
     {
         Reference< XShapes > xShapes;
 
-        if (mbExportShapeSelection)
+        if (mbExportSelection)
         {
             // #i124608# export a given object selection
             xShapes = maShapeSelection;
@@ -1540,7 +1544,7 @@ bool SVGFilter::implExportDrawPages( const SVGFilter::XDrawPageSequence & rxPage
             // handling a slide visibility.
             // In case the exported slides are more than one the initial
             // visibility of each slide is set to 'hidden'.
-            if( mbPresentation )
+            if( !mbSinglePage )
             {
                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" );
             }
@@ -1579,7 +1583,7 @@ bool SVGFilter::implExportPage( const OUString & sPageId,
 
     {
         OUString sPageName = implGetInterfaceName( rxPage );
-        if( mbPresentation && !sPageName.isEmpty() )
+        if( !(sPageName.isEmpty() || mbSinglePage ))
             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrName, sPageName );
 
         {
@@ -1619,7 +1623,7 @@ bool SVGFilter::implExportPage( const OUString & sPageId,
                 // of the parent slide regardless of the value of the 'IsBackgroundVisible' property.
                 // This means that we need to set up the visibility attribute only for the background
                 // element of a master page.
-                if( !mbPresentation && bMaster )
+                if( mbSinglePage && bMaster )
                 {
                     if( !mVisiblePagePropSet.bIsBackgroundVisible )
                     {
@@ -1646,7 +1650,7 @@ bool SVGFilter::implExportPage( const OUString & sPageId,
             OUString sBackgroundObjectsId = "bo-";
             sBackgroundObjectsId += sPageId;
             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sBackgroundObjectsId );
-            if( !mbPresentation )
+            if( mbSinglePage )
             {
                 if( !mVisiblePagePropSet.bAreBackgroundObjectsVisible )
                 {
@@ -1752,31 +1756,44 @@ bool SVGFilter::implExportShape( const Reference< XShape >& rxShape,
                         bool bIsDateTime    = ( aShapeClass == "Date/Time" );
                         if( bIsPageNumber || bIsDateTime || bIsFooter )
                         {
-                            // to notify to the SVGActionWriter::ImplWriteActions method
-                            // that we are dealing with a placeholder shape
-                            pElementId = &sPlaceholderTag;
+                            if( !mbSinglePage )
+                            {
+                                // to notify to the SVGActionWriter::ImplWriteActions method
+                                // that we are dealing with a placeholder shape
+                                pElementId = &sPlaceholderTag;
 
-                            mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" );
+                                mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" );
 
-                            sal_uInt16 nTextAdjust = ParagraphAdjust_LEFT;
-                            OUString sTextAdjust;
-                            xShapePropSet->getPropertyValue( "ParaAdjust" ) >>= nTextAdjust;
+                                sal_uInt16 nTextAdjust = ParagraphAdjust_LEFT;
+                                OUString sTextAdjust;
+                                xShapePropSet->getPropertyValue( "ParaAdjust" ) >>= nTextAdjust;
 
-                            switch( nTextAdjust )
-                            {
-                                case ParagraphAdjust_LEFT:
-                                        sTextAdjust = "left";
-                                        break;
-                                case ParagraphAdjust_CENTER:
-                                        sTextAdjust = "center";
-                                        break;
-                                case ParagraphAdjust_RIGHT:
-                                        sTextAdjust = "right";
+                                switch( nTextAdjust )
+                                {
+                                    case ParagraphAdjust_LEFT:
+                                            sTextAdjust = "left";
+                                            break;
+                                    case ParagraphAdjust_CENTER:
+                                            sTextAdjust = "center";
+                                            break;
+                                    case ParagraphAdjust_RIGHT:
+                                            sTextAdjust = "right";
+                                            break;
+                                    default:
                                         break;
-                                default:
-                                    break;
+                                }
+                                mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrTextAdjust, sTextAdjust );
+                            }
+                            else // single page case
+                            {
+                                if( !mVisiblePagePropSet.bAreBackgroundObjectsVisible || (
+                                    ( bIsPageNumber && !mVisiblePagePropSet.bIsPageNumberFieldVisible ) ||
+                                    ( bIsDateTime && !mVisiblePagePropSet.bIsDateTimeFieldVisible ) ||
+                                    ( bIsFooter && !mVisiblePagePropSet.bIsFooterFieldVisible ) ) )
+                                {
+                                    mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" );
+                                }
                             }
-                            mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrTextAdjust, sTextAdjust );
                         }
                     }
                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", aShapeClass );
@@ -1868,7 +1885,7 @@ bool SVGFilter::implExportShape( const Reference< XShape >& rxShape,
 
 bool SVGFilter::implCreateObjects()
 {
-    if (mbExportShapeSelection)
+    if (mbExportSelection)
     {
         // #i124608# export a given object selection
         if (mSelectedPages.getLength() && mSelectedPages[0].is())
@@ -2163,179 +2180,235 @@ IMPL_LINK_TYPED( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
     {
         bFieldProcessed = true;
         OUString   aRepresentation;
-        if( mpSVGExport->IsEmbedFonts() && mpSVGExport->IsUsePositionedCharacters() )
+        if( !mbSinglePage )
         {
-            // to notify to the SVGActionWriter::ImplWriteText method
-            // that we are dealing with a placeholder shape
-            aRepresentation = sPlaceholderTag;
-
-            if( !mCreateOjectsCurrentMasterPage.is() )
+            if( mpSVGExport->IsEmbedFonts() && mpSVGExport->IsUsePositionedCharacters() )
             {
-                OSL_FAIL( "error: !mCreateOjectsCurrentMasterPage.is()" );
-                return;
-            }
-            bool bHasCharSetMap = !( mTextFieldCharSets.find( mCreateOjectsCurrentMasterPage ) == mTextFieldCharSets.end() );
+                // to notify to the SVGActionWriter::ImplWriteText method
+                // that we are dealing with a placeholder shape
+                aRepresentation = sPlaceholderTag;
 
-            static const OUString aHeaderId( aOOOAttrHeaderField );
-            static const OUString aFooterId( aOOOAttrFooterField );
-            static const OUString aDateTimeId( aOOOAttrDateTimeField );
-            static const OUString aVariableDateTimeId( aOOOAttrDateTimeField + "-variable" );
+                if( !mCreateOjectsCurrentMasterPage.is() )
+                {
+                    OSL_FAIL( "error: !mCreateOjectsCurrentMasterPage.is()" );
+                    return;
+                }
+                bool bHasCharSetMap = !( mTextFieldCharSets.find( mCreateOjectsCurrentMasterPage ) == mTextFieldCharSets.end() );
 
-            const UCharSet * pCharSet = nullptr;
-            UCharSetMap * pCharSetMap = nullptr;
-            if( bHasCharSetMap )
-            {
-                pCharSetMap = &( mTextFieldCharSets[ mCreateOjectsCurrentMasterPage ] );
-            }
-            const SvxFieldData* pField = pInfo->GetField().GetField();
-            if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_HEADER ) && ( pCharSetMap->find( aHeaderId ) != pCharSetMap->end() ) )
-            {
-                pCharSet = &( (*pCharSetMap)[ aHeaderId ] );
-            }
-            else if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_FOOTER ) && ( pCharSetMap->find( aFooterId ) != pCharSetMap->end() ) )
-            {
-                pCharSet = &( (*pCharSetMap)[ aFooterId ] );
-            }
-            else if( pField->GetClassId() == text::textfield::Type::PRESENTATION_DATE_TIME )
-            {
-                if( bHasCharSetMap && ( pCharSetMap->find( aDateTimeId ) != pCharSetMap->end() ) )
+                static const OUString aHeaderId( aOOOAttrHeaderField );
+                static const OUString aFooterId( aOOOAttrFooterField );
+                static const OUString aDateTimeId( aOOOAttrDateTimeField );
+                static const OUString aVariableDateTimeId( aOOOAttrDateTimeField + "-variable" );
+
+                const UCharSet * pCharSet = nullptr;
+                UCharSetMap * pCharSetMap = nullptr;
+                if( bHasCharSetMap )
+                {
+                    pCharSetMap = &( mTextFieldCharSets[ mCreateOjectsCurrentMasterPage ] );
+                }
+                const SvxFieldData* pField = pInfo->GetField().GetField();
+                if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_HEADER ) && ( pCharSetMap->find( aHeaderId ) != pCharSetMap->end() ) )
+                {
+                    pCharSet = &( (*pCharSetMap)[ aHeaderId ] );
+                }
+                else if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_FOOTER ) && ( pCharSetMap->find( aFooterId ) != pCharSetMap->end() ) )
                 {
-                    pCharSet = &( (*pCharSetMap)[ aDateTimeId ] );
+                    pCharSet = &( (*pCharSetMap)[ aFooterId ] );
                 }
-                if( bHasCharSetMap && ( pCharSetMap->find( aVariableDateTimeId ) != pCharSetMap->end() ) && !(*pCharSetMap)[ aVariableDateTimeId ].empty() )
+                else if( pField->GetClassId() == text::textfield::Type::PRESENTATION_DATE_TIME )
                 {
-                    SvxDateFormat eDateFormat = SVXDATEFORMAT_B, eCurDateFormat;
-                    const UCharSet & aCharSet = (*pCharSetMap)[ aVariableDateTimeId ];
-                    UCharSet::const_iterator aChar = aCharSet.begin();
-                    // we look for the most verbose date format
-                    for( ; aChar != aCharSet.end(); ++aChar )
+                    if( bHasCharSetMap && ( pCharSetMap->find( aDateTimeId ) != pCharSetMap->end() ) )
                     {
-                        eCurDateFormat = (SvxDateFormat)( (int)( *aChar ) & 0x0f );
-                        switch( eDateFormat )
+                        pCharSet = &( (*pCharSetMap)[ aDateTimeId ] );
+                    }
+                    if( bHasCharSetMap && ( pCharSetMap->find( aVariableDateTimeId ) != pCharSetMap->end() ) && !(*pCharSetMap)[ aVariableDateTimeId ].empty() )
+                    {
+                        SvxDateFormat eDateFormat = SVXDATEFORMAT_B, eCurDateFormat;
+                        const UCharSet & aCharSet = (*pCharSetMap)[ aVariableDateTimeId ];
+                        UCharSet::const_iterator aChar = aCharSet.begin();
+                        // we look for the most verbose date format
+                        for( ; aChar != aCharSet.end(); ++aChar )
                         {
-                            case SVXDATEFORMAT_STDSMALL:
-                            case SVXDATEFORMAT_A:       // 13.02.96
-                            case SVXDATEFORMAT_B:       // 13.02.1996
-                                switch( eCurDateFormat )
-                                {
-                                    case SVXDATEFORMAT_C:       // 13.Feb 1996
-                                    case SVXDATEFORMAT_D:       // 13.February 1996
-                                    case SVXDATEFORMAT_E:       // Tue, 13.February 1996
-                                    case SVXDATEFORMAT_STDBIG:
-                                    case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
-                                        eDateFormat = eCurDateFormat;
-                                        break;
-                                    default:
-                                        break;
-                                }
-                                break;
-                            case SVXDATEFORMAT_C:       // 13.Feb 1996
-                            case SVXDATEFORMAT_D:       // 13.February 1996
-                                switch( eCurDateFormat )
-                                {
-                                    case SVXDATEFORMAT_E:       // Tue, 13.February 1996
-                                    case SVXDATEFORMAT_STDBIG:
-                                    case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
-                                        eDateFormat = eCurDateFormat;
-                                        break;
-                                    default:
-                                        break;
-                                }
-                                break;
-                            default:
-                                break;
+                            eCurDateFormat = (SvxDateFormat)( (int)( *aChar ) & 0x0f );
+                            switch( eDateFormat )
+                            {
+                                case SVXDATEFORMAT_STDSMALL:
+                                case SVXDATEFORMAT_A:       // 13.02.96
+                                case SVXDATEFORMAT_B:       // 13.02.1996
+                                    switch( eCurDateFormat )
+                                    {
+                                        case SVXDATEFORMAT_C:       // 13.Feb 1996
+                                        case SVXDATEFORMAT_D:       // 13.February 1996
+                                        case SVXDATEFORMAT_E:       // Tue, 13.February 1996
+                                        case SVXDATEFORMAT_STDBIG:
+                                        case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
+                                            eDateFormat = eCurDateFormat;
+                                            break;
+                                        default:
+                                            break;
+                                    }
+                                    break;
+                                case SVXDATEFORMAT_C:       // 13.Feb 1996
+                                case SVXDATEFORMAT_D:       // 13.February 1996
+                                    switch( eCurDateFormat )
+                                    {
+                                        case SVXDATEFORMAT_E:       // Tue, 13.February 1996
+                                        case SVXDATEFORMAT_STDBIG:
+                                        case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
+                                            eDateFormat = eCurDateFormat;
+                                            break;
+                                        default:
+                                            break;
+                                    }
+                                    break;
+                                default:
+                                    break;
+                            }
                         }
-                    }
-                    // Independently of the date format, we always put all these characters by default.
-                    // They should be enough to cover every time format.
-                    aRepresentation += "0123456789.:/-APM";
+                        // Independently of the date format, we always put all these characters by default.
+                        // They should be enough to cover every time format.
+                        aRepresentation += "0123456789.:/-APM";
 
-                    if( eDateFormat )
-                    {
-                        OUString sDate;
-                        LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
-                        SvNumberFormatter * pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM );
-                        // We always collect the characters obtained by using the SVXDATEFORMAT_B (as: 13.02.1996)
-                        // so we are sure to include any unusual day|month|year separator.
-                        Date aDate( 1, 1, 1996 );
-                        sDate += SvxDateField::GetFormatted( aDate, SVXDATEFORMAT_B, *pNumberFormatter, eLang );
-                        switch( eDateFormat )
+                        if( eDateFormat )
                         {
-                            case SVXDATEFORMAT_E:       // Tue, 13.February 1996
-                            case SVXDATEFORMAT_STDBIG:
-                            case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
-                                for( sal_uInt16 i = 1; i <= 7; ++i )  // we get all days in a week
-                                {
-                                    aDate.SetDay( i );
-                                    sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
-                                }
-                                // No break here! We need months too!
-                            case SVXDATEFORMAT_C:       // 13.Feb 1996
-                            case SVXDATEFORMAT_D:       // 13.February 1996
-                                for( sal_uInt16 i = 1; i <= 12; ++i ) // we get all months in a year
-                                {
-                                    aDate.SetMonth( i );
-                                    sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
-                                }
-                                break;
-                            // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
-                            case SVXDATEFORMAT_STDSMALL:
-                            case SVXDATEFORMAT_A:       // 13.02.96
-                            case SVXDATEFORMAT_B:       // 13.02.1996
-                            default:
-                                // nothing to do here, we always collect the characters needed for these cases.
-                                break;
+                            OUString sDate;
+                            LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
+                            SvNumberFormatter * pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM );
+                            // We always collect the characters obtained by using the SVXDATEFORMAT_B (as: 13.02.1996)
+                            // so we are sure to include any unusual day|month|year separator.
+                            Date aDate( 1, 1, 1996 );
+                            sDate += SvxDateField::GetFormatted( aDate, SVXDATEFORMAT_B, *pNumberFormatter, eLang );
+                            switch( eDateFormat )
+                            {
+                                case SVXDATEFORMAT_E:       // Tue, 13.February 1996
+                                case SVXDATEFORMAT_STDBIG:
+                                case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
+                                    for( sal_uInt16 i = 1; i <= 7; ++i )  // we get all days in a week
+                                    {
+                                        aDate.SetDay( i );
+                                        sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
+                                    }
+                                    // No break here! We need months too!
+                                case SVXDATEFORMAT_C:       // 13.Feb 1996
+                                case SVXDATEFORMAT_D:       // 13.February 1996
+                                    for( sal_uInt16 i = 1; i <= 12; ++i ) // we get all months in a year
+                                    {
+                                        aDate.SetMonth( i );
+                                        sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
+                                    }
+                                    break;
+                                // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
+                                case SVXDATEFORMAT_STDSMALL:
+                                case SVXDATEFORMAT_A:       // 13.02.96
+                                case SVXDATEFORMAT_B:       // 13.02.1996
+                                default:
+                                    // nothing to do here, we always collect the characters needed for these cases.
+                                    break;
+                            }
+                            aRepresentation += sDate;
                         }
-                        aRepresentation += sDate;
                     }
                 }
-            }
-            else if( pField->GetClassId() == text::textfield::Type::PAGE )
-            {
-                switch( mVisiblePagePropSet.nPageNumberingType )
+                else if( pField->GetClassId() == text::textfield::Type::PAGE )
+                {
+                    switch( mVisiblePagePropSet.nPageNumberingType )
+                    {
+                        case SVX_CHARS_UPPER_LETTER:
+                            aRepresentation += "QWERTYUIOPASDFGHJKLZXCVBNM";
+                            break;
+                        case SVX_CHARS_LOWER_LETTER:
+                            aRepresentation += "qwertyuiopasdfghjklzxcvbnm";
+                            break;
+                        case SVX_ROMAN_UPPER:
+                            aRepresentation += "IVXLCDM";
+                            break;
+                        case SVX_ROMAN_LOWER:
+                            aRepresentation += "ivxlcdm";
+                            break;
+                        // arabic numbering type is the default
+                        case SVX_ARABIC:
+                        // in case the numbering type is not handled we fall back on arabic numbering
+                        default:
+                            aRepresentation += "0123456789";
+                            break;
+                    }
+                }
+                else
+                {
+                    bFieldProcessed = false;
+                }
+                if( bFieldProcessed )
                 {
-                    case SVX_CHARS_UPPER_LETTER:
-                        aRepresentation += "QWERTYUIOPASDFGHJKLZXCVBNM";
-                        break;
-                    case SVX_CHARS_LOWER_LETTER:
-                        aRepresentation += "qwertyuiopasdfghjklzxcvbnm";
-                        break;
-                    case SVX_ROMAN_UPPER:
-                        aRepresentation += "IVXLCDM";
-                        break;
-                    case SVX_ROMAN_LOWER:
-                        aRepresentation += "ivxlcdm";
-                        break;
-                    // arabic numbering type is the default
-                    case SVX_ARABIC:
-                    // in case the numbering type is not handled we fall back on arabic numbering
-                    default:
-                        aRepresentation += "0123456789";
-                        break;
+                    if( pCharSet != nullptr )
+                    {
+                        UCharSet::const_iterator aChar = pCharSet->begin();
+                        for( ; aChar != pCharSet->end(); ++aChar )
+                        {
+                            aRepresentation += OUString( *aChar );
+                        }
+                    }
+                    pInfo->SetRepresentation( aRepresentation );
                 }
             }
             else
             {
                 bFieldProcessed = false;
             }
-            if( bFieldProcessed )
+        }
+        else  // single page case
+        {
+            if( mVisiblePagePropSet.bAreBackgroundObjectsVisible )
             {
-                if( pCharSet != nullptr )
+                const SvxFieldData* pField = pInfo->GetField().GetField();
+                if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_HEADER ) && mVisiblePagePropSet.bIsHeaderFieldVisible )
+                {
+                    aRepresentation += mVisiblePagePropSet.sHeaderText;
+                }
+                else if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_FOOTER ) && mVisiblePagePropSet.bIsFooterFieldVisible )
+                {
+                    aRepresentation += mVisiblePagePropSet.sFooterText;
+                }
+                else if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_DATE_TIME ) && mVisiblePagePropSet.bIsDateTimeFieldVisible )
                 {
-                    UCharSet::const_iterator aChar = pCharSet->begin();
-                    for( ; aChar != pCharSet->end(); ++aChar )
+                    // TODO: implement the variable case
+                    aRepresentation += mVisiblePagePropSet.sDateTimeText;
+                }
+                else if( ( pField->GetClassId() == text::textfield::Type::PAGE ) && mVisiblePagePropSet.bIsPageNumberFieldVisible )
+                {
+                    sal_Int16 nPageNumber = mVisiblePagePropSet.nPageNumber;
+                    switch( mVisiblePagePropSet.nPageNumberingType )
                     {
-                        aRepresentation += OUString( *aChar );
+                        case SVX_CHARS_UPPER_LETTER:
+                            aRepresentation += OUString( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' ) );
+                            break;
+                        case SVX_CHARS_LOWER_LETTER:
+                            aRepresentation += OUString( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'a' ) );
+                            break;
+                        case SVX_ROMAN_UPPER:
+                            aRepresentation += SvxNumberFormat::CreateRomanString( nPageNumber, true /* upper */ );
+                            break;
+                        case SVX_ROMAN_LOWER:
+                            aRepresentation += SvxNumberFormat::CreateRomanString( nPageNumber, false /* lower */ );
+                            break;
+                        // arabic numbering type is the default
+                        case SVX_ARABIC:
+                        // in case the numbering type is not handled we fall back on arabic numbering
+                        default:
+                            aRepresentation += OUString::number( nPageNumber );
+                            break;
                     }
                 }
-                pInfo->SetRepresentation( aRepresentation );
+                else
+                {
+                    bFieldProcessed = false;
+                }
+                if( bFieldProcessed )
+                {
+                    pInfo->SetRepresentation( aRepresentation );
+                }
             }
-        }
-        else
-        {
-            bFieldProcessed = false;
-        }
 
+        }
     }
     if (!bFieldProcessed)
         maOldFieldHdl.Call( pInfo );
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index f993900..d7111e7 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -77,7 +77,7 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) :
     mxDefaultPage(),
     maFilterData(),
     maShapeSelection(),
-    mbExportShapeSelection(false),
+    mbExportSelection(false),
     maOldFieldHdl()
 {
 }
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index 1e64c8b..1651f09 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -240,7 +240,7 @@ private:
     Sequence< PropertyValue >           maFilterData;
     // #i124608# explicit ShapeSelection for export when export of the selection is wanted
     Reference< XShapes >                maShapeSelection;
-    bool                                mbExportShapeSelection;
+    bool                                mbExportSelection;
     XDrawPageSequence                   mSelectedPages;
     std::vector< Reference< XDrawPage > > mMasterPageTargets;
 
commit b75c47c8e58beb8626f02495a75eb319c77e870a
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Dec 7 21:24:12 2015 +0100

    Revert "svg-export: fix wrong conflict resolution"
    
    This reverts commit 7485ea8b917c1e4da7982611c70b0f3d0a46b27a.

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index ce31b26..7005d92 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -889,7 +889,7 @@ bool SVGFilter::implExportDocument()
             }
 
             // #i124608# export a given object selection, so no MasterPage export at all
-            if (!mbExportShapeSelection)
+            if (!mbExportSelection)
                 implExportMasterPages( mMasterPageTargets, 0, mMasterPageTargets.size() - 1 );
             implExportDrawPages( mSelectedPages, 0, nLastPage );
 


More information about the Libreoffice-commits mailing list