LCOV - code coverage report
Current view: top level - sfx2/source/doc - frmdescr.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 32 101 31.7 %
Date: 2015-06-13 12:38:46 Functions: 10 25 40.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             : 
      21             : #include <sot/object.hxx>
      22             : #include <tools/stream.hxx>
      23             : #include <vcl/splitwin.hxx>
      24             : #include <svl/itemset.hxx>
      25             : 
      26             : #include <sfx2/frmdescr.hxx>
      27             : #include <sfx2/app.hxx>
      28             : 
      29             : struct SfxFrameDescriptor_Impl
      30             : {
      31             :     Wallpaper*  pWallpaper;
      32             :     SfxItemSet* pArgs;
      33             :     bool        bEditable;
      34             : 
      35        3252 :     SfxFrameDescriptor_Impl() : pWallpaper( NULL ), pArgs( NULL ), bEditable( true ) {}
      36        3245 :     ~SfxFrameDescriptor_Impl()
      37             :     {
      38        3245 :         delete pWallpaper;
      39        3245 :         delete pArgs;
      40        3245 :     }
      41             : };
      42             : 
      43        3252 : SfxFrameDescriptor::SfxFrameDescriptor() :
      44             :     aMargin( -1, -1 ),
      45             :     nWidth( 0L ),
      46             :     eScroll( ScrollingAuto ),
      47             :     eSizeSelector( SIZE_ABS ),
      48             :     nHasBorder( BORDER_YES ),
      49             :     nItemId( 0 ),
      50             :     bResizeHorizontal( true ),
      51             :     bResizeVertical( true ),
      52             :     bHasUI( true ),
      53        3252 :     bReadOnly( false )
      54             : {
      55             : 
      56        3252 :     pImp = new SfxFrameDescriptor_Impl;
      57        3252 : }
      58             : 
      59        6490 : SfxFrameDescriptor::~SfxFrameDescriptor()
      60             : {
      61        3245 :     delete pImp;
      62        3245 : }
      63             : 
      64        3251 : SfxItemSet* SfxFrameDescriptor::GetArgs()
      65             : {
      66        3251 :     if( !pImp->pArgs )
      67        3250 :         pImp->pArgs = new SfxAllItemSet( SfxGetpApp()->GetPool() );
      68        3251 :     return pImp->pArgs;
      69             : }
      70             : 
      71           1 : void SfxFrameDescriptor::SetURL( const OUString& rURL )
      72             : {
      73           1 :     aURL = INetURLObject(rURL);
      74           1 :     SetActualURL( aURL );
      75           1 : }
      76             : 
      77        3251 : void SfxFrameDescriptor::SetActualURL( const OUString& rURL )
      78             : {
      79        3251 :     aActualURL = INetURLObject(rURL);
      80        3251 :     if ( pImp->pArgs )
      81           0 :         pImp->pArgs->ClearItem();
      82        3251 : }
      83             : 
      84           1 : void SfxFrameDescriptor::SetActualURL( const INetURLObject& rURL )
      85             : {
      86           1 :     SetActualURL(rURL.GetMainURL( INetURLObject::DECODE_TO_IURI ));
      87           1 : }
      88             : 
      89        3250 : void SfxFrameDescriptor::SetEditable( bool bSet )
      90             : {
      91        3250 :     pImp->bEditable = bSet;
      92        3250 : }
      93             : 
      94           0 : bool SfxFrameDescriptor::IsEditable() const
      95             : {
      96           0 :     return pImp->bEditable;
      97             : }
      98             : 
      99           0 : SfxFrameDescriptor* SfxFrameDescriptor::Clone( bool bWithIds ) const
     100             : {
     101           0 :     SfxFrameDescriptor *pFrame = new SfxFrameDescriptor;
     102             : 
     103           0 :     pFrame->aURL = aURL;
     104           0 :     pFrame->aActualURL = aActualURL;
     105           0 :     pFrame->aName = aName;
     106           0 :     pFrame->aMargin = aMargin;
     107           0 :     pFrame->nWidth = nWidth;
     108           0 :     pFrame->eSizeSelector = eSizeSelector;
     109           0 :     pFrame->eScroll = eScroll;
     110           0 :     pFrame->bResizeHorizontal = bResizeHorizontal;
     111           0 :     pFrame->bResizeVertical = bResizeVertical;
     112           0 :     pFrame->nHasBorder = nHasBorder;
     113           0 :     pFrame->bHasUI = bHasUI;
     114           0 :     pFrame->SetReadOnly( IsReadOnly() );
     115           0 :     pFrame->SetEditable( IsEditable() );
     116           0 :     if ( pImp->pWallpaper )
     117           0 :         pFrame->pImp->pWallpaper = new Wallpaper( *pImp->pWallpaper );
     118           0 :     if( pImp->pArgs )
     119             :     {
     120             :         // Currently in the clone of SfxAllItemSets there is still a bug ...
     121           0 :         pFrame->pImp->pArgs = new SfxAllItemSet( SfxGetpApp()->GetPool() );
     122           0 :         pFrame->pImp->pArgs->Put(*pImp->pArgs);
     123             :     }
     124             : 
     125           0 :     if ( bWithIds )
     126           0 :         pFrame->nItemId = nItemId;
     127             :     else
     128           0 :         pFrame->nItemId = 0;
     129             : 
     130           0 :     return pFrame;
     131             : }
     132             : 
     133           1 : bool SfxFrameDescriptor::HasFrameBorder() const
     134             : {
     135           1 :     return (nHasBorder & BORDER_YES) != 0;
     136             : }
     137             : 
     138           0 : void SfxFrameDescriptor::SetWallpaper( const Wallpaper& rWallpaper )
     139             : {
     140           0 :     DELETEZ( pImp->pWallpaper );
     141             : 
     142           0 :     if ( rWallpaper.GetStyle() != WALLPAPER_NULL )
     143           0 :         pImp->pWallpaper = new Wallpaper( rWallpaper );
     144           0 : }
     145             : 
     146           0 : SfxFrameProperties& SfxFrameProperties::operator =(
     147             :     const SfxFrameProperties &rProp )
     148             : {
     149           0 :     aURL = rProp.aURL;
     150           0 :     aName = rProp.aName;
     151           0 :     lMarginWidth = rProp.lMarginWidth;
     152           0 :     lMarginHeight = rProp.lMarginHeight;
     153           0 :     lSize = rProp.lSize;
     154           0 :     lSetSize = rProp.lSetSize;
     155           0 :     lFrameSpacing = rProp.lFrameSpacing;
     156           0 :     lInheritedFrameSpacing = rProp.lInheritedFrameSpacing;
     157           0 :     eScroll = rProp.eScroll;
     158           0 :     eSizeSelector = rProp.eSizeSelector;
     159           0 :     eSetSizeSelector = rProp.eSetSizeSelector;
     160           0 :     bHasBorder = rProp.bHasBorder;
     161           0 :     bBorderSet = rProp.bBorderSet;
     162           0 :     bResizable = rProp.bResizable;
     163           0 :     bSetResizable = rProp.bSetResizable;
     164           0 :     bIsRootSet = rProp.bIsRootSet;
     165           0 :     bIsInColSet = rProp.bIsInColSet;
     166           0 :     bHasBorderInherited = rProp.bHasBorderInherited;
     167           0 :     pFrame = rProp.pFrame->Clone();
     168           0 :     return *this;
     169             : }
     170             : 
     171           0 : bool SfxFrameProperties::operator ==( const SfxFrameProperties& rProp ) const
     172             : {
     173           0 :     return aURL == rProp.aURL && aName == rProp.aName && lMarginWidth == rProp.lMarginWidth && lMarginHeight == rProp.lMarginHeight &&
     174           0 :             lSize == rProp.lSize && eScroll == rProp.eScroll && eSizeSelector == rProp.eSizeSelector &&
     175           0 :             lSetSize == rProp.lSetSize && lFrameSpacing == rProp.lFrameSpacing && eSetSizeSelector == rProp.eSetSizeSelector &&
     176           0 :             bHasBorder == rProp.bHasBorder && bBorderSet == rProp.bBorderSet &&
     177           0 :             bResizable == rProp.bResizable && bSetResizable == rProp.bSetResizable;
     178             : }
     179             : 
     180           0 : TYPEINIT1(SfxFrameDescriptorItem, SfxPoolItem);
     181             : 
     182           0 : SfxFrameDescriptorItem::~SfxFrameDescriptorItem()
     183           0 : {}
     184             : 
     185           0 : bool SfxFrameDescriptorItem::operator==( const SfxPoolItem& rAttr ) const
     186             : {
     187             :     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
     188             : 
     189           0 :     return aProperties == static_cast<const SfxFrameDescriptorItem&>(rAttr).aProperties;
     190             : }
     191             : 
     192             : 
     193             : 
     194           0 : SfxPoolItem* SfxFrameDescriptorItem::Clone( SfxItemPool* ) const
     195             : {
     196           0 :     return new SfxFrameDescriptorItem( *this );
     197             : }
     198             : 
     199             : 
     200             : 
     201           0 : bool SfxFrameDescriptorItem::GetPresentation
     202             : (
     203             :     SfxItemPresentation /*ePres*/,
     204             :     SfxMapUnit          /*eCoreUnit*/,
     205             :     SfxMapUnit          /*ePresUnit*/,
     206             :     OUString&           rText,
     207             :     const IntlWrapper *
     208             : )   const
     209             : {
     210           0 :     rText.clear();
     211           0 :     return false;
     212             : }
     213             : 
     214             : 
     215             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11