LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/core/api - ReportDefinition.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1446 0.0 %
Date: 2012-12-17 Functions: 0 221 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include "ReportDefinition.hxx"
      20             : 
      21             : #include "FixedLine.hxx"
      22             : #include "FixedText.hxx"
      23             : #include "FormattedField.hxx"
      24             : #include "Functions.hxx"
      25             : #include "Groups.hxx"
      26             : #include "ImageControl.hxx"
      27             : #include "ReportComponent.hxx"
      28             : #include "ReportHelperImpl.hxx"
      29             : #include "RptDef.hxx"
      30             : #include "RptModel.hxx"
      31             : #include "Section.hxx"
      32             : #include "Shape.hxx"
      33             : #include "Tools.hxx"
      34             : #include "UndoEnv.hxx"
      35             : #include "core_resource.hrc"
      36             : #include "core_resource.hxx"
      37             : #include "corestrings.hrc"
      38             : 
      39             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      40             : #include <com/sun/star/beans/XMultiPropertyStates.hpp>
      41             : #include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
      42             : #include <com/sun/star/document/DocumentProperties.hpp>
      43             : #include <com/sun/star/document/EventObject.hpp>
      44             : #include <com/sun/star/document/XEventListener.hpp>
      45             : #include <com/sun/star/document/XExporter.hpp>
      46             : #include <com/sun/star/document/XFilter.hpp>
      47             : #include <com/sun/star/document/XImporter.hpp>
      48             : #include <com/sun/star/embed/Aspects.hpp>
      49             : #include <com/sun/star/embed/ElementModes.hpp>
      50             : #include <com/sun/star/embed/EmbedMapUnits.hpp>
      51             : #include <com/sun/star/embed/EntryInitModes.hpp>
      52             : #include <com/sun/star/embed/XEmbedPersist.hpp>
      53             : #include <com/sun/star/embed/XTransactedObject.hpp>
      54             : #include <com/sun/star/embed/StorageFactory.hpp>
      55             : #include <com/sun/star/frame/FrameSearchFlag.hpp>
      56             : #include <com/sun/star/frame/XComponentLoader.hpp>
      57             : #include <com/sun/star/io/XActiveDataSource.hpp>
      58             : #include <com/sun/star/io/XSeekable.hpp>
      59             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      60             : #include <com/sun/star/report/GroupKeepTogether.hpp>
      61             : #include <com/sun/star/report/ReportPrintOption.hpp>
      62             : #include <com/sun/star/report/XFunction.hpp>
      63             : #include <com/sun/star/sdb/CommandType.hpp>
      64             : #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
      65             : #include <com/sun/star/style/GraphicLocation.hpp>
      66             : #include <com/sun/star/style/NumberingType.hpp>
      67             : #include <com/sun/star/style/PageStyleLayout.hpp>
      68             : #include <com/sun/star/style/XStyle.hpp>
      69             : #include <com/sun/star/table/BorderLine.hpp>
      70             : #include <com/sun/star/table/ShadowFormat.hpp>
      71             : #include <com/sun/star/task/InteractionHandler.hpp>
      72             : #include <com/sun/star/task/ErrorCodeIOException.hpp>
      73             : #include <com/sun/star/task/XStatusIndicator.hpp>
      74             : #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
      75             : #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
      76             : #include <com/sun/star/util/NumberFormatsSupplier.hpp>
      77             : #include <com/sun/star/xml/AttributeData.hpp>
      78             : #include <com/sun/star/xml/sax/Writer.hpp>
      79             : 
      80             : #include <comphelper/broadcasthelper.hxx>
      81             : #include <comphelper/documentconstants.hxx>
      82             : #include <comphelper/genericpropertyset.hxx>
      83             : #include <comphelper/mediadescriptor.hxx>
      84             : #include <comphelper/mimeconfighelper.hxx>
      85             : #include <comphelper/namecontainer.hxx>
      86             : #include <comphelper/namedvaluecollection.hxx>
      87             : #include <comphelper/numberedcollection.hxx>
      88             : #include <comphelper/proparrhlp.hxx>
      89             : #include <comphelper/property.hxx>
      90             : #include <comphelper/propertysetinfo.hxx>
      91             : #include <comphelper/propertystatecontainer.hxx>
      92             : #include <comphelper/seqstream.hxx>
      93             : #include <comphelper/sequence.hxx>
      94             : #include <comphelper/storagehelper.hxx>
      95             : #include <comphelper/uno3.hxx>
      96             : #include <connectivity/CommonTools.hxx>
      97             : #include <connectivity/dbconversion.hxx>
      98             : #include <connectivity/dbtools.hxx>
      99             : #include <cppuhelper/exc_hlp.hxx>
     100             : #include <cppuhelper/interfacecontainer.h>
     101             : #include <dbaccess/dbaundomanager.hxx>
     102             : #include <editeng/paperinf.hxx>
     103             : #include <framework/titlehelper.hxx>
     104             : #include <osl/thread.hxx>
     105             : #include <svl/itempool.hxx>
     106             : #include <svl/undo.hxx>
     107             : #include <svx/svdlayer.hxx>
     108             : #include <svx/unofill.hxx>
     109             : #include <svx/xmleohlp.hxx>
     110             : #include <svx/xmlgrhlp.hxx>
     111             : #include <tools/debug.hxx>
     112             : #include <tools/diagnose_ex.h>
     113             : #include <unotools/moduleoptions.hxx>
     114             : #include <unotools/saveopt.hxx>
     115             : #include <unotools/streamwrap.hxx>
     116             : #include <vcl/svapp.hxx>
     117             : #include <vcl/virdev.hxx>
     118             : 
     119             : #include <boost/bind.hpp>
     120             : #include <boost/mem_fn.hpp>
     121             : #include <boost/utility.hpp>
     122             : 
     123             : #define MAP_LEN(x) x, sizeof(x) - 1
     124             : #define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
     125             : //  page styles
     126             : #define SC_UNO_PAGE_GRAPHICFILT     "BackGraphicFilter"
     127             : #define SC_UNO_PAGE_LEFTBORDER      "LeftBorder"
     128             : #define SC_UNO_PAGE_RIGHTBORDER     "RightBorder"
     129             : #define SC_UNO_PAGE_BOTTBORDER      "BottomBorder"
     130             : #define SC_UNO_PAGE_TOPBORDER       "TopBorder"
     131             : #define SC_UNO_PAGE_LEFTBRDDIST     "LeftBorderDistance"
     132             : #define SC_UNO_PAGE_RIGHTBRDDIST    "RightBorderDistance"
     133             : #define SC_UNO_PAGE_BOTTBRDDIST     "BottomBorderDistance"
     134             : #define SC_UNO_PAGE_TOPBRDDIST      "TopBorderDistance"
     135             : #define SC_UNO_PAGE_BORDERDIST      "BorderDistance"
     136             : #define SC_UNO_PAGE_SHADOWFORM      "ShadowFormat"
     137             : #define SC_UNO_PAGE_PAPERTRAY       "PrinterPaperTray"
     138             : #define SC_UNO_PAGE_SCALEVAL        "PageScale"
     139             : #define SC_UNO_PAGE_SCALETOPAG      "ScaleToPages"
     140             : #define SC_UNO_PAGE_SCALETOX        "ScaleToPagesX"
     141             : #define SC_UNO_PAGE_SCALETOY        "ScaleToPagesY"
     142             : #define SC_UNO_PAGE_FIRSTPAGE       "FirstPageNumber"
     143             : #define SC_UNO_PAGE_LEFTHDRCONT     "LeftPageHeaderContent"
     144             : #define SC_UNO_PAGE_LEFTFTRCONT     "LeftPageFooterContent"
     145             : #define SC_UNO_PAGE_RIGHTHDRCON     "RightPageHeaderContent"
     146             : #define SC_UNO_PAGE_RIGHTFTRCON     "RightPageFooterContent"
     147             : #define SC_UNO_PAGE_PRINTFORMUL     "PrintFormulas"
     148             : #define SC_UNO_PAGE_PRINTZERO       "PrintZeroValues"
     149             : #define SC_UNO_PAGE_HDRBACKCOL      "HeaderBackColor"
     150             : #define SC_UNO_PAGE_HDRBACKTRAN     "HeaderBackTransparent"
     151             : #define SC_UNO_PAGE_HDRGRFFILT      "HeaderBackGraphicFilter"
     152             : #define SC_UNO_PAGE_HDRGRFLOC       "HeaderBackGraphicLocation"
     153             : #define SC_UNO_PAGE_HDRGRFURL       "HeaderBackGraphicURL"
     154             : #define SC_UNO_PAGE_HDRLEFTBOR      "HeaderLeftBorder"
     155             : #define SC_UNO_PAGE_HDRRIGHTBOR     "HeaderRightBorder"
     156             : #define SC_UNO_PAGE_HDRBOTTBOR      "HeaderBottomBorder"
     157             : #define SC_UNO_PAGE_HDRTOPBOR       "HeaderTopBorder"
     158             : #define SC_UNO_PAGE_HDRLEFTBDIS     "HeaderLeftBorderDistance"
     159             : #define SC_UNO_PAGE_HDRRIGHTBDIS    "HeaderRightBorderDistance"
     160             : #define SC_UNO_PAGE_HDRBOTTBDIS     "HeaderBottomBorderDistance"
     161             : #define SC_UNO_PAGE_HDRTOPBDIS      "HeaderTopBorderDistance"
     162             : #define SC_UNO_PAGE_HDRBRDDIST      "HeaderBorderDistance"
     163             : #define SC_UNO_PAGE_HDRSHADOW       "HeaderShadowFormat"
     164             : #define SC_UNO_PAGE_HDRLEFTMAR      "HeaderLeftMargin"
     165             : #define SC_UNO_PAGE_HDRRIGHTMAR     "HeaderRightMargin"
     166             : #define SC_UNO_PAGE_HDRBODYDIST     "HeaderBodyDistance"
     167             : #define SC_UNO_PAGE_HDRHEIGHT       "HeaderHeight"
     168             : #define SC_UNO_PAGE_HDRON           "HeaderIsOn"
     169             : #define SC_UNO_PAGE_HDRDYNAMIC      "HeaderIsDynamicHeight"
     170             : #define SC_UNO_PAGE_HDRSHARED       "HeaderIsShared"
     171             : #define SC_UNO_PAGE_FTRBACKCOL      "FooterBackColor"
     172             : #define SC_UNO_PAGE_FTRBACKTRAN     "FooterBackTransparent"
     173             : #define SC_UNO_PAGE_FTRGRFFILT      "FooterBackGraphicFilter"
     174             : #define SC_UNO_PAGE_FTRGRFLOC       "FooterBackGraphicLocation"
     175             : #define SC_UNO_PAGE_FTRGRFURL       "FooterBackGraphicURL"
     176             : #define SC_UNO_PAGE_FTRLEFTBOR      "FooterLeftBorder"
     177             : #define SC_UNO_PAGE_FTRRIGHTBOR     "FooterRightBorder"
     178             : #define SC_UNO_PAGE_FTRBOTTBOR      "FooterBottomBorder"
     179             : #define SC_UNO_PAGE_FTRTOPBOR       "FooterTopBorder"
     180             : #define SC_UNO_PAGE_FTRLEFTBDIS     "FooterLeftBorderDistance"
     181             : #define SC_UNO_PAGE_FTRRIGHTBDIS    "FooterRightBorderDistance"
     182             : #define SC_UNO_PAGE_FTRBOTTBDIS     "FooterBottomBorderDistance"
     183             : #define SC_UNO_PAGE_FTRTOPBDIS      "FooterTopBorderDistance"
     184             : #define SC_UNO_PAGE_FTRBRDDIST      "FooterBorderDistance"
     185             : #define SC_UNO_PAGE_FTRSHADOW       "FooterShadowFormat"
     186             : #define SC_UNO_PAGE_FTRLEFTMAR      "FooterLeftMargin"
     187             : #define SC_UNO_PAGE_FTRRIGHTMAR     "FooterRightMargin"
     188             : #define SC_UNO_PAGE_FTRBODYDIST     "FooterBodyDistance"
     189             : #define SC_UNO_PAGE_FTRHEIGHT       "FooterHeight"
     190             : #define SC_UNO_PAGE_FTRON           "FooterIsOn"
     191             : #define SC_UNO_PAGE_FTRDYNAMIC      "FooterIsDynamicHeight"
     192             : #define SC_UNO_PAGE_FTRSHARED       "FooterIsShared"
     193             : 
     194             : // =============================================================================
     195             : namespace reportdesign
     196             : {
     197             : // =============================================================================
     198             :     using namespace com::sun::star;
     199             :     using namespace comphelper;
     200             :     using namespace rptui;
     201             : // -----------------------------------------------------------------------------
     202             : // local functions
     203             : // -----------------------------------------------------------------------------
     204           0 : void lcl_setModelReadOnly(const uno::Reference< embed::XStorage >& _xStorage,::boost::shared_ptr<rptui::OReportModel>& _rModel)
     205             : {
     206           0 :     uno::Reference<beans::XPropertySet> xProp(_xStorage,uno::UNO_QUERY);
     207           0 :     sal_Int32 nOpenMode = embed::ElementModes::READ;
     208           0 :     if ( xProp.is() )
     209           0 :         xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode"))) >>= nOpenMode;
     210             : 
     211           0 :     _rModel->SetReadOnly((nOpenMode & embed::ElementModes::WRITE) != embed::ElementModes::WRITE);
     212           0 : }
     213           0 : void lcl_stripLoadArguments( ::comphelper::MediaDescriptor& _rDescriptor, uno::Sequence< beans::PropertyValue >& _rArgs )
     214             : {
     215           0 :     _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) ) );
     216           0 :     _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ) );
     217           0 :     _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) );
     218           0 :     _rDescriptor >> _rArgs;
     219           0 : }
     220             : // -----------------------------------------------------------------------------
     221           0 : void lcl_extractAndStartStatusIndicator( const ::comphelper::MediaDescriptor& _rDescriptor, uno::Reference< task::XStatusIndicator >& _rxStatusIndicator,
     222             :     uno::Sequence< uno::Any >& _rCallArgs )
     223             : {
     224             :     try
     225             :     {
     226           0 :         _rxStatusIndicator = _rDescriptor.getUnpackedValueOrDefault( _rDescriptor.PROP_STATUSINDICATOR(), _rxStatusIndicator );
     227           0 :         if ( _rxStatusIndicator.is() )
     228             :         {
     229           0 :             _rxStatusIndicator->start( ::rtl::OUString(), (sal_Int32)1000000 );
     230             : 
     231           0 :             sal_Int32 nLength = _rCallArgs.getLength();
     232           0 :             _rCallArgs.realloc( nLength + 1 );
     233           0 :             _rCallArgs[ nLength ] <<= _rxStatusIndicator;
     234             :         }
     235             :     }
     236           0 :     catch (const uno::Exception&)
     237             :     {
     238             :         OSL_FAIL( "lcl_extractAndStartStatusIndicator: caught an exception!" );
     239             :     }
     240           0 : }
     241             : // -----------------------------------------------------------------------------
     242             : typedef ::comphelper::OPropertyStateContainer       OStyle_PBASE;
     243             : class OStyle;
     244             : typedef ::comphelper::OPropertyArrayUsageHelper <   OStyle
     245             :                                                 >   OStyle_PABASE;
     246             : typedef ::cppu::WeakImplHelper2< style::XStyle, beans::XMultiPropertyStates> TStyleBASE;
     247             : 
     248             : class OStyle :   public ::comphelper::OMutexAndBroadcastHelper
     249             :                 ,public TStyleBASE
     250             :                 ,public OStyle_PBASE
     251             :                 ,public OStyle_PABASE
     252             : {
     253             :     awt::Size m_aSize;
     254             : 
     255             : protected:
     256             :     void getPropertyDefaultByHandle( sal_Int32 _nHandle, uno::Any& _rDefault ) const;
     257           0 :     ~OStyle(){}
     258             : public:
     259             :     OStyle();
     260             : 
     261             : 
     262             :     DECLARE_XINTERFACE( )
     263             : 
     264             :     // XPropertySet
     265             :     com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException);
     266             :     ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
     267             :     ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
     268             : 
     269             :     // XStyle
     270             :     ::sal_Bool SAL_CALL isUserDefined(  ) throw (uno::RuntimeException);
     271             :     ::sal_Bool SAL_CALL isInUse(  ) throw (uno::RuntimeException);
     272             :     ::rtl::OUString SAL_CALL getParentStyle(  ) throw (uno::RuntimeException);
     273             :     void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw (container::NoSuchElementException, uno::RuntimeException);
     274             : 
     275             :     // XNamed
     276             :     ::rtl::OUString SAL_CALL getName(  ) throw (uno::RuntimeException);
     277             :     void SAL_CALL setName( const ::rtl::OUString& aName ) throw (uno::RuntimeException);
     278             : 
     279             :     // XMultiPropertyState
     280           0 :     uno::Sequence< beans::PropertyState > SAL_CALL getPropertyStates( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException)
     281             :     {
     282           0 :         return OStyle_PBASE::getPropertyStates(aPropertyNames);
     283             :     }
     284             :     void SAL_CALL setAllPropertiesToDefault(  ) throw (uno::RuntimeException);
     285             :     void SAL_CALL setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException);
     286             :     uno::Sequence< uno::Any > SAL_CALL getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
     287             : };
     288             : // -----------------------------------------------------------------------------
     289           0 : OStyle::OStyle()
     290             : :OStyle_PBASE(m_aBHelper)
     291           0 : ,m_aSize(21000,29700)
     292             : {
     293           0 :     const ::Size aDefaultSize = SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM );
     294           0 :     m_aSize.Height = aDefaultSize.Height();
     295           0 :     m_aSize.Width = aDefaultSize.Width();
     296             : 
     297           0 :     const style::GraphicLocation eGraphicLocation = style::GraphicLocation_NONE;
     298           0 :     const sal_Bool bFalse = sal_False;
     299           0 :     const sal_Bool bTrue = sal_True;
     300           0 :     const sal_Int32 nMargin = 2000;
     301             :     //const sal_Int32 nColor = COL_WHITE;
     302           0 :     const sal_Int32 nTransparent = COL_TRANSPARENT;
     303           0 :     const sal_Int32 nZero = 0;
     304           0 :     const sal_Int16 n16Zero = 0;
     305           0 :     const sal_Int16 nNummeringType = style::NumberingType::ARABIC;
     306           0 :     const ::rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("Default"));
     307           0 :     const ::rtl::OUString sEmpty;
     308           0 :     const table::BorderLine eBorderLine(0,0,0,0);
     309           0 :     const table::ShadowFormat eShadowFormat(table::ShadowLocation_NONE,0,0,0);
     310           0 :     const style::PageStyleLayout ePageStyleLayout = style::PageStyleLayout_ALL;
     311           0 :     const sal_Int32 nBound = beans::PropertyAttribute::BOUND;
     312           0 :     const sal_Int32 nMayBeVoid = beans::PropertyAttribute::MAYBEVOID;
     313             : 
     314           0 :     sal_Int32 i = 0;
     315           0 :     registerPropertyNoMember( PROPERTY_NAME, ++i,nBound,::getCppuType( static_cast< ::rtl::OUString *>(NULL) ), &sName );
     316             : 
     317           0 :     registerPropertyNoMember(PROPERTY_BACKCOLOR,                    ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nTransparent);
     318             : 
     319           0 :     registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION,  ++i,nBound,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation);
     320           0 :     registerPropertyNoMember(PROPERTY_BACKTRANSPARENT,  ++i,nBound,::getBooleanCppuType() ,&bTrue);
     321           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BORDERDIST),  ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     322           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBORDER),  ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     323           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBRDDIST), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     324           0 :     registerPropertyNoMember(PROPERTY_BOTTOMMARGIN, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nMargin);
     325           0 :     registerPropertyNoMember(MAP_CHAR_LEN("DisplayName"),       ++i,nBound,::getCppuType((rtl::OUString*)0) ,&sEmpty);
     326           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL),  ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nTransparent);
     327           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT),  ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
     328           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC),   ++i,nBound,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation);
     329           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL),   ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
     330           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN), ++i,nBound,::getBooleanCppuType() ,&bTrue);
     331           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     332           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST),  ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     333           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR),  ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     334           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     335           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT),   ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     336           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC),  ++i,nBound,::getBooleanCppuType() ,&bFalse);
     337           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRON),       ++i,nBound,::getBooleanCppuType() ,&bFalse);
     338           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED),   ++i,nBound,::getBooleanCppuType() ,&bFalse);
     339           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR),  ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     340           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     341           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR),  ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     342           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     343           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS),++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     344           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     345           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW),   ++i,nBound,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat);
     346           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR),   ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     347           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS),  ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     348             :     //
     349           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL),  ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nTransparent);
     350           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT),  ++i,nBound|nMayBeVoid,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
     351           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC),   ++i,nBound|nMayBeVoid,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation);
     352           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL),   ++i,nBound|nMayBeVoid,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty);
     353           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN), ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bTrue);
     354           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     355           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST),  ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     356           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR),  ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     357           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     358           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT),   ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     359           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC),  ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse);
     360           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRON),       ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse);
     361           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED),   ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse);
     362           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR),  ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     363           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     364           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR),  ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     365           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR), ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     366           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS),++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     367           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     368           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW),   ++i,nBound|nMayBeVoid,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat);
     369           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR),   ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     370           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS),  ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero);
     371             :     //
     372           0 :     registerProperty(PROPERTY_HEIGHT,       ++i,nBound,&m_aSize.Height,     ::getCppuType((const sal_Int32*)0) );
     373           0 :     registerPropertyNoMember(PROPERTY_ISLANDSCAPE,                  ++i,nBound,         ::getBooleanCppuType() ,&bFalse);
     374           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBORDER),  ++i,nBound,     ::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     375           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBRDDIST), ++i,nBound,     ::getCppuType((const sal_Int32*)0) ,&nZero);
     376           0 :     registerPropertyNoMember(PROPERTY_LEFTMARGIN,   ++i,beans::PropertyAttribute::BOUND,        ::getCppuType((const sal_Int32*)0) ,&nMargin);
     377           0 :     registerPropertyNoMember(PROPERTY_NUMBERINGTYPE,                ++i,nBound,::getCppuType((const sal_Int16*)0) ,&nNummeringType);
     378           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALEVAL),    ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
     379           0 :     registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT,              ++i,nBound,::getCppuType((const style::PageStyleLayout*)0) ,&ePageStyleLayout);
     380           0 :     const ::rtl::OUString sPaperTray(RTL_CONSTASCII_USTRINGPARAM("[From printer settings]"));
     381           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_PAPERTRAY),   ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sPaperTray);
     382           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBORDER), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     383           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBRDDIST),++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     384           0 :     registerPropertyNoMember(PROPERTY_RIGHTMARGIN,  ++i,beans::PropertyAttribute::BOUND,::getCppuType((const sal_Int32*)0) ,&nMargin);
     385           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOPAG),  ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
     386           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOX),    ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
     387           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOY),    ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero);
     388           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SHADOWFORM),  ++i,nBound,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat);
     389           0 :     registerProperty(PROPERTY_PAPERSIZE,                    ++i,beans::PropertyAttribute::BOUND,&m_aSize,::getCppuType((const awt::Size*)0) );
     390           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBORDER),   ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine);
     391           0 :     registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBRDDIST),  ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero);
     392           0 :     registerPropertyNoMember(PROPERTY_TOPMARGIN,    ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nMargin);
     393           0 :     uno::Reference< container::XNameContainer> xAttribs = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast< xml::AttributeData* >(NULL)));
     394           0 :     registerPropertyNoMember(MAP_CHAR_LEN("UserDefinedAttributes"),     ++i,nBound,::getCppuType((uno::Reference<container::XNameContainer>*)0) ,&xAttribs);
     395           0 :     registerProperty(PROPERTY_WIDTH,        ++i,nBound,&m_aSize.Width,::getCppuType((const sal_Int32*)0) );
     396           0 :     registerPropertyNoMember(MAP_CHAR_LEN("PrinterName"),               ++i,nBound,::getCppuType((const ::rtl::OUString*)0),&sEmpty);
     397           0 :     uno::Sequence<sal_Int8> aSe;
     398           0 :     registerPropertyNoMember(MAP_CHAR_LEN("PrinterSetup"),              ++i,nBound,::getCppuType((const uno::Sequence<sal_Int8>*)0),&aSe);
     399             : 
     400             : 
     401           0 : }
     402             : // -----------------------------------------------------------------------------
     403           0 : IMPLEMENT_FORWARD_XINTERFACE2(OStyle,TStyleBASE,OStyle_PBASE)
     404             : // -----------------------------------------------------------------------------
     405           0 : uno::Reference< beans::XPropertySetInfo>  SAL_CALL OStyle::getPropertySetInfo() throw(uno::RuntimeException)
     406             : {
     407           0 :     return createPropertySetInfo( getInfoHelper() );
     408             : }
     409             : // -----------------------------------------------------------------------------
     410           0 : void OStyle::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, uno::Any& /*_rDefault*/ ) const
     411             : {
     412           0 : }
     413             : //-------------------------------------------------------------------------
     414           0 : ::cppu::IPropertyArrayHelper& OStyle::getInfoHelper()
     415             : {
     416           0 :     return *const_cast<OStyle*>(this)->getArrayHelper();
     417             : }
     418             : //--------------------------------------------------------------------
     419           0 : ::cppu::IPropertyArrayHelper* OStyle::createArrayHelper( ) const
     420             : {
     421           0 :     uno::Sequence< beans::Property > aProps;
     422           0 :     describeProperties(aProps);
     423           0 :     return new ::cppu::OPropertyArrayHelper(aProps);
     424             : }
     425             : // -----------------------------------------------------------------------------
     426             : // XStyle
     427           0 : ::sal_Bool SAL_CALL OStyle::isUserDefined(  ) throw (uno::RuntimeException)
     428             : {
     429           0 :     return sal_False;
     430             : }
     431             : // -----------------------------------------------------------------------------
     432           0 : ::sal_Bool SAL_CALL OStyle::isInUse(  ) throw (uno::RuntimeException)
     433             : {
     434           0 :     return sal_True;
     435             : }
     436             : // -----------------------------------------------------------------------------
     437           0 : ::rtl::OUString SAL_CALL OStyle::getParentStyle(  ) throw (uno::RuntimeException)
     438             : {
     439           0 :     return ::rtl::OUString();
     440             : }
     441             : // -----------------------------------------------------------------------------
     442           0 : void SAL_CALL OStyle::setParentStyle( const ::rtl::OUString& /*aParentStyle*/ ) throw (container::NoSuchElementException, uno::RuntimeException)
     443             : {
     444           0 : }
     445             : // -----------------------------------------------------------------------------
     446             : // XNamed
     447           0 : ::rtl::OUString SAL_CALL OStyle::getName(  ) throw (uno::RuntimeException)
     448             : {
     449           0 :     ::rtl::OUString sName;
     450           0 :     getPropertyValue(PROPERTY_NAME) >>= sName;
     451           0 :     return sName;
     452             : }
     453             : // -----------------------------------------------------------------------------
     454           0 : void SAL_CALL OStyle::setName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
     455             : {
     456           0 :     setPropertyValue(PROPERTY_NAME,uno::makeAny(aName));
     457           0 : }
     458             : // -----------------------------------------------------------------------------
     459           0 : void SAL_CALL OStyle::setAllPropertiesToDefault(  ) throw (uno::RuntimeException)
     460             : {
     461           0 : }
     462             : // -----------------------------------------------------------------------------
     463           0 : void SAL_CALL OStyle::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException)
     464             : {
     465           0 :     const ::rtl::OUString* pIter = aPropertyNames.getConstArray();
     466           0 :     const ::rtl::OUString* pEnd   = pIter + aPropertyNames.getLength();
     467           0 :     for(;pIter != pEnd;++pIter)
     468           0 :         setPropertyToDefault(*pIter);
     469           0 : }
     470             : // -----------------------------------------------------------------------------
     471           0 : uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     472             : {
     473           0 :     uno::Sequence< uno::Any > aRet(aPropertyNames.getLength());
     474           0 :     const ::rtl::OUString* pIter = aPropertyNames.getConstArray();
     475           0 :     const ::rtl::OUString* pEnd   = pIter + aPropertyNames.getLength();
     476           0 :     for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
     477           0 :         aRet[i] = getPropertyDefault(*pIter);
     478           0 :     return aRet;
     479             : }
     480             : namespace
     481             : {
     482             :     class FactoryLoader : public ::osl::Thread
     483             :     {
     484             :         ::rtl::OUString                          m_sMimeType;
     485             :         uno::Reference< uno::XComponentContext > m_xContext;
     486             :     public:
     487           0 :         FactoryLoader(const ::rtl::OUString& _sMimeType,uno::Reference< uno::XComponentContext > const & _xContext)
     488             :             :m_sMimeType(_sMimeType)
     489           0 :             ,m_xContext(_xContext)
     490           0 :         {}
     491             : 
     492             :     protected:
     493           0 :         virtual ~FactoryLoader(){}
     494             : 
     495             :         /// Working method which should be overridden.
     496             :         virtual void SAL_CALL run();
     497             :         virtual void SAL_CALL onTerminated();
     498             :     };
     499             : 
     500           0 :     void SAL_CALL FactoryLoader::run()
     501             :     {
     502             :         try
     503             :         {
     504           0 :             uno::Reference<frame::XComponentLoader> xFrameLoad( m_xContext->getServiceManager()->createInstanceWithContext(
     505             :                                                         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))
     506           0 :                                                         ,m_xContext)
     507           0 :                                                         ,uno::UNO_QUERY);
     508           0 :             ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank"));
     509           0 :             sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
     510           0 :             uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag);
     511           0 :             xFrameLoad.set( xFrame,uno::UNO_QUERY);
     512             : 
     513           0 :             if ( xFrameLoad.is() )
     514             :             {
     515           0 :                 uno::Sequence < beans::PropertyValue > aArgs( 3);
     516           0 :                 sal_Int32 nLen = 0;
     517           0 :                 aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate"));
     518           0 :                 aArgs[nLen++].Value <<= sal_False;
     519             : 
     520           0 :                 aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
     521           0 :                 aArgs[nLen++].Value <<= sal_True;
     522             : 
     523           0 :                 aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
     524           0 :                 aArgs[nLen++].Value <<= sal_True;
     525             : 
     526           0 :                 uno::Reference< lang::XMultiServiceFactory > xFac(m_xContext->getServiceManager(),uno::UNO_QUERY);
     527           0 :                 ::comphelper::MimeConfigurationHelper aHelper(xFac);
     528           0 :                 SvtModuleOptions aModuleOptions;
     529           0 :                 uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL(
     530             :                     aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(m_sMimeType) )),
     531             :                     ::rtl::OUString(), // empty frame name
     532             :                     0,
     533             :                     aArgs
     534           0 :                     ),uno::UNO_QUERY);
     535           0 :                 ::comphelper::disposeComponent(xModel);
     536           0 :             }
     537             :         }
     538           0 :         catch (const uno::Exception&)
     539             :         {
     540             :             DBG_UNHANDLED_EXCEPTION();
     541             :         }
     542           0 :     }
     543           0 :     void SAL_CALL FactoryLoader::onTerminated()
     544             :     {
     545           0 :         delete this;
     546           0 :     }
     547             : }
     548             : // -----------------------------------------------------------------------------
     549             : struct OReportDefinitionImpl
     550             : {
     551             :     uno::WeakReference< uno::XInterface >                   m_xParent;
     552             :     ::cppu::OInterfaceContainerHelper                       m_aStorageChangeListeners;
     553             :     ::cppu::OInterfaceContainerHelper                       m_aCloseListener;
     554             :     ::cppu::OInterfaceContainerHelper                       m_aModifyListeners;
     555             :     ::cppu::OInterfaceContainerHelper                       m_aDocEventListeners;
     556             :     ::std::vector< uno::Reference< frame::XController> >    m_aControllers;
     557             :     uno::Sequence< beans::PropertyValue >                   m_aArgs;
     558             : 
     559             :     uno::Reference< report::XGroups >                       m_xGroups;
     560             :     uno::Reference< report::XSection>                       m_xReportHeader;
     561             :     uno::Reference< report::XSection>                       m_xReportFooter;
     562             :     uno::Reference< report::XSection>                       m_xPageHeader;
     563             :     uno::Reference< report::XSection>                       m_xPageFooter;
     564             :     uno::Reference< report::XSection>                       m_xDetail;
     565             :     uno::Reference< embed::XStorage >                       m_xStorage;
     566             :     uno::Reference< frame::XController >                    m_xCurrentController;
     567             :     uno::Reference< container::XIndexAccess >               m_xViewData;
     568             :     uno::Reference< container::XNameAccess >                m_xStyles;
     569             :     uno::Reference< container::XNameAccess>                 m_xXMLNamespaceMap;
     570             :     uno::Reference< container::XNameAccess>                 m_xGradientTable;
     571             :     uno::Reference< container::XNameAccess>                 m_xHatchTable;
     572             :     uno::Reference< container::XNameAccess>                 m_xBitmapTable;
     573             :     uno::Reference< container::XNameAccess>                 m_xTransparencyGradientTable;
     574             :     uno::Reference< container::XNameAccess>                 m_xDashTable;
     575             :     uno::Reference< container::XNameAccess>                 m_xMarkerTable;
     576             :     uno::Reference< report::XFunctions >                    m_xFunctions;
     577             :     uno::Reference< ui::XUIConfigurationManager>            m_xUIConfigurationManager;
     578             :     uno::Reference< util::XNumberFormatsSupplier>           m_xNumberFormatsSupplier;
     579             :     uno::Reference< sdbc::XConnection>                      m_xActiveConnection;
     580             :     uno::Reference< frame::XTitle >                         m_xTitleHelper;
     581             :     uno::Reference< frame::XUntitledNumbers >               m_xNumberedControllers;
     582             :     uno::Reference< document::XDocumentProperties >         m_xDocumentProperties;
     583             : 
     584             :     ::boost::shared_ptr< ::comphelper::EmbeddedObjectContainer>
     585             :                                                             m_pObjectContainer;
     586             :     ::boost::shared_ptr<rptui::OReportModel>                m_pReportModel;
     587             :     ::rtl::Reference< ::dbaui::UndoManager >                m_pUndoManager;
     588             :     ::rtl::OUString                                         m_sCaption;
     589             :     ::rtl::OUString                                         m_sCommand;
     590             :     ::rtl::OUString                                         m_sFilter;
     591             :     ::rtl::OUString                                         m_sMimeType;
     592             :     ::rtl::OUString                                         m_sIdentifier;
     593             :     ::rtl::OUString                                         m_sDataSourceName;
     594             :     awt::Size                                               m_aVisualAreaSize;
     595             :     ::sal_Int64                                             m_nAspect;
     596             :     ::sal_Int16                                             m_nGroupKeepTogether;
     597             :     ::sal_Int16                                             m_nPageHeaderOption;
     598             :     ::sal_Int16                                             m_nPageFooterOption;
     599             :     ::sal_Int32                                             m_nCommandType;
     600             :     sal_Bool                                                m_bControllersLocked;
     601             :     sal_Bool                                                m_bModified;
     602             :     sal_Bool                                                m_bEscapeProcessing;
     603             :     sal_Bool                                                m_bSetModifiedEnabled;
     604             : 
     605           0 :     OReportDefinitionImpl(::osl::Mutex& _aMutex)
     606             :     :m_aStorageChangeListeners(_aMutex)
     607             :     ,m_aCloseListener(_aMutex)
     608             :     ,m_aModifyListeners(_aMutex)
     609             :     ,m_aDocEventListeners(_aMutex)
     610             :     ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT)
     611             :     ,m_sIdentifier(SERVICE_REPORTDEFINITION)
     612             :     // default visual area is 8 x 7 cm
     613             :     ,m_aVisualAreaSize( 8000, 7000 )
     614             :     ,m_nAspect(embed::Aspects::MSOLE_CONTENT)
     615             :     ,m_nGroupKeepTogether(0)
     616             :     ,m_nPageHeaderOption(0)
     617             :     ,m_nPageFooterOption(0)
     618             :     ,m_nCommandType(sdb::CommandType::TABLE)
     619             :     ,m_bControllersLocked(sal_False)
     620             :     ,m_bModified(sal_False)
     621             :     ,m_bEscapeProcessing(sal_True)
     622           0 :     ,m_bSetModifiedEnabled( sal_True )
     623           0 :     {}
     624             : 
     625           0 :     OReportDefinitionImpl(::osl::Mutex& _aMutex,const OReportDefinitionImpl& _aCopy)
     626             :     :m_aStorageChangeListeners(_aMutex)
     627             :     ,m_aCloseListener(_aMutex)
     628             :     ,m_aModifyListeners(_aMutex)
     629             :     ,m_aDocEventListeners(_aMutex)
     630             :     ,m_sMimeType(_aCopy.m_sMimeType)
     631             :     ,m_sIdentifier(_aCopy.m_sIdentifier)
     632             :     ,m_nGroupKeepTogether(_aCopy.m_nGroupKeepTogether)
     633             :     ,m_nPageHeaderOption(_aCopy.m_nPageHeaderOption)
     634             :     ,m_nPageFooterOption(_aCopy.m_nPageFooterOption)
     635             :     ,m_nCommandType(_aCopy.m_nCommandType)
     636             :     ,m_bControllersLocked(_aCopy.m_bControllersLocked)
     637             :     ,m_bModified(_aCopy.m_bModified)
     638           0 :     ,m_bEscapeProcessing(_aCopy.m_bEscapeProcessing)
     639           0 :     {}
     640             :     ~OReportDefinitionImpl();
     641             : };
     642           0 : OReportDefinitionImpl::~OReportDefinitionImpl()
     643             : {
     644           0 : }
     645             : 
     646             : DBG_NAME( rpt_OReportDefinition )
     647             : // -----------------------------------------------------------------------------
     648           0 : OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext)
     649             : : ReportDefinitionBase(m_aMutex)
     650             : ,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >())
     651           0 : ,m_aProps(new OReportComponentProperties(_xContext))
     652           0 : ,m_pImpl(new OReportDefinitionImpl(m_aMutex))
     653             : {
     654             :     DBG_CTOR( rpt_OReportDefinition,NULL);
     655           0 :     m_aProps->m_sName  = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager());
     656           0 :     osl_atomic_increment(&m_refCount);
     657             :     {
     658           0 :         init();
     659           0 :         m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
     660           0 :         m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
     661           0 :         m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
     662             :     }
     663           0 :     osl_atomic_decrement( &m_refCount );
     664           0 : }
     665             : // -----------------------------------------------------------------------------
     666           0 : OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext
     667             :                                      ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
     668             :                                      ,uno::Reference< drawing::XShape >& _xShape)
     669             : : ReportDefinitionBase(m_aMutex)
     670             : ,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >())
     671           0 : ,m_aProps(new OReportComponentProperties(_xContext))
     672           0 : ,m_pImpl(new OReportDefinitionImpl(m_aMutex))
     673             : {
     674           0 :     m_aProps->m_sName  = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager());
     675           0 :     m_aProps->m_xFactory = _xFactory;
     676           0 :     osl_atomic_increment(&m_refCount);
     677             :     {
     678           0 :         m_aProps->setShape(_xShape,this,m_refCount);
     679           0 :         init();
     680           0 :         m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
     681           0 :         m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
     682           0 :         m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager()));
     683             :     }
     684           0 :     osl_atomic_decrement( &m_refCount );
     685           0 : }
     686             : // -----------------------------------------------------------------------------
     687           0 : OReportDefinition::OReportDefinition(const OReportDefinition& _rCopy)
     688             : : cppu::BaseMutex()
     689             : ,ReportDefinitionBase(m_aMutex)
     690           0 : ,ReportDefinitionPropertySet(_rCopy.m_aProps->m_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >())
     691             : ,comphelper::IEmbeddedHelper()
     692           0 : ,m_aProps(new OReportComponentProperties(*_rCopy.m_aProps))
     693           0 : ,m_pImpl(new OReportDefinitionImpl(m_aMutex,*_rCopy.m_pImpl))
     694             : {
     695             :     DBG_CTOR( rpt_OReportDefinition,NULL);
     696           0 :     osl_atomic_increment(&m_refCount);
     697             :     {
     698           0 :         init();
     699           0 :         OGroups* pGroups = new OGroups(this,m_aProps->m_xContext);
     700           0 :         m_pImpl->m_xGroups = pGroups;
     701           0 :         pGroups->copyGroups(_rCopy.m_pImpl->m_xGroups);
     702           0 :         m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
     703           0 :         OSection::lcl_copySection(_rCopy.m_pImpl->m_xDetail,m_pImpl->m_xDetail);
     704             : 
     705           0 :         setPageHeaderOn(_rCopy.m_pImpl->m_xPageHeader.is());
     706           0 :         setPageFooterOn(_rCopy.m_pImpl->m_xPageFooter.is());
     707           0 :         setReportHeaderOn(_rCopy.m_pImpl->m_xReportHeader.is());
     708           0 :         setReportFooterOn(_rCopy.m_pImpl->m_xReportFooter.is());
     709           0 :         OSection::lcl_copySection(_rCopy.m_pImpl->m_xPageHeader,m_pImpl->m_xPageHeader);
     710           0 :         OSection::lcl_copySection(_rCopy.m_pImpl->m_xPageFooter,m_pImpl->m_xPageFooter);
     711           0 :         OSection::lcl_copySection(_rCopy.m_pImpl->m_xReportHeader,m_pImpl->m_xReportHeader);
     712           0 :         OSection::lcl_copySection(_rCopy.m_pImpl->m_xReportFooter,m_pImpl->m_xReportFooter);
     713             :     }
     714           0 :     osl_atomic_decrement( &m_refCount );
     715           0 : }
     716             : // -----------------------------------------------------------------------------
     717           0 : OReportDefinition::~OReportDefinition()
     718             : {
     719             :     DBG_DTOR( rpt_OReportDefinition,NULL);
     720           0 :     if ( !ReportDefinitionBase::rBHelper.bInDispose && !ReportDefinitionBase::rBHelper.bDisposed )
     721             :     {
     722           0 :         acquire();
     723           0 :         dispose();
     724             :     }
     725           0 : }
     726             : // -----------------------------------------------------------------------------
     727           0 : IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition, ReportDefinitionBase )
     728           0 : void OReportDefinition::init()
     729             : {
     730             :     try
     731             :     {
     732             :         static bool s_bFirstTime = sal_True;
     733           0 :         if ( s_bFirstTime )
     734             :         {
     735           0 :             s_bFirstTime = false;
     736           0 :             const uno::Sequence< ::rtl::OUString > aMimeTypes = getAvailableMimeTypes();
     737           0 :             const ::rtl::OUString* pIter = aMimeTypes.getConstArray();
     738           0 :             const ::rtl::OUString* pEnd  = pIter + aMimeTypes.getLength();
     739           0 :             for ( ; pIter != pEnd; ++pIter )
     740             :             {
     741           0 :                 FactoryLoader* pCreatorThread = new FactoryLoader(*pIter,m_aProps->m_xContext);
     742           0 :                 pCreatorThread->createSuspended();
     743           0 :                 pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal);
     744           0 :                 pCreatorThread->resume();
     745           0 :             }
     746             :         }
     747             : 
     748           0 :         m_pImpl->m_pReportModel.reset(new OReportModel(this));
     749           0 :         m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges();
     750           0 :         m_pImpl->m_pReportModel->SetScaleUnit( MAP_100TH_MM );
     751           0 :         SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin();
     752           0 :         rAdmin.NewStandardLayer(RPT_LAYER_FRONT);
     753           0 :         rAdmin.NewLayer(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("back")), RPT_LAYER_BACK);
     754           0 :         rAdmin.NewLayer(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HiddenLayer")), RPT_LAYER_HIDDEN);
     755             : 
     756           0 :         m_pImpl->m_pUndoManager = new ::dbaui::UndoManager( *this, m_aMutex );
     757           0 :         m_pImpl->m_pReportModel->SetSdrUndoManager( &m_pImpl->m_pUndoManager->GetSfxUndoManager() );
     758             : 
     759           0 :         m_pImpl->m_xFunctions = new OFunctions(this,m_aProps->m_xContext);
     760           0 :         if ( !m_pImpl->m_xStorage.is() )
     761           0 :             m_pImpl->m_xStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
     762             : 
     763           0 :         uno::Reference<beans::XPropertySet> xStorProps(m_pImpl->m_xStorage,uno::UNO_QUERY);
     764           0 :         if ( xStorProps.is())
     765             :         {
     766           0 :             ::rtl::OUString sMediaType;
     767           0 :             xStorProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType"))) >>= sMediaType;
     768           0 :             if ( sMediaType.isEmpty() )
     769           0 :                 xStorProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")),uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT));
     770             :         }
     771           0 :         m_pImpl->m_pObjectContainer.reset( new comphelper::EmbeddedObjectContainer(m_pImpl->m_xStorage , static_cast<cppu::OWeakObject*>(this) ) );
     772             :     }
     773           0 :     catch (const uno::Exception&)
     774             :     {
     775             :         DBG_UNHANDLED_EXCEPTION();
     776             :     }
     777           0 : }
     778             : // -----------------------------------------------------------------------------
     779           0 : void SAL_CALL OReportDefinition::dispose() throw(uno::RuntimeException)
     780             : {
     781           0 :     ReportDefinitionPropertySet::dispose();
     782           0 :     cppu::WeakComponentImplHelperBase::dispose();
     783           0 : }
     784             : // -----------------------------------------------------------------------------
     785           0 : void SAL_CALL OReportDefinition::disposing()
     786             : {
     787           0 :     notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnUnload")));
     788             : 
     789           0 :     uno::Reference< frame::XModel > xHoldAlive( this );
     790             : 
     791           0 :     lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
     792           0 :     m_pImpl->m_aModifyListeners.disposeAndClear( aDisposeEvent );
     793           0 :     m_pImpl->m_aCloseListener.disposeAndClear( aDisposeEvent );
     794           0 :     m_pImpl->m_aDocEventListeners.disposeAndClear( aDisposeEvent );
     795           0 :     m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent );
     796             : 
     797             :     // SYNCHRONIZED --->
     798           0 :     SolarMutexGuard aSolarGuard;
     799           0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
     800             : 
     801           0 :     m_pImpl->m_aControllers.clear();
     802             : 
     803           0 :     ::comphelper::disposeComponent(m_pImpl->m_xGroups);
     804           0 :     m_pImpl->m_xReportHeader.clear();
     805           0 :     m_pImpl->m_xReportFooter.clear();
     806           0 :     m_pImpl->m_xPageHeader.clear();
     807           0 :     m_pImpl->m_xPageFooter.clear();
     808           0 :     m_pImpl->m_xDetail.clear();
     809           0 :     ::comphelper::disposeComponent(m_pImpl->m_xFunctions);
     810             : 
     811             :     //::comphelper::disposeComponent(m_pImpl->m_xStorage);
     812             :         // don't dispose, this currently is the task of either the ref count going to
     813             :         // 0, or of the embedded object (if we're embedded, which is the only possible
     814             :         // case so far)
     815             :         // #i78366#
     816           0 :     m_pImpl->m_xStorage.clear();
     817           0 :     m_pImpl->m_xViewData.clear();
     818           0 :     m_pImpl->m_xCurrentController.clear();
     819           0 :     m_pImpl->m_xNumberFormatsSupplier.clear();
     820           0 :     m_pImpl->m_xStyles.clear();
     821           0 :     m_pImpl->m_xXMLNamespaceMap.clear();
     822           0 :     m_pImpl->m_xGradientTable.clear();
     823           0 :     m_pImpl->m_xHatchTable.clear();
     824           0 :     m_pImpl->m_xBitmapTable.clear();
     825           0 :     m_pImpl->m_xTransparencyGradientTable.clear();
     826           0 :     m_pImpl->m_xDashTable.clear();
     827           0 :     m_pImpl->m_xMarkerTable.clear();
     828           0 :     m_pImpl->m_xUIConfigurationManager.clear();
     829           0 :     m_pImpl->m_pReportModel.reset();
     830           0 :     m_pImpl->m_pObjectContainer.reset();
     831           0 :     m_pImpl->m_aArgs.realloc(0);
     832           0 :     m_pImpl->m_xTitleHelper.clear();
     833           0 :     m_pImpl->m_xNumberedControllers.clear();
     834             :     // <--- SYNCHRONIZED
     835           0 : }
     836             : 
     837             : // -----------------------------------------------------------------------------
     838           0 : ::rtl::OUString OReportDefinition::getImplementationName_Static(  ) throw(uno::RuntimeException)
     839             : {
     840           0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportDefinition"));
     841             : }
     842             : 
     843             : //--------------------------------------------------------------------------
     844           0 : ::rtl::OUString SAL_CALL OReportDefinition::getImplementationName(  ) throw(uno::RuntimeException)
     845             : {
     846           0 :     return getImplementationName_Static();
     847             : }
     848             : //--------------------------------------------------------------------------
     849           0 : uno::Sequence< ::rtl::OUString > OReportDefinition::getSupportedServiceNames_Static(  ) throw(uno::RuntimeException)
     850             : {
     851           0 :     uno::Sequence< ::rtl::OUString > aServices(1);
     852           0 :     aServices.getArray()[0] = SERVICE_REPORTDEFINITION;
     853             : 
     854           0 :     return aServices;
     855             : }
     856             : // --------------------------------------------------------------------------------
     857           0 : uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getSupportedServiceNames(  ) throw(uno::RuntimeException)
     858             : {
     859             :     // first collect the services which are supported by our aggregate
     860           0 :     uno::Sequence< ::rtl::OUString > aSupported;
     861           0 :     if ( m_aProps->m_xServiceInfo.is() )
     862           0 :         aSupported = m_aProps->m_xServiceInfo->getSupportedServiceNames();
     863             : 
     864             :     // append our own service, if necessary
     865           0 :     if ( 0 == ::comphelper::findValue( aSupported, SERVICE_REPORTDEFINITION, sal_True ).getLength() )
     866             :     {
     867           0 :         sal_Int32 nLen = aSupported.getLength();
     868           0 :         aSupported.realloc( nLen + 1 );
     869           0 :         aSupported[ nLen ] = SERVICE_REPORTDEFINITION;
     870             :     }
     871             : 
     872             :     // outta here
     873           0 :     return aSupported;
     874             : }
     875             : 
     876             : // --------------------------------------------------------------------------------
     877           0 : sal_Bool SAL_CALL OReportDefinition::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException)
     878             : {
     879           0 :     return ::comphelper::findValue( getSupportedServiceNames(), _rServiceName, sal_True ).getLength() != 0;
     880             : }
     881             : 
     882             : // --------------------------------------------------------------------------------
     883           0 : uno::Any SAL_CALL OReportDefinition::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException)
     884             : {
     885           0 :     uno::Any aReturn = ReportDefinitionBase::queryInterface(_rType);
     886           0 :     if ( !aReturn.hasValue() )
     887           0 :         aReturn = ReportDefinitionPropertySet::queryInterface(_rType);
     888             : 
     889           0 :     return aReturn.hasValue() ? aReturn : (m_aProps->m_xProxy.is() ? m_aProps->m_xProxy->queryAggregation(_rType) : aReturn);
     890             : }
     891             : // --------------------------------------------------------------------------------
     892           0 : uno::Sequence< uno::Type > SAL_CALL OReportDefinition::getTypes(  ) throw (uno::RuntimeException)
     893             : {
     894           0 :     if ( m_aProps->m_xTypeProvider.is() )
     895             :         return ::comphelper::concatSequences(
     896             :             ReportDefinitionBase::getTypes(),
     897           0 :             m_aProps->m_xTypeProvider->getTypes()
     898           0 :         );
     899           0 :     return ReportDefinitionBase::getTypes();
     900             : }
     901             : //------------------------------------------------------------------------------
     902           0 : uno::Reference< uno::XInterface > OReportDefinition::create(uno::Reference< uno::XComponentContext > const & xContext)
     903             : {
     904           0 :     return *(new OReportDefinition(xContext));
     905             : }
     906             : 
     907             : // -----------------------------------------------------------------------------
     908             : // XReportDefinition
     909           0 : ::rtl::OUString SAL_CALL OReportDefinition::getCaption() throw (uno::RuntimeException)
     910             : {
     911           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     912           0 :     return m_pImpl->m_sCaption;
     913             : }
     914             : // -----------------------------------------------------------------------------
     915           0 : void SAL_CALL OReportDefinition::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
     916             : {
     917           0 :     set(PROPERTY_CAPTION,_caption,m_pImpl->m_sCaption);
     918           0 : }
     919             : // -----------------------------------------------------------------------------
     920           0 : ::sal_Int16 SAL_CALL OReportDefinition::getGroupKeepTogether() throw (uno::RuntimeException)
     921             : {
     922           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     923           0 :     return m_pImpl->m_nGroupKeepTogether;
     924             : }
     925             : // -----------------------------------------------------------------------------
     926           0 : void SAL_CALL OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether ) throw (uno::RuntimeException)
     927             : {
     928           0 :     if ( _groupkeeptogether < report::GroupKeepTogether::PER_PAGE || _groupkeeptogether > report::GroupKeepTogether::PER_COLUMN )
     929             :         throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::GroupKeepTogether"))
     930             :                         ,*this
     931             :                         ,1
     932           0 :                         ,m_aProps->m_xContext);
     933           0 :     set(PROPERTY_GROUPKEEPTOGETHER,_groupkeeptogether,m_pImpl->m_nGroupKeepTogether);
     934           0 : }
     935             : // -----------------------------------------------------------------------------
     936           0 : ::sal_Int16 SAL_CALL OReportDefinition::getPageHeaderOption() throw (uno::RuntimeException)
     937             : {
     938           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     939           0 :     return m_pImpl->m_nPageHeaderOption;
     940             : }
     941             : // -----------------------------------------------------------------------------
     942           0 : void SAL_CALL OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption ) throw (uno::RuntimeException)
     943             : {
     944           0 :     if ( _pageheaderoption < report::ReportPrintOption::ALL_PAGES || _pageheaderoption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
     945             :         throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption"))
     946             :                         ,*this
     947             :                         ,1
     948           0 :                         ,m_aProps->m_xContext);
     949           0 :     set(PROPERTY_PAGEHEADEROPTION,_pageheaderoption,m_pImpl->m_nPageHeaderOption);
     950           0 : }
     951             : // -----------------------------------------------------------------------------
     952           0 : ::sal_Int16 SAL_CALL OReportDefinition::getPageFooterOption() throw (uno::RuntimeException)
     953             : {
     954           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     955           0 :     return m_pImpl->m_nPageFooterOption;
     956             : }
     957             : // -----------------------------------------------------------------------------
     958           0 : void SAL_CALL OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption ) throw (uno::RuntimeException)
     959             : {
     960           0 :     if ( _pagefooteroption < report::ReportPrintOption::ALL_PAGES || _pagefooteroption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
     961             :         throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption"))
     962             :                         ,*this
     963             :                         ,1
     964           0 :                         ,m_aProps->m_xContext);
     965           0 :     set(PROPERTY_PAGEFOOTEROPTION,_pagefooteroption,m_pImpl->m_nPageFooterOption);
     966           0 : }
     967             : // -----------------------------------------------------------------------------
     968           0 : ::rtl::OUString SAL_CALL OReportDefinition::getCommand() throw (uno::RuntimeException)
     969             : {
     970           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     971           0 :     return m_pImpl->m_sCommand;
     972             : }
     973             : // -----------------------------------------------------------------------------
     974           0 : void SAL_CALL OReportDefinition::setCommand( const ::rtl::OUString& _command ) throw (uno::RuntimeException)
     975             : {
     976           0 :     set(PROPERTY_COMMAND,_command,m_pImpl->m_sCommand);
     977           0 : }
     978             : // -----------------------------------------------------------------------------
     979           0 : ::sal_Int32 SAL_CALL OReportDefinition::getCommandType() throw (uno::RuntimeException)
     980             : {
     981           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     982           0 :     return m_pImpl->m_nCommandType;
     983             : }
     984             : // -----------------------------------------------------------------------------
     985           0 : void SAL_CALL OReportDefinition::setCommandType( ::sal_Int32 _commandtype ) throw (uno::RuntimeException)
     986             : {
     987           0 :     if ( _commandtype < sdb::CommandType::TABLE || _commandtype > sdb::CommandType::COMMAND )
     988             :         throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::sdb::CommandType"))
     989             :                         ,*this
     990             :                         ,1
     991           0 :                         ,m_aProps->m_xContext);
     992           0 :     set(PROPERTY_COMMANDTYPE,_commandtype,m_pImpl->m_nCommandType);
     993           0 : }
     994             : // -----------------------------------------------------------------------------
     995           0 : ::rtl::OUString SAL_CALL OReportDefinition::getFilter() throw (uno::RuntimeException)
     996             : {
     997           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     998           0 :     return m_pImpl->m_sFilter;
     999             : }
    1000             : // -----------------------------------------------------------------------------
    1001           0 : void SAL_CALL OReportDefinition::setFilter( const ::rtl::OUString& _filter ) throw (uno::RuntimeException)
    1002             : {
    1003           0 :     set(PROPERTY_FILTER,_filter,m_pImpl->m_sFilter);
    1004           0 : }
    1005             : // -----------------------------------------------------------------------------
    1006           0 : ::sal_Bool SAL_CALL OReportDefinition::getEscapeProcessing() throw (uno::RuntimeException)
    1007             : {
    1008           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1009           0 :     return m_pImpl->m_bEscapeProcessing;
    1010             : }
    1011             : // -----------------------------------------------------------------------------
    1012           0 : void SAL_CALL OReportDefinition::setEscapeProcessing( ::sal_Bool _escapeprocessing ) throw (uno::RuntimeException)
    1013             : {
    1014           0 :     set(PROPERTY_ESCAPEPROCESSING,_escapeprocessing,m_pImpl->m_bEscapeProcessing);
    1015           0 : }
    1016             : // -----------------------------------------------------------------------------
    1017           0 : ::sal_Bool SAL_CALL OReportDefinition::getReportHeaderOn() throw (uno::RuntimeException)
    1018             : {
    1019           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1020           0 :     return m_pImpl->m_xReportHeader.is();
    1021             : }
    1022             : // -----------------------------------------------------------------------------
    1023           0 : void SAL_CALL OReportDefinition::setReportHeaderOn( ::sal_Bool _reportheaderon ) throw (uno::RuntimeException)
    1024             : {
    1025           0 :     if ( _reportheaderon != m_pImpl->m_xReportHeader.is() )
    1026             :     {
    1027           0 :         setSection(PROPERTY_REPORTHEADERON,_reportheaderon,RPT_RESSTRING(RID_STR_REPORT_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportHeader);
    1028             :     }
    1029           0 : }
    1030             : // -----------------------------------------------------------------------------
    1031           0 : ::sal_Bool SAL_CALL OReportDefinition::getReportFooterOn() throw (uno::RuntimeException)
    1032             : {
    1033           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1034           0 :     return m_pImpl->m_xReportFooter.is();
    1035             : }
    1036             : // -----------------------------------------------------------------------------
    1037           0 : void SAL_CALL OReportDefinition::setReportFooterOn( ::sal_Bool _reportfooteron ) throw (uno::RuntimeException)
    1038             : {
    1039           0 :     if ( _reportfooteron != m_pImpl->m_xReportFooter.is() )
    1040             :     {
    1041           0 :         setSection(PROPERTY_REPORTFOOTERON,_reportfooteron,RPT_RESSTRING(RID_STR_REPORT_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportFooter);
    1042             :     }
    1043           0 : }
    1044             : // -----------------------------------------------------------------------------
    1045           0 : ::sal_Bool SAL_CALL OReportDefinition::getPageHeaderOn() throw (uno::RuntimeException)
    1046             : {
    1047           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1048           0 :     return m_pImpl->m_xPageHeader.is();
    1049             : }
    1050             : // -----------------------------------------------------------------------------
    1051           0 : void SAL_CALL OReportDefinition::setPageHeaderOn( ::sal_Bool _pageheaderon ) throw (uno::RuntimeException)
    1052             : {
    1053           0 :     if ( _pageheaderon != m_pImpl->m_xPageHeader.is() )
    1054             :     {
    1055           0 :         setSection(PROPERTY_PAGEHEADERON,_pageheaderon,RPT_RESSTRING(RID_STR_PAGE_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageHeader);
    1056             :     }
    1057           0 : }
    1058             : // -----------------------------------------------------------------------------
    1059           0 : ::sal_Bool SAL_CALL OReportDefinition::getPageFooterOn() throw (uno::RuntimeException)
    1060             : {
    1061           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1062           0 :     return m_pImpl->m_xPageFooter.is();
    1063             : }
    1064             : // -----------------------------------------------------------------------------
    1065           0 : void SAL_CALL OReportDefinition::setPageFooterOn( ::sal_Bool _pagefooteron ) throw (uno::RuntimeException)
    1066             : {
    1067           0 :     if ( _pagefooteron != m_pImpl->m_xPageFooter.is() )
    1068             :     {
    1069           0 :         setSection(PROPERTY_PAGEFOOTERON,_pagefooteron,RPT_RESSTRING(RID_STR_PAGE_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageFooter);
    1070             :     }
    1071           0 : }
    1072             : // -----------------------------------------------------------------------------
    1073           0 : uno::Reference< report::XGroups > SAL_CALL OReportDefinition::getGroups() throw (uno::RuntimeException)
    1074             : {
    1075           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1076           0 :     return m_pImpl->m_xGroups;
    1077             : }
    1078             : // -----------------------------------------------------------------------------
    1079           0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportHeader() throw (container::NoSuchElementException, uno::RuntimeException)
    1080             : {
    1081           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1082           0 :     if ( !m_pImpl->m_xReportHeader.is() )
    1083           0 :         throw container::NoSuchElementException();
    1084           0 :     return m_pImpl->m_xReportHeader;
    1085             : }
    1086             : // -----------------------------------------------------------------------------
    1087           0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageHeader() throw (container::NoSuchElementException, uno::RuntimeException)
    1088             : {
    1089           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1090           0 :     if ( !m_pImpl->m_xPageHeader.is() )
    1091           0 :         throw container::NoSuchElementException();
    1092           0 :     return m_pImpl->m_xPageHeader;
    1093             : }
    1094             : // -----------------------------------------------------------------------------
    1095           0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getDetail() throw (uno::RuntimeException)
    1096             : {
    1097           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1098           0 :     return m_pImpl->m_xDetail;
    1099             : }
    1100             : // -----------------------------------------------------------------------------
    1101           0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageFooter() throw (container::NoSuchElementException, uno::RuntimeException)
    1102             : {
    1103           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1104           0 :     if ( !m_pImpl->m_xPageFooter.is() )
    1105           0 :         throw container::NoSuchElementException();
    1106           0 :     return m_pImpl->m_xPageFooter;
    1107             : }
    1108             : // -----------------------------------------------------------------------------
    1109           0 : uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportFooter() throw (container::NoSuchElementException, uno::RuntimeException)
    1110             : {
    1111           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1112           0 :     if ( !m_pImpl->m_xReportFooter.is() )
    1113           0 :         throw container::NoSuchElementException();
    1114           0 :     return m_pImpl->m_xReportFooter;
    1115             : }
    1116             : //------------------------------------------------------------------------------
    1117           0 : uno::Reference< document::XEventBroadcaster > SAL_CALL OReportDefinition::getEventBroadcaster(  ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException)
    1118             : {
    1119           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1120           0 :     return this;
    1121             : }
    1122             : //------------------------------------------------------------------------------
    1123             : // XReportComponent
    1124           0 : REPORTCOMPONENT_MASTERDETAIL(OReportDefinition,*m_aProps)
    1125           0 : REPORTCOMPONENT_IMPL(OReportDefinition,*m_aProps)
    1126           0 : REPORTCOMPONENT_IMPL2(OReportDefinition,*m_aProps)
    1127             : 
    1128             : // -----------------------------------------------------------------------------
    1129           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL OReportDefinition::getPropertySetInfo(  ) throw(uno::RuntimeException)
    1130             : {
    1131           0 :     return ReportDefinitionPropertySet::getPropertySetInfo();
    1132             : }
    1133             : // -----------------------------------------------------------------------------
    1134           0 : void SAL_CALL OReportDefinition::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
    1135             : {
    1136           0 :     ReportDefinitionPropertySet::setPropertyValue( aPropertyName, aValue );
    1137           0 : }
    1138             : // -----------------------------------------------------------------------------
    1139           0 : uno::Any SAL_CALL OReportDefinition::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1140             : {
    1141           0 :     return ReportDefinitionPropertySet::getPropertyValue( PropertyName);
    1142             : }
    1143             : // -----------------------------------------------------------------------------
    1144           0 : void SAL_CALL OReportDefinition::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1145             : {
    1146           0 :     ReportDefinitionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
    1147           0 : }
    1148             : // -----------------------------------------------------------------------------
    1149           0 : void SAL_CALL OReportDefinition::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1150             : {
    1151           0 :     ReportDefinitionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
    1152           0 : }
    1153             : // -----------------------------------------------------------------------------
    1154           0 : void SAL_CALL OReportDefinition::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1155             : {
    1156           0 :     ReportDefinitionPropertySet::addVetoableChangeListener( PropertyName, aListener );
    1157           0 : }
    1158             : // -----------------------------------------------------------------------------
    1159           0 : void SAL_CALL OReportDefinition::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
    1160             : {
    1161           0 :     ReportDefinitionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
    1162           0 : }
    1163             : // -----------------------------------------------------------------------------
    1164             : // XChild
    1165           0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getParent(  ) throw (uno::RuntimeException)
    1166             : {
    1167           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1168           0 :     uno::Reference< container::XChild > xChild;
    1169           0 :     comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
    1170           0 :     if ( xChild.is() )
    1171           0 :         return xChild->getParent();
    1172           0 :     return m_pImpl->m_xParent;
    1173             : }
    1174             : // -----------------------------------------------------------------------------
    1175           0 : void SAL_CALL OReportDefinition::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException)
    1176             : {
    1177           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1178           0 :     m_aProps->m_xParent = uno::Reference< container::XChild >(Parent,uno::UNO_QUERY);
    1179           0 :     m_pImpl->m_xParent = Parent;
    1180           0 :     uno::Reference< container::XChild > xChild;
    1181           0 :     comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
    1182           0 :     if ( xChild.is() )
    1183           0 :         xChild->setParent(Parent);
    1184           0 : }
    1185             : // -----------------------------------------------------------------------------
    1186             : // XCloneable
    1187           0 : uno::Reference< util::XCloneable > SAL_CALL OReportDefinition::createClone(  ) throw (uno::RuntimeException)
    1188             : {
    1189             :     OSL_FAIL("Not yet implemented correctly");
    1190           0 :     uno::Reference< report::XReportComponent> xSource = this;
    1191           0 :     uno::Reference< report::XReportDefinition> xSet(cloneObject(xSource,m_aProps->m_xFactory,SERVICE_REPORTDEFINITION),uno::UNO_QUERY_THROW);
    1192           0 :     return xSet.get();
    1193             : }
    1194             : // -----------------------------------------------------------------------------
    1195           0 : void OReportDefinition::setSection(  const ::rtl::OUString& _sProperty
    1196             :                             ,const sal_Bool& _bOn
    1197             :                             ,const ::rtl::OUString& _sName
    1198             :                             ,uno::Reference< report::XSection>& _member)
    1199             : {
    1200           0 :     BoundListeners l;
    1201             :     {
    1202           0 :         ::osl::MutexGuard aGuard(m_aMutex);
    1203           0 :         prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l);
    1204           0 :         lcl_createSectionIfNeeded(_bOn ,this,_member,_sProperty == PROPERTY_PAGEHEADERON || _sProperty == PROPERTY_PAGEFOOTERON);
    1205           0 :         if ( _member.is() )
    1206           0 :             _member->setName(_sName);
    1207             :     }
    1208           0 :     l.notify();
    1209           0 : }
    1210             : // -----------------------------------------------------------------------------
    1211             : // XCloseBroadcaster
    1212           0 : void SAL_CALL OReportDefinition::addCloseListener( const uno::Reference< util::XCloseListener >& _xListener ) throw (uno::RuntimeException)
    1213             : {
    1214           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1215           0 :     if ( _xListener.is() )
    1216           0 :         m_pImpl->m_aCloseListener.addInterface(_xListener);
    1217           0 : }
    1218             : // -----------------------------------------------------------------------------
    1219           0 : void SAL_CALL OReportDefinition::removeCloseListener( const uno::Reference< util::XCloseListener >& _xListener ) throw (uno::RuntimeException)
    1220             : {
    1221           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1222           0 :     m_pImpl->m_aCloseListener.removeInterface(_xListener);
    1223           0 : }
    1224             : // -----------------------------------------------------------------------------
    1225             : // XCloseable
    1226           0 : void SAL_CALL OReportDefinition::close( ::sal_Bool _bDeliverOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
    1227             : {
    1228           0 :     SolarMutexGuard aSolarGuard;
    1229             : 
    1230           0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    1231           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1232             :     // notify our container listeners
    1233           0 :     lang::EventObject aEvt( static_cast< ::cppu::OWeakObject* >( this ) );
    1234           0 :     aGuard.clear();
    1235           0 :     m_pImpl->m_aCloseListener.forEach<util::XCloseListener>(
    1236           0 :         ::boost::bind(&util::XCloseListener::queryClosing,_1,boost::cref(aEvt),boost::cref(_bDeliverOwnership)));
    1237           0 :     aGuard.reset();
    1238             : 
    1239             : 
    1240           0 :     ::std::vector< uno::Reference< frame::XController> > aCopy = m_pImpl->m_aControllers;
    1241           0 :     ::std::vector< uno::Reference< frame::XController> >::iterator aIter = aCopy.begin();
    1242           0 :     ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = aCopy.end();
    1243           0 :     for (;aIter != aEnd ; ++aIter)
    1244             :     {
    1245           0 :         if ( aIter->is() )
    1246             :         {
    1247             :             try
    1248             :             {
    1249           0 :                 uno::Reference< util::XCloseable> xFrame( (*aIter)->getFrame(), uno::UNO_QUERY );
    1250           0 :                 if ( xFrame.is() )
    1251           0 :                     xFrame->close( _bDeliverOwnership );
    1252             :             }
    1253           0 :             catch (const util::CloseVetoException&) { throw; }
    1254           0 :             catch (const uno::Exception&)
    1255             :             {
    1256             :                 OSL_FAIL( "ODatabaseDocument::impl_closeControllerFrames: caught an unexpected exception!" );
    1257             :             }
    1258             :         }
    1259             :     }
    1260             : 
    1261           0 :     aGuard.clear();
    1262           0 :     m_pImpl->m_aCloseListener.notifyEach(&util::XCloseListener::notifyClosing,aEvt);
    1263           0 :     aGuard.reset();
    1264             : 
    1265           0 :     dispose();
    1266           0 : }
    1267             : // -----------------------------------------------------------------------------
    1268             : // XModel
    1269           0 : ::sal_Bool SAL_CALL OReportDefinition::attachResource( const ::rtl::OUString& /*_rURL*/, const uno::Sequence< beans::PropertyValue >& _aArguments ) throw (uno::RuntimeException)
    1270             : {
    1271             :     // LLA: we had a deadlock problem in our context, so we get the SolarMutex earlier.
    1272           0 :     SolarMutexGuard aSolarGuard;
    1273             : 
    1274           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1275           0 :     ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
    1276           0 :     ::comphelper::MediaDescriptor aDescriptor( _aArguments );
    1277             : 
    1278           0 :     m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( false );
    1279             :     try
    1280             :     {
    1281           0 :         fillArgs(aDescriptor);
    1282           0 :         m_pImpl->m_pReportModel->SetModified(sal_False);
    1283             :     }
    1284           0 :     catch (...)
    1285             :     {
    1286           0 :         m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
    1287           0 :         throw;
    1288             :     }
    1289           0 :     m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
    1290           0 :     return sal_True;
    1291             : }
    1292             : // -----------------------------------------------------------------------------
    1293           0 : void OReportDefinition::fillArgs(::comphelper::MediaDescriptor& _aDescriptor)
    1294             : {
    1295           0 :     uno::Sequence<beans::PropertyValue> aComponentData;
    1296           0 :     aComponentData = _aDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComponentData")),aComponentData);
    1297           0 :     if ( aComponentData.getLength() && (!m_pImpl->m_xActiveConnection.is() || !m_pImpl->m_xNumberFormatsSupplier.is()) )
    1298             :     {
    1299           0 :         ::comphelper::SequenceAsHashMap aComponentDataMap( aComponentData );
    1300           0 :         m_pImpl->m_xActiveConnection = aComponentDataMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")),m_pImpl->m_xActiveConnection);
    1301           0 :         m_pImpl->m_xNumberFormatsSupplier = dbtools::getNumberFormats(m_pImpl->m_xActiveConnection);
    1302             :     }
    1303           0 :     if ( !m_pImpl->m_xNumberFormatsSupplier.is() )
    1304             :     {
    1305           0 :         m_pImpl->m_xNumberFormatsSupplier.set( util::NumberFormatsSupplier::createWithDefaultLocale( m_aProps->m_xContext ) );
    1306             :     }
    1307           0 :     lcl_stripLoadArguments( _aDescriptor, m_pImpl->m_aArgs );
    1308           0 :     ::rtl::OUString sCaption;
    1309           0 :     sCaption = _aDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")),sCaption);
    1310           0 :     setCaption(sCaption);
    1311           0 : }
    1312             : // -----------------------------------------------------------------------------
    1313           0 : ::rtl::OUString SAL_CALL OReportDefinition::getURL(  ) throw (uno::RuntimeException)
    1314             : {
    1315           0 :     return ::rtl::OUString();
    1316             : }
    1317             : // -----------------------------------------------------------------------------
    1318           0 : uno::Sequence< beans::PropertyValue > SAL_CALL OReportDefinition::getArgs(  ) throw (uno::RuntimeException)
    1319             : {
    1320           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1321           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1322           0 :     return m_pImpl->m_aArgs;
    1323             : }
    1324             : // -----------------------------------------------------------------------------
    1325           0 : void SAL_CALL OReportDefinition::connectController( const uno::Reference< frame::XController >& _xController ) throw (uno::RuntimeException)
    1326             : {
    1327           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1328           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1329           0 :     m_pImpl->m_aControllers.push_back(_xController);
    1330             :     sal_Int32 nCount;
    1331           0 :     if ( _xController.is() && m_pImpl->m_xViewData.is() && ( nCount = m_pImpl->m_xViewData->getCount()) != 0)
    1332             :     {
    1333           0 :         _xController->restoreViewData(m_pImpl->m_xViewData->getByIndex(nCount - 1));
    1334           0 :     }
    1335           0 : }
    1336             : // -----------------------------------------------------------------------------
    1337           0 : void SAL_CALL OReportDefinition::disconnectController( const uno::Reference< frame::XController >& _xController ) throw (uno::RuntimeException)
    1338             : {
    1339           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1340           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1341           0 :     ::std::vector< uno::Reference< frame::XController> >::iterator aFind = ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController);
    1342           0 :     if ( aFind != m_pImpl->m_aControllers.end() )
    1343           0 :         m_pImpl->m_aControllers.erase(aFind);
    1344           0 :     if ( m_pImpl->m_xCurrentController == _xController )
    1345           0 :         m_pImpl->m_xCurrentController.clear();
    1346           0 : }
    1347             : // -----------------------------------------------------------------------------
    1348           0 : void SAL_CALL OReportDefinition::lockControllers(  ) throw (uno::RuntimeException)
    1349             : {
    1350           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1351           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1352           0 :     m_pImpl->m_bControllersLocked = sal_True;
    1353           0 : }
    1354             : // -----------------------------------------------------------------------------
    1355           0 : void SAL_CALL OReportDefinition::unlockControllers(  ) throw (uno::RuntimeException)
    1356             : {
    1357           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1358           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1359           0 :     m_pImpl->m_bControllersLocked = sal_False;
    1360           0 : }
    1361             : // -----------------------------------------------------------------------------
    1362           0 : ::sal_Bool SAL_CALL OReportDefinition::hasControllersLocked(  ) throw (uno::RuntimeException)
    1363             : {
    1364           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1365           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1366           0 :     return m_pImpl->m_bControllersLocked;
    1367             : }
    1368             : // -----------------------------------------------------------------------------
    1369           0 : uno::Reference< frame::XController > SAL_CALL OReportDefinition::getCurrentController(  ) throw (uno::RuntimeException)
    1370             : {
    1371           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1372           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1373           0 :     return m_pImpl->m_xCurrentController;
    1374             : }
    1375             : // -----------------------------------------------------------------------------
    1376           0 : void SAL_CALL OReportDefinition::setCurrentController( const uno::Reference< frame::XController >& _xController ) throw (container::NoSuchElementException, uno::RuntimeException)
    1377             : {
    1378           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1379           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1380           0 :     if ( ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController) == m_pImpl->m_aControllers.end() )
    1381           0 :         throw container::NoSuchElementException();
    1382           0 :     m_pImpl->m_xCurrentController = _xController;
    1383           0 : }
    1384             : // -----------------------------------------------------------------------------
    1385           0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getCurrentSelection(  ) throw (uno::RuntimeException)
    1386             : {
    1387           0 :     return uno::Reference< uno::XInterface >();
    1388             : }
    1389             : // -----------------------------------------------------------------------------
    1390             : 
    1391           0 : void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom,
    1392             :         const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor )
    1393             : {
    1394           0 :     m_pImpl->m_xStorage = _xStorageToLoadFrom;
    1395             : 
    1396           0 :     ::comphelper::MediaDescriptor aDescriptor( _aMediaDescriptor );
    1397           0 :     fillArgs(aDescriptor);
    1398           0 :     aDescriptor.createItemIfMissing(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(_xStorageToLoadFrom));
    1399             : 
    1400           0 :     uno::Sequence< uno::Any > aDelegatorArguments(_aMediaDescriptor.getLength());
    1401           0 :     uno::Any* pIter = aDelegatorArguments.getArray();
    1402           0 :     uno::Any* pEnd  = pIter + aDelegatorArguments.getLength();
    1403           0 :     for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
    1404             :     {
    1405           0 :         *pIter <<= _aMediaDescriptor[i];
    1406             :     }
    1407           0 :     sal_Int32 nPos = aDelegatorArguments.getLength();
    1408           0 :     aDelegatorArguments.realloc(nPos+1);
    1409           0 :     beans::PropertyValue aPropVal;
    1410           0 :     aPropVal.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage"));
    1411           0 :     aPropVal.Value <<= _xStorageToLoadFrom;
    1412           0 :     aDelegatorArguments[nPos] <<= aPropVal;
    1413             : 
    1414           0 :     rptui::OXUndoEnvironment& rEnv = m_pImpl->m_pReportModel->GetUndoEnv();
    1415           0 :     rptui::OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
    1416             :     {
    1417             :         uno::Reference< document::XFilter > xFilter(
    1418           0 :             m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportFilter")),aDelegatorArguments,m_aProps->m_xContext),
    1419           0 :             uno::UNO_QUERY_THROW );
    1420             : 
    1421           0 :         uno::Reference< document::XImporter> xImporter(xFilter,uno::UNO_QUERY_THROW);
    1422           0 :         uno::Reference<XComponent> xComponent(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
    1423           0 :         xImporter->setTargetDocument(xComponent);
    1424             : 
    1425           0 :         ::comphelper::MediaDescriptor aTemp;
    1426           0 :         aTemp << aDelegatorArguments;
    1427           0 :         xFilter->filter(aTemp.getAsConstPropertyValueList());
    1428             : 
    1429           0 :         lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
    1430           0 :         m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
    1431           0 :     }
    1432           0 : }
    1433             : // XStorageBasedDocument
    1434             : // -----------------------------------------------------------------------------
    1435           0 : void SAL_CALL OReportDefinition::loadFromStorage( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom
    1436             :                                                  , const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor ) throw (lang::IllegalArgumentException, frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException)
    1437             : {
    1438           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1439           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1440             : 
    1441           0 :     impl_loadFromStorage_nolck_throw( _xStorageToLoadFrom, _aMediaDescriptor );
    1442           0 : }
    1443             : 
    1444             : // -----------------------------------------------------------------------------
    1445           0 : void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XStorage >& _xStorageToSaveTo, const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException)
    1446             : {
    1447           0 :     if ( !_xStorageToSaveTo.is() )
    1448           0 :         throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1);
    1449             : 
    1450           0 :     SolarMutexGuard aSolarGuard;
    1451           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1452           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1453             :     // create XStatusIndicator
    1454           0 :     uno::Reference<task::XStatusIndicator> xStatusIndicator;
    1455           0 :     uno::Sequence< uno::Any > aDelegatorArguments;
    1456           0 :     ::comphelper::MediaDescriptor aDescriptor( _aMediaDescriptor );
    1457           0 :     lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, aDelegatorArguments );
    1458             : 
    1459             :     // properties
    1460           0 :     uno::Sequence < beans::PropertyValue > aProps;
    1461             : 
    1462             :     // export sub streams for package, else full stream into a file
    1463           0 :     sal_Bool bWarn = sal_False, bErr = sal_False;
    1464           0 :     ::rtl::OUString sWarnFile, sErrFile;
    1465             : 
    1466           0 :     uno::Reference< beans::XPropertySet> xProp(_xStorageToSaveTo,uno::UNO_QUERY);
    1467           0 :     if ( xProp.is() )
    1468             :     {
    1469           0 :         static const ::rtl::OUString sPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
    1470           0 :         ::rtl::OUString sOldMediaType;
    1471           0 :         xProp->getPropertyValue(sPropName) >>= sOldMediaType;
    1472           0 :         if ( !xProp->getPropertyValue(sPropName).hasValue() || sOldMediaType.isEmpty() || MIMETYPE_OASIS_OPENDOCUMENT_REPORT != sOldMediaType )
    1473           0 :             xProp->setPropertyValue( sPropName, uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT) );
    1474             :     }
    1475             : 
    1476             :     /** property map for export info set */
    1477             :     comphelper::PropertyMapEntry aExportInfoMap[] =
    1478             :     {
    1479           0 :         { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((sal_Bool*)0),          beans::PropertyAttribute::MAYBEVOID, 0 },
    1480           0 :         { MAP_LEN( "StreamName")        , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
    1481           0 :         { MAP_LEN( "StreamRelPath")     , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
    1482           0 :         { MAP_LEN( "BaseURI")           , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
    1483             :         { NULL, 0, 0, NULL, 0, 0 }
    1484           0 :     };
    1485           0 :     uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
    1486             : 
    1487           0 :     SvtSaveOptions aSaveOpt;
    1488           0 :     xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")), uno::makeAny(aSaveOpt.IsPrettyPrinting()));
    1489           0 :     if ( aSaveOpt.IsSaveRelFSys() )
    1490             :     {
    1491           0 :         const ::rtl::OUString sVal( aDescriptor.getUnpackedValueOrDefault(aDescriptor.PROP_DOCUMENTBASEURL(),::rtl::OUString()) );
    1492           0 :         xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")), uno::makeAny(sVal));
    1493             :     }
    1494           0 :     const ::rtl::OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),::rtl::OUString()) );
    1495           0 :     xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")), uno::makeAny(sHierarchicalDocumentName));
    1496             : 
    1497             : 
    1498           0 :     sal_Int32 nArgsLen = aDelegatorArguments.getLength();
    1499           0 :     aDelegatorArguments.realloc(nArgsLen+1);
    1500           0 :     aDelegatorArguments[nArgsLen++] <<= xInfoSet;
    1501             : 
    1502           0 :      uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
    1503           0 :     uno::Reference< document::XGraphicObjectResolver >      xGrfResolver;
    1504           0 :     SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(_xStorageToSaveTo,GRAPHICHELPER_MODE_WRITE);
    1505           0 :     xGrfResolver = pGraphicHelper;
    1506           0 :     pGraphicHelper->release();
    1507           0 :     SvXMLEmbeddedObjectHelper* pEmbeddedObjectHelper = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE );
    1508           0 :     xObjectResolver = pEmbeddedObjectHelper;
    1509           0 :     pEmbeddedObjectHelper->release();
    1510             : 
    1511           0 :     aDelegatorArguments.realloc(nArgsLen+2);
    1512           0 :     aDelegatorArguments[nArgsLen++] <<= xGrfResolver;
    1513           0 :     aDelegatorArguments[nArgsLen++] <<= xObjectResolver;
    1514             : 
    1515           0 :     uno::Reference<XComponent> xCom(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
    1516           0 :     if( !bErr )
    1517             :     {
    1518           0 :         xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml"))));
    1519           0 :         if( !WriteThroughComponent(
    1520             :             xCom, "settings.xml",
    1521             :             "com.sun.star.comp.report.XMLSettingsExporter",
    1522           0 :             aDelegatorArguments, aProps, _xStorageToSaveTo ) )
    1523             :         {
    1524           0 :             if( !bWarn )
    1525             :             {
    1526           0 :                 bWarn = sal_True;
    1527           0 :                 sWarnFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml"));
    1528             :             }
    1529             :         }
    1530             :     }
    1531             : 
    1532           0 :     if( !bErr )
    1533             :     {
    1534           0 :         xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml"))));
    1535           0 :         if( !WriteThroughComponent(
    1536             :             xCom, "meta.xml",
    1537             :             "com.sun.star.comp.report.XMLMetaExporter",
    1538           0 :             aDelegatorArguments, aProps, _xStorageToSaveTo ) )
    1539             :         {
    1540           0 :             if( !bWarn )
    1541             :             {
    1542           0 :                 bWarn = sal_True;
    1543           0 :                 sWarnFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml"));
    1544             :             }
    1545             :         }
    1546             :     }
    1547             : 
    1548           0 :     if( !bErr )
    1549             :     {
    1550           0 :         xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml"))));
    1551           0 :         if( !WriteThroughComponent(
    1552             :             xCom, "styles.xml",
    1553             :             "com.sun.star.comp.report.XMLStylesExporter",
    1554           0 :             aDelegatorArguments, aProps, _xStorageToSaveTo ) )
    1555             :         {
    1556           0 :             if( !bWarn )
    1557             :             {
    1558           0 :                 bWarn = sal_True;
    1559           0 :                 sWarnFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml"));
    1560             :             }
    1561             :         }
    1562             :     }
    1563             : 
    1564           0 :     if ( !bErr )
    1565             :     {
    1566           0 :         xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml"))));
    1567           0 :         if( !WriteThroughComponent(
    1568             :                 xCom, "content.xml",
    1569             :                 "com.sun.star.comp.report.ExportFilter",
    1570           0 :                 aDelegatorArguments, aProps, _xStorageToSaveTo ) )
    1571             :         {
    1572           0 :             bErr = sal_True;
    1573           0 :             sErrFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml"));
    1574             :         }
    1575             :     }
    1576             : 
    1577           0 :     uno::Any aImage;
    1578           0 :     uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY);
    1579           0 :     if ( xCurrentController.is() )
    1580             :     {
    1581           0 :         xCurrentController->setVisualAreaSize(m_pImpl->m_nAspect,m_pImpl->m_aVisualAreaSize);
    1582           0 :         aImage = xCurrentController->getPreferredVisualRepresentation( m_pImpl->m_nAspect ).Data;
    1583             :     }
    1584           0 :     if ( aImage.hasValue() )
    1585             :     {
    1586           0 :         ::rtl::OUString sObject1(RTL_CONSTASCII_USTRINGPARAM("report"));
    1587           0 :         ::rtl::OUString sPng(RTL_CONSTASCII_USTRINGPARAM("image/png"));
    1588             : 
    1589           0 :         uno::Sequence<sal_Int8> aSeq;
    1590           0 :         aImage >>= aSeq;
    1591           0 :         uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq );
    1592           0 :         m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream,sObject1,sPng);
    1593             :     }
    1594             : 
    1595           0 :     if ( !bErr )
    1596             :     {
    1597           0 :         sal_Bool bPersist = sal_False;
    1598           0 :         if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
    1599           0 :             bPersist = m_pImpl->m_pObjectContainer->StoreChildren(sal_True,sal_False);
    1600             :         else
    1601           0 :             bPersist = m_pImpl->m_pObjectContainer->StoreAsChildren(sal_True,sal_True,_xStorageToSaveTo);
    1602             : 
    1603           0 :         if( bPersist )
    1604           0 :             m_pImpl->m_pObjectContainer->SetPersistentEntries(m_pImpl->m_xStorage);
    1605             :         try
    1606             :         {
    1607           0 :             uno::Reference<embed::XTransactedObject> xTransact(_xStorageToSaveTo,uno::UNO_QUERY);
    1608           0 :             if ( xTransact.is() )
    1609           0 :                 xTransact->commit();
    1610             :         }
    1611           0 :         catch (const uno::Exception&)
    1612             :         {
    1613             :             OSL_FAIL("Exception Caught: Could not commit report storage!");
    1614           0 :             throw io::IOException();
    1615             :         }
    1616             : 
    1617           0 :         if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
    1618           0 :             setModified(sal_False);
    1619             :     }
    1620           0 :     if ( xStatusIndicator.is() )
    1621           0 :         xStatusIndicator->end();
    1622           0 : }
    1623             : // -----------------------------------------------------------------------------
    1624           0 : void SAL_CALL OReportDefinition::switchToStorage( const uno::Reference< embed::XStorage >& _xStorage ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException)
    1625             : {
    1626           0 :     if ( !_xStorage.is() )
    1627           0 :         throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1);
    1628             :     {
    1629           0 :         ::osl::MutexGuard aGuard(m_aMutex);
    1630           0 :         ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1631           0 :         m_pImpl->m_xStorage = _xStorage;
    1632           0 :         lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
    1633           0 :         m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
    1634             :     }
    1635             :     // notify our container listeners
    1636           0 :     m_pImpl->m_aStorageChangeListeners.forEach<document::XStorageChangeListener>(
    1637           0 :             ::boost::bind(&document::XStorageChangeListener::notifyStorageChange,_1,boost::cref(static_cast<OWeakObject*>(this)),boost::cref(_xStorage)));
    1638           0 : }
    1639             : // -----------------------------------------------------------------------------
    1640           0 : uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentStorage(  ) throw (io::IOException, uno::Exception, uno::RuntimeException)
    1641             : {
    1642           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1643           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1644           0 :     return m_pImpl->m_xStorage;
    1645             : }
    1646             : // -----------------------------------------------------------------------------
    1647           0 : void SAL_CALL OReportDefinition::addStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw (uno::RuntimeException)
    1648             : {
    1649           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1650           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1651           0 :     if ( xListener.is() )
    1652           0 :         m_pImpl->m_aStorageChangeListeners.addInterface(xListener);
    1653           0 : }
    1654             : // -----------------------------------------------------------------------------
    1655           0 : void SAL_CALL OReportDefinition::removeStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw (uno::RuntimeException)
    1656             : {
    1657           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1658           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1659           0 :     m_pImpl->m_aStorageChangeListeners.removeInterface(xListener);
    1660           0 : }
    1661             : // -----------------------------------------------------------------------------
    1662           0 : sal_Bool OReportDefinition::WriteThroughComponent(
    1663             :     const uno::Reference<lang::XComponent> & xComponent,
    1664             :     const sal_Char* pStreamName,
    1665             :     const sal_Char* pServiceName,
    1666             :     const uno::Sequence<uno::Any> & rArguments,
    1667             :     const uno::Sequence<beans::PropertyValue> & rMediaDesc,
    1668             :     const uno::Reference<embed::XStorage>& _xStorageToSaveTo)
    1669             : {
    1670             :     OSL_ENSURE( NULL != pStreamName, "Need stream name!" );
    1671             :     OSL_ENSURE( NULL != pServiceName, "Need service name!" );
    1672             :     try
    1673             :     {
    1674           0 :         uno::Reference<embed::XStorage> xMyStorage = _xStorageToSaveTo;
    1675             :         // open stream
    1676           0 :         ::rtl::OUString sStreamName = ::rtl::OUString::createFromAscii( pStreamName );
    1677           0 :         uno::Reference<io::XStream> xStream = xMyStorage->openStreamElement( sStreamName,embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
    1678           0 :         if ( !xStream.is() )
    1679           0 :             return sal_False;
    1680           0 :         uno::Reference<io::XOutputStream> xOutputStream = xStream->getOutputStream();
    1681             :         OSL_ENSURE(xOutputStream.is(), "Can't create output stream in package!");
    1682           0 :         if ( ! xOutputStream.is() )
    1683           0 :             return sal_False;
    1684             : 
    1685           0 :         uno::Reference<beans::XPropertySet> xStreamProp(xOutputStream,uno::UNO_QUERY);
    1686             :         OSL_ENSURE(xStreamProp.is(),"No valid preoperty set for the output stream!");
    1687             : 
    1688           0 :         uno::Reference<io::XSeekable> xSeek(xStreamProp,uno::UNO_QUERY);
    1689           0 :         if ( xSeek.is() )
    1690             :         {
    1691             :             OSL_TRACE("Length of stream %i",(int)xSeek->getPosition());
    1692           0 :             xSeek->seek(0);
    1693             :         }
    1694             : 
    1695           0 :         ::rtl::OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
    1696           0 :         ::rtl::OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
    1697           0 :         uno::Any aAny;
    1698           0 :         aAny <<= aMime;
    1699           0 :         xStreamProp->setPropertyValue( aPropName, aAny );
    1700             : 
    1701             :         // encrypt all streams
    1702           0 :         xStreamProp->setPropertyValue( "UseCommonStoragePasswordEncryption",
    1703           0 :                                        uno::makeAny( (sal_Bool)sal_True ) );
    1704             : 
    1705             :         // set buffer and create outputstream
    1706             : 
    1707             :         // write the stuff
    1708             :         sal_Bool bRet = WriteThroughComponent(
    1709             :             xOutputStream, xComponent,
    1710           0 :             pServiceName, rArguments, rMediaDesc );
    1711             :         // finally, commit stream.
    1712           0 :         return bRet;
    1713             :     }
    1714           0 :     catch (const uno::Exception&)
    1715             :     {
    1716           0 :         throw;
    1717             :     }
    1718             : }
    1719             : // -----------------------------------------------------------------------------
    1720           0 : sal_Bool OReportDefinition::WriteThroughComponent(
    1721             :     const uno::Reference<io::XOutputStream> & xOutputStream,
    1722             :     const uno::Reference<lang::XComponent> & xComponent,
    1723             :     const sal_Char* pServiceName,
    1724             :     const uno::Sequence<uno::Any> & rArguments,
    1725             :     const uno::Sequence<beans::PropertyValue> & rMediaDesc)
    1726             : {
    1727             :     OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" );
    1728             :     OSL_ENSURE( xComponent.is(), "Need component!" );
    1729             :     OSL_ENSURE( NULL != pServiceName, "Need component name!" );
    1730             : 
    1731             :     // get component
    1732             :     uno::Reference< xml::sax::XWriter > xSaxWriter(
    1733           0 :         xml::sax::Writer::create(m_aProps->m_xContext) );
    1734             : 
    1735             :     // connect XML writer to output stream
    1736           0 :     xSaxWriter->setOutputStream( xOutputStream );
    1737             : 
    1738             :     // prepare arguments (prepend doc handler to given arguments)
    1739           0 :     uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() );
    1740           0 :     aArgs[0] <<= xSaxWriter;
    1741           0 :     for(sal_Int32 i = 0; i < rArguments.getLength(); i++)
    1742           0 :         aArgs[i+1] = rArguments[i];
    1743             : 
    1744             :     // get filter component
    1745             :     uno::Reference< document::XExporter > xExporter(
    1746           0 :         m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
    1747           0 :             ::rtl::OUString::createFromAscii(pServiceName), aArgs,m_aProps->m_xContext), uno::UNO_QUERY);
    1748             :     OSL_ENSURE( xExporter.is(),
    1749             :             "can't instantiate export filter component" );
    1750           0 :     if( !xExporter.is() )
    1751           0 :         return sal_False;
    1752             : 
    1753             :     // connect model and filter
    1754           0 :     xExporter->setSourceDocument( xComponent );
    1755             : 
    1756             :     // filter!
    1757           0 :     uno::Reference<document::XFilter> xFilter( xExporter, uno::UNO_QUERY );
    1758           0 :     return xFilter->filter( rMediaDesc );
    1759             : }
    1760             : // -----------------------------------------------------------------------------
    1761             : // XLoadable
    1762           0 : void SAL_CALL OReportDefinition::initNew(  ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException)
    1763             : {
    1764           0 :      setPageHeaderOn( sal_True );
    1765           0 :      setPageFooterOn( sal_True );
    1766           0 : }
    1767             : // -----------------------------------------------------------------------------
    1768           0 : void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue >& _rArguments ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException)
    1769             : {
    1770           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1771           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1772             : 
    1773             :     // TODO: this code is pretty similar to what happens in ODatabaseModelImpl::getOrCreateRootStorage,
    1774             :     //       perhaps we can share code here.
    1775             : 
    1776           0 :     ::comphelper::NamedValueCollection aArguments( _rArguments );
    1777             : 
    1778             :     // the source for the to-be-created storage: either an URL, or a stream
    1779           0 :     uno::Reference< io::XInputStream > xStream;
    1780           0 :     ::rtl::OUString sURL;
    1781             : 
    1782           0 :     if ( aArguments.has( "Stream" ) )
    1783             :     {
    1784           0 :         aArguments.get_ensureType( "Stream", xStream );
    1785           0 :         aArguments.remove( "Stream" );
    1786             :     }
    1787           0 :     else if ( aArguments.has( "InputStream" ) )
    1788             :     {
    1789           0 :         aArguments.get_ensureType( "InputStream", xStream );
    1790           0 :         aArguments.remove( "InputStream" );
    1791             :     }
    1792             : 
    1793           0 :     if ( aArguments.has( "FileName" ) )
    1794             :     {
    1795           0 :         aArguments.get_ensureType( "FileName", sURL );
    1796           0 :         aArguments.remove( "FileName" );
    1797             :     }
    1798           0 :     else if ( aArguments.has( "URL" ) )
    1799             :     {
    1800           0 :         aArguments.get_ensureType( "URL", sURL );
    1801           0 :         aArguments.remove( "URL" );
    1802             :     }
    1803             : 
    1804           0 :     uno::Any aStorageSource;
    1805           0 :     if ( xStream.is() )
    1806           0 :         aStorageSource <<= aStorageSource;
    1807           0 :     else if ( !sURL.isEmpty() )
    1808           0 :         aStorageSource <<= sURL;
    1809             :     else
    1810             :         throw lang::IllegalArgumentException(
    1811             :             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No input source (URL or InputStream) found." ) ),
    1812             :                 // TODO: resource
    1813             :             *this,
    1814             :             1
    1815           0 :         );
    1816             : 
    1817           0 :     uno::Reference< lang::XSingleServiceFactory > xStorageFactory( embed::StorageFactory::create( m_aProps->m_xContext ) );
    1818             : 
    1819             :     // open read-write per default, unless told otherwise in the MediaDescriptor
    1820           0 :     uno::Reference< embed::XStorage > xDocumentStorage;
    1821             :     const sal_Int32 nOpenModes[2] = {
    1822             :         embed::ElementModes::READWRITE,
    1823             :         embed::ElementModes::READ
    1824           0 :     };
    1825           0 :     size_t nFirstOpenMode = 0;
    1826           0 :     if ( aArguments.has( "ReadOnly" ) )
    1827             :     {
    1828           0 :         sal_Bool bReadOnly = sal_False;
    1829           0 :         aArguments.get_ensureType( "ReadOnly", bReadOnly );
    1830           0 :         nFirstOpenMode = bReadOnly ? 1 : 0;
    1831             :     }
    1832           0 :     const size_t nLastOpenMode = sizeof( nOpenModes ) / sizeof( nOpenModes[0] ) - 1;
    1833           0 :     for ( size_t i=nFirstOpenMode; i <= nLastOpenMode; ++i )
    1834             :     {
    1835           0 :         uno::Sequence< uno::Any > aStorageCreationArgs(2);
    1836           0 :         aStorageCreationArgs[0] = aStorageSource;
    1837           0 :         aStorageCreationArgs[1] <<= nOpenModes[i];
    1838             : 
    1839             :         try
    1840             :         {
    1841           0 :             xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), uno::UNO_QUERY_THROW );
    1842             :         }
    1843           0 :         catch (const uno::Exception&)
    1844             :         {
    1845           0 :             if ( i == nLastOpenMode )
    1846             :                 throw lang::WrappedTargetException(
    1847             :                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "An error occurred while creating the document storage." ) ),
    1848             :                         // TODO: resource
    1849             :                     *this,
    1850             :                     ::cppu::getCaughtException()
    1851           0 :                 );
    1852             :         }
    1853           0 :     }
    1854             : 
    1855           0 :     if ( !xDocumentStorage.is() )
    1856             :     {
    1857           0 :         throw uno::RuntimeException();
    1858             :     }
    1859             : 
    1860           0 :     impl_loadFromStorage_nolck_throw( xDocumentStorage, aArguments.getPropertyValues() );
    1861             :     // TODO: do we need to take ownership of the storage? In opposite to loadFromStorage, we created the storage
    1862             :     // ourself here, and perhaps this means we're also responsible for it ...?
    1863           0 : }
    1864             : // -----------------------------------------------------------------------------
    1865             : // XVisualObject
    1866           0 : void SAL_CALL OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException)
    1867             : {
    1868           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1869           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1870             :         bool bChanged =
    1871           0 :             (m_pImpl->m_aVisualAreaSize.Width != _aSize.Width ||
    1872           0 :              m_pImpl->m_aVisualAreaSize.Height != _aSize.Height);
    1873           0 :         m_pImpl->m_aVisualAreaSize = _aSize;
    1874           0 :         if( bChanged )
    1875           0 :             setModified( sal_True );
    1876           0 :     m_pImpl->m_nAspect = _nAspect;
    1877           0 : }
    1878             : // -----------------------------------------------------------------------------
    1879           0 : awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException)
    1880             : {
    1881           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1882           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1883           0 :     return m_pImpl->m_aVisualAreaSize;
    1884             : }
    1885             : // -----------------------------------------------------------------------------
    1886           0 : embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException)
    1887             : {
    1888           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1889           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1890           0 :     embed::VisualRepresentation aResult;
    1891           0 :     ::rtl::OUString sImageName(RTL_CONSTASCII_USTRINGPARAM("report"));
    1892           0 :     ::rtl::OUString sMimeType;
    1893           0 :     uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream(sImageName,&sMimeType);
    1894           0 :     if ( xStream.is() )
    1895             :     {
    1896           0 :         uno::Sequence<sal_Int8> aSeq;
    1897           0 :         xStream->readBytes(aSeq,xStream->available());
    1898           0 :         xStream->closeInput();
    1899           0 :         aResult.Data <<= aSeq;
    1900           0 :         aResult.Flavor.MimeType = sMimeType;
    1901           0 :         aResult.Flavor.DataType = ::getCppuType( &aSeq );
    1902             :     }
    1903             : 
    1904           0 :     return aResult;
    1905             : }
    1906             : // -----------------------------------------------------------------------------
    1907           0 : ::sal_Int32 SAL_CALL OReportDefinition::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException)
    1908             : {
    1909           0 :     return embed::EmbedMapUnits::ONE_100TH_MM;
    1910             : }
    1911             : // -----------------------------------------------------------------------------
    1912             : // XModifiable
    1913           0 : ::sal_Bool SAL_CALL OReportDefinition::disableSetModified(  ) throw (uno::RuntimeException)
    1914             : {
    1915           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    1916           0 :     ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
    1917             : 
    1918           0 :     const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
    1919           0 :     m_pImpl->m_bSetModifiedEnabled = sal_False;
    1920           0 :     return bWasEnabled;
    1921             : }
    1922             : 
    1923             : // -----------------------------------------------------------------------------
    1924           0 : ::sal_Bool SAL_CALL OReportDefinition::enableSetModified(  ) throw (uno::RuntimeException)
    1925             : {
    1926           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    1927           0 :     ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
    1928             : 
    1929           0 :     const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
    1930           0 :     m_pImpl->m_bSetModifiedEnabled = sal_True;
    1931           0 :     return bWasEnabled;
    1932             : }
    1933             : 
    1934             : // -----------------------------------------------------------------------------
    1935           0 : ::sal_Bool SAL_CALL OReportDefinition::isSetModifiedEnabled(  ) throw (uno::RuntimeException)
    1936             : {
    1937           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    1938           0 :     ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
    1939             : 
    1940           0 :     return m_pImpl->m_bSetModifiedEnabled;
    1941             : }
    1942             : 
    1943             : // -----------------------------------------------------------------------------
    1944             : // XModifiable
    1945           0 : ::sal_Bool SAL_CALL OReportDefinition::isModified(  ) throw (uno::RuntimeException)
    1946             : {
    1947           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1948           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1949           0 :     return m_pImpl->m_bModified;
    1950             : }
    1951             : // -----------------------------------------------------------------------------
    1952           0 : void SAL_CALL OReportDefinition::setModified( ::sal_Bool _bModified ) throw (beans::PropertyVetoException, uno::RuntimeException)
    1953             : {
    1954           0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    1955           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1956             : 
    1957           0 :     if ( !m_pImpl->m_bSetModifiedEnabled )
    1958           0 :         return;
    1959             : 
    1960           0 :     if ( m_pImpl->m_pReportModel->IsReadOnly() && _bModified )
    1961           0 :         throw beans::PropertyVetoException();
    1962           0 :     if ( m_pImpl->m_bModified != _bModified )
    1963             :     {
    1964           0 :         m_pImpl->m_bModified = _bModified;
    1965           0 :         if ( m_pImpl->m_pReportModel->IsChanged() != _bModified )
    1966           0 :             m_pImpl->m_pReportModel->SetChanged(_bModified);
    1967             : 
    1968           0 :         lang::EventObject aEvent(*this);
    1969           0 :         aGuard.clear();
    1970           0 :         m_pImpl->m_aModifyListeners.notifyEach(&util::XModifyListener::modified,aEvent);
    1971           0 :         notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnModifyChanged")));
    1972           0 :     }
    1973             : }
    1974             : // -----------------------------------------------------------------------------
    1975             : // XModifyBroadcaster
    1976           0 : void SAL_CALL OReportDefinition::addModifyListener( const uno::Reference< util::XModifyListener >& _xListener ) throw (uno::RuntimeException)
    1977             : {
    1978           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1979           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1980           0 :     if ( _xListener.is() )
    1981           0 :         m_pImpl->m_aModifyListeners.addInterface(_xListener);
    1982           0 : }
    1983             : // -----------------------------------------------------------------------------
    1984           0 : void SAL_CALL OReportDefinition::removeModifyListener( const uno::Reference< util::XModifyListener >& _xListener ) throw (uno::RuntimeException)
    1985             : {
    1986           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    1987           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1988           0 :     m_pImpl->m_aModifyListeners.removeInterface(_xListener);
    1989           0 : }
    1990             : // -----------------------------------------------------------------------------
    1991           0 : void OReportDefinition::notifyEvent(const ::rtl::OUString& _sEventName)
    1992             : {
    1993             :     try
    1994             :     {
    1995           0 :         ::osl::ResettableMutexGuard aGuard(m_aMutex);
    1996           0 :         ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    1997           0 :         document::EventObject aEvt(*this, _sEventName);
    1998           0 :         aGuard.clear();
    1999           0 :         m_pImpl->m_aDocEventListeners.notifyEach(&document::XEventListener::notifyEvent,aEvt);
    2000             :     }
    2001           0 :     catch (const uno::Exception&)
    2002             :     {
    2003             :     }
    2004           0 : }
    2005             : // -----------------------------------------------------------------------------
    2006             : // document::XEventBroadcaster
    2007           0 : void SAL_CALL OReportDefinition::addEventListener(const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException)
    2008             : {
    2009           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2010           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2011           0 :     if ( _xListener.is() )
    2012           0 :         m_pImpl->m_aDocEventListeners.addInterface(_xListener);
    2013           0 : }
    2014             : // -----------------------------------------------------------------------------
    2015           0 : void SAL_CALL OReportDefinition::removeEventListener( const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException)
    2016             : {
    2017           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2018           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2019           0 :     m_pImpl->m_aDocEventListeners.removeInterface(_xListener);
    2020           0 : }
    2021             : // -----------------------------------------------------------------------------
    2022             : // document::XEventListener
    2023           0 : void SAL_CALL OReportDefinition::notifyEvent( const document::EventObject& aEvent ) throw (uno::RuntimeException)
    2024             : {
    2025             :     // used only to forward external events (e.g. for doc creation) from the frame loader
    2026             :     // to the global event broadcaster and all other interested doc event listener.
    2027           0 :     notifyEvent(aEvent.EventName);
    2028           0 : }
    2029             : // -----------------------------------------------------------------------------
    2030             : // document::XViewDataSupplier
    2031           0 : uno::Reference< container::XIndexAccess > SAL_CALL OReportDefinition::getViewData(  ) throw (uno::RuntimeException)
    2032             : {
    2033           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2034           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2035           0 :     if ( !m_pImpl->m_xViewData.is() )
    2036             :     {
    2037           0 :         m_pImpl->m_xViewData.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(
    2038           0 :                 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")),m_aProps->m_xContext ),uno::UNO_QUERY);
    2039           0 :         uno::Reference< container::XIndexContainer > xContainer(m_pImpl->m_xViewData,uno::UNO_QUERY);
    2040           0 :         ::std::vector< uno::Reference< frame::XController> >::iterator aIter = m_pImpl->m_aControllers.begin();
    2041           0 :         ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = m_pImpl->m_aControllers.end();
    2042           0 :         for (;aIter != aEnd ; ++aIter)
    2043             :         {
    2044           0 :             if ( aIter->is() )
    2045             :             {
    2046             :                 try
    2047             :                 {
    2048           0 :                     xContainer->insertByIndex(xContainer->getCount(),(*aIter)->getViewData());
    2049             :                 }
    2050           0 :                 catch (const uno::Exception&)
    2051             :                 {
    2052             :                 }
    2053             :             }
    2054           0 :         }
    2055             : 
    2056             :     }
    2057           0 :     return m_pImpl->m_xViewData;
    2058             : }
    2059             : // -----------------------------------------------------------------------------
    2060           0 : void SAL_CALL OReportDefinition::setViewData( const uno::Reference< container::XIndexAccess >& Data ) throw (uno::RuntimeException)
    2061             : {
    2062           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2063           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2064           0 :     m_pImpl->m_xViewData = Data;
    2065           0 : }
    2066             : // -----------------------------------------------------------------------------
    2067           0 : uno::Reference< report::XFunctions > SAL_CALL OReportDefinition::getFunctions() throw (uno::RuntimeException)
    2068             : {
    2069           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2070           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2071           0 :     return m_pImpl->m_xFunctions;
    2072             : }
    2073             : // -----------------------------------------------------------------------------
    2074           0 : uno::Reference< ui::XUIConfigurationManager > SAL_CALL OReportDefinition::getUIConfigurationManager(  ) throw (uno::RuntimeException)
    2075             : {
    2076           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2077           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2078             : 
    2079           0 :     if ( !m_pImpl->m_xUIConfigurationManager.is() )
    2080             :     {
    2081           0 :         m_pImpl->m_xUIConfigurationManager.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager")),m_aProps->m_xContext),
    2082           0 :             uno::UNO_QUERY);
    2083             : 
    2084           0 :         uno::Reference< ui::XUIConfigurationStorage > xUIConfigStorage( m_pImpl->m_xUIConfigurationManager, uno::UNO_QUERY );
    2085           0 :         if ( xUIConfigStorage.is() )
    2086             :         {
    2087           0 :             uno::Reference< embed::XStorage > xConfigStorage;
    2088             :             // initialize ui configuration manager with document substorage
    2089           0 :             xUIConfigStorage->setStorage( xConfigStorage );
    2090           0 :         }
    2091             :     }
    2092             : 
    2093           0 :     return m_pImpl->m_xUIConfigurationManager;
    2094             : }
    2095             : // -----------------------------------------------------------------------------
    2096           0 : uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentSubStorage( const ::rtl::OUString& aStorageName, sal_Int32 nMode ) throw (uno::RuntimeException)
    2097             : {
    2098           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2099           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2100           0 :     return m_pImpl->m_xStorage->openStorageElement(aStorageName, nMode);
    2101             : }
    2102             : // -----------------------------------------------------------------------------
    2103           0 : uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getDocumentSubStoragesNames(  ) throw (io::IOException, uno::RuntimeException)
    2104             : {
    2105           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2106           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2107           0 :     uno::Reference<container::XNameAccess> xNameAccess(m_pImpl->m_xStorage,uno::UNO_QUERY);
    2108           0 :     return xNameAccess.is() ? xNameAccess->getElementNames() : uno::Sequence< ::rtl::OUString >();
    2109             : }
    2110             : // -----------------------------------------------------------------------------
    2111           0 : ::rtl::OUString SAL_CALL OReportDefinition::getMimeType() throw (uno::RuntimeException)
    2112             : {
    2113           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2114           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2115           0 :     return m_pImpl->m_sMimeType;
    2116             : }
    2117             : // -----------------------------------------------------------------------------
    2118           0 : void SAL_CALL OReportDefinition::setMimeType( const ::rtl::OUString& _mimetype ) throw (lang::IllegalArgumentException, uno::RuntimeException)
    2119             : {
    2120           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2121           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2122           0 :     uno::Sequence< ::rtl::OUString > aList = getAvailableMimeTypes();
    2123           0 :     const ::rtl::OUString* pEnd = aList.getConstArray()+aList.getLength();
    2124           0 :     if ( ::std::find(aList.getConstArray(),pEnd,_mimetype) == pEnd )
    2125             :         throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getAvailableMimeTypes()"))
    2126             :                         ,*this
    2127             :                         ,1
    2128           0 :                         ,m_aProps->m_xContext);
    2129           0 :     set(PROPERTY_MIMETYPE,_mimetype,m_pImpl->m_sMimeType);
    2130           0 : }
    2131             : // -----------------------------------------------------------------------------
    2132           0 : uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getAvailableMimeTypes(  ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException)
    2133             : {
    2134           0 :     uno::Sequence< ::rtl::OUString > s_aList(2);
    2135           0 :     s_aList[0] = MIMETYPE_OASIS_OPENDOCUMENT_TEXT;
    2136           0 :     s_aList[1] = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET;
    2137           0 :     return s_aList;
    2138             : }
    2139             : // -----------------------------------------------------------------------------
    2140             : // com::sun::star::XUnoTunnel
    2141           0 : sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException)
    2142             : {
    2143           0 :     sal_Int64 nRet = 0;
    2144           0 :     if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
    2145           0 :         nRet = reinterpret_cast<sal_Int64>(this);
    2146             :     else
    2147             :     {
    2148           0 :         uno::Reference< lang::XUnoTunnel> xUnoTunnel(m_pImpl->m_xNumberFormatsSupplier,uno::UNO_QUERY);
    2149           0 :         if ( xUnoTunnel.is() )
    2150           0 :             nRet = xUnoTunnel->getSomething(rId);
    2151             :     }
    2152           0 :     if ( !nRet )
    2153             :     {
    2154           0 :         uno::Reference< lang::XUnoTunnel> xTunnel;
    2155           0 :         ::comphelper::query_aggregation(m_aProps->m_xProxy,xTunnel);
    2156           0 :         if ( xTunnel.is() )
    2157           0 :             nRet = xTunnel->getSomething(rId);
    2158             :     }
    2159             : 
    2160           0 :     return nRet;
    2161             : }
    2162             : // -----------------------------------------------------------------------------
    2163           0 : uno::Sequence< sal_Int8 > SAL_CALL OReportDefinition::getImplementationId(  ) throw (uno::RuntimeException)
    2164             : {
    2165           0 :     return OReportDefinition::getUnoTunnelImplementationId();
    2166             : }
    2167             : //--------------------------------------------------------------------------
    2168           0 : uno::Sequence< sal_Int8 > OReportDefinition::getUnoTunnelImplementationId()
    2169             : {
    2170             :     static ::cppu::OImplementationId * pId = 0;
    2171           0 :     if (! pId)
    2172             :     {
    2173           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
    2174           0 :         if (! pId)
    2175             :         {
    2176           0 :             static ::cppu::OImplementationId aId;
    2177           0 :             pId = &aId;
    2178           0 :         }
    2179             :     }
    2180           0 :     return pId->getImplementationId();
    2181             : }
    2182             : // -----------------------------------------------------------------------------
    2183           0 : uno::Reference< uno::XComponentContext > OReportDefinition::getContext()
    2184             : {
    2185           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2186           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2187           0 :     return m_aProps->m_xContext;
    2188             : }
    2189             : // -----------------------------------------------------------------------------
    2190           0 : ::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel() const
    2191             : {
    2192           0 :     return m_pImpl->m_pReportModel;
    2193             : }
    2194             : // -----------------------------------------------------------------------------
    2195           0 : ::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition)
    2196             : {
    2197           0 :     ::boost::shared_ptr<rptui::OReportModel> pReportModel;
    2198           0 :     uno::Reference< lang::XUnoTunnel > xUT( _xReportDefinition, uno::UNO_QUERY );
    2199           0 :     if( xUT.is() )
    2200           0 :         pReportModel = reinterpret_cast<OReportDefinition*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( OReportDefinition::getUnoTunnelImplementationId())))->getSdrModel();
    2201           0 :     return pReportModel;
    2202             : }
    2203             : // -----------------------------------------------------------------------------
    2204           0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs)
    2205             :     throw( uno::Exception, uno::RuntimeException )
    2206             : {
    2207           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2208           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2209             : 
    2210           0 :     uno::Reference< uno::XInterface > xRet;
    2211           0 :     if ( aServiceSpecifier.indexOf( "com.sun.star.document.ImportEmbeddedObjectResolver") == 0 )
    2212             :     {
    2213           0 :         uno::Reference< embed::XStorage > xStorage;
    2214           0 :         const uno::Any* pIter = _aArgs.getConstArray();
    2215           0 :         const uno::Any* pEnd  = pIter + _aArgs.getLength();
    2216           0 :         for(;pIter != pEnd ;++pIter)
    2217             :         {
    2218           0 :             beans::NamedValue aValue;
    2219           0 :             *pIter >>= aValue;
    2220           0 :             if ( aValue.Name == "Storage" )
    2221           0 :                 aValue.Value >>= xStorage;
    2222           0 :         }
    2223           0 :         m_pImpl->m_pObjectContainer->SwitchPersistence(xStorage);
    2224           0 :         xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ ));
    2225             :     }
    2226           0 :     return xRet;
    2227             : }
    2228             : // -----------------------------------------------------------------------------
    2229           0 : uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(uno::Exception, uno::RuntimeException)
    2230             : {
    2231           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2232           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2233           0 :     uno::Reference< drawing::XShape > xShape;
    2234           0 :     if ( aServiceSpecifier.indexOf( "com.sun.star.report." ) == 0 )
    2235             :     {
    2236           0 :         if ( aServiceSpecifier == SERVICE_SHAPE )
    2237           0 :             xShape.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")) ),uno::UNO_QUERY_THROW);
    2238           0 :         else if (   aServiceSpecifier == SERVICE_FORMATTEDFIELD
    2239           0 :             ||      aServiceSpecifier == SERVICE_FIXEDTEXT
    2240           0 :             ||      aServiceSpecifier == SERVICE_FIXEDLINE
    2241           0 :             ||      aServiceSpecifier == SERVICE_IMAGECONTROL )
    2242           0 :             xShape.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape")) ),uno::UNO_QUERY_THROW);
    2243             :         else
    2244           0 :             xShape.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ),uno::UNO_QUERY_THROW);
    2245             :     }
    2246           0 :     else if ( aServiceSpecifier.indexOf( "com.sun.star.form.component." ) == 0 )
    2247             :     {
    2248           0 :         xShape.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(aServiceSpecifier,m_aProps->m_xContext),uno::UNO_QUERY);
    2249             :     }
    2250           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.PageStyle") ) == 0 ||
    2251           0 :               aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.FrameStyle") ) == 0 ||
    2252           0 :               aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.GraphicStyle") ) == 0
    2253             :               )
    2254             :     {
    2255           0 :         uno::Reference< style::XStyle> xStyle = new OStyle();
    2256           0 :         xStyle->setName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default")));
    2257           0 :         uno::Reference<beans::XPropertySet> xProp(xStyle,uno::UNO_QUERY);
    2258           0 :         ::rtl::OUString sTray;
    2259           0 :         xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrinterPaperTray")))>>= sTray;
    2260             : 
    2261           0 :         return xStyle.get();
    2262             :     }
    2263           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) == 0 )
    2264             :     {
    2265           0 :         uno::Reference<beans::XPropertySet> xProp = new OStyle();
    2266             : 
    2267           0 :         return xProp.get();
    2268             :     }
    2269           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) == 0 )
    2270             :     {
    2271           0 :         uno::Reference<beans::XPropertySet> xProp = new OStyle();
    2272           0 :         return xProp.get();
    2273             :     }
    2274           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) == 0 )
    2275             :     {
    2276           0 :         if ( !m_pImpl->m_xGradientTable.is() )
    2277           0 :             m_pImpl->m_xGradientTable.set(SvxUnoGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
    2278           0 :         return m_pImpl->m_xGradientTable;
    2279             :     }
    2280           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) == 0 )
    2281             :     {
    2282           0 :         if ( !m_pImpl->m_xHatchTable.is() )
    2283           0 :             m_pImpl->m_xHatchTable.set(SvxUnoHatchTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
    2284           0 :         return m_pImpl->m_xHatchTable;
    2285             :     }
    2286           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) == 0 )
    2287             :     {
    2288           0 :         if ( !m_pImpl->m_xBitmapTable.is() )
    2289           0 :             m_pImpl->m_xBitmapTable.set(SvxUnoBitmapTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
    2290           0 :         return m_pImpl->m_xBitmapTable;
    2291             :     }
    2292           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) == 0 )
    2293             :     {
    2294           0 :         if ( !m_pImpl->m_xTransparencyGradientTable.is() )
    2295           0 :             m_pImpl->m_xTransparencyGradientTable.set(SvxUnoTransGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
    2296           0 :         return m_pImpl->m_xTransparencyGradientTable;
    2297             :     }
    2298           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) == 0 )
    2299             :     {
    2300           0 :         if ( !m_pImpl->m_xDashTable.is() )
    2301           0 :             m_pImpl->m_xDashTable.set(SvxUnoDashTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
    2302           0 :         return m_pImpl->m_xDashTable;
    2303             :     }
    2304           0 :     else if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
    2305             :     {
    2306           0 :         if( !m_pImpl->m_xMarkerTable.is() )
    2307           0 :             m_pImpl->m_xMarkerTable.set(SvxUnoMarkerTable_createInstance( m_pImpl->m_pReportModel.get() ),uno::UNO_QUERY);
    2308           0 :         return m_pImpl->m_xMarkerTable;
    2309             :     }
    2310           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")) == 0 )
    2311           0 :         return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ ));
    2312           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")) == 0 )
    2313           0 :         return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE ));
    2314           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")) == 0 )
    2315             :     {
    2316           0 :         SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE);
    2317           0 :         uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper));
    2318           0 :         pGraphicHelper->release();
    2319           0 :         return xRet;
    2320             :     }
    2321           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")) == 0 )
    2322             :     {
    2323           0 :         SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE);
    2324           0 :         uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper));
    2325           0 :         pGraphicHelper->release();
    2326           0 :         return xRet;
    2327             :     }
    2328           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.data.DataProvider")) == 0 )
    2329             :     {
    2330           0 :         uno::Reference<chart2::data::XDatabaseDataProvider> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps->m_xContext, m_pImpl->m_xActiveConnection ));
    2331           0 :         xDataProvider->setRowLimit(10);
    2332           0 :         uno::Reference< container::XChild > xChild(xDataProvider,uno::UNO_QUERY);
    2333           0 :         if ( xChild.is() )
    2334           0 :             xChild->setParent(*this);
    2335           0 :         return uno::Reference< uno::XInterface >(xDataProvider,uno::UNO_QUERY);
    2336             :     }
    2337           0 :     else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap")) == 0 )
    2338             :     {
    2339           0 :         if ( !m_pImpl->m_xXMLNamespaceMap.is() )
    2340           0 :             m_pImpl->m_xXMLNamespaceMap = comphelper::NameContainer_createInstance( ::getCppuType( (const ::rtl::OUString*) 0 ) ).get();
    2341           0 :         return m_pImpl->m_xXMLNamespaceMap;
    2342             :     }
    2343             :     else
    2344           0 :         xShape.set(SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ),uno::UNO_QUERY_THROW);
    2345             : 
    2346           0 :     return m_pImpl->m_pReportModel->createShape(aServiceSpecifier,xShape);
    2347             : }
    2348             : //-----------------------------------------------------------------------------
    2349           0 : uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getAvailableServiceNames(void) throw( uno::RuntimeException )
    2350             : {
    2351             :     static const ::rtl::OUString aSvxComponentServiceNameList[] =
    2352             :     {
    2353             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText")),
    2354             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl")),
    2355             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle")),
    2356             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle")),
    2357             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle")),
    2358             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults")),
    2359             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")),
    2360             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")),
    2361             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")),
    2362             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")),
    2363             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider")),
    2364             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap")),
    2365             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings")),
    2366             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable")),
    2367             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable")),
    2368             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable")),
    2369             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable")),
    2370             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable")),
    2371             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable"))
    2372           0 :     };
    2373             : 
    2374             :     static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
    2375             : 
    2376           0 :     uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount );
    2377           0 :     ::rtl::OUString* pStrings = aSeq.getArray();
    2378           0 :     for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
    2379           0 :         pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
    2380             : 
    2381           0 :     uno::Sequence< ::rtl::OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
    2382           0 :     return concatServiceNames( aParentSeq, aSeq );
    2383             : }
    2384             : // -----------------------------------------------------------------------------
    2385             : // XShape
    2386           0 : awt::Point SAL_CALL OReportDefinition::getPosition(  ) throw (uno::RuntimeException)
    2387             : {
    2388           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2389           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2390           0 :     if ( m_aProps->m_xShape.is() )
    2391           0 :         return m_aProps->m_xShape->getPosition();
    2392           0 :     return awt::Point(m_aProps->m_nPosX,m_aProps->m_nPosY);
    2393             : }
    2394             : // -----------------------------------------------------------------------------
    2395           0 : void SAL_CALL OReportDefinition::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException)
    2396             : {
    2397           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2398           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2399           0 :     if ( m_aProps->m_xShape.is() )
    2400           0 :         m_aProps->m_xShape->setPosition(aPosition);
    2401           0 :     set(PROPERTY_POSITIONX,aPosition.X,m_aProps->m_nPosX);
    2402           0 :     set(PROPERTY_POSITIONY,aPosition.Y,m_aProps->m_nPosY);
    2403           0 : }
    2404             : // -----------------------------------------------------------------------------
    2405           0 : awt::Size SAL_CALL OReportDefinition::getSize(  ) throw (uno::RuntimeException)
    2406             : {
    2407           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2408           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2409           0 :     if ( m_aProps->m_xShape.is() )
    2410           0 :         return m_aProps->m_xShape->getSize();
    2411           0 :     return awt::Size(m_aProps->m_nWidth,m_aProps->m_nHeight);
    2412             : }
    2413             : // -----------------------------------------------------------------------------
    2414           0 : void SAL_CALL OReportDefinition::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException)
    2415             : {
    2416           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2417           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2418           0 :     if ( m_aProps->m_xShape.is() )
    2419           0 :         m_aProps->m_xShape->setSize(aSize);
    2420           0 :     set(PROPERTY_WIDTH,aSize.Width,m_aProps->m_nWidth);
    2421           0 :     set(PROPERTY_HEIGHT,aSize.Height,m_aProps->m_nHeight);
    2422           0 : }
    2423             : // -----------------------------------------------------------------------------
    2424             : 
    2425             : // XShapeDescriptor
    2426           0 : ::rtl::OUString SAL_CALL OReportDefinition::getShapeType(  ) throw (uno::RuntimeException)
    2427             : {
    2428           0 :    return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape"));
    2429             : }
    2430             : // -----------------------------------------------------------------------------
    2431             : typedef ::cppu::WeakImplHelper2< container::XNameContainer,
    2432             :                              container::XIndexAccess
    2433             :                             > TStylesBASE;
    2434             : class OStylesHelper : public ::cppu::BaseMutex, public TStylesBASE
    2435             : {
    2436             :     typedef ::std::map< ::rtl::OUString, uno::Any  , ::comphelper::UStringMixLess> TStyleElements;
    2437             :     TStyleElements                                  m_aElements;
    2438             :     ::std::vector<TStyleElements::iterator>         m_aElementsPos;
    2439             :     uno::Type                                       m_aType;
    2440             : 
    2441             :     OStylesHelper(const OStylesHelper&);
    2442             :     void operator =(const OStylesHelper&);
    2443             : protected:
    2444           0 :     virtual ~OStylesHelper(){}
    2445             : public:
    2446           0 :     OStylesHelper(const uno::Type _aType = ::getCppuType(static_cast< uno::Reference< container::XElementAccess >* >(NULL)));
    2447             : 
    2448             :     // XNameContainer
    2449             :     virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException);
    2450             :     virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException);
    2451             : 
    2452             :     // XNameReplace
    2453             :     virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException);
    2454             : 
    2455             :     // container::XElementAccess
    2456             :     virtual uno::Type SAL_CALL getElementType(  ) throw(uno::RuntimeException);
    2457             :     virtual sal_Bool SAL_CALL hasElements(  ) throw(uno::RuntimeException);
    2458             :     // container::XIndexAccess
    2459             :     virtual sal_Int32 SAL_CALL getCount(  ) throw(uno::RuntimeException);
    2460             :     virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
    2461             : 
    2462             :     // container::XNameAccess
    2463             :     virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
    2464             :     virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw(uno::RuntimeException);
    2465             :     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException);
    2466             : };
    2467             : 
    2468           0 : OStylesHelper::OStylesHelper(const uno::Type _aType)
    2469             : : cppu::BaseMutex()
    2470           0 : ,m_aType(_aType)
    2471             : {
    2472           0 : }
    2473             : // -----------------------------------------------------------------------------;
    2474             : // container::XElementAccess
    2475           0 : uno::Type SAL_CALL OStylesHelper::getElementType(  ) throw(uno::RuntimeException)
    2476             : {
    2477           0 :     return m_aType;
    2478             : }
    2479             : // -----------------------------------------------------------------------------
    2480           0 : sal_Bool SAL_CALL OStylesHelper::hasElements(  ) throw(uno::RuntimeException)
    2481             : {
    2482           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2483           0 :     return !m_aElementsPos.empty();
    2484             : }
    2485             : // -----------------------------------------------------------------------------
    2486             : // container::XIndexAccess
    2487           0 : sal_Int32 SAL_CALL OStylesHelper::getCount(  ) throw(uno::RuntimeException)
    2488             : {
    2489           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2490           0 :     return m_aElementsPos.size();
    2491             : }
    2492             : // -----------------------------------------------------------------------------
    2493           0 : uno::Any SAL_CALL OStylesHelper::getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
    2494             : {
    2495           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2496           0 :     if ( Index < 0 || Index >= static_cast<sal_Int32>(m_aElementsPos.size()) )
    2497           0 :         throw lang::IndexOutOfBoundsException();
    2498           0 :     return uno::makeAny(m_aElementsPos[Index]->second);
    2499             : }
    2500             : // -----------------------------------------------------------------------------
    2501             : // container::XNameAccess
    2502           0 : uno::Any SAL_CALL OStylesHelper::getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
    2503             : {
    2504           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2505           0 :     TStyleElements::iterator aFind = m_aElements.find(aName);
    2506           0 :     if ( aFind == m_aElements.end() )
    2507           0 :         throw container::NoSuchElementException();
    2508           0 :     return uno::makeAny(aFind->second);
    2509             : }
    2510             : // -----------------------------------------------------------------------------
    2511           0 : uno::Sequence< ::rtl::OUString > SAL_CALL OStylesHelper::getElementNames(  ) throw(uno::RuntimeException)
    2512             : {
    2513           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2514           0 :     uno::Sequence< ::rtl::OUString > aNameList(m_aElementsPos.size());
    2515             : 
    2516           0 :     ::rtl::OUString* pStringArray = aNameList.getArray();
    2517           0 :     ::std::vector<TStyleElements::iterator>::const_iterator aEnd = m_aElementsPos.end();
    2518           0 :     for(::std::vector<TStyleElements::iterator>::const_iterator aIter = m_aElementsPos.begin();         aIter != aEnd;++aIter,++pStringArray)
    2519           0 :         *pStringArray = (*aIter)->first;
    2520             : 
    2521           0 :     return aNameList;
    2522             : }
    2523             : // -----------------------------------------------------------------------------
    2524           0 : sal_Bool SAL_CALL OStylesHelper::hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException)
    2525             : {
    2526           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2527           0 :     return m_aElements.find(aName) != m_aElements.end();
    2528             : }
    2529             : // -----------------------------------------------------------------------------
    2530             : // XNameContainer
    2531           0 : void SAL_CALL OStylesHelper::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException)
    2532             : {
    2533           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2534           0 :     if ( m_aElements.find(aName) != m_aElements.end() )
    2535           0 :         throw container::ElementExistException();
    2536             : 
    2537           0 :     if ( !aElement.isExtractableTo(m_aType) )
    2538           0 :         throw lang::IllegalArgumentException();
    2539             : 
    2540           0 :     m_aElementsPos.push_back(m_aElements.insert(TStyleElements::value_type(aName,aElement)).first);
    2541           0 : }
    2542             : // -----------------------------------------------------------------------------
    2543           0 : void SAL_CALL OStylesHelper::removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException)
    2544             : {
    2545           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2546           0 :     TStyleElements::iterator aFind = m_aElements.find(aName);
    2547           0 :     if ( aFind != m_aElements.end() )
    2548           0 :         throw container::NoSuchElementException();
    2549           0 :     m_aElementsPos.erase(::std::find(m_aElementsPos.begin(),m_aElementsPos.end(),aFind));
    2550           0 :     m_aElements.erase(aFind);
    2551           0 : }
    2552             : // -----------------------------------------------------------------------------
    2553             : // XNameReplace
    2554           0 : void SAL_CALL OStylesHelper::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException)
    2555             : {
    2556           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2557           0 :     TStyleElements::iterator aFind = m_aElements.find(aName);
    2558           0 :     if ( aFind != m_aElements.end() )
    2559           0 :         throw container::NoSuchElementException();
    2560           0 :     if ( !aElement.isExtractableTo(m_aType) )
    2561           0 :         throw lang::IllegalArgumentException();
    2562           0 :     aFind->second = aElement;
    2563           0 : }
    2564             : // -----------------------------------------------------------------------------
    2565           0 : uno::Reference< container::XNameAccess > SAL_CALL OReportDefinition::getStyleFamilies(  ) throw (uno::RuntimeException)
    2566             : {
    2567           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2568           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2569           0 :     if ( !m_pImpl->m_xStyles.is() )
    2570             :     {
    2571           0 :         m_pImpl->m_xStyles = new OStylesHelper();
    2572           0 :         uno::Reference< container::XNameContainer> xStyles(m_pImpl->m_xStyles,uno::UNO_QUERY);
    2573             : 
    2574           0 :         uno::Reference< container::XNameContainer> xPageStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL)));
    2575           0 :         xStyles->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles")),uno::makeAny(xPageStyles));
    2576           0 :         uno::Reference< style::XStyle> xPageStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle"))),uno::UNO_QUERY);
    2577           0 :         xPageStyles->insertByName(xPageStyle->getName(),uno::makeAny(xPageStyle));
    2578             : 
    2579           0 :         uno::Reference< container::XNameContainer> xFrameStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL)));
    2580           0 :         xStyles->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameStyles")),uno::makeAny(xFrameStyles));
    2581           0 :         uno::Reference< style::XStyle> xFrameStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle"))),uno::UNO_QUERY);
    2582           0 :         xFrameStyles->insertByName(xFrameStyle->getName(),uno::makeAny(xFrameStyle));
    2583             : 
    2584           0 :         uno::Reference< container::XNameContainer> xGraphicStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL)));
    2585           0 :         xStyles->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")),uno::makeAny(xGraphicStyles));
    2586           0 :         uno::Reference< style::XStyle> xGraphicStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle"))),uno::UNO_QUERY);
    2587           0 :         xGraphicStyles->insertByName(xGraphicStyle->getName(),uno::makeAny(xGraphicStyle));
    2588             :     }
    2589           0 :     return m_pImpl->m_xStyles;
    2590             : }
    2591           0 : ::rtl::OUString SAL_CALL  OReportDefinition::getIdentifier(  ) throw (uno::RuntimeException)
    2592             : {
    2593           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2594           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2595           0 :     return m_pImpl->m_sIdentifier;
    2596             : }
    2597             : // -----------------------------------------------------------------------------
    2598           0 : void SAL_CALL OReportDefinition::setIdentifier( const ::rtl::OUString& Identifier ) throw (uno::RuntimeException)
    2599             : {
    2600           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2601           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2602           0 :     m_pImpl->m_sIdentifier = Identifier;
    2603           0 : }
    2604             : // -----------------------------------------------------------------------------
    2605             : // XNumberFormatsSupplier
    2606           0 : uno::Reference< beans::XPropertySet > SAL_CALL OReportDefinition::getNumberFormatSettings(  ) throw (uno::RuntimeException)
    2607             : {
    2608           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2609           0 :     if ( m_pImpl->m_xNumberFormatsSupplier.is() )
    2610           0 :         return m_pImpl->m_xNumberFormatsSupplier->getNumberFormatSettings();
    2611           0 :     return uno::Reference< beans::XPropertySet >();
    2612             : }
    2613             : // -----------------------------------------------------------------------------
    2614           0 : uno::Reference< util::XNumberFormats > SAL_CALL OReportDefinition::getNumberFormats(  ) throw (uno::RuntimeException)
    2615             : {
    2616           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2617           0 :     if ( m_pImpl->m_xNumberFormatsSupplier.is() )
    2618           0 :         return m_pImpl->m_xNumberFormatsSupplier->getNumberFormats();
    2619           0 :     return uno::Reference< util::XNumberFormats >();
    2620             : }
    2621             : // -----------------------------------------------------------------------------
    2622           0 : ::comphelper::EmbeddedObjectContainer& OReportDefinition::getEmbeddedObjectContainer() const
    2623             : {
    2624           0 :     return *m_pImpl->m_pObjectContainer;
    2625             : }
    2626             : // -----------------------------------------------------------------------------
    2627           0 : uno::Reference< embed::XStorage > OReportDefinition::getStorage() const
    2628             : {
    2629           0 :     return m_pImpl->m_xStorage;
    2630             : }
    2631             : // -----------------------------------------------------------------------------
    2632           0 : uno::Reference< task::XInteractionHandler > OReportDefinition::getInteractionHandler() const
    2633             : {
    2634             :     uno::Reference< task::XInteractionHandler > xRet(
    2635           0 :         task::InteractionHandler::createWithParent(m_aProps->m_xContext, 0), uno::UNO_QUERY_THROW);
    2636           0 :     return xRet;
    2637             : }
    2638             : // -----------------------------------------------------------------------------
    2639           0 : uno::Reference< sdbc::XConnection > SAL_CALL OReportDefinition::getActiveConnection() throw (uno::RuntimeException)
    2640             : {
    2641           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2642           0 :     return m_pImpl->m_xActiveConnection;
    2643             : }
    2644             : // -----------------------------------------------------------------------------
    2645           0 : void SAL_CALL OReportDefinition::setActiveConnection( const uno::Reference< sdbc::XConnection >& _activeconnection ) throw (lang::IllegalArgumentException, uno::RuntimeException)
    2646             : {
    2647           0 :     if ( !_activeconnection.is() )
    2648           0 :         throw lang::IllegalArgumentException();
    2649           0 :     set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_pImpl->m_xActiveConnection);
    2650           0 : }
    2651             : // -----------------------------------------------------------------------------
    2652           0 : ::rtl::OUString SAL_CALL OReportDefinition::getDataSourceName() throw (uno::RuntimeException)
    2653             : {
    2654           0 :     osl::MutexGuard g(m_aMutex);
    2655           0 :     return m_pImpl->m_sDataSourceName;
    2656             : }
    2657             : // -----------------------------------------------------------------------------
    2658           0 : void SAL_CALL OReportDefinition::setDataSourceName(const ::rtl::OUString& the_value) throw (uno::RuntimeException)
    2659             : {
    2660           0 :     set(PROPERTY_DATASOURCENAME,the_value,m_pImpl->m_sDataSourceName);
    2661           0 : }
    2662             : // -----------------------------------------------------------------------------
    2663           0 : bool OReportDefinition::isEnableSetModified() const
    2664             : {
    2665           0 :     return true;
    2666             : }
    2667           0 : uno::Reference< frame::XTitle > OReportDefinition::impl_getTitleHelper_throw()
    2668             : {
    2669           0 :     SolarMutexGuard aSolarGuard;
    2670             : 
    2671           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2672           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2673             : 
    2674           0 :     if ( ! m_pImpl->m_xTitleHelper.is ())
    2675             :     {
    2676           0 :         uno::Reference< frame::XUntitledNumbers >    xDesktop(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(
    2677           0 :                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop")) ,m_aProps->m_xContext),uno::UNO_QUERY_THROW);
    2678           0 :         uno::Reference< frame::XModel >              xThis   (static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
    2679             : 
    2680           0 :         ::framework::TitleHelper* pHelper = new ::framework::TitleHelper( m_aProps->m_xContext );
    2681           0 :         m_pImpl->m_xTitleHelper = uno::Reference< frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
    2682           0 :         pHelper->setOwner                   (xThis   );
    2683           0 :         pHelper->connectWithUntitledNumbers (xDesktop);
    2684             :     }
    2685             : 
    2686           0 :     return m_pImpl->m_xTitleHelper;
    2687             : }
    2688             : // -----------------------------------------------------------------------------
    2689           0 : uno::Reference< frame::XUntitledNumbers > OReportDefinition::impl_getUntitledHelper_throw()
    2690             : {
    2691           0 :     SolarMutexGuard aSolarGuard;
    2692             : 
    2693           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2694           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2695             : 
    2696           0 :     if ( ! m_pImpl->m_xNumberedControllers.is ())
    2697             :     {
    2698           0 :         uno::Reference< frame::XModel > xThis   (static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
    2699           0 :         ::comphelper::NumberedCollection*         pHelper = new ::comphelper::NumberedCollection();
    2700           0 :         m_pImpl->m_xNumberedControllers = uno::Reference< frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
    2701             : 
    2702           0 :         pHelper->setOwner          (xThis);
    2703           0 :         pHelper->setUntitledPrefix (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")));
    2704             :     }
    2705             : 
    2706           0 :     return m_pImpl->m_xNumberedControllers;
    2707             : }
    2708             : // -----------------------------------------------------------------------------
    2709             : // css.frame.XTitle
    2710           0 : ::rtl::OUString SAL_CALL OReportDefinition::getTitle()
    2711             :     throw (uno::RuntimeException)
    2712             : {
    2713             :     // SYNCHRONIZED ->
    2714           0 :     SolarMutexGuard aSolarGuard;
    2715             : 
    2716           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2717           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2718             : 
    2719           0 :     return impl_getTitleHelper_throw()->getTitle ();
    2720             : }
    2721             : // -----------------------------------------------------------------------------
    2722             : // css.frame.XTitle
    2723           0 : void SAL_CALL OReportDefinition::setTitle( const ::rtl::OUString& sTitle )
    2724             :     throw (uno::RuntimeException)
    2725             : {
    2726             :     // SYNCHRONIZED ->
    2727           0 :     SolarMutexGuard aSolarGuard;
    2728             : 
    2729           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2730           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2731             : 
    2732           0 :     impl_getTitleHelper_throw()->setTitle (sTitle);
    2733           0 : }
    2734             : // -----------------------------------------------------------------------------
    2735             : // css.frame.XTitleChangeBroadcaster
    2736           0 : void SAL_CALL OReportDefinition::addTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
    2737             :     throw (uno::RuntimeException)
    2738             : {
    2739             :     // SYNCHRONIZED ->
    2740           0 :     SolarMutexGuard aSolarGuard;
    2741             : 
    2742           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2743           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2744             : 
    2745           0 :     uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
    2746           0 :     if (xBroadcaster.is ())
    2747           0 :         xBroadcaster->addTitleChangeListener (xListener);
    2748           0 : }
    2749             : // -----------------------------------------------------------------------------
    2750             : // css.frame.XTitleChangeBroadcaster
    2751           0 : void SAL_CALL OReportDefinition::removeTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
    2752             :     throw (uno::RuntimeException)
    2753             : {
    2754             :     // SYNCHRONIZED ->
    2755           0 :     SolarMutexGuard aSolarGuard;
    2756             : 
    2757           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2758           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2759             : 
    2760           0 :     uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
    2761           0 :     if (xBroadcaster.is ())
    2762           0 :         xBroadcaster->removeTitleChangeListener (xListener);
    2763           0 : }
    2764             : // -----------------------------------------------------------------------------
    2765             : // css.frame.XUntitledNumbers
    2766           0 : ::sal_Int32 SAL_CALL OReportDefinition::leaseNumber( const uno::Reference< uno::XInterface >& xComponent )
    2767             :     throw (lang::IllegalArgumentException,
    2768             :            uno::RuntimeException         )
    2769             : {
    2770             :     // object already disposed?
    2771           0 :     SolarMutexGuard aSolarGuard;
    2772           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2773           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2774             : 
    2775           0 :     return impl_getUntitledHelper_throw()->leaseNumber (xComponent);
    2776             : }
    2777             : // -----------------------------------------------------------------------------
    2778             : // css.frame.XUntitledNumbers
    2779           0 : void SAL_CALL OReportDefinition::releaseNumber( ::sal_Int32 nNumber )
    2780             :     throw (lang::IllegalArgumentException,
    2781             :            uno::RuntimeException         )
    2782             : {
    2783             :     // object already disposed?
    2784           0 :     SolarMutexGuard aSolarGuard;
    2785           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2786           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2787             : 
    2788           0 :     impl_getUntitledHelper_throw()->releaseNumber (nNumber);
    2789           0 : }
    2790             : // -----------------------------------------------------------------------------
    2791             : // css.frame.XUntitledNumbers
    2792           0 : void SAL_CALL OReportDefinition::releaseNumberForComponent( const uno::Reference< uno::XInterface >& xComponent )
    2793             :     throw (lang::IllegalArgumentException,
    2794             :            uno::RuntimeException         )
    2795             : {
    2796             :     // object already disposed?
    2797           0 :     SolarMutexGuard aSolarGuard;
    2798           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2799           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2800             : 
    2801           0 :     impl_getUntitledHelper_throw()->releaseNumberForComponent (xComponent);
    2802           0 : }
    2803             : // -----------------------------------------------------------------------------
    2804             : // css.frame.XUntitledNumbers
    2805           0 : ::rtl::OUString SAL_CALL OReportDefinition::getUntitledPrefix()
    2806             :     throw (uno::RuntimeException)
    2807             : {
    2808             :     // object already disposed?
    2809           0 :     SolarMutexGuard aSolarGuard;
    2810           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2811           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2812             : 
    2813           0 :     return impl_getUntitledHelper_throw()->getUntitledPrefix ();
    2814             : }
    2815             : // -----------------------------------------------------------------------------
    2816           0 : uno::Reference< document::XDocumentProperties > SAL_CALL OReportDefinition::getDocumentProperties(  ) throw (uno::RuntimeException)
    2817             : {
    2818           0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2819           0 :     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
    2820           0 :     if ( !m_pImpl->m_xDocumentProperties.is() )
    2821             :     {
    2822           0 :         m_pImpl->m_xDocumentProperties.set(document::DocumentProperties::create(m_aProps->m_xContext));
    2823             :     }
    2824           0 :     return m_pImpl->m_xDocumentProperties;
    2825             : }
    2826             : // -----------------------------------------------------------------------------
    2827           0 : uno::Reference< uno::XComponentContext > OReportDefinition::getContext() const
    2828             : {
    2829           0 :     return m_aProps->m_xContext;
    2830             : }
    2831             : // -----------------------------------------------------------------------------
    2832           0 : uno::Any SAL_CALL OReportDefinition::getTransferData( const datatransfer::DataFlavor& aFlavor ) throw (datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException)
    2833             : {
    2834           0 :     uno::Any aResult;
    2835           0 :     if( isDataFlavorSupported( aFlavor ) )
    2836             :     {
    2837             :         try
    2838             :         {
    2839           0 :             aResult <<= getPreferredVisualRepresentation(0).Data;
    2840             :         }
    2841           0 :         catch (const uno::Exception &)
    2842             :         {
    2843             :             DBG_UNHANDLED_EXCEPTION();
    2844             :         }
    2845             :     }
    2846             :     else
    2847             :     {
    2848           0 :         throw datatransfer::UnsupportedFlavorException(aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this ));
    2849             :     }
    2850             : 
    2851           0 :     return aResult;
    2852             : }
    2853             : // -----------------------------------------------------------------------------
    2854           0 : uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransferDataFlavors(  ) throw (uno::RuntimeException)
    2855             : {
    2856           0 :     uno::Sequence< datatransfer::DataFlavor > aRet(1);
    2857             : 
    2858           0 :     aRet[0] = datatransfer::DataFlavor( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")),
    2859             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PNG")),
    2860           0 :         ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
    2861             : 
    2862           0 :     return aRet;
    2863             : }
    2864             : // -----------------------------------------------------------------------------
    2865           0 : ::sal_Bool SAL_CALL OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor ) throw (uno::RuntimeException)
    2866             : {
    2867           0 :     return aFlavor.MimeType == "image/png";
    2868             : }
    2869             : 
    2870             : // -----------------------------------------------------------------------------
    2871           0 : uno::Reference< document::XUndoManager > SAL_CALL OReportDefinition::getUndoManager(  ) throw (uno::RuntimeException)
    2872             : {
    2873           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    2874           0 :     return m_pImpl->m_pUndoManager.get();
    2875             : }
    2876             : 
    2877             : 
    2878             : // =============================================================================
    2879           0 : }// namespace reportdesign
    2880             : // =============================================================================
    2881             : 
    2882             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10