LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/sfx2 - frmdescr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 34 2.9 %
Date: 2013-07-09 Functions: 1 17 5.9 %
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             : #ifndef _SFX_FRMDESCRHXX
      20             : #define _SFX_FRMDESCRHXX
      21             : 
      22             : #include "sal/config.h"
      23             : #include "sfx2/dllapi.h"
      24             : 
      25             : #include <sfx2/sfxsids.hrc>
      26             : #include <svl/poolitem.hxx>
      27             : #include <tools/urlobj.hxx>
      28             : #include <tools/string.hxx>
      29             : #include <tools/gen.hxx>
      30             : 
      31             : class SvStream;
      32             : struct SfxFrameDescriptor_Impl;
      33             : class SfxFrameDescriptor;
      34             : class Wallpaper;
      35             : 
      36             : //===========================================================================
      37             : // The SfxFrame descriptors build a recursive structure, that covers all the
      38             : // required data in-order to display the frame document.
      39             : // Through a SfxFrameSetDescriptor access is given to the whole underlying
      40             : // structure. Due to the nature of the SfxFrames document, the
      41             : // SfxFramesSetDescriptor is not only the content of this document, but also
      42             : // describes the view on it. The FrameSet is made up of lines, which in turn,
      43             : // contains the actual window . A line can be horizontally or vertically
      44             : // aligned, from which also the alignment of the FrameSet is given.
      45             : //===========================================================================
      46             : 
      47             : enum ScrollingMode
      48             : {
      49             :     ScrollingYes,
      50             :     ScrollingNo,
      51             :     ScrollingAuto
      52             : };
      53             : 
      54             : enum SizeSelector
      55             : {
      56             :     SIZE_ABS,
      57             :     SIZE_PERCENT,
      58             :     SIZE_REL
      59             : };
      60             : 
      61             : #define BORDER_SET          2
      62             : #define BORDER_YES          1
      63             : #define BORDER_NO           0
      64             : #define SPACING_NOT_SET     -1L
      65             : #define SIZE_NOT_SET        -1L
      66             : 
      67             : class SfxItemSet;
      68             : struct SfxFrameProperties;
      69             : 
      70             : class SFX2_DLLPUBLIC SfxFrameDescriptor
      71             : {
      72             :     INetURLObject           aURL;
      73             :     INetURLObject           aActualURL;
      74             :     String                  aName;
      75             :     Size                    aMargin;
      76             :     long                    nWidth;
      77             :     ScrollingMode           eScroll;
      78             :     SizeSelector            eSizeSelector;
      79             :     sal_uInt16                  nHasBorder;
      80             :     sal_uInt16                  nItemId;
      81             :     sal_Bool                    bResizeHorizontal;
      82             :     sal_Bool                    bResizeVertical;
      83             :     sal_Bool                    bHasUI;
      84             :     sal_Bool                    bReadOnly;
      85             :     SfxFrameDescriptor_Impl* pImp;
      86             : 
      87             : public:
      88             :                             SfxFrameDescriptor();
      89             :                             ~SfxFrameDescriptor();
      90             : 
      91             :                             // FileName/URL
      92             :     SfxItemSet*             GetArgs();
      93           0 :     const INetURLObject&    GetURL() const
      94           0 :                             { return aURL; }
      95             :     void                    SetURL( const String& rURL );
      96             :     const INetURLObject&    GetActualURL() const
      97             :                             { return aActualURL; }
      98             :     void                    SetActualURL( const INetURLObject& rURL );
      99             :     void                    SetActualURL( const String& rURL );
     100           1 :     void                    SetReadOnly( sal_Bool bSet ) { bReadOnly = bSet;}
     101           0 :     sal_Bool                    IsReadOnly(  ) const { return bReadOnly;}
     102             :     void                    SetEditable( sal_Bool bSet );
     103             :     sal_Bool                    IsEditable() const;
     104             : 
     105             :                             // Size
     106             :     void                    SetWidth( long n )
     107             :                             { nWidth = n; }
     108             :     void                    SetWidthPercent( long n )
     109             :                             { nWidth = n; eSizeSelector = SIZE_PERCENT; }
     110             :     void                    SetWidthRel( long n )
     111             :                             { nWidth = n; eSizeSelector = SIZE_REL; }
     112             :     void                    SetWidthAbs( long n )
     113             :                             { nWidth = n; eSizeSelector = SIZE_ABS; }
     114             :     long                    GetWidth() const
     115             :                             { return nWidth; }
     116             :     SizeSelector            GetSizeSelector() const
     117             :                             { return eSizeSelector; }
     118             :     sal_Bool                    IsResizable() const
     119             :                             { return bResizeHorizontal && bResizeVertical; }
     120           0 :     void                    SetResizable( sal_Bool bRes )
     121           0 :                             { bResizeHorizontal = bResizeVertical = bRes; }
     122             : 
     123             :                             // FrameName
     124           0 :     const String&           GetName() const
     125           0 :                             { return aName; }
     126           0 :     void                    SetName( const String& rName )
     127           0 :                             { aName = rName; }
     128             : 
     129             :                             // Margin, Scrolling
     130           0 :     const Size&             GetMargin() const
     131           0 :                             { return aMargin; }
     132           0 :     void                    SetMargin( const Size& rMargin )
     133           0 :                             { aMargin = rMargin; }
     134           0 :     ScrollingMode           GetScrollingMode() const
     135           0 :                             { return eScroll; }
     136           0 :     void                    SetScrollingMode( ScrollingMode eMode )
     137           0 :                             { eScroll = eMode; }
     138             : 
     139             :                             // FrameBorder
     140             :     void                    SetWallpaper( const Wallpaper& rWallpaper );
     141             :     sal_Bool                    HasFrameBorder() const;
     142             : 
     143           0 :     sal_Bool                    IsFrameBorderOn() const
     144           0 :                             { return ( nHasBorder & BORDER_YES ) != 0; }
     145             : 
     146           0 :     void                    SetFrameBorder( sal_Bool bBorder )
     147             :                             {
     148             :                                 nHasBorder = bBorder ?
     149             :                                             BORDER_YES | BORDER_SET :
     150           0 :                                             BORDER_NO | BORDER_SET;
     151           0 :                             }
     152           0 :     sal_Bool                    IsFrameBorderSet() const
     153           0 :                             { return (nHasBorder & BORDER_SET) != 0; }
     154           0 :     void                    ResetBorder()
     155           0 :                             { nHasBorder = 0; }
     156             : 
     157             :     sal_Bool                    HasUI() const
     158             :                             { return bHasUI; }
     159             :     void                    SetHasUI( sal_Bool bOn )
     160             :                             { bHasUI = bOn; }
     161             : 
     162             :                             // Attribute for Splitwindow
     163             :     sal_uInt16                  GetItemId() const
     164             :                             { return nItemId; }
     165             :     void                    SetItemId( sal_uInt16 nId )
     166             :                             { nItemId = nId; }
     167             : 
     168             :                             // Copy for example for Views
     169             :     SfxFrameDescriptor*     Clone( sal_Bool bWithIds = sal_True ) const;
     170             : };
     171             : 
     172             : // No block to implement a =operator
     173             : struct SfxFrameProperties
     174             : {
     175             :     String                              aURL;
     176             :     String                              aName;
     177             :     long                                lMarginWidth;
     178             :     long                                lMarginHeight;
     179             :     long                                lSize;
     180             :     long                                lSetSize;
     181             :     long                                lFrameSpacing;
     182             :     long                                lInheritedFrameSpacing;
     183             :     ScrollingMode                       eScroll;
     184             :     SizeSelector                        eSizeSelector;
     185             :     SizeSelector                        eSetSizeSelector;
     186             :     sal_Bool                                bHasBorder;
     187             :     sal_Bool                                bBorderSet;
     188             :     sal_Bool                                bResizable;
     189             :     sal_Bool                                bSetResizable;
     190             :     sal_Bool                                bIsRootSet;
     191             :     sal_Bool                                bIsInColSet;
     192             :     sal_Bool                                bHasBorderInherited;
     193             :     SfxFrameDescriptor*                 pFrame;
     194             : 
     195             : private:
     196             :     SfxFrameProperties( SfxFrameProperties& ) {}
     197             : public:
     198           0 :                                         SfxFrameProperties()
     199             :                                             : lMarginWidth( SIZE_NOT_SET ),
     200             :                                               lMarginHeight( SIZE_NOT_SET ),
     201             :                                               lSize( 1L ),
     202             :                                               lSetSize( 1L ),
     203             :                                               lFrameSpacing( SPACING_NOT_SET ),
     204             :                                               lInheritedFrameSpacing( SPACING_NOT_SET ),
     205             :                                               eScroll( ScrollingAuto ),
     206             :                                               eSizeSelector( SIZE_REL ),
     207             :                                               eSetSizeSelector( SIZE_REL ),
     208             :                                               bHasBorder( sal_True ),
     209             :                                               bBorderSet( sal_True ),
     210             :                                               bResizable( sal_True ),
     211             :                                               bSetResizable( sal_True ),
     212             :                                               bIsRootSet( sal_False ),
     213             :                                               bIsInColSet( sal_False ),
     214             :                                               bHasBorderInherited( sal_True ),
     215           0 :                                               pFrame( 0 ) {}
     216             : 
     217           0 :                                         ~SfxFrameProperties() { delete pFrame; }
     218             : 
     219             :     int                                 operator ==( const SfxFrameProperties& ) const;
     220             :     SfxFrameProperties&                 operator =( const SfxFrameProperties &rProp );
     221             : };
     222             : 
     223             : class SfxFrameDescriptorItem : public SfxPoolItem
     224             : {
     225             :     SfxFrameProperties                  aProperties;
     226             : public:
     227             :                                         TYPEINFO();
     228             : 
     229             :                                         SfxFrameDescriptorItem ( const sal_uInt16 nId = SID_FRAMEDESCRIPTOR )
     230             :                                             : SfxPoolItem( nId )
     231             :                                         {}
     232             : 
     233           0 :                                         SfxFrameDescriptorItem( const SfxFrameDescriptorItem& rCpy )
     234           0 :                                             : SfxPoolItem( rCpy )
     235             :                                         {
     236           0 :                                             aProperties = rCpy.aProperties;
     237           0 :                                         }
     238             : 
     239             :     virtual                             ~SfxFrameDescriptorItem();
     240             : 
     241             :     virtual int                         operator ==( const SfxPoolItem& ) const;
     242             :     SfxFrameDescriptorItem&             operator =( const SfxFrameDescriptorItem & );
     243             : 
     244             :     virtual SfxItemPresentation         GetPresentation( SfxItemPresentation ePres,
     245             :                                             SfxMapUnit eCoreMetric,
     246             :                                             SfxMapUnit ePresMetric,
     247             :                                             OUString &rText, const IntlWrapper * = 0 ) const;
     248             : 
     249             :     virtual SfxPoolItem*                Clone( SfxItemPool *pPool = 0 ) const;
     250             : 
     251             :     const SfxFrameProperties&           GetProperties() const
     252             :                                         { return aProperties; }
     253             :     void                                SetProperties( const SfxFrameProperties& rProp )
     254             :                                         { aProperties = rProp; }
     255             : };
     256             : 
     257             : #endif // #ifndef _SFX_FRMDESCRHXX
     258             : 
     259             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10