xref: /trunk/main/sw/inc/fmtsrnd.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _FMTSRND_HXX
28 #define _FMTSRND_HXX
29 
30 #include "swdllapi.h"
31 #include <hintids.hxx>
32 #include <format.hxx>
33 #include <svl/eitem.hxx>
34 
35 // --> OD 2006-08-15 #i68520# - refactoring
36 // separate enumeration <SwSurround> in own header file
37 #include <fmtsrndenum.hxx>
38 // <--
39 class IntlWrapper;
40 
41 //SwFmtSurround, wie soll sich der ---------------
42 //  Dokumentinhalt unter dem Rahmen verhalten ---
43 
44 class SW_DLLPUBLIC SwFmtSurround: public SfxEnumItem
45 {
46     sal_Bool    bAnchorOnly :1;
47     sal_Bool    bContour    :1;
48     sal_Bool    bOutside    :1;
49 public:
50     SwFmtSurround( SwSurround eNew = SURROUND_PARALLEL );
51     SwFmtSurround( const SwFmtSurround & );
52     inline SwFmtSurround &operator=( const SwFmtSurround &rCpy );
53 
54     // "pure virtual Methoden" vom SfxPoolItem
55     virtual int             operator==( const SfxPoolItem& ) const;
56     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
57     virtual sal_uInt16          GetValueCount() const;
58     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
59                                     SfxMapUnit eCoreMetric,
60                                     SfxMapUnit ePresMetric,
61                                     String &rText,
62                                     const IntlWrapper*    pIntl = 0 ) const;
63     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
64     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
65 
66 
67     SwSurround GetSurround()const { return SwSurround( GetValue() ); }
68     sal_Bool    IsAnchorOnly()  const { return bAnchorOnly; }
69     sal_Bool    IsContour()     const { return bContour; }
70     sal_Bool    IsOutside()     const { return bOutside; }
71     void    SetSurround  ( SwSurround eNew ){ SfxEnumItem::SetValue( sal_uInt16( eNew ) ); }
72     void    SetAnchorOnly( sal_Bool bNew )      { bAnchorOnly = bNew; }
73     void    SetContour( sal_Bool bNew )         { bContour = bNew; }
74     void    SetOutside( sal_Bool bNew )         { bOutside = bNew; }
75 };
76 
77 inline SwFmtSurround &SwFmtSurround::operator=( const SwFmtSurround &rCpy )
78 {
79     bAnchorOnly = rCpy.IsAnchorOnly();
80     bContour = rCpy.IsContour();
81     bOutside = rCpy.IsOutside();
82     SfxEnumItem::SetValue( rCpy.GetValue() );
83     return *this;
84 }
85 
86 inline const SwFmtSurround &SwAttrSet::GetSurround(sal_Bool bInP) const
87     { return (const SwFmtSurround&)Get( RES_SURROUND,bInP); }
88 
89 inline const SwFmtSurround &SwFmt::GetSurround(sal_Bool bInP) const
90     { return aSet.GetSurround(bInP); }
91 
92 #endif
93 
94