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 _PARATR_HXX 28 #define _PARATR_HXX 29 #include <svl/eitem.hxx> 30 #include <svl/stritem.hxx> 31 #include "swdllapi.h" 32 #include <hintids.hxx> 33 #include <calbck.hxx> 34 #include <swatrset.hxx> 35 #include <format.hxx> 36 #include <swtypes.hxx> 37 38 class SwCharFmt; 39 class IntlWrapper; 40 41 /************************************************************************* 42 |* class SwFmtDrop 43 *************************************************************************/ 44 45 #define DROP_WHOLEWORD ((sal_uInt16)0x0001) 46 47 //Wenn ein SwFmtDrop Client ist, so ist dies das CharFmt welches den Font fuer 48 //die DropCaps beschreibt. Ist es kein Client, so wird von der Formatierung 49 //das CharFmt des Absatzes benutzt. 50 //Wird das CharFmt verandert, so wird diese Aenderung ueber das Modify des 51 //SwFmtDrop an die Absatze propagiert. 52 class SW_DLLPUBLIC SwFmtDrop: public SfxPoolItem, public SwClient 53 { 54 SwModify* pDefinedIn; // Modify-Object, in dem der DropCaps steht 55 // kann nur TxtFmtCollection/TxtNode sein 56 sal_uInt16 nDistance; // Abstand zum Textbeginn 57 sal_uInt16 nReadFmt; // fuer den Sw3-Reader: CharFormat-Id (Pool laden!) 58 sal_uInt8 nLines; // Anzahl der Zeilen 59 sal_uInt8 nChars; // Anzahl der Zeichen 60 sal_Bool bWholeWord; // Erstes Wort als Initialen 61 public: 62 TYPEINFO(); //Bereits in der Basisklasse SwClient 63 64 SwFmtDrop(); 65 virtual ~SwFmtDrop(); 66 67 // @@@ public copy ctor, but no copy assignment? 68 SwFmtDrop( const SwFmtDrop & ); 69 private: 70 // @@@ public copy ctor, but no copy assignment? 71 SwFmtDrop & operator= (const SwFmtDrop &); 72 73 protected: 74 virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); 75 76 public: 77 78 // "pure virtual Methoden" vom SfxPoolItem 79 virtual int operator==( const SfxPoolItem& ) const; 80 virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; 81 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 82 SfxMapUnit eCoreMetric, 83 SfxMapUnit ePresMetric, 84 String &rText, 85 const IntlWrapper* pIntl = 0) const; 86 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 87 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 88 89 inline sal_uInt8 GetLines() const { return nLines; } 90 inline sal_uInt8 &GetLines() { return nLines; } 91 92 inline sal_uInt8 GetChars() const { return nChars; } 93 inline sal_uInt8 &GetChars() { return nChars; } 94 95 inline sal_Bool GetWholeWord() const { return bWholeWord; } 96 inline sal_uInt8 &GetWholeWord() { return bWholeWord; } 97 98 inline sal_uInt16 GetDistance() const { return nDistance; } 99 inline sal_uInt16 &GetDistance() { return nDistance; } 100 101 inline const SwCharFmt *GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); } 102 inline SwCharFmt *GetCharFmt() { return (SwCharFmt*)GetRegisteredIn(); } 103 void SetCharFmt( SwCharFmt *pNew ); 104 // erfrage vom Client Informationen 105 virtual sal_Bool GetInfo( SfxPoolItem& ) const; 106 107 // erfrage und setze den Modify-Pointer 108 inline const SwModify* GetDefinedIn() const { return pDefinedIn; } 109 inline void ChgDefinedIn( const SwModify* pNew ) 110 { pDefinedIn = (SwModify*)pNew; } 111 }; 112 113 class SwRegisterItem : public SfxBoolItem 114 { 115 public: 116 TYPEINFO(); 117 118 inline SwRegisterItem( const sal_Bool bRegister = sal_False ); 119 120 // @@@ public copy assignment, but no copy ctor? 121 inline SwRegisterItem& operator=( const SwRegisterItem& rRegister ); 122 123 // "pure virtual Methoden" vom SfxPoolItem 124 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 125 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 126 SfxMapUnit eCoreMetric, 127 SfxMapUnit ePresMetric, 128 String &rText, 129 const IntlWrapper* pIntl = 0 ) const; 130 }; 131 132 inline SwRegisterItem::SwRegisterItem( const sal_Bool bRegister ) : 133 SfxBoolItem( RES_PARATR_REGISTER, bRegister ) 134 {} 135 136 inline SwRegisterItem& SwRegisterItem::operator=( 137 const SwRegisterItem& rRegister ) 138 { 139 SetValue( rRegister.GetValue() ); 140 return *this; 141 } 142 143 class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem 144 { 145 public: 146 TYPEINFO(); 147 148 // --> OD 2008-03-04 #refactorlists# - removed <pDefinedIn> 149 SwNumRuleItem() 150 : SfxStringItem( RES_PARATR_NUMRULE, aEmptyStr ) {} 151 152 SwNumRuleItem( const String& rRuleName ) 153 : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {} 154 155 SwNumRuleItem( const SwNumRuleItem& rCpy ) 156 : SfxStringItem( RES_PARATR_NUMRULE, rCpy.GetValue() ) {} 157 158 SwNumRuleItem& operator=( const SwNumRuleItem& rCpy ) 159 { SetValue( rCpy.GetValue() ); return *this; } 160 // <-- 161 162 // "pure virtual Methoden" vom SfxPoolItem 163 virtual int operator==( const SfxPoolItem& ) const; 164 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 165 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 166 SfxMapUnit eCoreMetric, 167 SfxMapUnit ePresMetric, 168 String &rText, 169 const IntlWrapper* pIntl = 0 ) const; 170 171 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const; 172 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); 173 }; 174 175 class SwParaConnectBorderItem : public SfxBoolItem 176 { 177 public: 178 TYPEINFO(); 179 180 inline SwParaConnectBorderItem( const sal_Bool bConnect = sal_True ); 181 182 // @@@ public copy assignment, but no copy ctor? 183 inline SwParaConnectBorderItem& operator=( const SwParaConnectBorderItem& rConnect ); 184 185 // "pure virtual Methoden" vom SfxPoolItem 186 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 187 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 188 SfxMapUnit eCoreMetric, 189 SfxMapUnit ePresMetric, 190 String &rText, 191 const IntlWrapper* pIntl = 0 ) const; 192 }; 193 194 inline SwParaConnectBorderItem::SwParaConnectBorderItem( const sal_Bool bConnect ) : 195 SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect ) 196 {} 197 198 inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=( 199 const SwParaConnectBorderItem& rConnect ) 200 { 201 SetValue( rConnect.GetValue() ); 202 return *this; 203 } 204 205 206 207 /****************************************************************************** 208 * Implementierung der Paragraph-Attribut Methoden vom SwAttrSet 209 ******************************************************************************/ 210 211 inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(sal_Bool bInP) const 212 { return (const SvxLineSpacingItem&)Get( RES_PARATR_LINESPACING,bInP); } 213 inline const SvxAdjustItem &SwAttrSet::GetAdjust(sal_Bool bInP) const 214 { return (const SvxAdjustItem&)Get( RES_PARATR_ADJUST,bInP); } 215 inline const SvxFmtSplitItem &SwAttrSet::GetSplit(sal_Bool bInP) const 216 { return (const SvxFmtSplitItem&)Get( RES_PARATR_SPLIT,bInP); } 217 inline const SwRegisterItem &SwAttrSet::GetRegister(sal_Bool bInP) const 218 { return (const SwRegisterItem&)Get( RES_PARATR_REGISTER,bInP); } 219 inline const SvxWidowsItem &SwAttrSet::GetWidows(sal_Bool bInP) const 220 { return (const SvxWidowsItem&)Get( RES_PARATR_WIDOWS,bInP); } 221 inline const SvxOrphansItem &SwAttrSet::GetOrphans(sal_Bool bInP) const 222 { return (const SvxOrphansItem&)Get( RES_PARATR_ORPHANS,bInP); } 223 inline const SvxTabStopItem &SwAttrSet::GetTabStops(sal_Bool bInP) const 224 { return (const SvxTabStopItem&)Get( RES_PARATR_TABSTOP,bInP); } 225 inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(sal_Bool bInP) const 226 { return (const SvxHyphenZoneItem&)Get(RES_PARATR_HYPHENZONE,bInP); } 227 inline const SwFmtDrop &SwAttrSet::GetDrop(sal_Bool bInP) const 228 { return (const SwFmtDrop&)Get(RES_PARATR_DROP,bInP); } 229 inline const SwNumRuleItem &SwAttrSet::GetNumRule(sal_Bool bInP) const 230 { return (const SwNumRuleItem&)Get(RES_PARATR_NUMRULE,bInP); } 231 inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(sal_Bool bInP) const 232 { return (const SvxScriptSpaceItem&)Get(RES_PARATR_SCRIPTSPACE,bInP); } 233 inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(sal_Bool bInP) const 234 { return (const SvxHangingPunctuationItem&)Get(RES_PARATR_HANGINGPUNCTUATION,bInP); } 235 inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(sal_Bool bInP) const 236 { return (const SvxForbiddenRuleItem&)Get(RES_PARATR_FORBIDDEN_RULES, bInP); } 237 inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(sal_Bool bInP) const 238 { return (const SvxParaVertAlignItem&)Get( RES_PARATR_VERTALIGN, bInP ); } 239 inline const SvxParaGridItem &SwAttrSet::GetParaGrid(sal_Bool bInP) const 240 { return (const SvxParaGridItem&)Get( RES_PARATR_SNAPTOGRID, bInP ); } 241 inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(sal_Bool bInP) const 242 { return (const SwParaConnectBorderItem&)Get( RES_PARATR_CONNECT_BORDER, bInP ); } 243 244 /****************************************************************************** 245 * Implementierung der Paragraph-Attribut Methoden vom SwFmt 246 ******************************************************************************/ 247 248 inline const SvxLineSpacingItem &SwFmt::GetLineSpacing(sal_Bool bInP) const 249 { return aSet.GetLineSpacing(bInP); } 250 inline const SvxAdjustItem &SwFmt::GetAdjust(sal_Bool bInP) const 251 { return aSet.GetAdjust(bInP); } 252 inline const SvxFmtSplitItem &SwFmt::GetSplit(sal_Bool bInP) const 253 { return aSet.GetSplit(bInP); } 254 inline const SwRegisterItem &SwFmt::GetRegister(sal_Bool bInP) const 255 { return aSet.GetRegister(bInP); } 256 inline const SvxWidowsItem &SwFmt::GetWidows(sal_Bool bInP) const 257 { return aSet.GetWidows(bInP); } 258 inline const SvxOrphansItem &SwFmt::GetOrphans(sal_Bool bInP) const 259 { return aSet.GetOrphans(bInP); } 260 inline const SvxTabStopItem &SwFmt::GetTabStops(sal_Bool bInP) const 261 { return aSet.GetTabStops(bInP); } 262 inline const SvxHyphenZoneItem &SwFmt::GetHyphenZone(sal_Bool bInP) const 263 { return aSet.GetHyphenZone(bInP); } 264 inline const SwFmtDrop &SwFmt::GetDrop(sal_Bool bInP) const 265 { return aSet.GetDrop(bInP); } 266 inline const SwNumRuleItem &SwFmt::GetNumRule(sal_Bool bInP) const 267 { return aSet.GetNumRule(bInP); } 268 inline const SvxScriptSpaceItem& SwFmt::GetScriptSpace(sal_Bool bInP) const 269 { return aSet.GetScriptSpace(bInP) ; } 270 inline const SvxHangingPunctuationItem &SwFmt::GetHangingPunctuation(sal_Bool bInP) const 271 { return aSet.GetHangingPunctuation(bInP) ; } 272 inline const SvxForbiddenRuleItem &SwFmt::GetForbiddenRule(sal_Bool bInP) const 273 { return (const SvxForbiddenRuleItem&)aSet.Get(RES_PARATR_FORBIDDEN_RULES, bInP); } 274 inline const SvxParaVertAlignItem &SwFmt::GetParaVertAlign(sal_Bool bInP) const 275 { return (const SvxParaVertAlignItem&)aSet.Get( RES_PARATR_VERTALIGN, bInP ); } 276 inline const SvxParaGridItem &SwFmt::GetParaGrid(sal_Bool bInP) const 277 { return (const SvxParaGridItem&)aSet.Get( RES_PARATR_SNAPTOGRID, bInP ); } 278 inline const SwParaConnectBorderItem &SwFmt::GetParaConnectBorder(sal_Bool bInP) const 279 { return (const SwParaConnectBorderItem&)aSet.Get( RES_PARATR_CONNECT_BORDER, bInP ); } 280 281 #endif 282