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

Generated by: LCOV version 1.10