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