bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / filter / inc / fltshell.hxx
blobb5c30212ca38aed75e4659da3050fae0bd412a92
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _FLTSHELL_HXX
20 #define _FLTSHELL_HXX
22 #include <com/sun/star/text/HoriOrientation.hpp>
23 #include <com/sun/star/text/VertOrientation.hpp>
24 #include <com/sun/star/text/RelOrientation.hpp>
25 #include <hintids.hxx>
26 #include <vcl/keycod.hxx>
27 #include <tools/datetime.hxx>
28 #include <editeng/formatbreakitem.hxx>
29 #include <poolfmt.hxx>
30 #include <fmtornt.hxx>
31 #include <ndindex.hxx>
32 #include <pam.hxx>
33 #include <IDocumentRedlineAccess.hxx>
35 #include <boost/noncopyable.hpp>
36 #include <boost/ptr_container/ptr_deque.hpp>
38 class SwTOXBase;
39 class SwFltShell;
40 class SwField;
41 class SwFieldType;
42 class Graphic;
43 class SwTableBox;
44 class SwDoc;
45 class SwPaM;
47 inline void SwFltClearFlag(sal_uLong& rFieldFlags, int no)
48 { rFieldFlags &= ~(1L << no); }
50 inline void SwFltSetFlag(sal_uLong& rFieldFlags, int no)
51 { rFieldFlags |= 1L << no; }
53 inline bool SwFltGetFlag(sal_uLong nFieldFlags, int no)
54 { return (nFieldFlags & (1L << no)) != 0; }
56 //Subvert the Node/Content system to get positions which don't update as
57 //content is appended to them
58 struct SW_DLLPUBLIC SwFltPosition
60 public:
61 SwNodeIndex m_nNode;
62 xub_StrLen m_nCntnt;
63 public:
64 SwFltPosition(const SwFltPosition &rOther)
65 : m_nNode(rOther.m_nNode)
66 , m_nCntnt(rOther.m_nCntnt)
69 SwFltPosition &operator=(const SwFltPosition &rOther)
71 m_nNode = rOther.m_nNode;
72 m_nCntnt = rOther.m_nCntnt;
73 return *this;
75 bool operator==(const SwFltPosition &rOther) const
77 return (m_nCntnt == rOther.m_nCntnt &&
78 m_nNode == rOther.m_nNode);
80 void SetPos(SwNodeIndex &rNode, sal_uInt16 nIdx)
82 m_nNode = rNode;
83 m_nCntnt = nIdx;
85 //operators with SwPosition, where the node is hacked to the previous one,
86 //and the offset to content is de-dynamic-ified
87 SwFltPosition(const SwPosition &rPos)
88 : m_nNode(rPos.nNode, -1)
89 , m_nCntnt(rPos.nContent.GetIndex())
92 void SetPos(const SwPosition &rPos)
94 m_nNode = rPos.nNode.GetIndex()-1;
95 m_nCntnt = rPos.nContent.GetIndex();
99 // Stack-Eintrag fuer die Attribute Es werden immer Pointer auf neue Attribute uebergeben.
100 class SwFltStackEntry : private ::boost::noncopyable
102 public:
103 SwFltPosition m_aMkPos;
104 SwFltPosition m_aPtPos;
106 SfxPoolItem * pAttr;// Format Attribute
108 sal_Bool bOld; // to mark Attributes *before* skipping field results
109 sal_Bool bOpen; //Entry open, awaiting being closed
110 sal_Bool bConsumedByField;
112 sal_Int32 mnStartCP;
113 sal_Int32 mnEndCP;
114 bool bIsParaEnd;
116 SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt );
117 SW_DLLPUBLIC ~SwFltStackEntry();
119 void SetStartPos(const SwPosition & rStartPos);
120 SW_DLLPUBLIC void SetEndPos( const SwPosition & rEndPos);
121 SW_DLLPUBLIC bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const;
122 SW_DLLPUBLIC static bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion,
123 bool bCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd=false,
124 sal_uInt16 nWhich=0);
126 void SetStartCP(sal_Int32 nCP) {mnStartCP = nCP;}
127 void SetEndCP(sal_Int32 nCP) {mnEndCP = nCP;}
128 sal_Int32 GetStartCP() const {return mnStartCP;}
129 sal_Int32 GetEndCP() const {return mnEndCP;}
130 bool IsAbleMakeRegion();
131 bool IsParaEnd(){ return bIsParaEnd;}
132 void SetIsParaEnd(bool bArg){ bIsParaEnd = bArg;}
135 class SW_DLLPUBLIC SwFltControlStack : private ::boost::noncopyable
137 typedef boost::ptr_deque<SwFltStackEntry> Entries;
138 typedef Entries::iterator myEIter;
139 Entries maEntries;
140 friend class SwFltShell;
142 sal_uLong nFieldFlags;
143 KeyCode aEmptyKeyCode; // fuer Bookmarks
145 private:
146 bool bHasSdOD;
147 bool bSdODChecked;
149 protected:
150 SwDoc* pDoc;
151 bool bIsEndStack;
153 void MoveAttrs( const SwPosition& rPos );
154 virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry);
155 virtual sal_Int32 GetCurrAttrCP() const {return -1;}
156 virtual bool IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD=true) const;
158 //Clear the para end position recorded in reader intermittently for the least impact on loading performance
159 virtual void ClearParaEndPosition(){};
160 virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd);
161 bool HasSdOD();
163 public:
164 enum Flags
166 HYPO,
167 TAGS_DO_ID,
168 TAGS_VISIBLE,
169 BOOK_TO_VAR_REF,
170 BOOK_AND_REF,
171 TAGS_IN_TEXT,
172 ALLOW_FLD_CR,
173 NO_FLD_CR,
174 DONT_HARD_PROTECT
177 SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl);
178 virtual ~SwFltControlStack();
180 bool IsFlagSet(Flags no) const { return ::SwFltGetFlag(nFieldFlags, no);}
182 void NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr );
184 virtual SwFltStackEntry* SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand = LONG_MAX, sal_Bool consumedByField=sal_False);
186 void StealAttr(const SwNodeIndex& rNode, sal_uInt16 nAttrId = 0);
187 void MarkAllAttrsOld();
188 void KillUnlockedAttrs(const SwPosition& pPos);
189 SfxPoolItem* GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos = 0);
190 const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
191 void Delete(const SwPaM &rPam);
193 bool empty() const { return maEntries.empty(); }
194 Entries::size_type size() const { return maEntries.size(); }
195 SwFltStackEntry& operator[](Entries::size_type nIndex)
196 { return maEntries[nIndex]; }
197 void DeleteAndDestroy(Entries::size_type nCnt);
200 class SwFltAnchorClient;
202 class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem
204 SwFrmFmt* pFrmFmt;
205 SwFltAnchorClient * pClient;
207 public:
208 SwFltAnchor(SwFrmFmt* pFlyFmt);
209 SwFltAnchor(const SwFltAnchor&);
210 virtual ~SwFltAnchor();
212 // "pure virtual Methoden" vom SfxPoolItem
213 virtual int operator==(const SfxPoolItem&) const;
214 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
215 void SetFrmFmt(SwFrmFmt * _pFrmFmt);
216 const SwFrmFmt* GetFrmFmt() const;
217 SwFrmFmt* GetFrmFmt();
220 class SwFltAnchorClient : public SwClient
222 SwFltAnchor * m_pFltAnchor;
224 public:
225 SwFltAnchorClient(SwFltAnchor * pFltAnchor);
227 virtual void Modify (const SfxPoolItem *pOld, const SfxPoolItem *pNew);
231 class SW_DLLPUBLIC SwFltRedline : public SfxPoolItem
233 public:
234 DateTime aStamp;
235 DateTime aStampPrev;
236 RedlineType_t eType;
237 RedlineType_t eTypePrev;
238 sal_uInt16 nAutorNo;
239 sal_uInt16 nAutorNoPrev;
241 SwFltRedline(RedlineType_t eType_,
242 sal_uInt16 nAutorNo_,
243 const DateTime& rStamp_,
244 RedlineType_t eTypePrev_ = nsRedlineType_t::REDLINE_INSERT,
245 sal_uInt16 nAutorNoPrev_ = USHRT_MAX,
246 const DateTime* pStampPrev_ = 0)
247 : SfxPoolItem(RES_FLTR_REDLINE), aStamp(rStamp_),
248 aStampPrev( DateTime::EMPTY ),
249 eType(eType_),
250 eTypePrev(eTypePrev_), nAutorNo(nAutorNo_), nAutorNoPrev(nAutorNoPrev_)
252 if( pStampPrev_ )
253 aStampPrev = *pStampPrev_;
256 SwFltRedline(const SwFltRedline& rCpy):
257 SfxPoolItem(RES_FLTR_REDLINE),
258 aStamp( rCpy.aStamp ),
259 aStampPrev( rCpy.aStampPrev ),
260 eType( rCpy.eType ),
261 eTypePrev( rCpy.eTypePrev ),
262 nAutorNo( rCpy.nAutorNo ),
263 nAutorNoPrev( rCpy.nAutorNoPrev )
265 // "pure virtual Methoden" vom SfxPoolItem
266 virtual int operator==(const SfxPoolItem& rItem) const;
267 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
270 class SW_DLLPUBLIC SwFltBookmark : public SfxPoolItem
272 friend class SwFltShell; // darf aName und aVal uebersetzen
273 long nHandle;
274 String aName;
275 String aVal;
276 sal_Bool bOnlyRef; // "FRAGE"-Feld, Ref/Seitenrf oder nichts
277 sal_Bool bRef;
278 sal_Bool bPgRef;
279 public:
280 SwFltBookmark( const String& rNa, const String& rVa,
281 long nHand, sal_Bool bOnlyR );
282 SwFltBookmark( const SwFltBookmark& );
283 // "pure virtual Methoden" vom SfxPoolItem
284 virtual int operator==(const SfxPoolItem&) const;
285 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
286 const String& GetName() const { return aName; }
287 const String& GetValSys() const { return aVal; }
288 sal_Bool IsOnlyRef() const { return bOnlyRef; }
289 sal_Bool IsRef() const { return bRef; }
290 void SetRef(sal_Bool b = sal_True) { bRef = b; }
291 sal_Bool IsPgRef() const { return bPgRef; }
292 void SetPgRef(sal_Bool b = sal_True) { bPgRef = b; }
293 long GetHandle() const { return nHandle; }
296 class SW_DLLPUBLIC SwFltTOX : public SfxPoolItem
298 SwTOXBase* pTOXBase;
299 sal_uInt16 nCols;
300 sal_Bool bHadBreakItem; // there was a break item BEFORE insertion of the TOX
301 sal_Bool bHadPageDescItem; // ...
302 public:
303 SwFltTOX(SwTOXBase* pBase, sal_uInt16 _nCols = 0);
304 SwFltTOX(const SwFltTOX&);
305 // "pure virtual Methoden" vom SfxPoolItem
306 virtual int operator==(const SfxPoolItem&) const;
307 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
308 SwTOXBase* GetBase() { return pTOXBase; }
309 sal_uInt16 GetCols() const { return nCols; }
310 void SetHadBreakItem( sal_Bool bVal ) { bHadBreakItem = bVal; }
311 void SetHadPageDescItem( sal_Bool bVal ) { bHadPageDescItem = bVal; }
312 sal_Bool HadBreakItem() const { return bHadBreakItem; }
313 sal_Bool HadPageDescItem() const { return bHadPageDescItem; }
316 class SwFltSection : public SfxPoolItem
318 SwSectionData * m_pSection;
320 public:
321 SwFltSection( SwSectionData *const pSect );
322 SwFltSection( const SwFltSection& );
323 // "pure virtual Methoden" vom SfxPoolItem
324 virtual int operator==(const SfxPoolItem&) const;
325 virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
326 SwSectionData * GetSectionData() { return m_pSection; }
328 // Der WWEndStack verhaelt sich wie der WWControlStck, nur dass die Attribute
329 // auf ihm bis ans Ende des Dokuments gehortet werden, falls auf sie noch
330 // zugegriffen werden muss (z.B. Book/RefMarks, Index u.s.w.)
331 class SwFltEndStack : public SwFltControlStack
333 public:
334 SwFltEndStack(SwDoc* pDo, sal_uLong nFieldFl)
335 :SwFltControlStack(pDo, nFieldFl)
337 bIsEndStack = true;
341 ///////////////////////////////////////////////////////////////////////////////////////////
343 // hier beginnen die fuer ww1-filter neu erstellten klassen. diese
344 // sollen eine simple oberflaeche fuer die komplexen strukturen des
345 // writers speziell fuer filter sein. soll etwas in den writer gegeben
346 // werden, soll ein << reichen. hierfuer sind neue typen erzeugt
347 // worden. ausserdem soll moeglich sein das objekt nach vielen
348 // zustaenden der momentanen formatierung zu fragen, sodasz diese der
349 // filter nicht selbst verwalten musz.
351 // den anfang macht eine vorlagen-oberklasse, die einfachen umgang mit
352 // formatvorlagen ermoeglicht:
355 class SwFltOutBase
357 SwDoc& rDoc;
358 protected:
359 RndStdIds eFlyAnchor;
360 sal_Bool bFlyAbsPos;
362 SwDoc& GetDoc() { return rDoc; }
363 SfxItemSet* NewFlyDefaults();
364 SwFltOutBase(SwDoc& rDocu);
365 virtual ~SwFltOutBase();
366 public:
367 virtual SwFltOutBase& operator << (const SfxPoolItem& rItem) = 0;
369 virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich) = 0;
370 virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich) = 0;
372 virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich);
373 virtual bool BeginTable();
374 virtual void NextTableCell();
375 virtual void NextTableRow();
376 virtual void SetTableWidth(SwTwips nW);
377 virtual void SetTableOrient(sal_Int16 eOri);
378 virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell);
379 virtual void SetCellHeight(SwTwips nH);
380 virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell);
381 virtual void SetCellSpace(sal_uInt16 nSp);
382 virtual void DeleteCell(sal_uInt16 nCell);
383 virtual void EndTable();
385 virtual bool IsInFly() = 0;
386 virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr) = 0;
387 virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich) = 0;
388 virtual bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
389 const SfxItemSet* pMoreAttrs = 0 );
390 virtual void SetFlyAnchor( RndStdIds eAnchor );
391 virtual void EndFly();
394 class SwFltOutDoc : public SwFltOutBase
396 SwFltControlStack& rStack;
397 SwFltEndStack& rEndStack;
398 SwPaM* pPaM;
399 SwFrmFmt* pFly;
400 // table items:
401 const SwTable* pTable;
402 SwPosition* pTabSavedPos; // set when in table
403 SwPosition* pFlySavedPos; // set when in fly
404 SwTwips nTableWidth;
405 sal_uInt16 usTableX;
406 sal_uInt16 usTableY;
407 sal_Bool bReadNoTbl; // Keine Tabellen
409 SwTableBox* GetBox(sal_uInt16 ny, sal_uInt16 nx = USHRT_MAX);
410 sal_Bool SeekCell( short nRow, short nCol, sal_Bool bPam );
411 void SplitTable();
412 public:
413 SwFltOutDoc(SwDoc& rDocu, SwPaM* pP, SwFltControlStack& rStk,
414 SwFltEndStack& rEStk)
415 : SwFltOutBase(rDocu), rStack(rStk), rEndStack(rEStk), pPaM(pP),
416 pFly(0), pTable(0), pTabSavedPos(0), pFlySavedPos(0),
417 nTableWidth(0), bReadNoTbl(sal_False)
420 void SetReadNoTable() { bReadNoTbl = sal_True; }
421 sal_Bool IsTableWidthSet() const { return 0 != nTableWidth; }
423 virtual SwFltOutBase& operator << (const SfxPoolItem& rItem);
425 virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
426 virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
428 sal_Bool IsInTable();
429 virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich);
430 virtual bool BeginTable();
431 virtual void NextTableCell();
432 virtual void NextTableRow();
433 virtual void SetTableWidth(SwTwips nW);
434 virtual void SetTableOrient(sal_Int16 eOri);
435 virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell);
436 virtual void SetCellHeight(SwTwips nH);
437 virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell);
438 virtual void SetCellSpace(sal_uInt16 nSp);
439 virtual void DeleteCell(sal_uInt16 nCell);
440 virtual void EndTable();
442 SwFrmFmt* MakeFly( RndStdIds eAnchor, SfxItemSet* pSet );
443 virtual bool IsInFly();
444 virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr);
445 virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
446 virtual bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
447 const SfxItemSet* pMoreAttrs = 0 );
448 virtual void EndFly();
451 class SwFltFormatCollection : public SwFltOutBase
453 SwTxtFmtColl* pColl;
454 SfxItemSet* pFlyAttrs; // Simulation der Flys in Styles
455 bool bHasFly;
456 public:
457 SwFltFormatCollection(SwDoc&, RES_POOL_COLLFMT_TYPE nType);
458 SwFltFormatCollection(SwDoc&, const String& rName );
459 ~SwFltFormatCollection() { if( pFlyAttrs ) delete pFlyAttrs; }
461 void Reset()
463 // #i73790# - method renamed
464 pColl->ResetAllFmtAttr();
465 pColl->SetAuto(sal_False); // nach Empfehlung JP
467 void Derived(SwTxtFmtColl* pBase)
468 { pColl->SetDerivedFrom(pBase); }
470 // SwTxtFmtColl* Search(String, CharSet eSrc);
471 SwTxtFmtColl* GetColl() { return pColl; }
472 void SetHasFly() { bHasFly = true; }
473 SfxItemSet* GetpFlyAttrs() { return pFlyAttrs; }
475 virtual SwFltOutBase& operator << (const SfxPoolItem& rItem);
476 virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
477 virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
479 virtual bool IsInFly();
480 virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr);
481 virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
482 virtual bool BeginFly( RndStdIds eAnchor, sal_Bool bAbsolutePos,
483 const SfxItemSet* pMoreAttrs = 0 );
484 bool BeginStyleFly( SwFltOutDoc* pOutDoc );
485 virtual void EndFly();
489 // dies nun ist die zauberhafteklasse: intention: alle eins nach dem
490 // andern hinein'pipe'n. wird eine besondere struktur eingelesen, wird
491 // eine klammer geoeffnet (BeginXxx) und nach beendigung geschlossen
492 // (EndXxx), wobei Xxx zB fuer Fusznoten, Kopf/Fuszzeilen oder
493 // Tabellen steht. Styles funktionieren auch so, haben aber den
494 // unterschied, keine buchstaben zu akzeptieren.
495 // beginnt ein neuer absatz oder aehnliches, wird NextXxx genutzt.
496 // hier ist moeglich, Tab, Zeilenumbruch, Absatzende, Seitenumbruch
497 // und Sektionsende einzufuegen.
499 class SwFltShell
501 SwFltOutDoc* pOutDoc;
502 SwFltFormatCollection* pColls[256];
503 SwFltOutBase* pOut;
505 // SwFltFormatCollection* pFormat; // set when in style-mode
506 SwPageDesc* pCurrentPageDesc;
507 SwPosition* pSavedPos; // set, when in footnote or header/footer -mode
508 #ifdef None
509 #undef None
510 #endif
511 enum SubModes {
512 None,
513 Header,
514 Footer,
515 Footnote,
516 Table,
517 Fly,
518 Style,
520 } eSubMode;
522 // Fly items:
523 sal_uInt16 nAktStyle; // zur Indizierung pStyleFlyTable
525 SwFltControlStack aStack;
526 SwFltEndStack aEndStack;
527 SwPaM* pPaM;
529 String sBaseURL;
530 sal_uInt16 nPageDescOffset; // fuers update der pagedescs
531 CharSet eSrcCharSet; // charset der quelle
532 friend class SwFltControlStack;
533 sal_Bool bNewDoc;
534 sal_Bool bStdPD;
535 sal_Bool bProtect;
537 public:
538 SwFltShell(SwDoc* , SwPaM& , const String& rBaseURL, sal_Bool bNew, sal_uLong = 0);
539 ~SwFltShell();
541 SwDoc& GetDoc() { return *aStack.pDoc; }
543 CharSet SetCharSet(CharSet eNew) { CharSet eOld = eSrcCharSet;
544 eSrcCharSet = eNew;
545 return eOld;
547 void SetUseStdPageDesc() { bStdPD = sal_True; }
548 void SetProtect() { bProtect = sal_True; }
549 SwPageDesc* MakePageDesc(SwPageDesc* pFirstPageDesc = NULL);
550 SwPageDesc& GetPageDesc() { return *pCurrentPageDesc; }
551 void NextTab() { (*this) << sal_uInt8(0x09); }
552 void NextLine() { (*this) << sal_uInt8(0x0a); }
553 void NextParagraph();
554 void NextPage();
555 void NextSection() { pCurrentPageDesc = MakePageDesc(); }
557 SwFltShell& AddGraphic( const String& rPicName );
558 SwFltShell& AddError( const sal_Char* pErr );
559 SwFltShell& EndItem( sal_uInt16 nId );
560 SwFltShell& SetStyle( sal_uInt16 nStyle );
562 SwFltShell& operator << ( Graphic& );
563 SwFltShell& operator << ( SwFltBookmark& aBook );
564 void SetBookEnd(long nHandle);
565 SwFltShell& operator << ( const String& ); // Vorsicht: CHARSET_ANSI
566 SwFltShell& operator << ( const sal_Unicode );
567 SwFltShell& operator << ( const SwField& );
568 SwFltShell& operator << ( const SfxPoolItem& rItem )
569 { *pOut << rItem; return *this; }
571 // SwFltShell& operator >> (SfxPoolItem&);
572 // methode zum beenden einer sub-sektion, zB Fusznote etc
573 void End() { eSubMode = None; }
574 // methoden zur verwaltung von Header/Footer
575 void BeginHeader(SwPageDesc* =NULL);
576 void BeginFooter(SwPageDesc* =NULL);
577 void EndHeaderFooter();
578 // methoden zur verwaltung von FootNotes
579 void BeginFootnote();
580 void EndFootnote();
581 // methoden zur verwaltung von Tabellen
582 sal_Bool IsInTable() {
583 return ( pOut == pOutDoc ) ? pOutDoc->IsInTable() : 0; }
584 const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich) {
585 return pOut->GetCellAttr(nWhich); }
586 bool BeginTable() {
587 bool b = pOut->BeginTable();
588 if(b) eSubMode = Table;
589 return b; }
590 void NextTableCell() {
591 pOut->NextTableCell(); }
592 void NextTableRow() {
593 pOut->NextTableRow(); }
594 void SetTableWidth(SwTwips nW) {
595 pOut->SetTableWidth(nW); }
596 sal_Bool IsTableWidthSet() {
597 return pOutDoc->IsTableWidthSet(); }
598 void SetTableOrient(sal_Int16 eOri) {
599 pOut->SetTableOrient(eOri); }
600 void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell = USHRT_MAX ) {
601 pOut->SetCellWidth(nWidth, nCell); }
602 void SetCellHeight(SwTwips nH) {
603 pOut->SetCellHeight(nH); }
604 void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell = USHRT_MAX ){
605 pOut->SetCellBorder(rFmtBox, nCell); }
606 void SetCellSpace(sal_uInt16 nSp) {
607 pOut->SetCellSpace(nSp); }
608 void DeleteCell(sal_uInt16 nCell = USHRT_MAX) {
609 pOut->DeleteCell(nCell); }
610 void EndTable() {
611 pOut->EndTable(); }
612 // methoden zur verwaltung von Flys
613 bool IsInFly() { return pOut->IsInFly(); }
614 bool BeginFly( RndStdIds eAnchor = FLY_AT_PARA, sal_Bool bAbsolutePos = sal_False );
615 void SetFlyAnchor( RndStdIds eAnchor )
616 { pOut->SetFlyAnchor( eAnchor ); }
617 void SetFlyXPos( short nXPos, sal_Int16 eHRel = com::sun::star::text::RelOrientation::FRAME,
618 sal_Int16 eHAlign = com::sun::star::text::HoriOrientation::NONE );
619 void SetFlyYPos( short nYPos, sal_Int16 eVRel = com::sun::star::text::RelOrientation::FRAME,
620 sal_Int16 eVAlign = com::sun::star::text::VertOrientation::NONE );
621 void SetFlyFrmAttr(const SfxPoolItem& rAttr){
622 pOut->SetFlyFrmAttr( rAttr ); }
623 void EndFly();
624 // methoden zur verwaltung von styles:
625 void BeginStyle(sal_uInt16 nUserCode, RES_POOL_COLLFMT_TYPE aType)
627 OSL_ENSURE(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds");
628 OSL_ENSURE(pColls[nUserCode] == NULL, "user codes dublicate");
629 if (eSubMode == Style)
630 EndStyle();
631 pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), aType);
632 nAktStyle = nUserCode;
633 eSubMode = Style;
635 void BeginStyle( sal_uInt16 nUserCode, const String& rName )
637 OSL_ENSURE(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds");
638 OSL_ENSURE(pColls[nUserCode] == NULL, "user codes dublicate");
639 if (eSubMode == Style)
640 EndStyle();
641 pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), rName );
642 nAktStyle = nUserCode;
643 eSubMode = Style;
645 sal_Bool IsStyleImported(sal_uInt16 nUserCode)
646 { return pColls[nUserCode] != 0; }
647 void BaseStyle(sal_uInt16 nBased)
649 OSL_ENSURE(eSubMode == Style, "wrong state for style");
650 OSL_ENSURE(pColls[nBased], "Style based on noexistent style" );
651 if( eSubMode == Style && pColls[nBased]->GetColl() )
652 ((SwFltFormatCollection*)pOut)->Derived(pColls[nBased]->GetColl());
654 void NextStyle(sal_uInt16 nWhich, sal_uInt16 nNext);
656 void EndStyle()
658 // OSL_ENSURE(eSubMode == Style, "wrong state for style");
659 nAktStyle = 0;
660 pOut = pOutDoc;
661 eSubMode = None;
664 bool IsFlagSet(SwFltControlStack::Flags no) const
665 { return aStack.IsFlagSet(no); }
666 void ConvertUStr( String& rInOut );
667 OUString QuoteStr( const OUString& rIn );
669 // folgende status kann die shell verwalten:
670 const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich);
671 const SfxPoolItem& GetAttr(sal_uInt16 nWhich);
672 const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich);
673 SwFieldType* GetSysFldType(sal_uInt16 eWhich);
674 bool GetWeightBold();
675 bool GetPostureItalic();
676 bool GetCrossedOut();
677 bool GetContour();
678 bool GetCaseKapitaelchen();
679 bool GetCaseVersalien();
681 const String& GetBaseURL() const { return sBaseURL; }
684 SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset);
686 #endif
688 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */