diff options
Diffstat (limited to 'sw/source/filter/inc')
-rw-r--r-- | sw/source/filter/inc/fltbase.hxx | 127 | ||||
-rw-r--r-- | sw/source/filter/inc/fltglbls.hxx | 124 | ||||
-rw-r--r-- | sw/source/filter/inc/fltini.hxx | 108 | ||||
-rw-r--r-- | sw/source/filter/inc/fltshell.hxx | 629 | ||||
-rw-r--r-- | sw/source/filter/inc/makefile.mk | 26 | ||||
-rw-r--r-- | sw/source/filter/inc/msfilter.hxx | 528 | ||||
-rw-r--r-- | sw/source/filter/inc/rtf.hxx | 132 | ||||
-rw-r--r-- | sw/source/filter/inc/wrt_fn.hxx | 66 | ||||
-rw-r--r-- | sw/source/filter/inc/wrtswtbl.hxx | 334 | ||||
-rw-r--r-- | sw/source/filter/inc/wwstyles.hxx | 221 |
10 files changed, 2295 insertions, 0 deletions
diff --git a/sw/source/filter/inc/fltbase.hxx b/sw/source/filter/inc/fltbase.hxx new file mode 100644 index 000000000000..b67b54ce314a --- /dev/null +++ b/sw/source/filter/inc/fltbase.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __FLTBASE_HXX__ +#define __FLTBASE_HXX__ + +#include <tools/stream.hxx> +#include <tools/string.hxx> + +class SwFilterBase +{ +protected: + SvStream *pIn; + sal_Char *pReadBuff; // Groessenangabe + INT32 nBytesLeft; // noch zu lesende Bytes des aktuelle Records + + CharSet eQuellChar; // Quell-Zeichensatz (interner Zeichensatz) +// CharSet eZielChar; // Ziel-Zeichensatz + + USHORT nTab; // z.Zt. bearbeitete Tabelle + USHORT nReadBuffSize;// temporaerer Lesepuffer mit + + // ---------------------------------------------------------- + inline void ReadChar( char &rC ); + inline void ReadByte( BYTE &rN ); + inline void Read( short &rN ); + inline void ReadUnicode( sal_Unicode &rU ); + inline void Read( BYTE &rN0, USHORT &rN1, USHORT &rN2 ); + inline void Read( USHORT &rN ); + inline void Read( USHORT &rN1, USHORT &rN2 ); + inline void Read( USHORT &rN1, USHORT &rN2, USHORT &rN3, USHORT &rN4 ); + inline void Read( double &rF ); + void Read( String &rS ); // liest 0-terminierten C-String! + inline void ClearBytesLeft( void ); +}; + + +inline void SwFilterBase::ReadChar( char &rC ) + { + *pIn >> rC; + nBytesLeft--; + } + +inline void SwFilterBase::ReadByte( BYTE &rN ) + { + *pIn >> rN; + nBytesLeft--; + } + +inline void SwFilterBase::ReadUnicode( sal_Unicode &rU ) +{ + { + sal_Char cC; + *pIn >> cC; + rU = ByteString::ConvertToUnicode(cC, eQuellChar); + nBytesLeft--; + } +} + +inline void SwFilterBase::Read( short &rN ) + { + *pIn >> rN; + nBytesLeft -= 2; + } + +inline void SwFilterBase::Read( BYTE &rN0, USHORT &rN1, USHORT &rN2 ) + { + *pIn >> rN0 >> rN1 >> rN2; + nBytesLeft -= 5; + } + +inline void SwFilterBase::Read( USHORT &rN ) + { + *pIn >> rN; + nBytesLeft -= 2; + } + +inline void SwFilterBase::Read( USHORT &rN1, USHORT &rN2 ) + { + *pIn >> rN1 >> rN2; + nBytesLeft -= 4; + } + +inline void SwFilterBase::Read( USHORT &rN1, USHORT &rN2, USHORT &rN3, USHORT &rN4 ) + { + *pIn >> rN1 >> rN2 >> rN3 >> rN4; + nBytesLeft -= 8; + } + +inline void SwFilterBase::Read( double &rF ) + { + *pIn >> rF; + nBytesLeft -= 8; + } + +inline void SwFilterBase::ClearBytesLeft( void ) + { + pIn->SeekRel( nBytesLeft ); + nBytesLeft = 0; + } + + +#endif + diff --git a/sw/source/filter/inc/fltglbls.hxx b/sw/source/filter/inc/fltglbls.hxx new file mode 100644 index 000000000000..cf2c4a29610b --- /dev/null +++ b/sw/source/filter/inc/fltglbls.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FLTGLBS_HXX +#define _FLTGLBS_HXX + +#include <tools/string.hxx> +#include <i18npool/lang.h> +#include <svl/svarray.hxx> + + +class SfxPoolItem; +class SwDoc; +class SwPaM; +class SwTable; + +class XF_Buffer; +class ColorBuffer; +class FontBuffer; +class SvNumberFormatter; + + +class ExcGlob; +extern ExcGlob *pExcGlob; + +class LotGlob; +extern LotGlob *pLotGlob; + +// ----- Basis-Klasse ---------------------------------------------------- +class FilterGlobals +{ +protected: + SvPtrarr aTblFmts; + USHORT nColStart; + USHORT nColEnd; + USHORT nRowStart; + USHORT nRowEnd; + USHORT nAnzCols; + USHORT nAnzRows; + +public: + FilterGlobals( SwDoc& rDoc, const SwPaM& rPam ); + ~FilterGlobals(); + + SwDoc *pD; + SwPaM *pPam; + const SwTable *pTable; + + SvNumberFormatter *pNumFormatter; + LanguageType eDefLanguage; + ULONG nStandard; + ULONG nDefFormat; // = 0xFFFFFFFF + + void SetRange( USHORT nCS, USHORT nCE, USHORT nRS, USHORT nRE ); + + BOOL IsInColRange( USHORT nCol ) + { return ( nCol >= nColStart && nCol <= nColEnd ); } + BOOL IsInRowRange( USHORT nRow ) + { return ( nRow >= nRowStart && nRow <= nRowEnd ); } + BOOL IsInRange( USHORT nCol, USHORT nRow ) + { return IsInRowRange(nRow) && IsInColRange(nCol); } + + void NormalizeCol( USHORT &rCol ) { rCol -= nColStart; } + void NormalizeRow( USHORT &rRow ) { rRow -= nRowStart; } + void Normalize( USHORT &rCol, USHORT &rRow ) + { NormalizeCol( rCol ); NormalizeRow( rRow ); } + + USHORT AnzCols() const { return nAnzCols; } + USHORT AnzRows() const { return nAnzRows; } + + BOOL ColRangeLimitter( USHORT &rCS, USHORT &rCE ); + + void InsertText( USHORT nCol, USHORT nRow, const String& rStr ); + void CreateTable(); + void InsertAttr( const SfxPoolItem& rItem ); + + inline void ColLimitter( USHORT &rCol ); + inline void RowLimitter( USHORT &rRow ); +}; + + + + + +inline void FilterGlobals::ColLimitter( USHORT &rCol ) +{ + if( rCol < nColStart ) + rCol = nColStart; + else if( rCol > nColEnd ) + rCol = nColEnd; +} + +inline void FilterGlobals::RowLimitter( USHORT &rRow ) +{ + if( rRow < nRowStart ) + rRow = nRowStart; + else if( rRow > nRowEnd ) + rRow = nRowEnd; +} + +#endif diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx new file mode 100644 index 000000000000..a9711f1331a5 --- /dev/null +++ b/sw/source/filter/inc/fltini.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FLTINI_HXX +#define _FLTINI_HXX + +#include <shellio.hxx> +#include <tools/color.hxx> + +class SwNumRuleTbl; +class SwDoc; +class SwTxtNode; +class SwNumRule; +class SwNodeIndex; + +// die speziellen Reader + +class HTMLReader: public Reader +{ + // wir wollen die Streams / Storages nicht geoeffnet haben + virtual int SetStrmStgPtr(); + virtual ULONG Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); + virtual String GetTemplateName() const; +public: + HTMLReader(); +}; + +class WW1Reader : public Reader +{ + virtual ULONG Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); +}; + +class XMLReader : public Reader +{ + virtual ULONG Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); +public: + virtual int GetReaderType(); + + XMLReader(); + + // read the sections of the document, which is equal to the medium. + // returns the count of it + virtual USHORT GetSectionList( SfxMedium& rMedium, + SvStrings& rStrings ) const; +}; + +// die speziellen Writer + +void GetWW8Writer( const String&, const String&, WriterRef& ); + + +// JP 17.03.99 - 63049 +// Umsetzen der LRSpaces im aktuell importierten Doc. Die Fremd-Filter +// liefern immer absolute Werte fuer die Ebenen einer NumRule. Wir +// verarbeiten jetzt aber relative Werte bezogen auf das LR-Space-Item. +// Das hat zur Folge, das bei allen Absaetzen die EInzuege der NumRule vom +// Absatz-Einzug abgezogen werden muss. +class SW_DLLPUBLIC SwRelNumRuleSpaces +{ + SwNumRuleTbl* pNumRuleTbl; // Liste aller benannten NumRules + BOOL bNewDoc; + + void SetNumLSpace( SwTxtNode& rNd, const SwNumRule& rRule ); + +public: + SwRelNumRuleSpaces( SwDoc& rDoc, BOOL bNewDoc ); + ~SwRelNumRuleSpaces(); + + void SetNumRelSpaces( SwDoc& rDoc ); + void SetOultineRelSpaces( const SwNodeIndex& rStt, + const SwNodeIndex& rEnd ); +}; + +#define SW_SV_BRUSH_25 0 +#define SW_SV_BRUSH_50 1 +#define SW_SV_BRUSH_75 2 +#define SW_SV_BRUSH_NULL 3 +#define SW_SV_BRUSH_SOLID 4 +#define SW_SV_BRUSH_INVALID 5 + +// Get size of fly (if 'automatic' in WW) and check if not too small +SW_DLLPUBLIC void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, + SwTwips nPageWidth); + +#endif diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx new file mode 100644 index 000000000000..c511d4aab02a --- /dev/null +++ b/sw/source/filter/inc/fltshell.hxx @@ -0,0 +1,629 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FLTSHELL_HXX +#define _FLTSHELL_HXX + +#include <deque> + +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> +#include <hintids.hxx> +#include <vcl/keycod.hxx> +#include <tools/datetime.hxx> +#include <editeng/brkitem.hxx> +#include <poolfmt.hxx> +#include <fmtornt.hxx> +#include <ndindex.hxx> +#include <IDocumentRedlineAccess.hxx> + +class SwTOXBase; +class SwFltShell; +class SwField; +class SwFieldType; +class Graphic; +class SwTableBox; +class SwDoc; +class SwPaM; + +using namespace com::sun::star; + +inline void SwFltClearFlag(ULONG& rFieldFlags, int no) + { rFieldFlags &= ~(1L << no); } + +inline void SwFltSetFlag(ULONG& rFieldFlags, int no) + { rFieldFlags |= 1L << no; } + +inline BOOL SwFltGetFlag(ULONG nFieldFlags, int no) + { return (nFieldFlags & (1L << no)) != 0; } + +// Stack-Eintrag fuer die Attribute Es werden immer Pointer auf neue Attribute uebergeben. +class SwFltStackEntry +{ +public: + SwNodeIndex nMkNode; + SwNodeIndex nPtNode; + SfxPoolItem * pAttr;// Format Attribute + long nHandle; // fuer verschachtelte Attrs, z.B. Bookmarks + xub_StrLen nMkCntnt;// Nachbildung von Mark() + xub_StrLen nPtCntnt;// Nachbildung von GetPoint() + + BOOL bOld; // to mark Attributes *before* skipping field results + BOOL bLocked; + BOOL bCopied; + BOOL bConsumedByField; + + SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt ); + SW_DLLPUBLIC SwFltStackEntry(const SwFltStackEntry& rEntry); + SW_DLLPUBLIC ~SwFltStackEntry(); + + void SetStartPos(const SwPosition & rStartPos); + SW_DLLPUBLIC void SetEndPos( const SwPosition & rEndPos); + SW_DLLPUBLIC BOOL MakeRegion(SwDoc* pDoc, SwPaM& rRegion, BOOL bCheck ); +}; + +class SW_DLLPUBLIC SwFltControlStack +{ + typedef std::deque<SwFltStackEntry*> Entries; + typedef Entries::iterator myEIter; + Entries maEntries; + friend class SwFltShell; + + ULONG nFieldFlags; + KeyCode aEmptyKeyCode; // fuer Bookmarks + +protected: + SwDoc* pDoc; + BOOL bIsEndStack; + + void MoveAttrs( const SwPosition& rPos ); + virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* pEntry); + +public: + enum Flags + { + HYPO, + TAGS_DO_ID, + TAGS_VISIBLE, + BOOK_TO_VAR_REF, + BOOK_AND_REF, + TAGS_IN_TEXT, + ALLOW_FLD_CR, + NO_FLD_CR, + DONT_HARD_PROTECT + }; + + SwFltControlStack(SwDoc* pDo, ULONG nFieldFl); + virtual ~SwFltControlStack(); + + BOOL IsFlagSet(Flags no) const { return ::SwFltGetFlag(nFieldFlags, no);} + + void NewAttr(const SwPosition& rPos, const SfxPoolItem & rAttr ); + + virtual void SetAttr(const SwPosition& rPos, USHORT nAttrId=0, BOOL bTstEnde=TRUE, long nHand = LONG_MAX, BOOL consumedByField=FALSE); + + void StealAttr(const SwPosition* pPos, USHORT nAttrId = 0); + void MarkAllAttrsOld(); + void KillUnlockedAttrs(const SwPosition& pPos); + SfxPoolItem* GetFmtStackAttr(USHORT nWhich, USHORT * pPos = 0); + const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, USHORT nWhich); + void Delete(const SwPaM &rPam); + + Entries::size_type Count() { return maEntries.size(); } + SwFltStackEntry* operator[](Entries::size_type nIndex) + { return maEntries[nIndex]; } + void DeleteAndDestroy(Entries::size_type nCnt); +}; + +class SwFltAnchorClient; + +class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem +{ + SwFrmFmt* pFrmFmt; + SwFltAnchorClient * pClient; + +public: + SwFltAnchor(SwFrmFmt* pFlyFmt); + SwFltAnchor(const SwFltAnchor&); + virtual ~SwFltAnchor(); + + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone(SfxItemPool* = 0) const; + void SetFrmFmt(SwFrmFmt * _pFrmFmt); + const SwFrmFmt* GetFrmFmt() const; + SwFrmFmt* GetFrmFmt(); +}; + +class SwFltAnchorClient : public SwClient +{ + SwFltAnchor * m_pFltAnchor; + +public: + SwFltAnchorClient(SwFltAnchor * pFltAnchor); + + virtual void Modify (SfxPoolItem *pOld, SfxPoolItem *pNew); +}; + + +class SW_DLLPUBLIC SwFltRedline : public SfxPoolItem +{ +public: + DateTime aStamp; + DateTime aStampPrev; + RedlineType_t eType; + RedlineType_t eTypePrev; + USHORT nAutorNo; + USHORT nAutorNoPrev; + + SwFltRedline(RedlineType_t eType_, + USHORT nAutorNo_, + const DateTime& rStamp_, + RedlineType_t eTypePrev_ = nsRedlineType_t::REDLINE_INSERT, + USHORT nAutorNoPrev_ = USHRT_MAX, + const DateTime* pStampPrev_ = 0) + : SfxPoolItem(RES_FLTR_REDLINE), aStamp(rStamp_), eType(eType_), + eTypePrev(eTypePrev_), nAutorNo(nAutorNo_), nAutorNoPrev(nAutorNoPrev_) + { + if( pStampPrev_ ) + aStampPrev = *pStampPrev_; + } + + SwFltRedline(const SwFltRedline& rCpy): + SfxPoolItem(RES_FLTR_REDLINE), + aStamp( rCpy.aStamp ), + aStampPrev( rCpy.aStampPrev ), + eType( rCpy.eType ), + eTypePrev( rCpy.eTypePrev ), + nAutorNo( rCpy.nAutorNo ), + nAutorNoPrev( rCpy.nAutorNoPrev ) + {} + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==(const SfxPoolItem& rItem) const; + virtual SfxPoolItem* Clone(SfxItemPool* = 0) const; +}; + +class SW_DLLPUBLIC SwFltBookmark : public SfxPoolItem +{ + friend class SwFltShell; // darf aName und aVal uebersetzen + long nHandle; + String aName; + String aVal; + BOOL bOnlyRef; // "FRAGE"-Feld, Ref/Seitenrf oder nichts + BOOL bRef; + BOOL bPgRef; +public: + SwFltBookmark( const String& rNa, const String& rVa, + long nHand, BOOL bOnlyR ); + SwFltBookmark( const SwFltBookmark& ); + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone(SfxItemPool* = 0) const; + const String& GetName() const { return aName; } + const String& GetValSys() const { return aVal; } + BOOL IsOnlyRef() const { return bOnlyRef; } + BOOL IsRef() const { return bRef; } + void SetRef(BOOL b = TRUE) { bRef = b; } + BOOL IsPgRef() const { return bPgRef; } + void SetPgRef(BOOL b = TRUE) { bPgRef = b; } + long GetHandle() const { return nHandle; } +}; + +class SW_DLLPUBLIC SwFltTOX : public SfxPoolItem +{ + SwTOXBase* pTOXBase; + USHORT nCols; + BOOL bHadBreakItem; // there was a break item BEFORE insertion of the TOX + BOOL bHadPageDescItem; // ... +public: + SwFltTOX(SwTOXBase* pBase, USHORT _nCols = 0); + SwFltTOX(const SwFltTOX&); + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone(SfxItemPool* = 0) const; + SwTOXBase* GetBase() { return pTOXBase; } + USHORT GetCols() const { return nCols; } + void SetHadBreakItem( BOOL bVal ) { bHadBreakItem = bVal; } + void SetHadPageDescItem( BOOL bVal ) { bHadPageDescItem = bVal; } + BOOL HadBreakItem() const { return bHadBreakItem; } + BOOL HadPageDescItem() const { return bHadPageDescItem; } +}; + +class SwFltSection : public SfxPoolItem +{ + SwSectionData * m_pSection; + +public: + SwFltSection( SwSectionData *const pSect ); + SwFltSection( const SwFltSection& ); + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone(SfxItemPool* = 0) const; + SwSectionData * GetSectionData() { return m_pSection; } +}; +// Der WWEndStack verhaelt sich wie der WWControlStck, nur dass die Attribute +// auf ihm bis ans Ende des Dokuments gehortet werden, falls auf sie noch +// zugegriffen werden muss (z.B. Book/RefMarks, Index u.s.w.) +class SwFltEndStack : public SwFltControlStack +{ +public: + SwFltEndStack(SwDoc* pDo, ULONG nFieldFl) + :SwFltControlStack(pDo, nFieldFl) + { + bIsEndStack = TRUE; + } +}; + +/////////////////////////////////////////////////////////////////////////////////////////// +// +// hier beginnen die fuer ww1-filter neu erstellten klassen. diese +// sollen eine simple oberflaeche fuer die komplexen strukturen des +// writers speziell fuer filter sein. soll etwas in den writer gegeben +// werden, soll ein << reichen. hierfuer sind neue typen erzeugt +// worden. ausserdem soll moeglich sein das objekt nach vielen +// zustaenden der momentanen formatierung zu fragen, sodasz diese der +// filter nicht selbst verwalten musz. +// +// den anfang macht eine vorlagen-oberklasse, die einfachen umgang mit +// formatvorlagen ermoeglicht: +// + +class SwFltOutBase +{ + SwDoc& rDoc; +protected: + RndStdIds eFlyAnchor; + BOOL bFlyAbsPos; + + SwDoc& GetDoc() { return rDoc; } + SfxItemSet* NewFlyDefaults(); + SwFltOutBase(SwDoc& rDocu); + virtual ~SwFltOutBase(); +public: + virtual SwFltOutBase& operator << (const SfxPoolItem& rItem) = 0; + + virtual const SfxPoolItem& GetAttr(USHORT nWhich) = 0; + virtual const SfxPoolItem& GetNodeOrStyAttr(USHORT nWhich) = 0; + + virtual const SfxPoolItem& GetCellAttr(USHORT nWhich); + virtual BOOL BeginTable(); + virtual void NextTableCell(); + virtual void NextTableRow(); + virtual void SetTableWidth(SwTwips nW); + virtual void SetTableOrient(sal_Int16 eOri); + virtual void SetCellWidth(SwTwips nWidth, USHORT nCell); + virtual void SetCellHeight(SwTwips nH); + virtual void SetCellBorder(const SvxBoxItem& rFmtBox, USHORT nCell); + virtual void SetCellSpace(USHORT nSp); + virtual void DeleteCell(USHORT nCell); + virtual void EndTable(); + + virtual BOOL IsInFly() = 0; + virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr) = 0; + virtual const SfxPoolItem& GetFlyFrmAttr(USHORT nWhich) = 0; + virtual BOOL BeginFly( RndStdIds eAnchor, BOOL bAbsolutePos, + const SfxItemSet* pMoreAttrs = 0 ); + virtual void SetFlyAnchor( RndStdIds eAnchor ); + virtual void EndFly(); +}; + +class SwFltOutDoc : public SwFltOutBase +{ + SwFltControlStack& rStack; + SwFltEndStack& rEndStack; + SwPaM* pPaM; + SwFrmFmt* pFly; +// table items: + const SwTable* pTable; + SwPosition* pTabSavedPos; // set when in table + SwPosition* pFlySavedPos; // set when in fly + SwTwips nTableWidth; + USHORT usTableX; + USHORT usTableY; + BOOL bReadNoTbl; // Keine Tabellen + + SwTableBox* GetBox(USHORT ny, USHORT nx = USHRT_MAX); + BOOL SeekCell( short nRow, short nCol, BOOL bPam ); + void SplitTable(); +public: + SwFltOutDoc(SwDoc& rDocu, SwPaM* pP, SwFltControlStack& rStk, + SwFltEndStack& rEStk) + : SwFltOutBase(rDocu), rStack(rStk), rEndStack(rEStk), pPaM(pP), + pFly(0), pTable(0), pTabSavedPos(0), pFlySavedPos(0), + nTableWidth(0), bReadNoTbl(FALSE) + {} + + void SetReadNoTable() { bReadNoTbl = TRUE; } + BOOL IsTableWidthSet() const { return 0 != nTableWidth; } + + virtual SwFltOutBase& operator << (const SfxPoolItem& rItem); + + virtual const SfxPoolItem& GetAttr(USHORT nWhich); + virtual const SfxPoolItem& GetNodeOrStyAttr(USHORT nWhich); + + BOOL IsInTable(); + virtual const SfxPoolItem& GetCellAttr(USHORT nWhich); + virtual BOOL BeginTable(); + virtual void NextTableCell(); + virtual void NextTableRow(); + virtual void SetTableWidth(SwTwips nW); + virtual void SetTableOrient(sal_Int16 eOri); + virtual void SetCellWidth(SwTwips nWidth, USHORT nCell); + virtual void SetCellHeight(SwTwips nH); + virtual void SetCellBorder(const SvxBoxItem& rFmtBox, USHORT nCell); + virtual void SetCellSpace(USHORT nSp); + virtual void DeleteCell(USHORT nCell); + virtual void EndTable(); + + SwFrmFmt* MakeFly( RndStdIds eAnchor, SfxItemSet* pSet ); + virtual BOOL IsInFly(); + virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr); + virtual const SfxPoolItem& GetFlyFrmAttr(USHORT nWhich); + virtual BOOL BeginFly( RndStdIds eAnchor, BOOL bAbsolutePos, + const SfxItemSet* pMoreAttrs = 0 ); + virtual void EndFly(); +}; + +class SwFltFormatCollection : public SwFltOutBase +{ + SwTxtFmtColl* pColl; + SfxItemSet* pFlyAttrs; // Simulation der Flys in Styles + BOOL bHasFly; +public: + SwFltFormatCollection(SwDoc&, RES_POOL_COLLFMT_TYPE nType); + SwFltFormatCollection(SwDoc&, const String& rName ); + ~SwFltFormatCollection() { if( pFlyAttrs ) delete pFlyAttrs; } + + void Reset() + { + // --> OD 2007-01-25 #i73790# - method renamed + pColl->ResetAllFmtAttr(); + // <-- + pColl->SetAuto(FALSE); // nach Empfehlung JP + } + void Derived(SwTxtFmtColl* pBase) + { pColl->SetDerivedFrom(pBase); } + +// SwTxtFmtColl* Search(String, CharSet eSrc); + SwTxtFmtColl* GetColl() { return pColl; } + void SetHasFly() { bHasFly = TRUE; } + SfxItemSet* GetpFlyAttrs() { return pFlyAttrs; } + + virtual SwFltOutBase& operator << (const SfxPoolItem& rItem); + virtual const SfxPoolItem& GetAttr(USHORT nWhich); + virtual const SfxPoolItem& GetNodeOrStyAttr(USHORT nWhich); + + virtual BOOL IsInFly(); + virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr); + virtual const SfxPoolItem& GetFlyFrmAttr(USHORT nWhich); + virtual BOOL BeginFly( RndStdIds eAnchor, BOOL bAbsolutePos, + const SfxItemSet* pMoreAttrs = 0 ); + BOOL BeginStyleFly( SwFltOutDoc* pOutDoc ); + virtual void EndFly(); +}; + +// +// dies nun ist die zauberhafteklasse: intention: alle eins nach dem +// andern hinein'pipe'n. wird eine besondere struktur eingelesen, wird +// eine klammer geoeffnet (BeginXxx) und nach beendigung geschlossen +// (EndXxx), wobei Xxx zB fuer Fusznoten, Kopf/Fuszzeilen oder +// Tabellen steht. Styles funktionieren auch so, haben aber den +// unterschied, keine buchstaben zu akzeptieren. +// beginnt ein neuer absatz oder aehnliches, wird NextXxx genutzt. +// hier ist moeglich, Tab, Zeilenumbruch, Absatzende, Seitenumbruch +// und Sektionsende einzufuegen. +// +class SwFltShell +{ + SwFltOutDoc* pOutDoc; + SwFltFormatCollection* pColls[256]; + SwFltOutBase* pOut; + +// SwFltFormatCollection* pFormat; // set when in style-mode + SwPageDesc* pCurrentPageDesc; + SwPosition* pSavedPos; // set, when in footnote or header/footer -mode +#ifdef None +#undef None +#endif + enum SubModes { + None, + Header, + Footer, + Footnote, + Table, + Fly, + Style, + Max + } eSubMode; + +// Fly items: + USHORT nAktStyle; // zur Indizierung pStyleFlyTable +// + SwFltControlStack aStack; + SwFltEndStack aEndStack; + SwPaM* pPaM; +// + String sBaseURL; + USHORT nPageDescOffset; // fuers update der pagedescs + CharSet eSrcCharSet; // charset der quelle + friend class SwFltControlStack; + BOOL bNewDoc; + BOOL bStdPD; + BOOL bProtect; + +public: + SwFltShell(SwDoc* , SwPaM& , const String& rBaseURL, BOOL bNew, ULONG = 0); + ~SwFltShell(); + + SwDoc& GetDoc() { return *aStack.pDoc; } + + CharSet SetCharSet(CharSet eNew) { CharSet eOld = eSrcCharSet; + eSrcCharSet = eNew; + return eOld; + } + void SetUseStdPageDesc() { bStdPD = TRUE; } + void SetProtect() { bProtect = TRUE; } + SwPageDesc* MakePageDesc(SwPageDesc* pFirstPageDesc = NULL); + SwPageDesc& GetPageDesc() { return *pCurrentPageDesc; } + void NextTab() { (*this) << BYTE(0x09); } + void NextLine() { (*this) << BYTE(0x0a); } + void NextParagraph(); + void NextPage(); + void NextSection() { pCurrentPageDesc = MakePageDesc(); } + + SwFltShell& AddGraphic( const String& rPicName ); + SwFltShell& AddError( const sal_Char* pErr ); + SwFltShell& EndItem( USHORT nId ); + SwFltShell& SetStyle( USHORT nStyle ); + + SwFltShell& operator << ( Graphic& ); + SwFltShell& operator << ( SwFltBookmark& aBook ); + void SetBookEnd(long nHandle); + SwFltShell& operator << ( const String& ); // Vorsicht: CHARSET_ANSI + SwFltShell& operator << ( const sal_Unicode ); + SwFltShell& operator << ( const SwField& ); + SwFltShell& operator << ( const SfxPoolItem& rItem ) + { *pOut << rItem; return *this; } + +// SwFltShell& operator >> (SfxPoolItem&); +// methode zum beenden einer sub-sektion, zB Fusznote etc + void End() { eSubMode = None; } +// methoden zur verwaltung von Header/Footer + void BeginHeader(SwPageDesc* =NULL); + void BeginFooter(SwPageDesc* =NULL); + void EndHeaderFooter(); +// methoden zur verwaltung von FootNotes + void BeginFootnote(); + void EndFootnote(); +// methoden zur verwaltung von Tabellen + BOOL IsInTable() { + return ( pOut == pOutDoc ) ? pOutDoc->IsInTable() : 0; } + const SfxPoolItem& GetCellAttr(USHORT nWhich) { + return pOut->GetCellAttr(nWhich); } + BOOL BeginTable() { + BOOL b = pOut->BeginTable(); + if(b) eSubMode = Table; + return b; } + void NextTableCell() { + pOut->NextTableCell(); } + void NextTableRow() { + pOut->NextTableRow(); } + void SetTableWidth(SwTwips nW) { + pOut->SetTableWidth(nW); } + BOOL IsTableWidthSet() { + return pOutDoc->IsTableWidthSet(); } + void SetTableOrient(sal_Int16 eOri) { + pOut->SetTableOrient(eOri); } + void SetCellWidth(SwTwips nWidth, USHORT nCell = USHRT_MAX ) { + pOut->SetCellWidth(nWidth, nCell); } + void SetCellHeight(SwTwips nH) { + pOut->SetCellHeight(nH); } + void SetCellBorder(const SvxBoxItem& rFmtBox, USHORT nCell = USHRT_MAX ){ + pOut->SetCellBorder(rFmtBox, nCell); } + void SetCellSpace(USHORT nSp) { + pOut->SetCellSpace(nSp); } + void DeleteCell(USHORT nCell = USHRT_MAX) { + pOut->DeleteCell(nCell); } + void EndTable() { + pOut->EndTable(); } +// methoden zur verwaltung von Flys + BOOL IsInFly() { return pOut->IsInFly(); } + BOOL BeginFly( RndStdIds eAnchor = FLY_AT_PARA, BOOL bAbsolutePos = FALSE ); + void SetFlyAnchor( RndStdIds eAnchor ) + { pOut->SetFlyAnchor( eAnchor ); } + void SetFlyXPos( short nXPos, sal_Int16 eHRel = com::sun::star::text::RelOrientation::FRAME, + sal_Int16 eHAlign = com::sun::star::text::HoriOrientation::NONE ); + void SetFlyYPos( short nYPos, sal_Int16 eVRel = com::sun::star::text::RelOrientation::FRAME, + sal_Int16 eVAlign = com::sun::star::text::VertOrientation::NONE ); + void SetFlyFrmAttr(const SfxPoolItem& rAttr){ + pOut->SetFlyFrmAttr( rAttr ); } + void EndFly(); +// methoden zur verwaltung von styles: + void BeginStyle(USHORT nUserCode, RES_POOL_COLLFMT_TYPE aType) + { + ASSERT(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds"); + ASSERT(pColls[nUserCode] == NULL, "user codes dublicate"); + if (eSubMode == Style) + EndStyle(); + pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), aType); + nAktStyle = nUserCode; + eSubMode = Style; + } + void BeginStyle( USHORT nUserCode, const String& rName ) + { + ASSERT(nUserCode<sizeof(pColls)/sizeof(*pColls), "code out of bounds"); + ASSERT(pColls[nUserCode] == NULL, "user codes dublicate"); + if (eSubMode == Style) + EndStyle(); + pOut = pColls[nUserCode] = new SwFltFormatCollection(GetDoc(), rName ); + nAktStyle = nUserCode; + eSubMode = Style; + } + BOOL IsStyleImported(USHORT nUserCode) + { return pColls[nUserCode] != 0; } + void BaseStyle(USHORT nBased) + { + ASSERT(eSubMode == Style, "wrong state for style"); + ASSERT(pColls[nBased], "Style based on noexistent style" ); + if( eSubMode == Style && pColls[nBased]->GetColl() ) + ((SwFltFormatCollection*)pOut)->Derived(pColls[nBased]->GetColl()); + } + void NextStyle(USHORT nWhich, USHORT nNext); + + void EndStyle() + { +// ASSERT(eSubMode == Style, "wrong state for style"); + nAktStyle = 0; + pOut = pOutDoc; + eSubMode = None; + } + + BOOL IsFlagSet(SwFltControlStack::Flags no) const + { return aStack.IsFlagSet(no); } + void ConvertUStr( String& rInOut ); + String QuoteStr( const String& rIn ); + + // folgende status kann die shell verwalten: + const SfxPoolItem& GetNodeOrStyAttr(USHORT nWhich); + const SfxPoolItem& GetAttr(USHORT nWhich); + const SfxPoolItem& GetFlyFrmAttr(USHORT nWhich); + SwFieldType* GetSysFldType(USHORT eWhich); + BOOL GetWeightBold(); + BOOL GetPostureItalic(); + BOOL GetCrossedOut(); + BOOL GetContour(); + BOOL GetCaseKapitaelchen(); + BOOL GetCaseVersalien(); + + const String& GetBaseURL() const { return sBaseURL; } +}; + +SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset); + +#endif + +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/inc/makefile.mk b/sw/source/filter/inc/makefile.mk new file mode 100644 index 000000000000..1b35ca49549d --- /dev/null +++ b/sw/source/filter/inc/makefile.mk @@ -0,0 +1,26 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx new file mode 100644 index 000000000000..2f93e279c21d --- /dev/null +++ b/sw/source/filter/inc/msfilter.hxx @@ -0,0 +1,528 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ +/// @HTML + +#ifndef SW_MS_MSFILTER_HXX +#define SW_MS_MSFILTER_HXX + +#include <set> +#include <map> +#include <vector> +# include <swtypes.hxx> //SwTwips +# include <tools/string.hxx> //String +# include "wwstyles.hxx" //ww::sti +# include <rtl/textenc.h> //rtl_TextEncoding +# include <tools/gen.hxx> //Size +#include <tools/datetime.hxx> +#include <fltshell.hxx> // fuer den Attribut Stack +#include <redline.hxx> +#include <shellio.hxx> +#include <svl/zforlist.hxx> + +#define CREATE_CONST_ASC(s) String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM(s)) + +class SwDoc; +class SwPaM; +class String; +class SwTableNode; +class SwNodeIndex; +class SwNoTxtNode; +class SwTxtNode; +class WW8TabDesc; + +namespace myImplHelpers +{ +template<class C> class StyleMapperImpl; +} + +class SwTxtFmtColl; +class SwCharFmt; +typedef myImplHelpers::StyleMapperImpl<SwTxtFmtColl> ParaMapper; +typedef myImplHelpers::StyleMapperImpl<SwCharFmt> CharMapper; + +namespace sw +{ + namespace ms + { + /** MSOffice appears to set the charset of unicode fonts to MS 932 + + Arial Unicode MS for example is a unicode font, but word sets + exported uses of it to the MS 932 charset + + @param eTextEncoding + the OOo encoding to convert from + + @return + a msoffice equivalent charset identifier + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + sal_uInt8 rtl_TextEncodingToWinCharset(rtl_TextEncoding eTextEncoding); + + /** Import a MSWord XE field. Suitable for .doc and .rtf + + @param rDoc + the document to insert into + + @param rPaM + the position in the document to insert into + + @param rXE + the arguments of the original word XE field + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + void ImportXE(SwDoc &rDoc, SwPaM &rPaM, const String &rXE); + + /** Convert from DTTM to Writer's DateTime + + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a + */ + DateTime DTTM2DateTime( long lDTTM ); + + /** Convert from DTTM to Writer's DateTime + + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a + */ + long DateTime2DTTM( const DateTime& rDT ); + + /** Convert from Word Date/Time field str to Writer's Date Time str + + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a + */ + ULONG MSDateTimeFormatToSwFormat(String& rParams, SvNumberFormatter *pFormatter, USHORT &rLang, bool bHijri); + + /** Used by MSDateTimeFormatToSwFormat to identify AM time fields + + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a + */ + bool IsNotAM(String& rParams, xub_StrLen nPos); + + /** Another function used by MSDateTimeFormatToSwFormat + + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a + */ + void SwapQuotesInField(String &rFmt); + + } + + namespace util + { + struct AuthorInfo; + typedef AuthorInfo* AuthorInfo_Ptr; + + /// Redlining Authors + struct AuthorInfo + { + USHORT nWWAuthorId; + USHORT nOurId; + + AuthorInfo(USHORT nWWAuthorId_, USHORT nOurId_ = 0): + nWWAuthorId( nWWAuthorId_ ), + nOurId( nOurId_ ) + {} + bool operator==(const AuthorInfo& rEntry) const + { + return (nWWAuthorId == rEntry.nWWAuthorId); + } + bool operator<(const AuthorInfo& rEntry) const + { + return (nWWAuthorId < rEntry.nWWAuthorId); + } + }; + + SV_DECL_PTRARR_SORT_DEL(AuthorInfos, AuthorInfo_Ptr,16,16) + + /** Clips a value to MAX/MIN 16bit value to make it safe for use + as a position value to give to writer. i.e. +-57.8cm. Sometimes + we see ridiculous values for positioning in rtf and word document, + this captures such ones and clips them to values which are + still outside the document, but of a value that doesn't cause + problems for writer's layout, e.g. see + http://www.openoffice.org/issues/show_bug.cgi?id=i9245 + + @param nIn + + @return nIn clipped to min/max 16bit value + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + SwTwips MakeSafePositioningValue(SwTwips nIn); + + /** Knows which writer style a given word style should be imported as + + Mapping a word style to a writer style has to consider mapping + the word builtin styles like "Normal" as the default root style + to our default root style which is called "Default" in english, + and "Normal" in german. + + Additionally it then has to avoid name collisions such as + + a) styles "Normal" and "Default" in a single document, where + we can use the original distinct names "Normal" and "Default" and.. + b) styles "Normal" and "Default" in a single document, where + we can not use the original names, and must come up with an + alternative name for one of them.. + + And it needs to report to the importer if the style being mapped to + was already in existance, for the cut and paste/insert file mode we + should not modify the returned style if it is already in use as it + is does not belong to us to change. + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + class ParaStyleMapper + { + private: + //I hate these things stupid pImpl things, but its warranted here + ParaMapper *mpImpl; + public: + ParaStyleMapper(SwDoc &rDoc); + ~ParaStyleMapper(); + + /** StyleResult + StyleResult is a std::pair of a pointer to a style and a flag + which is true if the style existed previously in the document. + */ + typedef std::pair<SwTxtFmtColl*, bool> StyleResult; + + /** Get the writer style which the word style should map to + + @param rName + The name of the word style + + @param eSti + The style id of the word style, we are really only interested + in knowing if the style has either a builtin standard id, or is + a user defined style. + + @return + The equivalent writer style packaged as a StyleResult to use + for this word style. + + It will only return a failure in the pathological case of + catastropic failure elsewhere of there exist already styles + rName and WW-rName[0..SAL_MAX_INT32], which is both unlikely + and impossible. + */ + StyleResult GetStyle(const String& rName, ww::sti eSti); + }; + + /** Knows which writer style a given word style should be imported as + + Mapping a word style to a writer style has to consider mapping + the word builtin styles like "Normal" as the default root style + to our default root style which is called "Default" in english, + and "Normal" in german. + + Additionally it then has to avoid name collisions such as + + a) styles "Normal" and "Default" in a single document, where + we can use the original distinct names "Normal" and "Default" and.. + b) styles "Normal" and "Default" in a single document, where + we can not use the original names, and must come up with an + alternative name for one of them.. + + And it needs to report to the importer if the style being mapped to + was already in existance, for the cut and paste/insert file mode we + should not modify the returned style if it is already in use as it + is does not belong to us to change. + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + class CharStyleMapper + { + private: + //I hate these things stupid pImpl things, but its warranted here + CharMapper *mpImpl; + public: + CharStyleMapper(SwDoc &rDoc); + ~CharStyleMapper(); + + /** StyleResult + StyleResult is a std::pair of a pointer to a style and a flag + which is true if the style existed previously in the document. + */ + typedef std::pair<SwCharFmt*, bool> StyleResult; + + /** Get the writer style which the word style should map to + + @param rName + The name of the word style + + @param eSti + The style id of the word style, we are really only interested + in knowing if the style has either a builtin standard id, or is + a user defined style. + + @return + The equivalent writer style packaged as a StyleResult to use + for this word style. + + It will only return a failure in the pathological case of + catastropic failure elsewhere of there exist already styles + rName and WW-rName[0..SAL_MAX_INT32], which is both unlikely + and impossible. + */ + StyleResult GetStyle(const String& rName, ww::sti eSti); + }; + + /** Find suitable names for exporting this font + + Given a fontname description find the best primary and secondary + fallback font to use from MSWord's persp font + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + + @see #i10242#/#i19164# for examples + */ + class FontMapExport + { + public: + String msPrimary; + String msSecondary; + bool HasDistinctSecondary() const; + FontMapExport(const String &rFontDescription); + }; + + class InsertedTableClient : public SwClient + { + public: + InsertedTableClient(SwTableNode & rNode); + SwTableNode * GetTableNode(); + }; + + /** Handle requirements for table formatting in insert->file mode. + + When inserting a table into a document which already has been + formatted and laid out (e.g using insert->file) then tables + must be handled in a special way, (or so previous comments and + code in the filters leads me to believe). + + Before the document is finalized the new tables need to have + their layout frms deleted and recalculated. This TableManager + detects the necessity to do this, and all tables inserted into + a document should be registered with this manager with + InsertTable, and before finialization DelAndMakeTblFrms should + be called. + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + + @see #i25782# for examples + */ + class InsertedTablesManager + { + public: + typedef std::map<InsertedTableClient *, SwNodeIndex *> TblMap; + typedef TblMap::iterator TblMapIter; + void DelAndMakeTblFrms(); + void InsertTable(SwTableNode &rTableNode, SwPaM &rPaM); + InsertedTablesManager(const SwDoc &rDoc); + private: + bool mbHasRoot; + TblMap maTables; + }; + + /** + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a> + */ + class RedlineStack + { + private: + std::vector<SwFltStackEntry *> maStack; + typedef std::vector<SwFltStackEntry *>::reverse_iterator myriter; + SwDoc &mrDoc; + public: + explicit RedlineStack(SwDoc &rDoc) : mrDoc(rDoc) {} + void open(const SwPosition& rPos, const SfxPoolItem& rAttr); + bool close(const SwPosition& rPos, RedlineType_t eType); + void close(const SwPosition& rPos, RedlineType_t eType, + WW8TabDesc* pTabDesc ); + void closeall(const SwPosition& rPos); + ~RedlineStack(); + private: + //No copying + RedlineStack(const RedlineStack&); + RedlineStack& operator=(const RedlineStack&); + }; + + /** + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a> + */ + class SetInDocAndDelete + { + private: + SwDoc &mrDoc; + public: + explicit SetInDocAndDelete(SwDoc &rDoc) : mrDoc(rDoc) {} + void operator()(SwFltStackEntry *pEntry); + private: + //No assignment + SetInDocAndDelete& operator=(const SetInDocAndDelete&); + }; + + /** + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a> + */ + class CloseIfOpen //Subclass from something ? + { + private: + const SwPosition &mrPos; + public: + explicit CloseIfOpen(const SwPosition &rPos) : mrPos(rPos) {} + void operator()(SwFltStackEntry *pEntry) const + { + if (pEntry->bLocked) + pEntry->SetEndPos(mrPos); + } + private: + //No assignment + CloseIfOpen& operator=(const CloseIfOpen&); + }; + + /** + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a> + */ + class CompareRedlines: + public std::binary_function<const SwFltStackEntry*, const SwFltStackEntry*, + bool> + { + public: + bool operator()(const SwFltStackEntry *pOneE, const SwFltStackEntry *pTwoE) + const; + }; + + class WrtRedlineAuthor + { + protected: + std::vector<String> maAuthors; // Array of Sw - Bookmarknames + + USHORT GetPos( const String& rNm ); + + //No copying + WrtRedlineAuthor(const WrtRedlineAuthor&); + WrtRedlineAuthor& operator=(const WrtRedlineAuthor&); + public: + WrtRedlineAuthor() {} + virtual ~WrtRedlineAuthor() {} + + USHORT AddName( const String& rNm ); + virtual void Write(Writer &rWrt) = 0; + // std::vector<String> GetNames(); + }; + + /** Given a SwNoTxtNode (ole/graphic) get original size + + Get the uncropped and unscaled size of the underlying graphic or + ole object associated with a given SwNoTxtNode. + + This function will swap in the graphic if it is swapped out from + the graphic or object cache, but will swap it out if that was the + case, i.e. rNd is logically unchanged before and after + GetSwappedInSize, though not physically const + + @param rNd + the SwNoTxtNode whose objects original size we want + + @return + the uncropped unscaled size of the SwNoTxtNode + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + Size GetSwappedInSize(const SwNoTxtNode& rNd); + + struct CharRunEntry + { + xub_StrLen mnEndPos; + sal_uInt16 mnScript; + rtl_TextEncoding meCharSet; + bool mbRTL; + CharRunEntry(xub_StrLen nEndPos, sal_uInt16 nScript, + rtl_TextEncoding eCharSet, bool bRTL) + : mnEndPos(nEndPos), mnScript(nScript), meCharSet(eCharSet), + mbRTL(bRTL) + { + } + }; + + typedef std::vector<CharRunEntry> CharRuns; + typedef CharRuns::const_iterator cCharRunIter; + + /** Collect the ranges of Text which share + + Word generally requires characters which share the same direction, + the same script, and occasionally (depending on the format) the + same charset to be exported in independant chunks. + + So this function finds these ranges and returns a STL container + of CharRuns + + @param rTxtNd + The TextNode we want to ranges from + + @param nStart + The position in the TxtNode to start processing from + + @param bSplitOnCharSet + Set to true is we want to split on ranges of characters that + share a plausible charset for export to e.g. WW7- or perhaps + RTF format, not necessary for a unicode aware format like WW8+ + + @return STL container of CharRuns which describe the shared + direction, script and optionally script of the contigious sequences + of characters + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + + @see #i22537# for example + */ + CharRuns GetPseudoCharRuns(const SwTxtNode& rTxtNd, + xub_StrLen nStart = 0, bool bSplitOnCharSet = false); + } +} + +#endif +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/inc/rtf.hxx b/sw/source/filter/inc/rtf.hxx new file mode 100644 index 000000000000..9f7578fd5f71 --- /dev/null +++ b/sw/source/filter/inc/rtf.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RTF_HXX +#define _RTF_HXX + +#include <tools/solar.h> + +// Umsetzung einiger FlyFrame-Attribute +class RTFVertOrient +{ + union { + struct { + USHORT nOrient : 4; + USHORT nRelOrient : 1; + } Flags; + USHORT nVal; + } Value; + +public: + RTFVertOrient( USHORT nValue ) { Value.nVal = nValue; } + + RTFVertOrient( USHORT nOrient, USHORT nRelOrient ) { + Value.Flags.nOrient = nOrient; + Value.Flags.nRelOrient = nRelOrient; + } + + USHORT GetOrient() const { return Value.Flags.nOrient; } + USHORT GetRelation() const { return Value.Flags.nRelOrient; } + USHORT GetValue() const { return Value.nVal; } +}; + + +class RTFHoriOrient +{ + union { + struct { + USHORT nOrient : 4; + USHORT nRelAnchor : 4; + USHORT nRelOrient : 1; + } Flags; + USHORT nVal; + } Value; + +public: + RTFHoriOrient( USHORT nValue ) { Value.nVal = nValue; } + + RTFHoriOrient( USHORT nOrient, USHORT nRelOrient ) { + Value.Flags.nOrient = nOrient; + Value.Flags.nRelOrient = nRelOrient; + Value.Flags.nRelAnchor = 0; + } + + USHORT GetOrient() const { return Value.Flags.nOrient; } + USHORT GetRelation() const { return Value.Flags.nRelOrient; } + USHORT GetValue() const { return Value.nVal; } +}; + +class RTFProtect +{ + union { + struct { + BOOL bCntnt : 1; + BOOL bSize : 1; + BOOL bPos : 1; + } Flags; + BYTE nVal; + } Value; +public: + RTFProtect( BYTE nValue ) { Value.nVal = nValue; } + + RTFProtect( BOOL bCntnt, BOOL bSize, BOOL bPos ) { + Value.Flags.bCntnt = bCntnt; + Value.Flags.bSize = bSize; + Value.Flags.bPos = bPos; + } + + BOOL GetCntnt() const { return Value.Flags.bCntnt; } + BOOL GetSize() const { return Value.Flags.bSize; } + BOOL GetPos() const { return Value.Flags.bPos; } + USHORT GetValue() const { return Value.nVal; } +}; + + +class RTFSurround +{ + union { + struct { + USHORT nGoldCut : 1; + USHORT nOrder : 4; + } Flags; + BYTE nVal; + } Value; +public: + RTFSurround( BYTE nValue ) { Value.nVal = nValue; } + + RTFSurround( BOOL bGoldCut, BYTE nOrder ) { + Value.Flags.nOrder = nOrder; + Value.Flags.nGoldCut = bGoldCut; + } + + BYTE GetOrder() const { return (BYTE)Value.Flags.nOrder; } + BOOL GetGoldCut() const { return (BOOL)Value.Flags.nGoldCut; } + USHORT GetValue() const { return Value.nVal; } +}; + +#endif // _RTF_HXX + + diff --git a/sw/source/filter/inc/wrt_fn.hxx b/sw/source/filter/inc/wrt_fn.hxx new file mode 100644 index 000000000000..f190811a6f46 --- /dev/null +++ b/sw/source/filter/inc/wrt_fn.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _WRT_FN_HXX +#define _WRT_FN_HXX +#include "hintids.hxx" // fuer die Konstanten + +// einige Forward-Deklarationen +class SwNode; +class SwCntntNode; +class Writer; +class SfxPoolItem; +class SfxItemSet; + +/* Funktionspointer auf die Attribut-Write-Funktionen */ +typedef Writer& (*FnAttrOut)( Writer&, const SfxPoolItem& ); +typedef FnAttrOut SwAttrFnTab[ POOLATTR_END - POOLATTR_BEGIN ]; + +SW_DLLPUBLIC Writer& Out( const SwAttrFnTab, const SfxPoolItem&, Writer& ); +SW_DLLPUBLIC Writer& Out_SfxItemSet( const SwAttrFnTab, Writer&, const SfxItemSet&, + BOOL bDeep, BOOL bTstForDefault = TRUE ); + + +/* Funktionspointer auf die Node-Write-Funktionen */ + +enum RES_NODE +{ +RES_NODE_BEGIN = 0, + RES_TXTNODE = RES_NODE_BEGIN, + RES_GRFNODE, + RES_OLENODE, +RES_NODE_END +}; + +typedef Writer& (*FnNodeOut)( Writer&, SwCntntNode& ); +typedef FnNodeOut SwNodeFnTab[ RES_NODE_END - RES_NODE_BEGIN ]; + +SW_DLLPUBLIC Writer& Out( const SwNodeFnTab, SwNode&, Writer & rWrt ); + + + + +#endif // _WRT_FN_HXX diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx new file mode 100644 index 000000000000..5bbf776351a1 --- /dev/null +++ b/sw/source/filter/inc/wrtswtbl.hxx @@ -0,0 +1,334 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _WRTSWTBL_HXX +#define _WRTSWTBL_HXX + +#include <tools/solar.h> +#include <tools/color.hxx> +#include <svl/svarray.hxx> + +#include <swdllapi.h> + +class Color; +class SwTableBox; +class SwTableLine; +class SwTableLines; +class SwTable; +class SwHTMLTableLayout; +class SvxBrushItem; +class SvxBorderLine; + +//--------------------------------------------------------------------------- +// Code aus dem HTML-Filter fuers schreiben von Tabellen +//--------------------------------------------------------------------------- + +#define COLFUZZY 20 +#define ROWFUZZY 20 +#define COL_DFLT_WIDTH ((2*COLFUZZY)+1) +#define ROW_DFLT_HEIGHT (2*ROWFUZZY)+1 + + +//----------------------------------------------------------------------- + +class SwWriteTableCell +{ + const SwTableBox *pBox; // SwTableBox der Zelle + const SvxBrushItem *pBackground; // geerbter Hintergrund einer Zeile + + long nHeight; // fixe/Mindest-Hoehe der Zeile + + USHORT nWidthOpt; // Breite aus Option; + + USHORT nRow; // Start-Zeile + USHORT nCol; // Start-Spalte + + USHORT nRowSpan; // ueberspannte Zeilen + USHORT nColSpan; // ueberspannte Spalten + + + BOOL bPrcWidthOpt; + +public: + + SwWriteTableCell(const SwTableBox *pB, USHORT nR, USHORT nC, USHORT nRSpan, + USHORT nCSpan, long nHght, const SvxBrushItem *pBGround) + : pBox( pB ), pBackground( pBGround ), nHeight( nHght ), nWidthOpt( 0 ), + nRow( nR ), nCol( nC ), nRowSpan( nRSpan ), nColSpan( nCSpan ), + bPrcWidthOpt( FALSE ) + {} + + const SwTableBox *GetBox() const { return pBox; } + + USHORT GetRow() const { return nRow; } + USHORT GetCol() const { return nCol; } + + USHORT GetRowSpan() const { return nRowSpan; } + USHORT GetColSpan() const { return nColSpan; } + + long GetHeight() const { return nHeight; } + sal_Int16 GetVertOri() const; + + const SvxBrushItem *GetBackground() const { return pBackground; } + + void SetWidthOpt( USHORT nWidth, BOOL bPrc ) + { + nWidthOpt = nWidth; bPrcWidthOpt = bPrc; + } + + USHORT GetWidthOpt() const { return nWidthOpt; } + BOOL HasPrcWidthOpt() const { return bPrcWidthOpt; } +}; + +typedef SwWriteTableCell *SwWriteTableCellPtr; +SV_DECL_PTRARR_DEL( SwWriteTableCells, SwWriteTableCellPtr, 5, 5 ) + + +//----------------------------------------------------------------------- + +class SwWriteTableRow +{ + SwWriteTableCells aCells; // Alle Zellen der Rows + const SvxBrushItem *pBackground;// Hintergrund + + long nPos; // End-Position (twips) der Zeile + BOOL mbUseLayoutHeights; + + // Forbidden and not implemented. + SwWriteTableRow(); + + SwWriteTableRow & operator= (const SwWriteTableRow &); + +protected: + // GCC >= 3.4 needs accessible T (const T&) to pass T as const T& argument. + SwWriteTableRow( const SwWriteTableRow & ); + +public: + + USHORT nTopBorder; // Dicke der oberen/unteren Umrandugen + USHORT nBottomBorder; + + BOOL bTopBorder : 1; // Welche Umrandungen sind da? + BOOL bBottomBorder : 1; + + SwWriteTableRow( long nPos, BOOL bUseLayoutHeights ); + + SwWriteTableCell *AddCell( const SwTableBox *pBox, + USHORT nRow, USHORT nCol, + USHORT nRowSpan, USHORT nColSpan, + long nHeight, + const SvxBrushItem *pBackground ); + + void SetBackground( const SvxBrushItem *pBGround ) + { + pBackground = pBGround; + } + const SvxBrushItem *GetBackground() const { return pBackground; } + + BOOL HasTopBorder() const { return bTopBorder; } + BOOL HasBottomBorder() const { return bBottomBorder; } + + long GetPos() const { return nPos; } + const SwWriteTableCells& GetCells() const { return aCells; } + + inline int operator==( const SwWriteTableRow& rRow ) const; + inline int operator<( const SwWriteTableRow& rRow2 ) const; +}; + +inline int SwWriteTableRow::operator==( const SwWriteTableRow& rRow ) const +{ + // etwas Unschaerfe zulassen + return (nPos >= rRow.nPos ? nPos - rRow.nPos : rRow.nPos - nPos ) <= + (mbUseLayoutHeights ? 0 : ROWFUZZY); +} + +inline int SwWriteTableRow::operator<( const SwWriteTableRow& rRow ) const +{ + // Da wir hier nur die Wahrheits-Grade 0 und 1 kennen, lassen wir lieber + // auch nicht zu, dass x==y und x<y gleichzeitig gilt ;-) + return nPos < rRow.nPos - (mbUseLayoutHeights ? 0 : ROWFUZZY); +} + +typedef SwWriteTableRow *SwWriteTableRowPtr; +SV_DECL_PTRARR_SORT_DEL( SwWriteTableRows, SwWriteTableRowPtr, 5, 5 ) + + +//----------------------------------------------------------------------- + +class SwWriteTableCol +{ + USHORT nPos; // End Position der Spalte + + USHORT nWidthOpt; + + BOOL bRelWidthOpt : 1; + BOOL bOutWidth : 1; // Spaltenbreite ausgeben? + +public: + BOOL bLeftBorder : 1; // Welche Umrandungen sind da? + BOOL bRightBorder : 1; + + SwWriteTableCol( USHORT nPosition ); + + USHORT GetPos() const { return nPos; } + + void SetLeftBorder( BOOL bBorder ) { bLeftBorder = bBorder; } + BOOL HasLeftBorder() const { return bLeftBorder; } + + void SetRightBorder( BOOL bBorder ) { bRightBorder = bBorder; } + BOOL HasRightBorder() const { return bRightBorder; } + + void SetOutWidth( BOOL bSet ) { bOutWidth = bSet; } + BOOL GetOutWidth() const { return bOutWidth; } + + inline int operator==( const SwWriteTableCol& rCol ) const; + inline int operator<( const SwWriteTableCol& rCol ) const; + + void SetWidthOpt( USHORT nWidth, BOOL bRel ) + { + nWidthOpt = nWidth; bRelWidthOpt = bRel; + } + USHORT GetWidthOpt() const { return nWidthOpt; } + BOOL HasRelWidthOpt() const { return bRelWidthOpt; } +}; + +inline int SwWriteTableCol::operator==( const SwWriteTableCol& rCol ) const +{ + // etwas Unschaerfe zulassen + return (nPos >= rCol.nPos ? nPos - rCol.nPos + : rCol.nPos - nPos ) <= COLFUZZY; +} + +inline int SwWriteTableCol::operator<( const SwWriteTableCol& rCol ) const +{ + // Da wir hier nur die Wahrheits-Grade 0 und 1 kennen, lassen wir lieber + // auch nicht zu, dass x==y und x<y gleichzeitig gilt ;-) + return nPos < rCol.nPos - COLFUZZY; +} + + +typedef SwWriteTableCol *SwWriteTableColPtr; +SV_DECL_PTRARR_SORT_DEL( SwWriteTableCols, SwWriteTableColPtr, 5, 5 ) + +//----------------------------------------------------------------------- + +class SW_DLLPUBLIC SwWriteTable +{ +protected: + SwWriteTableCols aCols; // alle Spalten + SwWriteTableRows aRows; // alle Zellen + + UINT32 nBorderColor; // Umrandungsfarbe + + USHORT nCellSpacing; // Dicke der inneren Umrandung + USHORT nCellPadding; // Absatnd Umrandung-Inhalt + + USHORT nBorder; // Dicke der ausseren Umrandung + USHORT nInnerBorder; // Dicke der inneren Umrandung + USHORT nBaseWidth; // Bezugsgroesse fur Breiten SwFmtFrmSize + + USHORT nHeadEndRow; // letzte Zeile des Tabellen-Kopfes + + USHORT nLeftSub; + USHORT nRightSub; + + long nTabWidth; // Absolute/Relative Breite der Tabelle + + BOOL bRelWidths : 1; // Breiten relativ ausgeben? + BOOL bUseLayoutHeights : 1; // Layout zur Hoehenbestimmung nehmen? +#ifdef DBG_UTIL + BOOL bGetLineHeightCalled : 1; +#endif + + BOOL bColsOption : 1; + BOOL bColTags : 1; + BOOL bLayoutExport : 1; + BOOL bCollectBorderWidth : 1; + + virtual BOOL ShouldExpandSub( const SwTableBox *pBox, + BOOL bExpandedBefore, USHORT nDepth ) const; + + void CollectTableRowsCols( long nStartRPos, USHORT nStartCPos, + long nParentLineHeight, + USHORT nParentLineWidth, + const SwTableLines& rLines, + USHORT nDepth ); + + void FillTableRowsCols( long nStartRPos, USHORT nStartRow, + USHORT nStartCPos, USHORT nStartCol, + long nParentLineHeight, + USHORT nParentLineWidth, + const SwTableLines& rLines, + const SvxBrushItem* pLineBrush, + USHORT nDepth, + sal_uInt16 nNumOfHeaderRows ); + + void MergeBorders( const SvxBorderLine* pBorderLine, BOOL bTable ); + + USHORT MergeBoxBorders( const SwTableBox *pBox, USHORT nRow, USHORT nCol, + USHORT nRowSpan, USHORT nColSpan, + USHORT &rTopBorder, USHORT &rBottomBorder ); + + USHORT GetBaseWidth() const { return nBaseWidth; } + + BOOL HasRelWidths() const { return bRelWidths; } + +public: + static long GetBoxWidth( const SwTableBox *pBox ); + + USHORT GetRawWidth( USHORT nCol, USHORT nColSpan ) const; + USHORT GetAbsWidth( USHORT nCol, USHORT nColSpan ) const; + USHORT GetRelWidth( USHORT nCol, USHORT nColSpan ) const; + USHORT GetPrcWidth( USHORT nCol, USHORT nColSpan ) const; + + long GetAbsHeight( long nRawWidth, USHORT nRow, USHORT nRowSpan ) const; +protected: + + long GetLineHeight( const SwTableLine *pLine ); + long GetLineHeight( const SwTableBox *pBox ) const; + const SvxBrushItem *GetLineBrush( const SwTableBox *pBox, + SwWriteTableRow *pRow ); + + USHORT GetLeftSpace( USHORT nCol ) const; + USHORT GetRightSpace( USHORT nCol, USHORT nColSpan ) const; + + +public: + SwWriteTable( const SwTableLines& rLines, long nWidth, USHORT nBWidth, + BOOL bRel, USHORT nMaxDepth = USHRT_MAX, + USHORT nLeftSub=0, USHORT nRightSub=0, sal_uInt32 nNumOfRowsToRepeat=0 ); + SwWriteTable( const SwHTMLTableLayout *pLayoutInfo ); + virtual ~SwWriteTable(); + + const SwWriteTableCols& GetCols() const { return aCols; } + const SwWriteTableRows& GetRows() const { return aRows; } +}; + + + + +#endif + diff --git a/sw/source/filter/inc/wwstyles.hxx b/sw/source/filter/inc/wwstyles.hxx new file mode 100644 index 000000000000..75b819676adc --- /dev/null +++ b/sw/source/filter/inc/wwstyles.hxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ +/// @HTML +#ifndef WW_WWSTYLES_HXX +#define WW_WWSTYLES_HXX + +class String; //yuck... + +#include <sal/types.h> + +namespace ww +{ + enum sti + { + stiNormal = 0, // 0x0000 + stiLev1 = 1, // 0x0001 + stiLev2 = 2, // 0x0002 + stiLev3 = 3, // 0x0003 + stiLev4 = 4, // 0x0004 + stiLev5 = 5, // 0x0005 + stiLev6 = 6, // 0x0006 + stiLev7 = 7, // 0x0007 + stiLev8 = 8, // 0x0008 + stiLev9 = 9, // 0x0009 + stiLevFirst = stiLev1, + stiLevLast = stiLev9, + stiIndex1 = 10, // 0x000A + stiIndex2 = 11, // 0x000B + stiIndex3 = 12, // 0x000C + stiIndex4 = 13, // 0x000D + stiIndex5 = 14, // 0x000E + stiIndex6 = 15, // 0x000F + stiIndex7 = 16, // 0x0010 + stiIndex8 = 17, // 0x0011 + stiIndex9 = 18, // 0x0012 + stiIndexFirst = stiIndex1, + stiIndexLast = stiIndex9, + stiToc1 = 19, // 0x0013 + stiToc2 = 20, // 0x0014 + stiToc3 = 21, // 0x0015 + stiToc4 = 22, // 0x0016 + stiToc5 = 23, // 0x0017 + stiToc6 = 24, // 0x0018 + stiToc7 = 25, // 0x0019 + stiToc8 = 26, // 0x001A + stiToc9 = 27, // 0x001B + stiTocFirst = stiToc1, + stiTocLast = stiToc9, + stiNormIndent = 28, // 0x001C + stiFtnText = 29, // 0x001D + stiAtnText = 30, // 0x001E + stiHeader = 31, // 0x001F + stiFooter = 32, // 0x0020 + stiIndexHeading = 33, // 0x0021 + stiCaption = 34, // 0x0022 + stiToCaption = 35, // 0x0023 + stiEnvAddr = 36, // 0x0024 + stiEnvRet = 37, // 0x0025 + stiFtnRef = 38, // 0x0026 char style + stiAtnRef = 39, // 0x0027 char style + stiLnn = 40, // 0x0028 char style + stiPgn = 41, // 0x0029 char style + stiEdnRef = 42, // 0x002A char style + stiEdnText = 43, // 0x002B + stiToa = 44, // 0x002C + stiMacro = 45, // 0x002D + stiToaHeading = 46, // 0x002E + stiList = 47, // 0x002F + stiListBullet = 48, // 0x0030 + stiListNumber = 49, // 0x0031 + stiList2 = 50, // 0x0032 + stiList3 = 51, // 0x0033 + stiList4 = 52, // 0x0034 + stiList5 = 53, // 0x0035 + stiListBullet2 = 54, // 0x0036 + stiListBullet3 = 55, // 0x0037 + stiListBullet4 = 56, // 0x0038 + stiListBullet5 = 57, // 0x0039 + stiListNumber2 = 58, // 0x003A + stiListNumber3 = 59, // 0x003B + stiListNumber4 = 60, // 0x003C + stiListNumber5 = 61, // 0x003D + stiTitle = 62, // 0x003E + stiClosing = 63, // 0x003F + stiSignature = 64, // 0x0040 + stiNormalChar = 65, // 0x0041 char style + stiBodyText = 66, // 0x0042 + /* + stiBodyTextInd1 was orig stiBodyText2 in documentation, but that + collides with the other stiBodyText2 and this seems more reasonable. + cmc@openoffice.org + */ + stiBodyTextInd1 = 67, // 0x0043 + stiListCont = 68, // 0x0044 + stiListCont2 = 69, // 0x0045 + stiListCont3 = 70, // 0x0046 + stiListCont4 = 71, // 0x0047 + stiListCont5 = 72, // 0x0048 + stiMsgHeader = 73, // 0x0049 + stiSubtitle = 74, // 0x004A + stiSalutation = 75, // 0x004B + stiDate = 76, // 0X004C + stiBodyText1I = 77, // 0x004D + stiBodyText1I2 = 78, // 0x004E + stiNoteHeading = 79, // 0x004F + stiBodyText2 = 80, // 0x0050 + stiBodyText3 = 81, // 0x0051 + stiBodyTextInd2 = 82, // 0x0052 + stiBodyTextInd3 = 83, // 0x0053 + stiBlockQuote = 84, // 0x0054 + stiHyperlink = 85, // 0x0055 char style + stiHyperlinkFollowed = 86, // 0x0056 char style + stiStrong = 87, // 0x0057 char style + stiEmphasis = 88, // 0x0058 char style + stiNavPane = 89, // 0x0059 char style + stiPlainText = 90, // 0x005A + stiMax = 91, // number of defined sti's + stiUser = 0x0ffe, // user styles are distinguished by name + stiNil = 0x0fff // max for 12 bits + }; + + /** Find the WinWord sti index of an english style name. + + When importing a RTF document we would like to treat styles as similiar + to how word does as possible, to this end word will treat some styles + with special names as inbuilt styles, and some as user defined styles. + + See OpenOffice.org issue 21881 + (http://www.openoffice.org/issues/show_bug.cgi?id=21881) + and OpenOffice.org issue 17503 + (http://www.openoffice.org/issues/show_bug.cgi?id=17503) + + @param + rSting the Style name to test to see what winword sti word would give + such a name if it has no other information to work with (e.g. importing + a RTF document) + + @return the sti that word would give it. stiUser if word would treat + it as a user defined style. + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + <a href="mailto:tono@openoffice.org">Takashi Ono</a> + */ + sti GetCanonicalStiFromEnglishName(const String &rString) throw(); + + /** Find the WinWord sti index of an old <= Word2 stc (style code) + + When importing a Word 2 document we would like to treat styles as + similiar to how word 8 does as possible, to this end word will treat + some styles with special codes as inbuilt styles, and some as user + defined styles. + + @param + stc the Style code to test to see what winword sti word would give + such a code + + @return the sti that word would give it. stiUser if word would treat + it as a user defined style. + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + sti GetCanonicalStiFromStc(sal_uInt8 stc) throw(); + + /** Find the WinWord english name from a sti index + + Map the word style index to it's english name + + @param + sti the Style index + + @return the name word would give it if it's an inbuilt name, otherwise + NULL + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + const sal_Char* GetEnglishNameFromSti(sti eSti) throw(); + + /** Determine if the WinWord sti is standard Character Style + + @param + sti the Style index + + @return true if a known inbuild character style + + @author + <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> + */ + bool StandardStiIsCharStyle(sti eSti) throw(); +} // namespace ww + +#endif +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ |