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 _FLTSHELL_HXX
24 #define _FLTSHELL_HXX
25
26 #include <deque>
27
28 #include <com/sun/star/text/HoriOrientation.hpp>
29 #include <com/sun/star/text/VertOrientation.hpp>
30 #include <com/sun/star/text/RelOrientation.hpp>
31 #include <hintids.hxx>
32 #include <vcl/keycod.hxx>
33 #include <tools/datetime.hxx>
34 #include <editeng/brkitem.hxx>
35 #include <poolfmt.hxx>
36 #include <fmtornt.hxx>
37 #include <ndindex.hxx>
38 #include <IDocumentRedlineAccess.hxx>
39
40 class SwTOXBase;
41 class SwFltShell;
42 class SwField;
43 class SwFieldType;
44 class Graphic;
45 class SwTableBox;
46 class SwDoc;
47 class SwPaM;
48
49 using namespace com::sun::star;
50
SwFltClearFlag(sal_uLong & rFieldFlags,int no)51 inline void SwFltClearFlag(sal_uLong& rFieldFlags, int no)
52 { rFieldFlags &= ~(1L << no); }
53
SwFltSetFlag(sal_uLong & rFieldFlags,int no)54 inline void SwFltSetFlag(sal_uLong& rFieldFlags, int no)
55 { rFieldFlags |= 1L << no; }
56
SwFltGetFlag(sal_uLong nFieldFlags,int no)57 inline sal_Bool SwFltGetFlag(sal_uLong nFieldFlags, int no)
58 { return (nFieldFlags & (1L << no)) != 0; }
59
60 // Stack-Eintrag fuer die Attribute Es werden immer Pointer auf neue Attribute uebergeben.
61 class SwFltStackEntry
62 {
63 public:
64 SwNodeIndex nMkNode;
65 SwNodeIndex nPtNode;
66 SfxPoolItem * pAttr;// Format Attribute
67 long nHandle; // fuer verschachtelte Attrs, z.B. Bookmarks
68 xub_StrLen nMkCntnt;// Nachbildung von Mark()
69 xub_StrLen nPtCntnt;// Nachbildung von GetPoint()
70
71 sal_Bool bOld; // to mark Attributes *before* skipping field results
72 sal_Bool bLocked;
73 sal_Bool bCopied;
74 sal_Bool bConsumedByField;
75 //Modify here for #119405, by easyfan, 2012-05-24
76 sal_Int32 mnStartCP;
77 sal_Int32 mnEndCP;
78 bool bIsParaEnd;
79 //End of modification, by easyfan
80
81 SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt );
82 SW_DLLPUBLIC SwFltStackEntry(const SwFltStackEntry& rEntry);
83 SW_DLLPUBLIC ~SwFltStackEntry();
84
85 void SetStartPos(const SwPosition & rStartPos);
86 SW_DLLPUBLIC void SetEndPos( const SwPosition & rEndPos);
87 SW_DLLPUBLIC sal_Bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, sal_Bool bCheck );
88 //Modify here for #119405, by easyfan, 2012-05-24
SetStartCP(sal_Int32 nCP)89 void SetStartCP(sal_Int32 nCP) {mnStartCP = nCP;}
SetEndCP(sal_Int32 nCP)90 void SetEndCP(sal_Int32 nCP) {mnEndCP = nCP;}
GetStartCP() const91 sal_Int32 GetStartCP() const {return mnStartCP;}
GetEndCP() const92 sal_Int32 GetEndCP() const {return mnEndCP;}
93 //End of modification, by easyfan
94 //Modify here for #119405, by chengjh, 2012-08-16
95 bool IsAbleMakeRegion();
IsParaEnd()96 bool IsParaEnd(){ return bIsParaEnd;}
SetIsParaEnd(bool bArg)97 void SetIsParaEnd(bool bArg){ bIsParaEnd = bArg;}
98 //End
99 };
100
101 class SW_DLLPUBLIC SwFltControlStack
102 {
103 typedef std::deque<SwFltStackEntry*> Entries;
104 typedef Entries::iterator myEIter;
105 Entries maEntries;
106 friend class SwFltShell;
107
108 sal_uLong nFieldFlags;
109 KeyCode aEmptyKeyCode; // fuer Bookmarks
110 //Modify for #119405 by chengjh, 2012-08-16
111 private:
112 bool bHasSdOD;
113 bool bSdODChecked;
114 //End
115
116 protected:
117 SwDoc* pDoc;
118 sal_Bool bIsEndStack;
119
120 void MoveAttrs( const SwPosition& rPos );
121 virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* pEntry);
122 //Modify here for #119405, by easyfan, 2012-05-24
GetCurrAttrCP() const123 virtual sal_Int32 GetCurrAttrCP() const {return -1;}
IsParaEndInCPs(sal_Int32,sal_Int32,bool) const124 virtual bool IsParaEndInCPs(sal_Int32 /* nStart */,sal_Int32 /* nEnd */,bool /* bSdOD=true */) const {return false;}
125 //End of modification, by easyfan
126 //Modify for #119405 by chengjh, 2012-08-16
127 //Clear the para end position recorded in reader intermittently for the least impact on loading performance
ClearParaEndPosition()128 virtual void ClearParaEndPosition(){};
CheckSdOD(sal_Int32,sal_Int32)129 virtual bool CheckSdOD(sal_Int32 /* nStart */,sal_Int32 /* nEnd */){return false;}
130 bool HasSdOD();
131 //End
132
133 public:
134 enum Flags
135 {
136 HYPO,
137 TAGS_DO_ID,
138 TAGS_VISIBLE,
139 BOOK_TO_VAR_REF,
140 BOOK_AND_REF,
141 TAGS_IN_TEXT,
142 ALLOW_FLD_CR,
143 NO_FLD_CR,
144 DONT_HARD_PROTECT
145 };
146
147 SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl);
148 virtual ~SwFltControlStack();
149
IsFlagSet(Flags no) const150 sal_Bool IsFlagSet(Flags no) const { return ::SwFltGetFlag(nFieldFlags, no);}
151
152 void NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr );
153
154 virtual void SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand = LONG_MAX, sal_Bool consumedByField=sal_False);
155
156 void StealAttr(const SwPosition* pPos, sal_uInt16 nAttrId = 0);
157 void MarkAllAttrsOld();
158 void KillUnlockedAttrs(const SwPosition& pPos);
159 SfxPoolItem* GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos = 0);
160 const SfxPoolItem* GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich);
161 const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
162 void Delete(const SwPaM &rPam);
163
Count()164 Entries::size_type Count() { return maEntries.size(); }
operator [](Entries::size_type nIndex)165 SwFltStackEntry* operator[](Entries::size_type nIndex)
166 { return maEntries[nIndex]; }
167 void DeleteAndDestroy(Entries::size_type nCnt);
168 };
169
170 class SwFltAnchorClient;
171
172 class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem
173 {
174 SwFrmFmt* pFrmFmt;
175 SwFltAnchorClient * pClient;
176
177 public:
178 SwFltAnchor(SwFrmFmt* pFlyFmt);
179 SwFltAnchor(const SwFltAnchor&);
180 virtual ~SwFltAnchor();
181
182 // "pure virtual Methoden" vom SfxPoolItem
183 virtual int operator==(const SfxPoolItem&) const;
184 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
185 void SetFrmFmt(SwFrmFmt * _pFrmFmt);
186 const SwFrmFmt* GetFrmFmt() const;
187 SwFrmFmt* GetFrmFmt();
188 };
189
190 class SwFltAnchorClient : public SwClient
191 {
192 SwFltAnchor * m_pFltAnchor;
193
194 public:
195 SwFltAnchorClient(SwFltAnchor * pFltAnchor);
196
197 virtual void Modify (const SfxPoolItem *pOld, const SfxPoolItem *pNew);
198 };
199
200
201 class SW_DLLPUBLIC SwFltRedline : public SfxPoolItem
202 {
203 public:
204 DateTime aStamp;
205 DateTime aStampPrev;
206 RedlineType_t eType;
207 RedlineType_t eTypePrev;
208 sal_uInt16 nAutorNo;
209 sal_uInt16 nAutorNoPrev;
210
SwFltRedline(RedlineType_t eType_,sal_uInt16 nAutorNo_,const DateTime & rStamp_,RedlineType_t eTypePrev_=nsRedlineType_t::REDLINE_INSERT,sal_uInt16 nAutorNoPrev_=USHRT_MAX,const DateTime * pStampPrev_=0)211 SwFltRedline(RedlineType_t eType_,
212 sal_uInt16 nAutorNo_,
213 const DateTime& rStamp_,
214 RedlineType_t eTypePrev_ = nsRedlineType_t::REDLINE_INSERT,
215 sal_uInt16 nAutorNoPrev_ = USHRT_MAX,
216 const DateTime* pStampPrev_ = 0)
217 : SfxPoolItem(RES_FLTR_REDLINE), aStamp(rStamp_), eType(eType_),
218 eTypePrev(eTypePrev_), nAutorNo(nAutorNo_), nAutorNoPrev(nAutorNoPrev_)
219 {
220 if( pStampPrev_ )
221 aStampPrev = *pStampPrev_;
222 }
223
SwFltRedline(const SwFltRedline & rCpy)224 SwFltRedline(const SwFltRedline& rCpy):
225 SfxPoolItem(RES_FLTR_REDLINE),
226 aStamp( rCpy.aStamp ),
227 aStampPrev( rCpy.aStampPrev ),
228 eType( rCpy.eType ),
229 eTypePrev( rCpy.eTypePrev ),
230 nAutorNo( rCpy.nAutorNo ),
231 nAutorNoPrev( rCpy.nAutorNoPrev )
232 {}
233 // "pure virtual Methoden" vom SfxPoolItem
234 virtual int operator==(const SfxPoolItem& rItem) const;
235 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
236 };
237
238 class SW_DLLPUBLIC SwFltBookmark : public SfxPoolItem
239 {
240 private:
241 friend class SwFltShell; // darf aName und aVal uebersetzen
242
243 long mnHandle;
244 String maName;
245 String maVal;
246 bool mbIsTOCBookmark;
247
248 public:
249 SwFltBookmark( const String& rNa,
250 const String& rVa,
251 long nHand,
252 const bool bIsTOCBookmark = false );
253 SwFltBookmark( const SwFltBookmark& );
254
255 // "pure virtual Methoden" vom SfxPoolItem
256 virtual int operator==(const SfxPoolItem&) const;
257 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
258
GetHandle() const259 long GetHandle() const { return mnHandle; }
GetName() const260 const String& GetName() const { return maName; }
GetValSys() const261 const String& GetValSys() const { return maVal; }
IsTOCBookmark() const262 bool IsTOCBookmark() const
263 {
264 return mbIsTOCBookmark;
265 }
266 };
267
268 class SW_DLLPUBLIC SwFltTOX : public SfxPoolItem
269 {
270 SwTOXBase* pTOXBase;
271 sal_uInt16 nCols;
272 sal_Bool bHadBreakItem; // there was a break item BEFORE insertion of the TOX
273 sal_Bool bHadPageDescItem; // ...
274 public:
275 SwFltTOX(SwTOXBase* pBase, sal_uInt16 _nCols = 0);
276 SwFltTOX(const SwFltTOX&);
277 // "pure virtual Methoden" vom SfxPoolItem
278 virtual int operator==(const SfxPoolItem&) const;
279 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
GetBase()280 SwTOXBase* GetBase() { return pTOXBase; }
GetCols() const281 sal_uInt16 GetCols() const { return nCols; }
SetHadBreakItem(sal_Bool bVal)282 void SetHadBreakItem( sal_Bool bVal ) { bHadBreakItem = bVal; }
SetHadPageDescItem(sal_Bool bVal)283 void SetHadPageDescItem( sal_Bool bVal ) { bHadPageDescItem = bVal; }
HadBreakItem() const284 sal_Bool HadBreakItem() const { return bHadBreakItem; }
HadPageDescItem() const285 sal_Bool HadPageDescItem() const { return bHadPageDescItem; }
286 };
287
288 class SwFltSection : public SfxPoolItem
289 {
290 SwSectionData * m_pSection;
291
292 public:
293 SwFltSection( SwSectionData *const pSect );
294 SwFltSection( const SwFltSection& );
295 // "pure virtual Methoden" vom SfxPoolItem
296 virtual int operator==(const SfxPoolItem&) const;
297 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
GetSectionData()298 SwSectionData * GetSectionData() { return m_pSection; }
299 };
300 // Der WWEndStack verhaelt sich wie der WWControlStck, nur dass die Attribute
301 // auf ihm bis ans Ende des Dokuments gehortet werden, falls auf sie noch
302 // zugegriffen werden muss (z.B. Book/RefMarks, Index u.s.w.)
303 class SwFltEndStack : public SwFltControlStack
304 {
305 public:
SwFltEndStack(SwDoc * pDo,sal_uLong nFieldFl)306 SwFltEndStack(SwDoc* pDo, sal_uLong nFieldFl)
307 :SwFltControlStack(pDo, nFieldFl)
308 {
309 bIsEndStack = sal_True;
310 }
311 };
312
313 ///////////////////////////////////////////////////////////////////////////////////////////
314 //
315 // hier beginnen die fuer ww1-filter neu erstellten klassen. diese
316 // sollen eine simple oberflaeche fuer die komplexen strukturen des
317 // writers speziell fuer filter sein. soll etwas in den writer gegeben
318 // werden, soll ein << reichen. hierfuer sind neue typen erzeugt
319 // worden. ausserdem soll moeglich sein das objekt nach vielen
320 // zustaenden der momentanen formatierung zu fragen, sodasz diese der
321 // filter nicht selbst verwalten musz.
322 //
323 // den anfang macht eine vorlagen-oberklasse, die einfachen umgang mit
324 // formatvorlagen ermoeglicht:
325 //
326
327 class SwFltOutBase
328 {
329 SwDoc& rDoc;
330 protected:
331 RndStdIds eFlyAnchor;
332 sal_Bool bFlyAbsPos;
333
GetDoc()334 SwDoc& GetDoc() { return rDoc; }
335 SfxItemSet* NewFlyDefaults();
336 SwFltOutBase(SwDoc& rDocu);
337 virtual ~SwFltOutBase();
338 public:
339 virtual SwFltOutBase& operator << (const SfxPoolItem& rItem) = 0;
340
341 virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich) = 0;
342 virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich) = 0;
343
344 virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich);
345 virtual sal_Bool BeginTable();
346 virtual void NextTableCell();
347 virtual void NextTableRow();
348 virtual void SetTableWidth(SwTwips nW);
349 virtual void SetTableOrient(sal_Int16 eOri);
350 virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell);
351 virtual void SetCellHeight(SwTwips nH);
352 virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell);
353 virtual void SetCellSpace(sal_uInt16 nSp);
354 virtual void DeleteCell(sal_uInt16 nCell);
355 virtual void EndTable();
356
357 virtual sal_Bool IsInFly() = 0;
358 virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr) = 0;
359 virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich) = 0;
360 virtual sal_Bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
361 const SfxItemSet* pMoreAttrs = 0 );
362 virtual void SetFlyAnchor( RndStdIds eAnchor );
363 virtual void EndFly();
364 };
365
366 class SwFltOutDoc : public SwFltOutBase
367 {
368 SwFltControlStack& rStack;
369 SwFltEndStack& rEndStack;
370 SwPaM* pPaM;
371 SwFrmFmt* pFly;
372 // table items:
373 const SwTable* pTable;
374 SwPosition* pTabSavedPos; // set when in table
375 SwPosition* pFlySavedPos; // set when in fly
376 SwTwips nTableWidth;
377 sal_uInt16 usTableX;
378 sal_uInt16 usTableY;
379 sal_Bool bReadNoTbl; // Keine Tabellen
380
381 SwTableBox* GetBox(sal_uInt16 ny, sal_uInt16 nx = USHRT_MAX);
382 sal_Bool SeekCell( short nRow, short nCol, sal_Bool bPam );
383 void SplitTable();
384 public:
SwFltOutDoc(SwDoc & rDocu,SwPaM * pP,SwFltControlStack & rStk,SwFltEndStack & rEStk)385 SwFltOutDoc(SwDoc& rDocu, SwPaM* pP, SwFltControlStack& rStk,
386 SwFltEndStack& rEStk)
387 : SwFltOutBase(rDocu), rStack(rStk), rEndStack(rEStk), pPaM(pP),
388 pFly(0), pTable(0), pTabSavedPos(0), pFlySavedPos(0),
389 nTableWidth(0), bReadNoTbl(sal_False)
390 {}
391
SetReadNoTable()392 void SetReadNoTable() { bReadNoTbl = sal_True; }
IsTableWidthSet() const393 sal_Bool IsTableWidthSet() const { return 0 != nTableWidth; }
394
395 virtual SwFltOutBase& operator << (const SfxPoolItem& rItem);
396
397 virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
398 virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
399
400 sal_Bool IsInTable();
401 virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich);
402 virtual sal_Bool BeginTable();
403 virtual void NextTableCell();
404 virtual void NextTableRow();
405 virtual void SetTableWidth(SwTwips nW);
406 virtual void SetTableOrient(sal_Int16 eOri);
407 virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell);
408 virtual void SetCellHeight(SwTwips nH);
409 virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell);
410 virtual void SetCellSpace(sal_uInt16 nSp);
411 virtual void DeleteCell(sal_uInt16 nCell);
412 virtual void EndTable();
413
414 SwFrmFmt* MakeFly( RndStdIds eAnchor, SfxItemSet* pSet );
415 virtual sal_Bool IsInFly();
416 virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr);
417 virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
418 virtual sal_Bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
419 const SfxItemSet* pMoreAttrs = 0 );
420 virtual void EndFly();
421 };
422
423 class SwFltFormatCollection : public SwFltOutBase
424 {
425 SwTxtFmtColl* pColl;
426 SfxItemSet* pFlyAttrs; // Simulation der Flys in Styles
427 sal_Bool bHasFly;
428 public:
429 SwFltFormatCollection(SwDoc&, RES_POOL_COLLFMT_TYPE nType);
430 SwFltFormatCollection(SwDoc&, const String& rName );
~SwFltFormatCollection()431 ~SwFltFormatCollection() { if( pFlyAttrs ) delete pFlyAttrs; }
432
Reset()433 void Reset()
434 {
435 // --> OD 2007-01-25 #i73790# - method renamed
436 pColl->ResetAllFmtAttr();
437 // <--
438 pColl->SetAuto(sal_False); // nach Empfehlung JP
439 }
Derived(SwTxtFmtColl * pBase)440 void Derived(SwTxtFmtColl* pBase)
441 { pColl->SetDerivedFrom(pBase); }
442
443 // SwTxtFmtColl* Search(String, CharSet eSrc);
GetColl()444 SwTxtFmtColl* GetColl() { return pColl; }
SetHasFly()445 void SetHasFly() { bHasFly = sal_True; }
GetpFlyAttrs()446 SfxItemSet* GetpFlyAttrs() { return pFlyAttrs; }
447
448 virtual SwFltOutBase& operator << (const SfxPoolItem& rItem);
449 virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
450 virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
451
452 virtual sal_Bool IsInFly();
453 virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr);
454 virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
455 virtual sal_Bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
456 const SfxItemSet* pMoreAttrs = 0 );
457 sal_Bool BeginStyleFly( SwFltOutDoc* pOutDoc );
458 virtual void EndFly();
459 };
460
461 //
462 // dies nun ist die zauberhafteklasse: intention: alle eins nach dem
463 // andern hinein'pipe'n. wird eine besondere struktur eingelesen, wird
464 // eine klammer geoeffnet (BeginXxx) und nach beendigung geschlossen
465 // (EndXxx), wobei Xxx zB fuer Fusznoten, Kopf/Fuszzeilen oder
466 // Tabellen steht. Styles funktionieren auch so, haben aber den
467 // unterschied, keine buchstaben zu akzeptieren.
468 // beginnt ein neuer absatz oder aehnliches, wird NextXxx genutzt.
469 // hier ist moeglich, Tab, Zeilenumbruch, Absatzende, Seitenumbruch
470 // und Sektionsende einzufuegen.
471 //
472 class SwFltShell
473 {
474 SwFltOutDoc* pOutDoc;
475 SwFltFormatCollection* pColls[256];
476 SwFltOutBase* pOut;
477
478 // SwFltFormatCollection* pFormat; // set when in style-mode
479 SwPageDesc* pCurrentPageDesc;
480 SwPosition* pSavedPos; // set, when in footnote or header/footer -mode
481 #ifdef None
482 #undef None
483 #endif
484 enum SubModes {
485 None,
486 Header,
487 Footer,
488 Footnote,
489 Table,
490 Fly,
491 Style,
492 Max
493 } eSubMode;
494
495 // Fly items:
496 sal_uInt16 nAktStyle; // zur Indizierung pStyleFlyTable
497 //
498 SwFltControlStack aStack;
499 SwFltEndStack aEndStack;
500 SwPaM* pPaM;
501 //
502 String sBaseURL;
503 sal_uInt16 nPageDescOffset; // fuers update der pagedescs
504 CharSet eSrcCharSet; // charset der quelle
505 friend class SwFltControlStack;
506 sal_Bool bNewDoc;
507 sal_Bool bStdPD;
508 sal_Bool bProtect;
509
510 public:
511 SwFltShell(SwDoc* , SwPaM& , const String& rBaseURL, sal_Bool bNew, sal_uLong = 0);
512 ~SwFltShell();
513
GetDoc()514 SwDoc& GetDoc() { return *aStack.pDoc; }
515
SetCharSet(CharSet eNew)516 CharSet SetCharSet(CharSet eNew) { CharSet eOld = eSrcCharSet;
517 eSrcCharSet = eNew;
518 return eOld;
519 }
SetUseStdPageDesc()520 void SetUseStdPageDesc() { bStdPD = sal_True; }
SetProtect()521 void SetProtect() { bProtect = sal_True; }
522 SwPageDesc* MakePageDesc(SwPageDesc* pFirstPageDesc = NULL);
GetPageDesc()523 SwPageDesc& GetPageDesc() { return *pCurrentPageDesc; }
NextTab()524 void NextTab() { (*this) << sal_uInt8(0x09); }
NextLine()525 void NextLine() { (*this) << sal_uInt8(0x0a); }
526 void NextParagraph();
527 void NextPage();
NextSection()528 void NextSection() { pCurrentPageDesc = MakePageDesc(); }
529
530 SwFltShell& AddGraphic( const String& rPicName );
531 SwFltShell& AddError( const sal_Char* pErr );
532 SwFltShell& EndItem( sal_uInt16 nId );
533 SwFltShell& SetStyle( sal_uInt16 nStyle );
534
535 SwFltShell& operator << ( Graphic& );
536 SwFltShell& operator << ( SwFltBookmark& aBook );
537 void SetBookEnd(long nHandle);
538 SwFltShell& operator << ( const String& ); // Vorsicht: CHARSET_ANSI
539 SwFltShell& operator << ( const sal_Unicode );
540 SwFltShell& operator << ( const SwField& );
operator <<(const SfxPoolItem & rItem)541 SwFltShell& operator << ( const SfxPoolItem& rItem )
542 { *pOut << rItem; return *this; }
543
544 // SwFltShell& operator >> (SfxPoolItem&);
545 // methode zum beenden einer sub-sektion, zB Fusznote etc
End()546 void End() { eSubMode = None; }
547 // methoden zur verwaltung von Header/Footer
548 void BeginHeader(SwPageDesc* =NULL);
549 void BeginFooter(SwPageDesc* =NULL);
550 void EndHeaderFooter();
551 // methoden zur verwaltung von FootNotes
552 void BeginFootnote();
553 void EndFootnote();
554 // methoden zur verwaltung von Tabellen
IsInTable()555 sal_Bool IsInTable() {
556 return ( pOut == pOutDoc ) ? pOutDoc->IsInTable() : 0; }
GetCellAttr(sal_uInt16 nWhich)557 const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich) {
558 return pOut->GetCellAttr(nWhich); }
BeginTable()559 sal_Bool BeginTable() {
560 sal_Bool b = pOut->BeginTable();
561 if(b) eSubMode = Table;
562 return b; }
NextTableCell()563 void NextTableCell() {
564 pOut->NextTableCell(); }
NextTableRow()565 void NextTableRow() {
566 pOut->NextTableRow(); }
SetTableWidth(SwTwips nW)567 void SetTableWidth(SwTwips nW) {
568 pOut->SetTableWidth(nW); }
IsTableWidthSet()569 sal_Bool IsTableWidthSet() {
570 return pOutDoc->IsTableWidthSet(); }
SetTableOrient(sal_Int16 eOri)571 void SetTableOrient(sal_Int16 eOri) {
572 pOut->SetTableOrient(eOri); }
SetCellWidth(SwTwips nWidth,sal_uInt16 nCell=USHRT_MAX)573 void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell = USHRT_MAX ) {
574 pOut->SetCellWidth(nWidth, nCell); }
SetCellHeight(SwTwips nH)575 void SetCellHeight(SwTwips nH) {
576 pOut->SetCellHeight(nH); }
SetCellBorder(const SvxBoxItem & rFmtBox,sal_uInt16 nCell=USHRT_MAX)577 void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell = USHRT_MAX ){
578 pOut->SetCellBorder(rFmtBox, nCell); }
SetCellSpace(sal_uInt16 nSp)579 void SetCellSpace(sal_uInt16 nSp) {
580 pOut->SetCellSpace(nSp); }
DeleteCell(sal_uInt16 nCell=USHRT_MAX)581 void DeleteCell(sal_uInt16 nCell = USHRT_MAX) {
582 pOut->DeleteCell(nCell); }
EndTable()583 void EndTable() {
584 pOut->EndTable(); }
585 // methoden zur verwaltung von Flys
IsInFly()586 sal_Bool IsInFly() { return pOut->IsInFly(); }
587 sal_Bool BeginFly( RndStdIds eAnchor = FLY_AT_PARA, sal_Bool bAbsolutePos = sal_False );
SetFlyAnchor(RndStdIds eAnchor)588 void SetFlyAnchor( RndStdIds eAnchor )
589 { pOut->SetFlyAnchor( eAnchor ); }
590 void SetFlyXPos( short nXPos, sal_Int16 eHRel = com::sun::star::text::RelOrientation::FRAME,
591 sal_Int16 eHAlign = com::sun::star::text::HoriOrientation::NONE );
592 void SetFlyYPos( short nYPos, sal_Int16 eVRel = com::sun::star::text::RelOrientation::FRAME,
593 sal_Int16 eVAlign = com::sun::star::text::VertOrientation::NONE );
SetFlyFrmAttr(const SfxPoolItem & rAttr)594 void SetFlyFrmAttr(const SfxPoolItem& rAttr){
595 pOut->SetFlyFrmAttr( rAttr ); }
596 void EndFly();
597 // methoden zur verwaltung von styles:
BeginStyle(sal_uInt16 nUserCode,RES_POOL_COLLFMT_TYPE aType)598 void BeginStyle(sal_uInt16 nUserCode, RES_POOL_COLLFMT_TYPE aType)
599 {
600 ASSERT(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds");
601 ASSERT(pColls[nUserCode] == NULL, "user codes dublicate");
602 if (eSubMode == Style)
603 EndStyle();
604 pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), aType);
605 nAktStyle = nUserCode;
606 eSubMode = Style;
607 }
BeginStyle(sal_uInt16 nUserCode,const String & rName)608 void BeginStyle( sal_uInt16 nUserCode, const String& rName )
609 {
610 ASSERT(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds");
611 ASSERT(pColls[nUserCode] == NULL, "user codes dublicate");
612 if (eSubMode == Style)
613 EndStyle();
614 pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), rName );
615 nAktStyle = nUserCode;
616 eSubMode = Style;
617 }
IsStyleImported(sal_uInt16 nUserCode)618 sal_Bool IsStyleImported(sal_uInt16 nUserCode)
619 { return pColls[nUserCode] != 0; }
BaseStyle(sal_uInt16 nBased)620 void BaseStyle(sal_uInt16 nBased)
621 {
622 ASSERT(eSubMode == Style, "wrong state for style");
623 ASSERT(pColls[nBased], "Style based on noexistent style" );
624 if( eSubMode == Style && pColls[nBased]->GetColl() )
625 ((SwFltFormatCollection*)pOut)->Derived(pColls[nBased]->GetColl());
626 }
627 void NextStyle(sal_uInt16 nWhich, sal_uInt16 nNext);
628
EndStyle()629 void EndStyle()
630 {
631 // ASSERT(eSubMode == Style, "wrong state for style");
632 nAktStyle = 0;
633 pOut = pOutDoc;
634 eSubMode = None;
635 }
636
IsFlagSet(SwFltControlStack::Flags no) const637 sal_Bool IsFlagSet(SwFltControlStack::Flags no) const
638 { return aStack.IsFlagSet(no); }
639 void ConvertUStr( String& rInOut );
640 String QuoteStr( const String& rIn );
641
642 // folgende status kann die shell verwalten:
643 const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
644 const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
645 const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
646 SwFieldType* GetSysFldType(sal_uInt16 eWhich);
647 sal_Bool GetWeightBold();
648 sal_Bool GetPostureItalic();
649 sal_Bool GetCrossedOut();
650 sal_Bool GetContour();
651 sal_Bool GetCaseKapitaelchen();
652 sal_Bool GetCaseVersalien();
653
GetBaseURL() const654 const String& GetBaseURL() const { return sBaseURL; }
655 };
656
657 SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset);
658
659 #endif
660
661 /* vi:set tabstop=4 shiftwidth=4 expandtab: */
662