LCOV - code coverage report
Current view: top level - sw/source/filter/xml - xmlexp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 292 349 83.7 %
Date: 2012-08-25 Functions: 39 46 84.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 319 714 44.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/text/XTextDocument.hpp>
      31                 :            : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      32                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      33                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      34                 :            : #include <com/sun/star/container/XIndexContainer.hpp>
      35                 :            : #include <com/sun/star/uno/RuntimeException.hpp>
      36                 :            : #include <com/sun/star/xforms/XFormsSupplier.hpp>
      37                 :            : 
      38                 :            : #include <sax/tools/converter.hxx>
      39                 :            : #include <svx/svdmodel.hxx>
      40                 :            : #include <svx/svdpage.hxx>
      41                 :            : #include <svx/xmleohlp.hxx>
      42                 :            : #include <svx/xmlgrhlp.hxx>
      43                 :            : #include <editeng/eeitem.hxx>
      44                 :            : #include <svx/svddef.hxx>
      45                 :            : #include <xmloff/nmspmap.hxx>
      46                 :            : #include <xmloff/xmlnmspe.hxx>
      47                 :            : #include <editeng/xmlcnitm.hxx>
      48                 :            : #include <xmloff/ProgressBarHelper.hxx>
      49                 :            : #include <xmloff/xmluconv.hxx>
      50                 :            : #include <xmloff/xformsexport.hxx>
      51                 :            : #include <pam.hxx>
      52                 :            : #include <doc.hxx>
      53                 :            : #include <swmodule.hxx>
      54                 :            : #include <docsh.hxx>
      55                 :            : #include <viewsh.hxx>
      56                 :            : #include <docstat.hxx>
      57                 :            : #include <swerror.h>
      58                 :            : #include <unotext.hxx>
      59                 :            : #include <xmltexte.hxx>
      60                 :            : #include <xmlexp.hxx>
      61                 :            : #include <sfx2/viewsh.hxx>
      62                 :            : #include <comphelper/processfactory.hxx>
      63                 :            : #include <docary.hxx>
      64                 :            : #include <editeng/unolingu.hxx>
      65                 :            : #include <editeng/forbiddencharacterstable.hxx>
      66                 :            : #include <comphelper/servicehelper.hxx>
      67                 :            : 
      68                 :            : // for locking SolarMutex: svapp + mutex
      69                 :            : #include <vcl/svapp.hxx>
      70                 :            : #include <osl/mutex.hxx>
      71                 :            : 
      72                 :            : #include <pausethreadstarting.hxx> // #i73788#
      73                 :            : 
      74                 :            : 
      75                 :            : using ::rtl::OUString;
      76                 :            : using namespace ::com::sun::star;
      77                 :            : using namespace ::com::sun::star::frame;
      78                 :            : using namespace ::com::sun::star::lang;
      79                 :            : using namespace ::com::sun::star::xml::sax;
      80                 :            : using namespace ::com::sun::star::uno;
      81                 :            : using namespace ::com::sun::star::text;
      82                 :            : using namespace ::com::sun::star::container;
      83                 :            : using namespace ::com::sun::star::document;
      84                 :            : using namespace ::com::sun::star::drawing;
      85                 :            : using namespace ::com::sun::star::beans;
      86                 :            : using namespace ::com::sun::star::i18n;
      87                 :            : using namespace ::com::sun::star::xforms;
      88                 :            : using namespace ::xmloff::token;
      89                 :            : 
      90                 :         92 : SwXMLExport::SwXMLExport(
      91                 :            :     const uno::Reference< lang::XMultiServiceFactory > xServiceFactory,
      92                 :            :     sal_uInt16 nExportFlags)
      93                 :            : :   SvXMLExport( util::MeasureUnit::INCH, xServiceFactory, XML_TEXT,
      94                 :            :         nExportFlags ),
      95                 :            :     pTableItemMapper( 0 ),
      96                 :            :     pTableLines( 0 ),
      97                 :            :     bBlock( sal_False ),
      98                 :            :     bShowProgress( sal_True ),
      99                 :            :     sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
     100                 :            :     sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
     101 [ +  - ][ +  - ]:         92 :     sCell(RTL_CONSTASCII_USTRINGPARAM("Cell"))
                 [ +  - ]
     102                 :            : {
     103         [ +  - ]:         92 :     _InitItemExport();
     104                 :         92 : }
     105                 :            : 
     106                 :          4 : void SwXMLExport::setBlockMode()
     107                 :            : {
     108                 :          4 :     bBlock = sal_True;
     109                 :            : 
     110                 :          4 : }
     111                 :            : 
     112                 :         80 : sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
     113                 :            : {
     114         [ -  + ]:         80 :     if( !GetModel().is() )
     115                 :          0 :         return ERR_SWG_WRITE_ERROR;
     116                 :            : 
     117         [ +  - ]:         80 :     SwPauseThreadStarting aPauseThreadStarting; // #i73788#
     118                 :            : 
     119         [ +  - ]:         80 :     Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
     120 [ +  - ][ +  - ]:         80 :     Reference < XText > xText = xTextDoc->getText();
     121         [ +  - ]:         80 :     Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
     122                 :            :     OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
     123         [ -  + ]:         80 :     if( !xTextTunnel.is() )
     124                 :          0 :         return ERR_SWG_WRITE_ERROR;
     125                 :            : 
     126                 :            :     // from here, we use core interfaces -> lock Solar-Mutex
     127         [ +  - ]:         80 :     SolarMutexGuard aGuard;
     128                 :            : 
     129                 :            :     {
     130         [ +  - ]:         80 :         Reference<XPropertySet> rInfoSet = getExportInfo();
     131         [ +  - ]:         80 :         if( rInfoSet.is() )
     132                 :            :         {
     133                 :            :             OUString sAutoTextMode(
     134         [ +  - ]:         80 :                 RTL_CONSTASCII_USTRINGPARAM("AutoTextMode"));
     135 [ +  - ][ +  - ]:        160 :             if( rInfoSet->getPropertySetInfo()->hasPropertyByName(
         [ +  - ][ +  - ]
     136         [ +  - ]:         80 :                         sAutoTextMode ) )
     137                 :            :             {
     138 [ +  - ][ +  - ]:         80 :                 Any aAny = rInfoSet->getPropertyValue(sAutoTextMode);
     139         [ +  - ]:         84 :                 if( aAny.getValueType() == ::getBooleanCppuType() &&
           [ +  +  +  - ]
                 [ +  + ]
     140                 :          4 :                     *static_cast<const sal_Bool*>(aAny.getValue()) )
     141                 :         80 :                     setBlockMode();
     142                 :         80 :             }
     143                 :         80 :         }
     144                 :            :     }
     145                 :            : 
     146                 :            :     SwXText *pText = reinterpret_cast< SwXText * >(
     147 [ +  - ][ +  - ]:         80 :             sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
                 [ +  - ]
     148                 :            :     OSL_ENSURE( pText, "SwXText missing" );
     149         [ -  + ]:         80 :     if( !pText )
     150                 :          0 :         return ERR_SWG_WRITE_ERROR;
     151                 :            : 
     152         [ +  - ]:         80 :     SwDoc *pDoc = pText->GetDoc();
     153                 :            : 
     154                 :         80 :     sal_Bool bExtended = sal_False;
     155         [ +  + ]:         80 :     if( (getExportFlags() & (EXPORT_FONTDECLS|EXPORT_STYLES|
     156                 :            :                              EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 )
     157                 :            :     {
     158 [ +  - ][ +  - ]:         42 :         if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
     159                 :            :         {
     160                 :         42 :             _GetNamespaceMap().Add(
     161         [ +  - ]:         42 :                 GetXMLToken(XML_NP_OFFICE_EXT),
     162         [ +  - ]:         42 :                 GetXMLToken(XML_N_OFFICE_EXT),
     163         [ +  - ]:         42 :                 XML_NAMESPACE_OFFICE_EXT);
     164                 :            :         }
     165                 :            : 
     166 [ +  - ][ +  - ]:         42 :         GetTextParagraphExport()->SetBlockMode( bBlock );
                 [ +  - ]
     167                 :            : 
     168                 :            :         const SfxPoolItem* pItem;
     169                 :         42 :         const SfxItemPool& rPool = pDoc->GetAttrPool();
     170                 :            :         sal_uInt16 aWhichIds[5] = { RES_UNKNOWNATR_CONTAINER,
     171                 :            :                                     RES_TXTATR_UNKNOWN_CONTAINER,
     172                 :            :                                     SDRATTR_XMLATTRIBUTES,
     173                 :            :                                     EE_PARA_XMLATTRIBS,
     174                 :         42 :                                     EE_CHAR_XMLATTRIBS };
     175                 :            : 
     176 [ +  - ][ +  - ]:         42 :         sal_uInt16 nWhichIds = rPool.GetSecondaryPool() ? 5 : 2;
     177         [ +  + ]:        252 :         for( sal_uInt16 j=0; j < nWhichIds; j++ )
     178                 :            :         {
     179                 :        210 :             sal_uInt16 nWhichId = aWhichIds[j];
     180         [ +  - ]:        210 :             sal_uInt32 i=0, nItems = rPool.GetItemCount2( nWhichId );
     181         [ +  + ]:        222 :             for( i = 0; i < nItems; ++i )
     182                 :            :             {
     183 [ +  - ][ +  - ]:         12 :                 if( 0 != (pItem = rPool.GetItem2( nWhichId , i ) ) )
     184                 :            :                 {
     185                 :            :                     const SvXMLAttrContainerItem *pUnknown =
     186 [ +  - ][ +  - ]:         12 :                                 PTR_CAST( SvXMLAttrContainerItem, pItem );
         [ +  - ][ +  - ]
     187                 :            :                     OSL_ENSURE( pUnknown, "illegal attribute container item" );
     188 [ +  - ][ +  - ]:         12 :                     if( pUnknown && (pUnknown->GetAttrCount() > 0) )
         [ -  + ][ -  + ]
     189                 :            :                     {
     190         [ #  # ]:          0 :                         sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex();
     191         [ #  # ]:          0 :                         while( USHRT_MAX != nIdx )
     192                 :            :                         {
     193                 :            :                             const OUString& rPrefix =
     194         [ #  # ]:          0 :                                 pUnknown->GetPrefix( nIdx );
     195                 :          0 :                             _GetNamespaceMap().Add( rPrefix,
     196         [ #  # ]:          0 :                                                 pUnknown->GetNamespace( nIdx ),
     197         [ #  # ]:          0 :                                                 XML_NAMESPACE_UNKNOWN );
     198         [ #  # ]:          0 :                             nIdx = pUnknown->GetNextNamespaceIndex( nIdx );
     199                 :            :                         }
     200                 :          0 :                         bExtended = sal_True;
     201                 :            :                     }
     202                 :            :                 }
     203                 :            :             }
     204                 :            :         }
     205                 :            :     }
     206                 :            : 
     207                 :            :     sal_uInt16 const eUnit = SvXMLUnitConverter::GetMeasureUnit(
     208 [ +  - ][ +  - ]:         80 :             SW_MOD()->GetMetric(pDoc->get(IDocumentSettingAccess::HTML_MODE)));
         [ +  - ][ +  - ]
     209 [ +  - ][ -  + ]:         80 :     if (GetMM100UnitConverter().GetXMLMeasureUnit() != eUnit )
     210                 :            :     {
     211         [ #  # ]:          0 :         GetMM100UnitConverter().SetXMLMeasureUnit( eUnit );
     212         [ #  # ]:          0 :         pTwipUnitConv->SetXMLMeasureUnit( eUnit );
     213                 :            :     }
     214                 :            : 
     215                 :         80 :     SetExtended( bExtended );
     216                 :            : 
     217         [ +  + ]:         80 :     if( (getExportFlags() & EXPORT_META) != 0 )
     218                 :            :     {
     219                 :            :         // Update doc stat, so that correct values are exported and
     220                 :            :         // the progress works correctly.
     221         [ +  - ]:         19 :         pDoc->UpdateDocStat();
     222                 :            : 
     223                 :         19 :         SfxObjectShell* pObjSh = pDoc->GetDocShell();
     224         [ +  - ]:         19 :         if( pObjSh )
     225         [ +  - ]:         19 :             pObjSh->UpdateDocInfoForSave();     // update information
     226                 :            :     }
     227         [ +  - ]:         80 :     if( bShowProgress )
     228                 :            :     {
     229         [ +  - ]:         80 :         ProgressBarHelper *pProgress = GetProgressBarHelper();
     230         [ +  + ]:         80 :         if( -1 == pProgress->GetReference() )
     231                 :            :         {
     232                 :            :             // progress isn't initialized:
     233                 :            :             // We assume that the whole doc is exported, and the following
     234                 :            :             // durations:
     235                 :            :             // - meta information: 2
     236                 :            :             // - settings: 4 (TODO: not now!)
     237                 :            :             // - styles (except page styles): 2
     238                 :            :             // - page styles: 2 (TODO: not now!) + 2 for each paragraph
     239                 :            :             // - paragraph: 2 (1 for automatic styles and one for content)
     240                 :            : 
     241                 :            :             // count each item once, and then multiply by two to reach the
     242                 :            :             // figures given above
     243                 :            :             // The styles in pDoc also count the default style that never
     244                 :            :             // gets exported -> subtract one.
     245                 :         21 :             sal_Int32 nRef = 1; // meta.xml
     246                 :         21 :             nRef += pDoc->GetCharFmts()->size() - 1;
     247                 :         21 :             nRef += pDoc->GetFrmFmts()->size() - 1;
     248                 :         21 :             nRef += pDoc->GetTxtFmtColls()->size() - 1;
     249                 :         21 :             nRef *= 2; // for the above styles, xmloff will increment by 2!
     250                 :            :             // #i93174#: count all paragraphs for the progress bar
     251         [ +  - ]:         21 :             nRef += pDoc->GetUpdatedDocStat().nAllPara; // 1: only content, no autostyle
     252                 :         21 :             pProgress->SetReference( nRef );
     253         [ +  - ]:         21 :             pProgress->SetValue( 0 );
     254                 :            :         }
     255                 :            :     }
     256                 :            : 
     257         [ +  + ]:         80 :     if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 )
     258                 :            :     {
     259                 :            :         //Auf die Korrektheit der OrdNums sind wir schon angewiesen.
     260         [ +  - ]:         42 :         SdrModel* pModel = pDoc->GetDrawModel();
     261         [ +  - ]:         42 :         if( pModel )
     262 [ +  - ][ +  - ]:         42 :             pModel->GetPage( 0 )->RecalcObjOrdNums();
     263                 :            :     }
     264                 :            : 
     265                 :            :     // adjust document class (eClass)
     266 [ +  - ][ -  + ]:         80 :     if (pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT))
     267                 :            :     {
     268                 :          0 :         eClass = XML_TEXT_GLOBAL;
     269                 :            : 
     270                 :            :         // additionally, we take care of the save-linked-sections-thingy
     271         [ #  # ]:          0 :         mbSaveLinkedSections = pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS);
     272                 :            :     }
     273                 :            :     // MIB: 03/26/04: The Label information is saved in the settings, so
     274                 :            :     // we don't need it here.
     275                 :            :     // else: keep default pClass that we received
     276                 :            : 
     277                 :         80 :     SvXMLGraphicHelper *pGraphicResolver = 0;
     278         [ +  + ]:         80 :     if( !GetGraphicResolver().is() )
     279                 :            :     {
     280         [ +  - ]:         38 :         pGraphicResolver = SvXMLGraphicHelper::Create( GRAPHICHELPER_MODE_WRITE );
     281 [ +  - ][ +  - ]:         38 :         Reference< XGraphicObjectResolver > xGraphicResolver( pGraphicResolver );
     282         [ +  - ]:         38 :         SetGraphicResolver( xGraphicResolver );
     283                 :            :     }
     284                 :            : 
     285                 :         80 :     SvXMLEmbeddedObjectHelper *pEmbeddedResolver = 0;
     286         [ +  + ]:         80 :     if( !GetEmbeddedResolver().is() )
     287                 :            :     {
     288         [ +  - ]:         38 :         SfxObjectShell *pPersist = pDoc->GetPersist();
     289         [ +  - ]:         38 :         if( pPersist )
     290                 :            :         {
     291                 :            :             pEmbeddedResolver = SvXMLEmbeddedObjectHelper::Create(
     292                 :            :                                             *pPersist,
     293         [ +  - ]:         38 :                                             EMBEDDEDOBJECTHELPER_MODE_WRITE );
     294 [ +  - ][ +  - ]:         38 :             Reference< XEmbeddedObjectResolver > xEmbeddedResolver( pEmbeddedResolver );
     295         [ +  - ]:         38 :             SetEmbeddedResolver( xEmbeddedResolver );
     296                 :            :         }
     297                 :            :     }
     298                 :            : 
     299                 :            :     // set redline mode if we export STYLES or CONTENT, unless redline
     300                 :            :     // mode is taken care of outside (through info XPropertySet)
     301                 :            :     sal_Bool bSaveRedline =
     302                 :         80 :         ( (getExportFlags() & (EXPORT_CONTENT|EXPORT_STYLES)) != 0 );
     303         [ +  + ]:         80 :     if( bSaveRedline )
     304                 :            :     {
     305                 :            :         // if the info property set has a ShowChanges property,
     306                 :            :         // then change tracking is taken care of on the outside,
     307                 :            :         // so we don't have to!
     308         [ +  - ]:         42 :         Reference<XPropertySet> rInfoSet = getExportInfo();
     309         [ +  - ]:         42 :         if( rInfoSet.is() )
     310                 :            :         {
     311         [ +  - ]:         42 :             OUString sShowChanges( RTL_CONSTASCII_USTRINGPARAM("ShowChanges"));
     312 [ +  - ][ +  - ]:         84 :             bSaveRedline = ! rInfoSet->getPropertySetInfo()->hasPropertyByName(
                 [ +  - ]
     313         [ +  - ]:         84 :                                                                 sShowChanges );
     314                 :         42 :         }
     315                 :            :     }
     316                 :         80 :     sal_uInt16 nRedlineMode = 0;
     317         [ +  - ]:         80 :     bSavedShowChanges = IDocumentRedlineAccess::IsShowChanges( pDoc->GetRedlineMode() );
     318         [ -  + ]:         80 :     if( bSaveRedline )
     319                 :            :     {
     320                 :            :         // now save and switch redline mode
     321         [ #  # ]:          0 :         nRedlineMode = pDoc->GetRedlineMode();
     322                 :            :         pDoc->SetRedlineMode(
     323         [ #  # ]:          0 :                  (RedlineMode_t)(( nRedlineMode & nsRedlineMode_t::REDLINE_SHOW_MASK ) | nsRedlineType_t::REDLINE_INSERT ));
     324                 :            :     }
     325                 :            : 
     326         [ +  - ]:         80 :      sal_uInt32 nRet = SvXMLExport::exportDoc( eClass );
     327                 :            : 
     328                 :            :     // now we can restore the redline mode (if we changed it previously)
     329         [ -  + ]:         80 :     if( bSaveRedline )
     330                 :            :     {
     331         [ #  # ]:          0 :       pDoc->SetRedlineMode( (RedlineMode_t)(nRedlineMode ));
     332                 :            :     }
     333                 :            : 
     334                 :            : 
     335         [ +  + ]:         80 :     if( pGraphicResolver )
     336         [ +  - ]:         38 :         SvXMLGraphicHelper::Destroy( pGraphicResolver );
     337         [ +  + ]:         80 :     if( pEmbeddedResolver )
     338         [ +  - ]:         38 :         SvXMLEmbeddedObjectHelper::Destroy( pEmbeddedResolver );
     339                 :            : 
     340                 :            :     OSL_ENSURE( !pTableLines, "there are table columns infos left" );
     341                 :            : 
     342 [ +  - ][ +  - ]:         80 :     return nRet;
     343                 :            : }
     344                 :            : 
     345                 :         42 : XMLTextParagraphExport* SwXMLExport::CreateTextParagraphExport()
     346                 :            : {
     347 [ +  - ][ +  - ]:         42 :     return new SwXMLTextParagraphExport( *this, *GetAutoStylePool().get() );
     348                 :            : }
     349                 :            : 
     350                 :         42 : XMLShapeExport* SwXMLExport::CreateShapeExport()
     351                 :            : {
     352 [ +  - ][ +  - ]:         42 :     XMLShapeExport* pShapeExport = new XMLShapeExport( *this, XMLTextParagraphExport::CreateShapeExtPropMapper( *this ) );
                 [ +  - ]
     353         [ +  - ]:         42 :     Reference < XDrawPageSupplier > xDPS( GetModel(), UNO_QUERY );
     354         [ +  - ]:         42 :     if( xDPS.is() )
     355                 :            :     {
     356 [ +  - ][ +  - ]:         42 :          Reference < XShapes > xShapes( xDPS->getDrawPage(), UNO_QUERY );
                 [ +  - ]
     357                 :         42 :         pShapeExport->seekShapes( xShapes );
     358                 :            :     }
     359                 :            : 
     360                 :         42 :     return pShapeExport;
     361                 :            : }
     362                 :            : 
     363 [ +  - ][ +  - ]:         92 : SwXMLExport::~SwXMLExport()
         [ +  - ][ +  - ]
     364                 :            : {
     365         [ +  - ]:         92 :     DeleteTableLines();
     366         [ +  - ]:         92 :     _FinitItemExport();
     367         [ -  + ]:        184 : }
     368                 :            : 
     369                 :            : 
     370                 :         42 : void SwXMLExport::_ExportFontDecls()
     371                 :            : {
     372                 :         42 :     GetFontAutoStylePool(); // make sure the pool is created
     373                 :         42 :     SvXMLExport::_ExportFontDecls();
     374                 :         42 : }
     375                 :            : 
     376                 :            : #define NUM_EXPORTED_VIEW_SETTINGS 11
     377                 :         19 : void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
     378                 :            : {
     379                 :            :     Reference< XMultiServiceFactory > xServiceFactory =
     380         [ +  - ]:         19 :             comphelper::getProcessServiceFactory();
     381                 :            :     OSL_ENSURE( xServiceFactory.is(),
     382                 :            :             "XMLReader::Read: got no service manager" );
     383         [ -  + ]:         19 :     if( !xServiceFactory.is() )
     384                 :            :         return;
     385                 :            : 
     386         [ +  - ]:         19 :     aProps.realloc( NUM_EXPORTED_VIEW_SETTINGS );
     387                 :            :      // Currently exporting 9 properties
     388         [ +  - ]:         19 :     PropertyValue *pValue = aProps.getArray();
     389                 :         19 :     sal_Int32 nIndex = 0;
     390                 :            : 
     391         [ +  - ]:         19 :     Reference < XIndexContainer > xBox (xServiceFactory->createInstance
     392 [ +  - ][ +  - ]:         19 :             (OUString( RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.document.IndexedPropertyValues") ) ), UNO_QUERY);
                 [ +  - ]
     393         [ +  - ]:         19 :     if (xBox.is() )
     394                 :            :     {
     395         [ +  - ]:         19 :         pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "Views") );
     396 [ +  - ][ +  - ]:         19 :         pValue[nIndex++].Value <<= Reference < XIndexAccess > ( xBox, UNO_QUERY );
     397                 :            :     }
     398                 :            : 
     399                 :         19 :     Reference < XText > xText;
     400                 :         19 :     SwXText *pText = 0;
     401                 :            : 
     402         [ +  - ]:         19 :     if( GetModel().is() )
     403                 :            :     {
     404         [ +  - ]:         19 :         Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
     405 [ +  - ][ +  - ]:         19 :         xText = xTextDoc->getText();
                 [ +  - ]
     406         [ +  - ]:         19 :         Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
     407                 :            :         OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
     408         [ +  - ]:         19 :         if( xTextTunnel.is() )
     409                 :            :         {
     410                 :            :             pText = reinterpret_cast< SwXText * >(
     411 [ +  - ][ +  - ]:         19 :                     sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId()) ));
                 [ +  - ]
     412                 :            :             OSL_ENSURE( pText, "SwXText missing" );
     413                 :         19 :         }
     414                 :            :     }
     415                 :            : 
     416         [ -  + ]:         19 :     if( !pText )
     417                 :            :     {
     418         [ #  # ]:          0 :         aProps.realloc(nIndex);
     419                 :            :         return;
     420                 :            :     }
     421                 :            : 
     422         [ +  - ]:         19 :     SwDoc *pDoc = pText->GetDoc();
     423                 :            :     const Rectangle rRect =
     424         [ +  - ]:         19 :         pDoc->GetDocShell()->GetVisArea( ASPECT_CONTENT );
     425         [ +  - ]:         19 :     sal_Bool bTwip = pDoc->GetDocShell()->GetMapUnit ( ) == MAP_TWIP;
     426                 :            : 
     427                 :            :    OSL_ENSURE( bTwip, "Map unit for visible area is not in TWIPS!" );
     428                 :            : 
     429         [ +  - ]:         19 :     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaTop") );
     430 [ +  - ][ +  - ]:         19 :     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.Top() ) : rRect.Top();
                 [ +  - ]
     431                 :            : 
     432         [ +  - ]:         19 :     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaLeft") );
     433 [ +  - ][ +  - ]:         19 :     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.Left() ) : rRect.Left();
                 [ +  - ]
     434                 :            : 
     435         [ +  - ]:         19 :     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaWidth") );
     436 [ +  - ][ +  - ]:         19 :     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.GetWidth() ) : rRect.GetWidth();
         [ +  - ][ #  # ]
         [ #  # ][ +  - ]
                 [ +  - ]
     437                 :            : 
     438         [ +  - ]:         19 :     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaHeight") );
     439 [ +  - ][ +  - ]:         19 :     pValue[nIndex++].Value <<= bTwip ? TWIP_TO_MM100 ( rRect.GetHeight() ) : rRect.GetHeight();
         [ +  - ][ #  # ]
         [ #  # ][ +  - ]
                 [ +  - ]
     440                 :            : 
     441                 :            :     // "show redline mode" cannot simply be read from the document
     442                 :            :     // since it gets changed during execution. If it's in the info
     443                 :            :     // XPropertySet, we take it from there.
     444                 :         19 :     sal_Bool bShowRedlineChanges = bSavedShowChanges;
     445         [ +  - ]:         19 :     Reference<XPropertySet> xInfoSet( getExportInfo() );
     446         [ +  - ]:         19 :     if ( xInfoSet.is() )
     447                 :            :     {
     448         [ +  - ]:         19 :         OUString sShowChanges( RTL_CONSTASCII_USTRINGPARAM( "ShowChanges" ));
     449 [ +  - ][ +  - ]:         19 :         if( xInfoSet->getPropertySetInfo()->hasPropertyByName( sShowChanges ) )
         [ +  - ][ +  - ]
                 [ +  - ]
     450                 :            :         {
     451         [ +  - ]:         19 :             bShowRedlineChanges = *(sal_Bool*) xInfoSet->
     452         [ +  - ]:         19 :                                    getPropertyValue( sShowChanges ).getValue();
     453                 :         19 :         }
     454                 :            :     }
     455                 :            : 
     456         [ +  - ]:         19 :     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ShowRedlineChanges") );
     457         [ +  - ]:         19 :     pValue[nIndex++].Value.setValue( &bShowRedlineChanges, ::getBooleanCppuType() );
     458                 :            : 
     459         [ +  - ]:         19 :     sal_Bool bInBrowse =  pDoc->get(IDocumentSettingAccess::BROWSE_MODE);
     460         [ +  - ]:         19 :     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "InBrowseMode") );
     461         [ +  - ]:         19 :     pValue[nIndex++].Value.setValue( &bInBrowse, ::getBooleanCppuType() );
     462                 :            : 
     463         [ +  - ]:         19 :     if ( nIndex < NUM_EXPORTED_VIEW_SETTINGS )
     464 [ +  - ][ -  + ]:         19 :         aProps.realloc(nIndex);
         [ -  + ][ +  - ]
     465                 :            : }
     466                 :            : #undef NUM_EXPORTED_VIEW_SETTINGS
     467                 :            : 
     468                 :         19 : void SwXMLExport::GetConfigurationSettings( Sequence < PropertyValue >& rProps)
     469                 :            : {
     470         [ +  - ]:         19 :     Reference< XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
     471         [ +  - ]:         19 :     if( xFac.is() )
     472                 :            :     {
     473 [ +  - ][ +  - ]:         19 :         Reference< XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
         [ +  - ][ +  - ]
     474         [ +  - ]:         19 :         if( xProps.is() )
     475         [ +  - ]:         19 :             SvXMLUnitConverter::convertPropertySet( rProps, xProps );
     476                 :         19 :     }
     477                 :         19 : }
     478                 :            : 
     479                 :         19 : sal_Int32 SwXMLExport::GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings )
     480                 :            : {
     481                 :            :     // the only doc-specific settings group we know so far are the XForms settings
     482         [ +  - ]:         19 :     uno::Sequence<beans::PropertyValue> aXFormsSettings;
     483         [ +  - ]:         19 :     Reference< XFormsSupplier > xXFormsSupp( GetModel(), UNO_QUERY );
     484                 :         19 :     Reference< XNameAccess > xXForms;
     485         [ +  - ]:         19 :     if ( xXFormsSupp.is() )
     486 [ +  - ][ +  - ]:         19 :         xXForms = xXFormsSupp->getXForms().get();
         [ +  - ][ +  - ]
     487         [ -  + ]:         19 :     if ( xXForms.is() )
     488                 :            :     {
     489         [ #  # ]:          0 :         getXFormsSettings( xXForms, aXFormsSettings );
     490 [ #  # ][ #  # ]:          0 :         _out_rSettings.push_back( SettingsGroup( XML_XFORM_MODEL_SETTINGS, aXFormsSettings ) );
                 [ #  # ]
     491                 :            :     }
     492                 :            : 
     493 [ +  - ][ +  - ]:         19 :     return aXFormsSettings.getLength() + SvXMLExport::GetDocumentSpecificSettings( _out_rSettings );
     494                 :            : }
     495                 :            : 
     496                 :         21 : void SwXMLExport::SetBodyAttributes()
     497                 :            : {
     498         [ +  - ]:         21 :     Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
     499 [ +  - ][ +  - ]:         21 :     Reference < XText > xText = xTextDoc->getText();
     500                 :            :     // export use of soft page breaks
     501                 :            :     {
     502         [ +  - ]:         21 :         Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
     503                 :            :         OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
     504         [ +  - ]:         21 :         if( xTextTunnel.is() )
     505                 :            :         {
     506                 :            :             SwXText *pText = reinterpret_cast< SwXText * >(
     507 [ +  - ][ +  - ]:         21 :                     sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
                 [ +  - ]
     508                 :            :             OSL_ENSURE( pText, "SwXText missing" );
     509         [ +  - ]:         21 :             if( pText )
     510                 :            :             {
     511         [ +  - ]:         21 :                 SwDoc *pDoc = pText->GetDoc();
     512 [ +  - ][ +  - ]:         40 :                 if( pDoc && pDoc->GetCurrentViewShell() &&
         [ +  + ][ +  + ]
                 [ +  + ]
     513 [ +  - ][ +  - ]:         19 :                     pDoc->GetCurrentViewShell()->GetPageCount() > 1 )
     514                 :            :                 {
     515                 :          4 :                     sal_Bool bValue = sal_True;
     516                 :          4 :                     rtl::OUStringBuffer sBuffer;
     517         [ +  - ]:          4 :                     ::sax::Converter::convertBool(sBuffer, bValue);
     518                 :            :                     AddAttribute(XML_NAMESPACE_TEXT, XML_USE_SOFT_PAGE_BREAKS,
     519 [ +  - ][ +  - ]:          4 :                         sBuffer.makeStringAndClear());
     520                 :            :                 }
     521                 :            :             }
     522                 :         21 :         }
     523                 :         21 :     }
     524                 :         21 : }
     525                 :            : 
     526                 :            : 
     527                 :         21 : void SwXMLExport::_ExportContent()
     528                 :            : {
     529                 :            :     // export forms
     530         [ +  - ]:         21 :     Reference<XDrawPageSupplier> xDrawPageSupplier(GetModel(), UNO_QUERY);
     531         [ +  - ]:         21 :     if (xDrawPageSupplier.is())
     532                 :            :     {
     533                 :            :         // export only if we actually have elements
     534 [ +  - ][ +  - ]:         21 :         Reference<XDrawPage> xPage = xDrawPageSupplier->getDrawPage();
     535         [ +  - ]:         21 :         if (xPage.is())
     536                 :            :         {
     537                 :            :             // prevent export of form controls which are embedded in mute sections
     538         [ +  - ]:         21 :             Reference<XIndexAccess> xIAPage( xPage, UNO_QUERY );
     539                 :            :             GetTextParagraphExport()->PreventExportOfControlsInMuteSections(
     540 [ +  - ][ +  - ]:         21 :                 xIAPage, GetFormExport() );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     541                 :            : 
     542                 :            :             // #i36597#
     543 [ +  - ][ +  - ]:         21 :             if ( GetFormExport()->pageContainsForms( xPage ) || GetFormExport()->documentContainsXForms() )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ -  +  #  #  
                   #  # ]
     544                 :            :             {
     545         [ #  # ]:          0 :                 ::xmloff::OOfficeFormsExport aOfficeForms(*this);
     546                 :            : 
     547 [ #  # ][ #  # ]:          0 :                 GetFormExport()->exportXForms();
         [ #  # ][ #  # ]
     548                 :            : 
     549 [ #  # ][ #  # ]:          0 :                 GetFormExport()->seekPage(xPage);
         [ #  # ][ #  # ]
     550 [ #  # ][ #  # ]:          0 :                 GetFormExport()->exportForms(xPage);
         [ #  # ][ #  # ]
                 [ #  # ]
     551                 :         21 :             }
     552                 :         21 :         }
     553                 :            :     }
     554                 :            : 
     555         [ +  - ]:         21 :     Reference<XPropertySet> xPropSet(GetModel(), UNO_QUERY);
     556         [ +  - ]:         21 :     if (xPropSet.is())
     557                 :            :     {
     558         [ +  - ]:         21 :         OUString sTwoDigitYear(RTL_CONSTASCII_USTRINGPARAM("TwoDigitYear"));
     559                 :            : 
     560 [ +  - ][ +  - ]:         21 :         Any aAny = xPropSet->getPropertyValue( sTwoDigitYear );
     561         [ +  - ]:         21 :         aAny <<= (sal_Int16)1930;
     562                 :            : 
     563                 :         21 :         sal_Int16 nYear = 0;
     564                 :         21 :         aAny >>= nYear;
     565         [ -  + ]:         21 :         if (nYear != 1930 )
     566                 :            :         {
     567                 :          0 :             rtl::OUStringBuffer sBuffer;
     568         [ #  # ]:          0 :             ::sax::Converter::convertNumber(sBuffer, nYear);
     569 [ #  # ][ #  # ]:          0 :             AddAttribute(XML_NAMESPACE_TABLE, XML_NULL_YEAR, sBuffer.makeStringAndClear());
     570 [ #  # ][ #  # ]:          0 :             SvXMLElementExport aCalcSettings(*this, XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, sal_True, sal_True);
     571                 :         21 :         }
     572                 :            :     }
     573                 :            : 
     574 [ +  - ][ +  - ]:         21 :     GetTextParagraphExport()->exportTrackedChanges( sal_False );
         [ +  - ][ +  - ]
     575 [ +  - ][ +  - ]:         21 :     GetTextParagraphExport()->exportTextDeclarations();
         [ +  - ][ +  - ]
     576         [ +  - ]:         21 :     Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
     577 [ +  - ][ +  - ]:         21 :     Reference < XText > xText = xTextDoc->getText();
     578                 :            : 
     579 [ +  - ][ +  - ]:         21 :     GetTextParagraphExport()->exportFramesBoundToPage( bShowProgress );
         [ +  - ][ +  - ]
     580 [ +  - ][ +  - ]:         21 :     GetTextParagraphExport()->exportText( xText, bShowProgress );
         [ +  - ][ +  - ]
     581                 :         21 : }
     582                 :            : 
     583                 :            : 
     584                 :            : 
     585                 :            : //
     586                 :            : // uno component registration
     587                 :            : // helper functions for export service(s)
     588                 :            : //
     589                 :            : 
     590                 :            : // OOo
     591                 :        148 : OUString SAL_CALL SwXMLExportOOO_getImplementationName() throw()
     592                 :            : {
     593                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     594                 :        148 :         "com.sun.star.comp.Writer.XMLExporter" ) );
     595                 :            : }
     596                 :            : 
     597                 :          0 : Sequence< OUString > SAL_CALL SwXMLExportOOO_getSupportedServiceNames()
     598                 :            :     throw()
     599                 :            : {
     600                 :          0 :     const OUString aServiceName(SwXMLExportOOO_getImplementationName());
     601         [ #  # ]:          0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     602                 :          0 :     return aSeq;
     603                 :            : }
     604                 :            : 
     605                 :          0 : Reference< XInterface > SAL_CALL SwXMLExportOOO_createInstance(
     606                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     607                 :            :     throw( Exception )
     608                 :            : {
     609 [ #  # ][ #  # ]:          0 :     return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL);
     610                 :            : }
     611                 :            : 
     612                 :        160 : OUString SAL_CALL SwXMLExportStylesOOO_getImplementationName() throw()
     613                 :            : {
     614                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     615                 :        160 :         "com.sun.star.comp.Writer.XMLStylesExporter" ) );
     616                 :            : }
     617                 :            : 
     618                 :          6 : Sequence< OUString > SAL_CALL SwXMLExportStylesOOO_getSupportedServiceNames()
     619                 :            :     throw()
     620                 :            : {
     621                 :          6 :     const OUString aServiceName(SwXMLExportStylesOOO_getImplementationName());
     622         [ +  - ]:          6 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     623                 :          6 :     return aSeq;
     624                 :            : }
     625                 :            : 
     626                 :          8 : Reference< XInterface > SAL_CALL SwXMLExportStylesOOO_createInstance(
     627                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     628                 :            :     throw( Exception )
     629                 :            : {
     630                 :            :     return (cppu::OWeakObject*)new SwXMLExport( rSMgr,
     631                 :            :         EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES |
     632 [ +  - ][ +  - ]:          8 :         EXPORT_FONTDECLS );
     633                 :            : }
     634                 :            : 
     635                 :        154 : OUString SAL_CALL SwXMLExportContentOOO_getImplementationName() throw()
     636                 :            : {
     637                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     638                 :        154 :         "com.sun.star.comp.Writer.XMLContentExporter" ) );
     639                 :            : }
     640                 :            : 
     641                 :          6 : Sequence< OUString > SAL_CALL SwXMLExportContentOOO_getSupportedServiceNames()
     642                 :            :     throw()
     643                 :            : {
     644                 :          6 :     const OUString aServiceName(SwXMLExportContentOOO_getImplementationName());
     645         [ +  - ]:          6 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     646                 :          6 :     return aSeq;
     647                 :            : }
     648                 :            : 
     649                 :          8 : Reference< XInterface > SAL_CALL SwXMLExportContentOOO_createInstance(
     650                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     651                 :            :     throw( Exception )
     652                 :            : {
     653                 :            :     return (cppu::OWeakObject*)new SwXMLExport(rSMgr,
     654                 :            :         EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS |
     655 [ +  - ][ +  - ]:          8 :         EXPORT_FONTDECLS );
     656                 :            : }
     657                 :            : 
     658                 :        144 : OUString SAL_CALL SwXMLExportMetaOOO_getImplementationName() throw()
     659                 :            : {
     660                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     661                 :        144 :         "com.sun.star.comp.Writer.XMLMetaExporter" ) );
     662                 :            : }
     663                 :            : 
     664                 :          4 : Sequence< OUString > SAL_CALL SwXMLExportMetaOOO_getSupportedServiceNames()
     665                 :            :     throw()
     666                 :            : {
     667                 :          4 :     const OUString aServiceName(SwXMLExportMetaOOO_getImplementationName());
     668         [ +  - ]:          4 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     669                 :          4 :     return aSeq;
     670                 :            : }
     671                 :            : 
     672                 :          4 : Reference< XInterface > SAL_CALL SwXMLExportMetaOOO_createInstance(
     673                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     674                 :            :     throw( Exception )
     675                 :            : {
     676 [ +  - ][ +  - ]:          4 :     return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_META);
     677                 :            : }
     678                 :            : 
     679                 :        144 : OUString SAL_CALL SwXMLExportSettingsOOO_getImplementationName() throw()
     680                 :            : {
     681                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     682                 :        144 :         "com.sun.star.comp.Writer.XMLSettingsExporter" ) );
     683                 :            : }
     684                 :            : 
     685                 :          6 : Sequence< OUString > SAL_CALL SwXMLExportSettingsOOO_getSupportedServiceNames()
     686                 :            :     throw()
     687                 :            : {
     688                 :          6 :     const OUString aServiceName(SwXMLExportSettingsOOO_getImplementationName());
     689         [ +  - ]:          6 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     690                 :          6 :     return aSeq;
     691                 :            : }
     692                 :            : 
     693                 :          8 : Reference< XInterface > SAL_CALL SwXMLExportSettingsOOO_createInstance(
     694                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     695                 :            :     throw( Exception )
     696                 :            : {
     697 [ +  - ][ +  - ]:          8 :     return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_SETTINGS);
     698                 :            : }
     699                 :            : 
     700                 :            : // OASIS
     701                 :        126 : OUString SAL_CALL SwXMLExport_getImplementationName() throw()
     702                 :            : {
     703                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     704                 :        126 :         "com.sun.star.comp.Writer.XMLOasisExporter" ) );
     705                 :            : }
     706                 :            : 
     707                 :          0 : Sequence< OUString > SAL_CALL SwXMLExport_getSupportedServiceNames()
     708                 :            :     throw()
     709                 :            : {
     710                 :          0 :     const OUString aServiceName(SwXMLExport_getImplementationName());
     711         [ #  # ]:          0 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     712                 :          0 :     return aSeq;
     713                 :            : }
     714                 :            : 
     715                 :          0 : Reference< XInterface > SAL_CALL SwXMLExport_createInstance(
     716                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     717                 :            :     throw( Exception )
     718                 :            : {
     719 [ #  # ][ #  # ]:          0 :     return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL|EXPORT_OASIS);
     720                 :            : }
     721                 :            : 
     722                 :        152 : OUString SAL_CALL SwXMLExportStyles_getImplementationName() throw()
     723                 :            : {
     724                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     725                 :        152 :         "com.sun.star.comp.Writer.XMLOasisStylesExporter" ) );
     726                 :            : }
     727                 :            : 
     728                 :         13 : Sequence< OUString > SAL_CALL SwXMLExportStyles_getSupportedServiceNames()
     729                 :            :     throw()
     730                 :            : {
     731                 :         13 :     const OUString aServiceName(SwXMLExportStyles_getImplementationName());
     732         [ +  - ]:         13 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     733                 :         13 :     return aSeq;
     734                 :            : }
     735                 :            : 
     736                 :         17 : Reference< XInterface > SAL_CALL SwXMLExportStyles_createInstance(
     737                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     738                 :            :     throw( Exception )
     739                 :            : {
     740                 :            :     return (cppu::OWeakObject*)new SwXMLExport( rSMgr,
     741                 :            :         EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES |
     742 [ +  - ][ +  - ]:         17 :         EXPORT_FONTDECLS|EXPORT_OASIS );
     743                 :            : }
     744                 :            : 
     745                 :        139 : OUString SAL_CALL SwXMLExportContent_getImplementationName() throw()
     746                 :            : {
     747                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     748                 :        139 :         "com.sun.star.comp.Writer.XMLOasisContentExporter" ) );
     749                 :            : }
     750                 :            : 
     751                 :         13 : Sequence< OUString > SAL_CALL SwXMLExportContent_getSupportedServiceNames()
     752                 :            :     throw()
     753                 :            : {
     754                 :         13 :     const OUString aServiceName(SwXMLExportContent_getImplementationName());
     755         [ +  - ]:         13 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     756                 :         13 :     return aSeq;
     757                 :            : }
     758                 :            : 
     759                 :         17 : Reference< XInterface > SAL_CALL SwXMLExportContent_createInstance(
     760                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     761                 :            :     throw( Exception )
     762                 :            : {
     763                 :            :     return (cppu::OWeakObject*)new SwXMLExport(
     764                 :            :         rSMgr,
     765                 :            :         EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS |
     766 [ +  - ][ +  - ]:         17 :         EXPORT_FONTDECLS|EXPORT_OASIS );
     767                 :            : }
     768                 :            : 
     769                 :        122 : OUString SAL_CALL SwXMLExportMeta_getImplementationName() throw()
     770                 :            : {
     771                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     772                 :        122 :         "com.sun.star.comp.Writer.XMLOasisMetaExporter" ) );
     773                 :            : }
     774                 :            : 
     775                 :         11 : Sequence< OUString > SAL_CALL SwXMLExportMeta_getSupportedServiceNames()
     776                 :            :     throw()
     777                 :            : {
     778                 :         11 :     const OUString aServiceName(SwXMLExportMeta_getImplementationName());
     779         [ +  - ]:         11 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     780                 :         11 :     return aSeq;
     781                 :            : }
     782                 :            : 
     783                 :         15 : Reference< XInterface > SAL_CALL SwXMLExportMeta_createInstance(
     784                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     785                 :            :     throw( Exception )
     786                 :            : {
     787 [ +  - ][ +  - ]:         15 :     return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_META|EXPORT_OASIS);
     788                 :            : }
     789                 :            : 
     790                 :        111 : OUString SAL_CALL SwXMLExportSettings_getImplementationName() throw()
     791                 :            : {
     792                 :            :     return OUString( RTL_CONSTASCII_USTRINGPARAM(
     793                 :        111 :         "com.sun.star.comp.Writer.XMLOasisSettingsExporter" ) );
     794                 :            : }
     795                 :            : 
     796                 :         11 : Sequence< OUString > SAL_CALL SwXMLExportSettings_getSupportedServiceNames()
     797                 :            :     throw()
     798                 :            : {
     799                 :         11 :     const OUString aServiceName(SwXMLExportSettings_getImplementationName());
     800         [ +  - ]:         11 :     const Sequence< OUString > aSeq( &aServiceName, 1 );
     801                 :         11 :     return aSeq;
     802                 :            : }
     803                 :            : 
     804                 :         15 : Reference< XInterface > SAL_CALL SwXMLExportSettings_createInstance(
     805                 :            :         const Reference< XMultiServiceFactory > & rSMgr)
     806                 :            :     throw( Exception )
     807                 :            : {
     808 [ +  - ][ +  - ]:         15 :     return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_SETTINGS|EXPORT_OASIS);
     809                 :            : }
     810                 :            : 
     811                 :            : namespace
     812                 :            : {
     813                 :            :     class theSwXMLExportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXMLExportUnoTunnelId > {};
     814                 :            : }
     815                 :            : 
     816                 :          0 : const Sequence< sal_Int8 > & SwXMLExport::getUnoTunnelId() throw()
     817                 :            : {
     818                 :          0 :     return theSwXMLExportUnoTunnelId::get().getSeq();
     819                 :            : }
     820                 :            : 
     821                 :          0 : sal_Int64 SAL_CALL SwXMLExport::getSomething( const Sequence< sal_Int8 >& rId )
     822                 :            :     throw(RuntimeException)
     823                 :            : {
     824   [ #  #  #  # ]:          0 :     if( rId.getLength() == 16
                 [ #  # ]
     825                 :          0 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
     826                 :          0 :                                         rId.getConstArray(), 16 ) )
     827                 :            :     {
     828                 :          0 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
     829                 :            :     }
     830                 :          0 :     return SvXMLExport::getSomething( rId );
     831                 :            : }
     832                 :            : 
     833                 :            : 
     834                 :            : // XServiceInfo
     835                 :            : // override empty method from parent class
     836                 :          0 : OUString SAL_CALL SwXMLExport::getImplementationName()
     837                 :            :     throw(RuntimeException)
     838                 :            : {
     839   [ #  #  #  #  :          0 :     switch( getExportFlags() )
                   #  # ]
     840                 :            :     {
     841                 :            :         case EXPORT_ALL:
     842                 :          0 :             return SwXMLExport_getImplementationName();
     843                 :            :         case (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS):
     844                 :          0 :             return SwXMLExportStyles_getImplementationName();
     845                 :            :         case (EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS):
     846                 :          0 :             return SwXMLExportContent_getImplementationName();
     847                 :            :         case EXPORT_META:
     848                 :          0 :             return SwXMLExportMeta_getImplementationName();
     849                 :            :         case EXPORT_SETTINGS:
     850                 :          0 :             return SwXMLExportSettings_getImplementationName();
     851                 :            :         default:
     852                 :            :             // generic name for 'unknown' cases
     853                 :            :             return OUString( RTL_CONSTASCII_USTRINGPARAM(
     854                 :          0 :                 "com.sun.star.comp.Writer.SwXMLExport" ) );
     855                 :            :     }
     856                 :            : }
     857                 :            : 
     858                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10