Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _FMTFSIZE_HXX
29 : : #define _FMTFSIZE_HXX
30 : :
31 : : #include <tools/gen.hxx>
32 : : #include <svl/poolitem.hxx>
33 : : #include "swdllapi.h"
34 : : #include <hintids.hxx>
35 : : #include <swtypes.hxx>
36 : : #include <format.hxx>
37 : :
38 : : class IntlWrapper;
39 : :
40 : : //Frame size.
41 : :
42 : : enum SwFrmSize
43 : : {
44 : : ATT_VAR_SIZE, // Frame is variable in Var-direction.
45 : : ATT_FIX_SIZE, // Frame cannot be moved in Var-direction.
46 : : ATT_MIN_SIZE // Value in Var-direction gives minimum
47 : : // (can be exceeded but not be less).
48 : : };
49 : :
50 [ - + ]: 26511 : class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
51 : : {
52 : : Size aSize;
53 : : SwFrmSize eFrmHeightType;
54 : : SwFrmSize eFrmWidthType;
55 : : sal_uInt8 nWidthPercent;
56 : : sal_uInt8 nHeightPercent;
57 : :
58 : : // For tables: width can be given in percent.
59 : :
60 : : // For frames: height and/or width may be given in percent.
61 : : // If only one of these percentage values is given, the value 0xFF
62 : : // used instead of the missing percentage value indicates this side
63 : : // being proportional to the given one.
64 : : // The calculation in this case is based upon the values in Size.
65 : : // Percentages are always related to the environment in which
66 : : // the object is placed (PrtArea) and to the screen width
67 : : // minus borders in BrowseView if the environment is the page.
68 : :
69 : :
70 : :
71 : : public:
72 : : SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
73 : : SwTwips nWidth = 0, SwTwips nHeight = 0 );
74 : : SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );
75 : :
76 : : // "Pure virtual methods" of SfxPoolItem.
77 : : virtual int operator==( const SfxPoolItem& ) const;
78 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
79 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
80 : : SfxMapUnit eCoreMetric,
81 : : SfxMapUnit ePresMetric,
82 : : String &rText,
83 : : const IntlWrapper* pIntl = 0 ) const;
84 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
85 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
86 : :
87 : 14665 : SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
88 : 71 : void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }
89 : :
90 : 3792 : SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
91 : 102 : void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }
92 : :
93 : 58850 : const Size& GetSize() const { return aSize; }
94 : 2919 : void SetSize( const Size &rNew ) { aSize = rNew; }
95 : :
96 : 4973 : SwTwips GetHeight() const { return aSize.Height(); }
97 : 20661 : SwTwips GetWidth() const { return aSize.Width(); }
98 : 350 : void SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
99 : 1443 : void SetWidth ( const SwTwips nNew ) { aSize.Width() = nNew; }
100 : :
101 : 11181 : sal_uInt8 GetHeightPercent() const{ return nHeightPercent; }
102 : 11488 : sal_uInt8 GetWidthPercent() const { return nWidthPercent; }
103 : 10 : void SetHeightPercent( sal_uInt8 n ) { nHeightPercent = n; }
104 : 91 : void SetWidthPercent ( sal_uInt8 n ) { nWidthPercent = n; }
105 : : };
106 : :
107 : 55798 : inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(sal_Bool bInP) const
108 : 55798 : { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
109 : :
110 : 41183 : inline const SwFmtFrmSize &SwFmt::GetFrmSize(sal_Bool bInP) const
111 : 41183 : { return aSet.GetFrmSize(bInP); }
112 : :
113 : : #endif
114 : :
115 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|