LCOV - code coverage report
Current view: top level - sw/source/core/draw - drawdoc.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 60 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : 
      20             : #include <svx/svxids.hrc>
      21             : #include <tools/stream.hxx>
      22             : #include <unotools/pathoptions.hxx>
      23             : #include <sot/storage.hxx>
      24             : #include <svl/intitem.hxx>
      25             : #include <editeng/forbiddencharacterstable.hxx>
      26             : 
      27             : #include <unotools/ucbstreamhelper.hxx>
      28             : #include <svx/xtable.hxx>
      29             : #include <svx/drawitem.hxx>
      30             : #include <viewsh.hxx>
      31             : #include <doc.hxx>
      32             : #include <rootfrm.hxx>
      33             : #include <drawdoc.hxx>
      34             : #include <dpage.hxx>
      35             : #include <docsh.hxx>
      36             : #include <shellio.hxx>
      37             : #include <hintids.hxx>
      38             : #include <com/sun/star/embed/ElementModes.hpp>
      39             : 
      40             : using namespace com::sun::star;
      41             : 
      42             : // Constructor
      43             : 
      44           0 : const OUString GetPalettePath()
      45             : {
      46           0 :     SvtPathOptions aPathOpt;
      47           0 :     return aPathOpt.GetPalettePath();
      48             : }
      49             : 
      50           0 : SwDrawDocument::SwDrawDocument( SwDoc* pD ) :
      51           0 :     FmFormModel( ::GetPalettePath(), &pD->GetAttrPool(),
      52           0 :                  pD->GetDocShell(), true ),
      53           0 :     pDoc( pD )
      54             : {
      55           0 :     SetScaleUnit( MAP_TWIP );
      56           0 :     SetSwapGraphics( true );
      57             : 
      58           0 :     SwDocShell* pDocSh = pDoc->GetDocShell();
      59           0 :     if ( pDocSh )
      60             :     {
      61           0 :         SetObjectShell( pDocSh );
      62             :         SvxColorListItem* pColItem = ( SvxColorListItem* )
      63           0 :                                 ( pDocSh->GetItem( SID_COLOR_TABLE ) );
      64             :         XColorListRef pXCol = pColItem ? pColItem->GetColorList() :
      65           0 :                                          XColorList::GetStdColorList();
      66           0 :         SetPropertyList( static_cast<XPropertyList *> (pXCol.get()) );
      67             : 
      68           0 :         if ( !pColItem )
      69           0 :             pDocSh->PutItem( SvxColorListItem( pXCol, SID_COLOR_TABLE ) );
      70             : 
      71           0 :         pDocSh->PutItem( SvxGradientListItem( GetGradientList(), SID_GRADIENT_LIST ));
      72           0 :         pDocSh->PutItem( SvxHatchListItem( GetHatchList(), SID_HATCH_LIST ) );
      73           0 :         pDocSh->PutItem( SvxBitmapListItem( GetBitmapList(), SID_BITMAP_LIST ) );
      74           0 :         pDocSh->PutItem( SvxDashListItem( GetDashList(), SID_DASH_LIST ) );
      75           0 :         pDocSh->PutItem( SvxLineEndListItem( GetLineEndList(), SID_LINEEND_LIST ) );
      76           0 :         pDocSh->PutItem( SfxUInt16Item(SID_ATTR_LINEEND_WIDTH_DEFAULT, 111) );
      77           0 :         SetObjectShell( pDocSh );
      78             :     }
      79             :     else
      80           0 :         SetPropertyList( static_cast<XPropertyList *> (XColorList::GetStdColorList().get()) );
      81             : 
      82             :     // copy all the default values to the SdrModel
      83           0 :     SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool();
      84           0 :     if( pSdrPool )
      85             :     {
      86             :         const sal_uInt16 aWhichRanges[] =
      87             :             {
      88             :                 RES_CHRATR_BEGIN, RES_CHRATR_END,
      89             :                 RES_PARATR_BEGIN, RES_PARATR_END,
      90             :                 0
      91           0 :             };
      92             : 
      93           0 :         SfxItemPool& rDocPool = pD->GetAttrPool();
      94             :         sal_uInt16 nEdtWhich, nSlotId;
      95             :         const SfxPoolItem* pItem;
      96           0 :         for( const sal_uInt16* pRangeArr = aWhichRanges;
      97             :             *pRangeArr; pRangeArr += 2 )
      98           0 :             for( sal_uInt16 nW = *pRangeArr, nEnd = *(pRangeArr+1);
      99             :                     nW < nEnd; ++nW )
     100           0 :                 if( 0 != (pItem = rDocPool.GetPoolDefaultItem( nW )) &&
     101           0 :                     0 != (nSlotId = rDocPool.GetSlotId( nW ) ) &&
     102           0 :                     nSlotId != nW &&
     103           0 :                     0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) &&
     104             :                     nSlotId != nEdtWhich )
     105             :                 {
     106           0 :                     SfxPoolItem* pCpy = pItem->Clone();
     107           0 :                     pCpy->SetWhich( nEdtWhich );
     108           0 :                     pSdrPool->SetPoolDefaultItem( *pCpy );
     109           0 :                     delete pCpy;
     110             :                 }
     111             :     }
     112             : 
     113           0 :     SetForbiddenCharsTable( pD->getForbiddenCharacterTable() );
     114             :     // Implementation for asian compression
     115           0 :     SetCharCompressType( static_cast<sal_uInt16>(pD->getCharacterCompressionType() ));
     116           0 : }
     117             : 
     118             : // Destructor
     119             : 
     120           0 : SwDrawDocument::~SwDrawDocument()
     121             : {
     122           0 :     Broadcast(SdrHint(HINT_MODELCLEARED));
     123             : 
     124           0 :     ClearModel(true);
     125           0 : }
     126             : 
     127             : /** Create a new page (SdPage) and return a pointer to it back.
     128             :  *
     129             :  * The drawing engine is using this method while loading for the creating of
     130             :  * pages (whose type it not even know, because they are inherited from SdrPage).
     131             :  *
     132             :  * @return Pointer to the new page.
     133             :  */
     134           0 : SdrPage* SwDrawDocument::AllocPage(bool bMasterPage)
     135             : {
     136           0 :     SwDPage* pPage = new SwDPage(*this, bMasterPage);
     137           0 :     pPage->SetName(OUString("Controls"));
     138           0 :     return pPage;
     139             : }
     140             : 
     141           0 : uno::Reference<embed::XStorage> SwDrawDocument::GetDocumentStorage() const
     142             : {
     143           0 :     return pDoc->GetDocStorage();
     144             : }
     145             : 
     146           0 : SdrLayerID SwDrawDocument::GetControlExportLayerId( const SdrObject & ) const
     147             : {
     148             :     //for versions < 5.0, there was only Hell and Heaven
     149           0 :     return (SdrLayerID)pDoc->GetHeavenId();
     150             : }
     151             : 
     152           0 : uno::Reference< uno::XInterface > SwDrawDocument::createUnoModel()
     153             : {
     154           0 :     uno::Reference< uno::XInterface > xModel;
     155             : 
     156             :     try
     157             :     {
     158           0 :         if ( GetDoc().GetDocShell() )
     159             :         {
     160           0 :             xModel = GetDoc().GetDocShell()->GetModel();
     161             :         }
     162             :     }
     163           0 :     catch( uno::RuntimeException& )
     164             :     {
     165             :         OSL_FAIL( "<SwDrawDocument::createUnoModel()> - could *not* retrieve model at <SwDocShell>" );
     166             :     }
     167             : 
     168           0 :     return xModel;
     169             : }
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10