LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/xmloff - xmlexp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 48 58 82.8 %
Date: 2012-08-25 Functions: 22 28 78.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 15 22 68.2 %

           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                 :            : #ifndef _XMLOFF_XMLEXP_HXX
      30                 :            : #define _XMLOFF_XMLEXP_HXX
      31                 :            : 
      32                 :            : #include "sal/config.h"
      33                 :            : #include "xmloff/dllapi.h"
      34                 :            : #include "sal/types.h"
      35                 :            : 
      36                 :            : #include <com/sun/star/embed/XStorage.hpp>
      37                 :            : #include <com/sun/star/xml/sax/SAXParseException.hpp>
      38                 :            : #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
      39                 :            : #include <com/sun/star/xml/sax/SAXException.hpp>
      40                 :            : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      41                 :            : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      42                 :            : #include <com/sun/star/xml/sax/XLocator.hpp>
      43                 :            : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      44                 :            : #include <com/sun/star/lang/XUnoTunnel.hpp>
      45                 :            : #include <rtl/ustring.hxx>
      46                 :            : #include <xmloff/txtparae.hxx>
      47                 :            : #include <xmloff/formlayerexport.hxx>
      48                 :            : #include <xmloff/xmlnumfe.hxx>
      49                 :            : #include <xmloff/xmlaustp.hxx>
      50                 :            : #include <xmloff/shapeexport.hxx>
      51                 :            : #include <xmloff/xmltoken.hxx>
      52                 :            : #include <xmloff/SchXMLExportHelper.hxx>
      53                 :            : #include <xmloff/XMLFontAutoStylePool.hxx>
      54                 :            : #include <com/sun/star/document/XFilter.hpp>
      55                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      56                 :            : #include <com/sun/star/document/XExporter.hpp>
      57                 :            : #include <com/sun/star/document/XGraphicObjectResolver.hpp>
      58                 :            : #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
      59                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      60                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      61                 :            : #include <com/sun/star/lang/XEventListener.hpp>
      62                 :            : #include <com/sun/star/container/XNamed.hpp>
      63                 :            : 
      64                 :            : #include <unotools/saveopt.hxx>
      65                 :            : 
      66                 :            : #include <xmloff/XMLPageExport.hxx>
      67                 :            : #include <xmloff/ProgressBarHelper.hxx>
      68                 :            : #include <cppuhelper/implbase6.hxx>
      69                 :            : 
      70                 :            : #include <list>
      71                 :            : 
      72                 :            : class SvXMLNamespaceMap;
      73                 :            : class SvXMLAttributeList;
      74                 :            : class SvXMLExport_Impl;
      75                 :            : class SvXMLUnitConverter;
      76                 :            : class ProgressBarHelper;
      77                 :            : class XMLEventExport;
      78                 :            : class XMLSettingsExportHelper;
      79                 :            : class XMLImageMapExport;
      80                 :            : class XMLErrors;
      81                 :            : 
      82                 :            : // Shapes in Writer cannot be named via context menu (#i51726#)
      83                 :            : #include <unotools/moduleoptions.hxx>
      84                 :            : 
      85                 :            : namespace rtl { class OUString; }
      86                 :            : namespace com { namespace sun { namespace star {
      87                 :            :     namespace uno { class XComponentContext; }
      88                 :            :     namespace frame { class XModel; }
      89                 :            :     namespace container { class XIndexContainer; }
      90                 :            : } } }
      91                 :            : namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
      92                 :            : 
      93                 :            : #define EXPORT_META                     0x0001
      94                 :            : #define EXPORT_STYLES                   0x0002
      95                 :            : #define EXPORT_MASTERSTYLES             0x0004
      96                 :            : #define EXPORT_AUTOSTYLES               0x0008
      97                 :            : #define EXPORT_CONTENT                  0x0010
      98                 :            : #define EXPORT_SCRIPTS                  0x0020
      99                 :            : #define EXPORT_SETTINGS                 0x0040
     100                 :            : #define EXPORT_FONTDECLS                0x0080
     101                 :            : #define EXPORT_EMBEDDED                 0x0100
     102                 :            : #define EXPORT_NODOCTYPE                0x0200
     103                 :            : #define EXPORT_PRETTY                   0x0400
     104                 :            : #define EXPORT_SAVEBACKWARDCOMPATIBLE   0x0800
     105                 :            : #define EXPORT_OASIS                    0x8000
     106                 :            : #define EXPORT_ALL                      0x7fff
     107                 :            : 
     108                 :            : class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6<
     109                 :            :              ::com::sun::star::document::XFilter,
     110                 :            :              ::com::sun::star::lang::XServiceInfo,
     111                 :            :              ::com::sun::star::document::XExporter,
     112                 :            :               ::com::sun::star::lang::XInitialization,
     113                 :            :              ::com::sun::star::container::XNamed,
     114                 :            :              ::com::sun::star::lang::XUnoTunnel>
     115                 :            : {
     116                 :            :     SvXMLExport_Impl            *mpImpl;            // dummy
     117                 :            : 
     118                 :            :     // #110680#
     119                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
     120                 :            : 
     121                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
     122                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >            mxHandler;      // the handlers
     123                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler >    mxExtHandler;
     124                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
     125                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver;
     126                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver;
     127                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mxStatusIndicator;
     128                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxExportInfo;
     129                 :            :      ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener;
     130                 :            : 
     131                 :            :     SvXMLAttributeList          *mpAttrList;        // a common attribute list
     132                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >          mxAttrList;     // and an interface of it
     133                 :            : 
     134                 :            :     ::rtl::OUString     msOrigFileName; // the original URL
     135                 :            :     ::rtl::OUString     msGraphicObjectProtocol;
     136                 :            :     ::rtl::OUString     msEmbeddedObjectProtocol;
     137                 :            :     ::rtl::OUString     msFilterName;
     138                 :            :     SvXMLNamespaceMap           *mpNamespaceMap;    // the namepspace map
     139                 :            :     SvXMLUnitConverter          *mpUnitConv;        // the unit converter
     140                 :            :     SvXMLNumFmtExport           *mpNumExport;
     141                 :            :     ProgressBarHelper           *mpProgressBarHelper;
     142                 :            : 
     143                 :            :     UniReference< XMLTextParagraphExport > mxTextParagraphExport;
     144                 :            :     UniReference< XMLShapeExport > mxShapeExport;
     145                 :            :     UniReference< SvXMLAutoStylePoolP > mxAutoStylePool;
     146                 :            :     UniReference< SchXMLExportHelper > mxChartExport;
     147                 :            :     UniReference< XMLPageExport > mxPageExport;
     148                 :            :     UniReference< XMLFontAutoStylePool > mxFontAutoStylePool;
     149                 :            :     UniReference< xmloff::OFormLayerXMLExport > mxFormExport;
     150                 :            :     XMLEventExport* mpEventExport;
     151                 :            :     XMLImageMapExport* mpImageMapExport;
     152                 :            :     XMLErrors*  mpXMLErrors;
     153                 :            : 
     154                 :            :     sal_Bool                        mbExtended;     // Does document contain extens.
     155                 :            : 
     156                 :            :     const enum ::xmloff::token::XMLTokenEnum meClass;
     157                 :            :     SAL_DLLPRIVATE void _InitCtor();
     158                 :            : 
     159                 :            :     sal_uInt16  mnExportFlags;
     160                 :            :     sal_uInt16  mnErrorFlags;
     161                 :            :     bool  mbEnableExperimentalOdfExport;
     162                 :            : 
     163                 :            : public:
     164                 :            : 
     165                 :            :     const ::rtl::OUString               msWS;           // " "
     166                 :            : 
     167                 :            : private:
     168                 :            : 
     169                 :            :     // Shapes in Writer cannot be named via context menu (#i51726#)
     170                 :            :     SvtModuleOptions::EFactory meModelType;
     171                 :            :     SAL_DLLPRIVATE void _DetermineModelType();
     172                 :            : 
     173                 :            :     SAL_DLLPRIVATE void ImplExportMeta(); // <office:meta>
     174                 :            :     SAL_DLLPRIVATE void ImplExportSettings(); // <office:settings>
     175                 :            :     SAL_DLLPRIVATE void ImplExportStyles( sal_Bool bUsed ); // <office:styles>
     176                 :            :     SAL_DLLPRIVATE void ImplExportAutoStyles( sal_Bool bUsed );
     177                 :            :         // <office:automatic-styles>
     178                 :            :     SAL_DLLPRIVATE void ImplExportMasterStyles( sal_Bool bUsed );
     179                 :            :         // <office:master-styles>
     180                 :            :     SAL_DLLPRIVATE void ImplExportContent(); // <office:body>
     181                 :            :     virtual void SetBodyAttributes();
     182                 :            :     void GetViewSettingsAndViews(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
     183                 :            : 
     184                 :            : protected:
     185                 :          0 :     void setExportFlags( sal_uInt16 nExportFlags ) { mnExportFlags = nExportFlags; }
     186                 :            : 
     187                 :            :     // Get (modifyable) namespace map
     188                 :       4110 :     SvXMLNamespaceMap& _GetNamespaceMap() { return *mpNamespaceMap; }
     189                 :            : 
     190                 :            :     // get a new namespave map (used in starmath to have a default namespace)
     191                 :            :     void ResetNamespaceMap();
     192                 :            : 
     193                 :            :     // This method can be overloaded to export the content of <office:meta>.
     194                 :            :     // There is a default implementation.
     195                 :            :     virtual void _ExportMeta();
     196                 :            : 
     197                 :            :     // This method can be overloaded to export the content of <office:scripts>.
     198                 :            :     // There is a default implementation.
     199                 :            :     virtual void _ExportScripts();
     200                 :            : 
     201                 :            :     // This method can be overloaded to export the font declarations
     202                 :            :     // The default implementation will export the contents of the
     203                 :            :     // XMLFontAutoStylePool if it has been created.
     204                 :            :     virtual void _ExportFontDecls();
     205                 :            : 
     206                 :            :     // This method should be overloaded to export the content of <style:styles>.
     207                 :            :     // If bUsed is set, used styles should be exported only.
     208                 :            :     // Overloaded Methods must call this method !
     209                 :            :     virtual void _ExportStyles( sal_Bool bUsed ) ;
     210                 :            : 
     211                 :            :     // This method must be overloaded to export the contents of
     212                 :            :     // <style:auto-styles>
     213                 :            :     virtual void _ExportAutoStyles() = 0;
     214                 :            : 
     215                 :            :     // This method must be overloaded to export the contents of
     216                 :            :     // <style:master-styles>
     217                 :            :     virtual void _ExportMasterStyles() = 0;
     218                 :            : 
     219                 :            :     // This method must be overloaded to export the content of <office:body>.
     220                 :            :     virtual void _ExportContent() = 0;
     221                 :            : 
     222                 :         80 :     void SetExtended( sal_Bool bSet=sal_True ) { mbExtended = bSet; }
     223                 :            : 
     224                 :            :     // save linked sections? (may be false in global documents)
     225                 :            :     sal_Bool mbSaveLinkedSections;
     226                 :            : 
     227                 :            :     virtual XMLTextParagraphExport* CreateTextParagraphExport();
     228                 :            :     virtual XMLShapeExport* CreateShapeExport();
     229                 :            :     virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
     230                 :            :     virtual SchXMLExportHelper* CreateChartExport();
     231                 :            :     virtual XMLPageExport* CreatePageExport();
     232                 :            :     virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
     233                 :            :     virtual xmloff::OFormLayerXMLExport* CreateFormExport();
     234                 :            :     virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
     235                 :            :     virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
     236                 :            : 
     237                 :          0 :     struct SettingsGroup
     238                 :            :     {
     239                 :            :         ::xmloff::token::XMLTokenEnum                                               eGroupName;
     240                 :            :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >   aSettings;
     241                 :            : 
     242                 :            :         SettingsGroup()
     243                 :            :             :eGroupName( ::xmloff::token::XML_TOKEN_INVALID )
     244                 :            :             ,aSettings()
     245                 :            :         {
     246                 :            :         }
     247                 :            : 
     248                 :          0 :         SettingsGroup(
     249                 :            :                 const ::xmloff::token::XMLTokenEnum _eGroupName,
     250                 :            :                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rSettings )
     251                 :            :             :eGroupName( _eGroupName )
     252                 :          0 :             ,aSettings( _rSettings )
     253                 :            :         {
     254                 :          0 :         }
     255                 :            :     };
     256                 :            :     /** returns the current document settings
     257                 :            : 
     258                 :            :         The default implementation will obtain the view settings by calling GetViewSettingsAndViews, and the
     259                 :            :         configuration settings by calling GetConfigurationSettings, and return them together with the proper XML token.
     260                 :            : 
     261                 :            :         @return
     262                 :            :             the accumulated count of all settings in all groups
     263                 :            :     */
     264                 :            :     virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings );
     265                 :            : 
     266                 :         80 :     const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; }
     267                 :            :     inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver );
     268                 :            : 
     269                 :         80 :     const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; }
     270                 :            :     void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver );
     271                 :            : 
     272                 :            :     void SetDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &rHandler );
     273                 :            : 
     274                 :            : public:
     275                 :            : 
     276                 :            :     // #110680#
     277                 :            :     //SvXMLExport( MapUnit eDfltUnit,
     278                 :            :     //             const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID,
     279                 :            :     //             sal_uInt16 nExportFlag = EXPORT_ALL );
     280                 :            :     SvXMLExport(
     281                 :            :         sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
     282                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
     283                 :            :         const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID,
     284                 :            :         sal_uInt16 nExportFlag = EXPORT_ALL );
     285                 :            : 
     286                 :            :     // #110680#
     287                 :            :     //SvXMLExport( const ::rtl::OUString& rFileName,
     288                 :            :     //           const ::com::sun::star::uno::Reference<
     289                 :            :     //              ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
     290                 :            :     //           MapUnit eDfltUnit = MAP_INCH );
     291                 :            :     SvXMLExport(
     292                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
     293                 :            :         const ::rtl::OUString& rFileName,
     294                 :            :         sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
     295                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler);
     296                 :            : 
     297                 :            :     // #110680#
     298                 :            :     //SvXMLExport( const ::rtl::OUString& rFileName,
     299                 :            :     //           const ::com::sun::star::uno::Reference<
     300                 :            :     //              ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
     301                 :            :     //           const ::com::sun::star::uno::Reference<
     302                 :            :     //              ::com::sun::star::frame::XModel > &,
     303                 :            :     //           sal_Int16 eDfltUnit );
     304                 :            :     SvXMLExport(
     305                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
     306                 :            :         const ::rtl::OUString& rFileName,
     307                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
     308                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
     309                 :            :         sal_Int16 const eDefaultFieldUnit );
     310                 :            : 
     311                 :            :     virtual ~SvXMLExport();
     312                 :            : 
     313                 :            :     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
     314                 :            :     static SvXMLExport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
     315                 :            : 
     316                 :            :     // XExporter
     317                 :            :     virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     318                 :            : 
     319                 :            :     // XFilter
     320                 :            :     virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw(::com::sun::star::uno::RuntimeException);
     321                 :            :     virtual void SAL_CALL cancel() throw(::com::sun::star::uno::RuntimeException);
     322                 :            : 
     323                 :            :     // XInitialization
     324                 :            :     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
     325                 :            : 
     326                 :            :     // XNamed
     327                 :            :     virtual ::rtl::OUString SAL_CALL getName(  ) throw (::com::sun::star::uno::RuntimeException);
     328                 :            :     virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
     329                 :            : 
     330                 :            :     // XServiceInfo
     331                 :            :     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
     332                 :            :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
     333                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
     334                 :            : 
     335                 :            :     // XUnoTunnel
     336                 :            :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
     337                 :            : 
     338                 :            :     /** ensures that the given namespace is in scope at the next started
     339                 :            :         element.
     340                 :            : 
     341                 :            :         <p>If the namespace is not yet declared, the necessary attribute will
     342                 :            :         be added, as well.</p>
     343                 :            : 
     344                 :            :         @param i_rNamespace         the namespace to be declared
     345                 :            :         @param i_rPreferredPrefix   (opt.) preferred prefix for the namespace
     346                 :            : 
     347                 :            :         @returns the actual prefix that the namespace is associated with
     348                 :            :       */
     349                 :            :     ::rtl::OUString
     350                 :            :     EnsureNamespace(::rtl::OUString const & i_rNamespace,
     351                 :            :         ::rtl::OUString const & i_rPreferredPrefix
     352                 :            :         = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gen")) );
     353                 :            : 
     354                 :            :     // Check if common attribute list is empty.
     355                 :            : #ifndef DBG_UTIL
     356                 :         16 :     void CheckAttrList() {}
     357                 :            : #else
     358                 :            :     void CheckAttrList();
     359                 :            : #endif
     360                 :            : 
     361                 :            :     // Clear common attribute list.
     362                 :            :     void ClearAttrList();
     363                 :            : 
     364                 :            :     // Add an attribute to the common attribute list.
     365                 :            :     void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName,
     366                 :            :                             const sal_Char *pValue );
     367                 :            :     void AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName,
     368                 :            :                        const ::rtl::OUString& rValue );
     369                 :            :     void AddAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rName,
     370                 :            :                        const ::rtl::OUString& rValue );
     371                 :            :     void AddAttribute( sal_uInt16 nPrefix,
     372                 :            :                        enum ::xmloff::token::XMLTokenEnum eName,
     373                 :            :                        const ::rtl::OUString& rValue );
     374                 :            :     void AddAttribute( sal_uInt16 nPrefix,
     375                 :            :                        enum ::xmloff::token::XMLTokenEnum eName,
     376                 :            :                        enum ::xmloff::token::XMLTokenEnum eValue );
     377                 :            :     void AddAttribute( const ::rtl::OUString& rQName,
     378                 :            :                        const ::rtl::OUString& rValue );
     379                 :            :     void AddAttribute( const ::rtl::OUString& rQName,
     380                 :            :                        enum ::xmloff::token::XMLTokenEnum eValue );
     381                 :            :     // add several attributes to the common attribute list
     382                 :            :     void AddAttributeList( const ::com::sun::star::uno::Reference<
     383                 :            :                                   ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
     384                 :            : 
     385                 :            :     // Get common attribute list as implementation or interface.
     386                 :       2472 :     SvXMLAttributeList &GetAttrList() { return *mpAttrList; }
     387                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & GetXAttrList() { return mxAttrList; }
     388                 :            : 
     389                 :            :     // Get document handler. This methods are not const, because the
     390                 :            :     // reference allowes modifications through the handler.
     391                 :      10084 :     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & GetDocHandler() { return mxHandler; }
     392                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > & GetExtDocHandler()
     393                 :            :     {
     394                 :            :         return mxExtHandler;
     395                 :            :     }
     396                 :            : 
     397                 :            :     // Get original ::com::sun::star::util::URL.
     398                 :          4 :     const ::rtl::OUString& GetOrigFileName() const { return msOrigFileName; }
     399                 :            : 
     400                 :            :     // Get (const) namespace map.
     401                 :       2632 :     const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
     402                 :            : 
     403                 :            :     // Get unit converter
     404                 :            :     const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; }
     405                 :            : 
     406                 :       1580 :     SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; }
     407                 :            : 
     408                 :            :     void addChaffWhenEncryptedStorage();
     409                 :            : 
     410                 :            :     // Export the document.
     411                 :            :     virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID );
     412                 :            : 
     413                 :            :     virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
     414                 :            :     virtual void exportDataStyles();
     415                 :            :     virtual void exportAutoDataStyles();
     416                 :            :     virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
     417                 :            :     sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const;
     418                 :            : 
     419                 :            :     virtual void exportAnnotationMeta( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape);
     420                 :            : 
     421                 :            :     // Get XModel
     422                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &
     423                 :       4311 :                GetModel() const { return mxModel; }
     424                 :            :     // Get XNumberFormatsSupplier
     425                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; }
     426                 :        348 :     inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier)
     427                 :            :     {
     428                 :        348 :         mxNumberFormatsSupplier = _xNumberFormatSupplier;
     429 [ +  - ][ +  - ]:        348 :         if ( mxNumberFormatsSupplier.is() && mxHandler.is() )
                 [ +  - ]
     430         [ +  - ]:        348 :             mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
     431                 :        348 :     }
     432                 :            : 
     433                 :            :     // get export helper for text
     434                 :            :     inline UniReference< XMLTextParagraphExport > GetTextParagraphExport();
     435                 :            : 
     436                 :            :     // get export helper for shapes
     437                 :            :     inline UniReference< XMLShapeExport > GetShapeExport();
     438                 :            : 
     439                 :            :     // get auto style pool
     440                 :            :     inline UniReference< SvXMLAutoStylePoolP > GetAutoStylePool();
     441                 :            : 
     442                 :            :     // get Page Export
     443                 :            :     inline UniReference< XMLPageExport > GetPageExport();
     444                 :            : 
     445                 :            :     // get chart export helper
     446                 :            :     inline UniReference< SchXMLExportHelper > GetChartExport();
     447                 :            : 
     448                 :            :     // get font auto style pool
     449                 :            :     inline UniReference< XMLFontAutoStylePool > GetFontAutoStylePool();
     450                 :            : 
     451                 :            :     ProgressBarHelper*  GetProgressBarHelper();
     452                 :            : 
     453                 :            :     // get Formlayer Export
     454                 :            :     inline UniReference< xmloff::OFormLayerXMLExport > GetFormExport();
     455                 :            :     inline bool HasFormExport();
     456                 :            : 
     457                 :            :     // get XPropertySet with export information
     458                 :        141 :     inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getExportInfo() const { return mxExportInfo; }
     459                 :            : 
     460                 :            :     com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > GetStatusIndicator() { return mxStatusIndicator; }
     461                 :            : 
     462                 :            :     /// get Event export, with handlers for script types "None" and
     463                 :            :     /// "StarBasic" already registered; other handlers may be registered, too.
     464                 :            :     XMLEventExport& GetEventExport();
     465                 :            : 
     466                 :            :     /// get the export for image maps
     467                 :            :     XMLImageMapExport& GetImageMapExport();
     468                 :            : 
     469                 :            :     ::rtl::OUString AddEmbeddedGraphicObject(
     470                 :            :                             const ::rtl::OUString& rGraphicObjectURL );
     471                 :            :     sal_Bool AddEmbeddedGraphicObjectAsBase64(
     472                 :            :                             const ::rtl::OUString& rGraphicObjectURL );
     473                 :            : 
     474                 :            :     ::rtl::OUString AddEmbeddedObject(
     475                 :            :                             const ::rtl::OUString& rEmbeddedObjectURL );
     476                 :            :     sal_Bool AddEmbeddedObjectAsBase64(
     477                 :            :                             const ::rtl::OUString& rEmbeddedObjectURL );
     478                 :            : 
     479                 :            :     ::rtl::OUString EncodeStyleName( const ::rtl::OUString& rName,
     480                 :            :                                      sal_Bool *pEncoded=0 ) const;
     481                 :            : 
     482                 :            :     // save linked sections?
     483                 :            :     inline sal_Bool IsSaveLinkedSections() { return mbSaveLinkedSections; }
     484                 :            : 
     485                 :            :     // get export flags
     486                 :       2600 :     sal_uInt16 getExportFlags() const { return mnExportFlags; }
     487                 :            : 
     488                 :            :     sal_Bool ExportEmbeddedOwnObject(
     489                 :            :         ::com::sun::star::uno::Reference<
     490                 :            :             ::com::sun::star::lang::XComponent >& rComp );
     491                 :            : 
     492                 :            :     rtl::OUString GetRelativeReference(const rtl::OUString& rValue);
     493                 :            : 
     494                 :            :     // methods for accessing the document handler and handling SAX errors
     495                 :            :     void StartElement(sal_uInt16 nPrefix,
     496                 :            :                         enum ::xmloff::token::XMLTokenEnum eName,
     497                 :            :                         sal_Bool bIgnWSOutside );
     498                 :            :     void StartElement(const ::rtl::OUString& rName,
     499                 :            :                         sal_Bool bIgnWSOutside );
     500                 :            :     void Characters(const ::rtl::OUString& rChars);
     501                 :            :     void EndElement(sal_uInt16 nPrefix,
     502                 :            :                         enum ::xmloff::token::XMLTokenEnum eName,
     503                 :            :                         sal_Bool bIgnWSInside );
     504                 :            :     void EndElement(const ::rtl::OUString& rName,
     505                 :            :                         sal_Bool bIgnWSInside );
     506                 :            :     void IgnorableWhitespace();
     507                 :            : 
     508                 :            :     /**
     509                 :            :      * Record an error condition that occurred during export. The
     510                 :            :      * behavior of SetError can be modified using the error flag
     511                 :            :      * constants.
     512                 :            :      */
     513                 :            :     void SetError(
     514                 :            :         /// error ID, may contain an error flag
     515                 :            :         sal_Int32 nId,
     516                 :            :         /// string parameters for the error message
     517                 :            :         const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams,
     518                 :            :         /// original exception message (if applicable)
     519                 :            :         const ::rtl::OUString& rExceptionMessage,
     520                 :            :         /// error location (if applicable)
     521                 :            :         const ::com::sun::star::uno::Reference<
     522                 :            :             ::com::sun::star::xml::sax::XLocator> & rLocator );
     523                 :            : 
     524                 :            :     void SetError(
     525                 :            :         sal_Int32 nId,
     526                 :            :         const ::com::sun::star::uno::Sequence< ::rtl::OUString> & rMsgParams);
     527                 :            : 
     528                 :            :     /** return current error flags (logical 'or' of all error flags so far) */
     529                 :            :     sal_uInt16 GetErrorFlags()  { return mnErrorFlags; }
     530                 :            : 
     531                 :            :     virtual void DisposingModel();
     532                 :            : 
     533                 :            :     ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();
     534                 :            : 
     535                 :            :     // #110680#
     536                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory();
     537                 :            : 
     538                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
     539                 :            :     GetComponentContext() const;
     540                 :            : 
     541                 :            :     // Shapes in Writer cannot be named via context menu (#i51726#)
     542                 :            :     SvtModuleOptions::EFactory GetModelType() const
     543                 :            :     {
     544                 :            :         return meModelType;
     545                 :            :     }
     546                 :            : 
     547                 :            :     // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
     548                 :            :     sal_Bool writeOutlineStyleAsNormalListStyle() const;
     549                 :            :        bool isExperimentalOdfExportEnabled() const { return mbEnableExperimentalOdfExport; }
     550                 :            : 
     551                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetTargetStorage();
     552                 :            : 
     553                 :            :     /// returns the currently configured default version for odf export
     554                 :            :     SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
     555                 :            : 
     556                 :            :     /// name of stream in package, e.g., "content.xml"
     557                 :            :     ::rtl::OUString GetStreamName() const;
     558                 :            : 
     559                 :            :     // FIXME: this is only for legacy stuff that has not yet been adapted
     560                 :            :     //        to implement XMetadatable; this can write duplicate IDs!
     561                 :            :     /// add xml:id and legacy namespace id
     562                 :            :     void SAL_DLLPRIVATE AddAttributeIdLegacy(
     563                 :            :             sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue);
     564                 :            : 
     565                 :            :     /// add xml:id attribute (for RDF metadata)
     566                 :            :     void AddAttributeXmlId(::com::sun::star::uno::Reference<
     567                 :            :             ::com::sun::star::uno::XInterface> const & i_xIfc);
     568                 :            : 
     569                 :            :     /// add RDFa attributes for a metadatable text content
     570                 :            :     void AddAttributesRDFa( ::com::sun::star::uno::Reference<
     571                 :            :         ::com::sun::star::text::XTextContent> const & i_xTextContent);
     572                 :            : 
     573                 :            :     sal_Bool exportTextNumberElement() const;
     574                 :            : 
     575                 :            :     /// set null date from model to unit converter, if not already done
     576                 :            :     sal_Bool SetNullDateOnUnitConverter();
     577                 :            : };
     578                 :            : 
     579                 :        421 : inline UniReference< XMLTextParagraphExport > SvXMLExport::GetTextParagraphExport()
     580                 :            : {
     581         [ +  + ]:        421 :     if( !mxTextParagraphExport.is() )
     582                 :         50 :         mxTextParagraphExport = CreateTextParagraphExport();
     583                 :            : 
     584                 :        421 :     return mxTextParagraphExport;
     585                 :            : }
     586                 :            : 
     587                 :         79 : inline UniReference< XMLShapeExport > SvXMLExport::GetShapeExport()
     588                 :            : {
     589         [ +  + ]:         79 :     if( !mxShapeExport.is() )
     590                 :         25 :         mxShapeExport = CreateShapeExport();
     591                 :            : 
     592                 :         79 :     return mxShapeExport;
     593                 :            : }
     594                 :            : 
     595                 :       2266 : inline UniReference< SvXMLAutoStylePoolP > SvXMLExport::GetAutoStylePool()
     596                 :            : {
     597         [ +  + ]:       2266 :     if( !mxAutoStylePool.is() )
     598                 :        412 :         mxAutoStylePool = CreateAutoStylePool();
     599                 :            : 
     600                 :       2266 :     return mxAutoStylePool;
     601                 :            : }
     602                 :            : 
     603                 :          0 : inline UniReference< SchXMLExportHelper > SvXMLExport::GetChartExport()
     604                 :            : {
     605         [ #  # ]:          0 :     if( !mxChartExport.is() )
     606                 :          0 :         mxChartExport = CreateChartExport();
     607                 :            : 
     608                 :          0 :     return mxChartExport;
     609                 :            : }
     610                 :            : 
     611                 :         96 : inline UniReference< XMLPageExport > SvXMLExport::GetPageExport()
     612                 :            : {
     613         [ +  + ]:         96 :     if( !mxPageExport.is() )
     614                 :         25 :         mxPageExport = CreatePageExport();
     615                 :            : 
     616                 :         96 :     return mxPageExport;
     617                 :            : }
     618                 :            : 
     619                 :        224 : inline UniReference< XMLFontAutoStylePool > SvXMLExport::GetFontAutoStylePool()
     620                 :            : {
     621         [ +  - ]:        224 :     if( !mxFontAutoStylePool.is() )
     622                 :        224 :         mxFontAutoStylePool = CreateFontAutoStylePool();
     623                 :            : 
     624                 :        224 :     return mxFontAutoStylePool;
     625                 :            : }
     626                 :            : 
     627                 :        130 : inline UniReference< xmloff::OFormLayerXMLExport > SvXMLExport::GetFormExport()
     628                 :            : {
     629         [ +  + ]:        130 :     if( !mxFormExport.is() )
     630                 :         25 :         mxFormExport = CreateFormExport();
     631                 :            : 
     632                 :        130 :     return mxFormExport;
     633                 :            : }
     634                 :            : 
     635                 :            : inline bool SvXMLExport::HasFormExport()
     636                 :            : {
     637                 :            :     return mxFormExport.is();
     638                 :            : }
     639                 :            : 
     640                 :         38 : inline void SvXMLExport::SetEmbeddedResolver(
     641                 :            :     com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver )
     642                 :            : {
     643                 :         38 :     mxEmbeddedResolver = _xEmbeddedResolver;
     644                 :         38 : }
     645                 :            : 
     646                 :         38 : inline void SvXMLExport::SetGraphicResolver(
     647                 :            :     com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver )
     648                 :            : {
     649                 :         38 :     mxGraphicResolver = _xGraphicResolver;
     650                 :         38 : }
     651                 :            : 
     652                 :            : // Helper class to export an element.
     653                 :            : class XMLOFF_DLLPUBLIC SvXMLElementExport
     654                 :            : {
     655                 :            :     SvXMLExport& rExport;
     656                 :            :     ::rtl::OUString aName;
     657                 :            :     sal_Bool bIgnWS : 1;
     658                 :            :     sal_Bool bDoSomething : 1;
     659                 :            : 
     660                 :            :     SAL_DLLPRIVATE void StartElement( SvXMLExport& rExp, sal_uInt16 nPrefix,
     661                 :            :                        const ::rtl::OUString& rName,
     662                 :            :                        sal_Bool bIgnWSOutside );
     663                 :            : 
     664                 :            : public:
     665                 :            : 
     666                 :            :     // The constructor prints a start tag that has the common attributes
     667                 :            :     // of the XMLExport instance attached.
     668                 :            :     SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
     669                 :            :                         const sal_Char *pName,
     670                 :            :                         sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
     671                 :            :     SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
     672                 :            :                         const ::rtl::OUString& rName,
     673                 :            :                         sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
     674                 :            :     SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix,
     675                 :            :                         enum ::xmloff::token::XMLTokenEnum eName,
     676                 :            :                         sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
     677                 :            :     SvXMLElementExport( SvXMLExport& rExp, const ::rtl::OUString& rQName,
     678                 :            :                         sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
     679                 :            : 
     680                 :            :     // Thes constructors do nothing if bDoSomething is not set
     681                 :            :     SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething,
     682                 :            :                         sal_uInt16 nPrefix,
     683                 :            :                         enum ::xmloff::token::XMLTokenEnum eName,
     684                 :            :                         sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside );
     685                 :            : 
     686                 :            :     // The destructor prints an end tag.
     687                 :            :     ~SvXMLElementExport();
     688                 :            : };
     689                 :            : 
     690                 :            : #endif  //  _XMLOFF_SVXMLEXP_HXX
     691                 :            : 
     692                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10