1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23 #ifndef _FMTFSIZE_HXX
24 #define _FMTFSIZE_HXX
25
26 #include <tools/gen.hxx>
27 #include <svl/poolitem.hxx>
28 #include "swdllapi.h"
29 #include <hintids.hxx>
30 #include <swtypes.hxx>
31 #include <format.hxx>
32
33 class IntlWrapper;
34
35 //Die Framesize ---------------------------------
36
37 enum SwFrmSize
38 {
39 ATT_VAR_SIZE, //Frm ist in der Var-Richtung variabel
40 ATT_FIX_SIZE, //Frm ist in der Var-Richtung unbeweglich
41 ATT_MIN_SIZE //Der Wert in der Var-Richtung beschreibt eine
42 //Minimalgroesse, die nicht unter- wohl aber
43 //ueberschritten werden kann.
44 };
45
46 class SW_DLLPUBLIC SwFmtFrmSize: public SfxPoolItem
47 {
48 Size aSize;
49 SwFrmSize eFrmHeightType;
50 SwFrmSize eFrmWidthType;
51 sal_uInt8 nWidthPercent; //Fuer Tabellen kann die Breite in Prozent
52 sal_uInt8 nHeightPercent; //angegeben sein.
53 //Fuer Rahmen koennen Hoehe und/oder Breite
54 //in Prozent angegeben sein. Wenn nur eine
55 //der Angaben in Prozent angeben ist, kann
56 //durch den ausgezeichneten Wert 0xFF in der
57 //anderen Prozentangabe bestimmt werden, das
58 //sich diese Richtung proportional zur anderen
59 //verhaelt. Basis fuer die Umrechnung sind fuer
60 //diesen Fall die Angaben in der Size.
61 //Die Prozentwerte beziehen sich immer auf die
62 //Umgebung in der das Objekt steht (PrtArea)
63 //Auf die Bildschirmbreite abzueglich Raender
64 //in der BrowseView wenn die Umgebung die Seite
65 //ist.
66 public:
67 SwFmtFrmSize( SwFrmSize eSize = ATT_VAR_SIZE,
68 SwTwips nWidth = 0, SwTwips nHeight = 0 );
69 SwFmtFrmSize& operator=( const SwFmtFrmSize& rCpy );
70 SwFmtFrmSize(const SwFmtFrmSize&) = default;
71
72 // "pure virtual Methoden" vom SfxPoolItem
73 virtual int operator==( const SfxPoolItem& ) const;
74 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
75 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
76 SfxMapUnit eCoreMetric,
77 SfxMapUnit ePresMetric,
78 String &rText,
79 const IntlWrapper* pIntl = 0 ) const;
80 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
81 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
82
GetHeightSizeType() const83 SwFrmSize GetHeightSizeType() const { return eFrmHeightType; }
SetHeightSizeType(SwFrmSize eSize)84 void SetHeightSizeType( SwFrmSize eSize ) { eFrmHeightType = eSize; }
85
GetWidthSizeType() const86 SwFrmSize GetWidthSizeType() const { return eFrmWidthType; }
SetWidthSizeType(SwFrmSize eSize)87 void SetWidthSizeType( SwFrmSize eSize ) { eFrmWidthType = eSize; }
88
GetSize() const89 const Size& GetSize() const { return aSize; }
SetSize(const Size & rNew)90 void SetSize( const Size &rNew ) { aSize = rNew; }
91
GetHeight() const92 SwTwips GetHeight() const { return aSize.Height(); }
GetWidth() const93 SwTwips GetWidth() const { return aSize.Width(); }
SetHeight(const SwTwips nNew)94 void SetHeight( const SwTwips nNew ) { aSize.Height() = nNew; }
SetWidth(const SwTwips nNew)95 void SetWidth ( const SwTwips nNew ) { aSize.Width() = nNew; }
96
GetHeightPercent() const97 sal_uInt8 GetHeightPercent() const{ return nHeightPercent; }
GetWidthPercent() const98 sal_uInt8 GetWidthPercent() const { return nWidthPercent; }
SetHeightPercent(sal_uInt8 n)99 void SetHeightPercent( sal_uInt8 n ) { nHeightPercent = n; }
SetWidthPercent(sal_uInt8 n)100 void SetWidthPercent ( sal_uInt8 n ) { nWidthPercent = n; }
101 };
102
GetFrmSize(sal_Bool bInP) const103 inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(sal_Bool bInP) const
104 { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); }
105
GetFrmSize(sal_Bool bInP) const106 inline const SwFmtFrmSize &SwFmt::GetFrmSize(sal_Bool bInP) const
107 { return aSet.GetFrmSize(bInP); }
108
109 #endif
110