summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 14:45:43 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 14:45:43 +0000
commit70de0c38fd177b3c95837118c5fb35e380c87e90 (patch)
treebb54ac0c5769dcfc89fdaeb151ffac6eb18154de /sw/source/filter
parent5aff37cd51879a41365f2ceb0e927bdf57ffddb3 (diff)
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/ascii/parasc.cxx514
-rw-r--r--sw/source/filter/basflt/fltini.cxx59
-rw-r--r--sw/source/filter/basflt/shellio.cxx19
-rw-r--r--sw/source/filter/html/htmlatr.cxx12
-rw-r--r--sw/source/filter/html/htmlbas.cxx6
-rw-r--r--sw/source/filter/html/htmlfly.cxx10
-rw-r--r--sw/source/filter/html/htmlfly.hxx6
-rw-r--r--sw/source/filter/html/htmlflyt.cxx83
-rw-r--r--sw/source/filter/html/htmlform.cxx6
-rw-r--r--sw/source/filter/html/htmlgrin.cxx168
-rw-r--r--sw/source/filter/html/htmltab.cxx23
-rw-r--r--sw/source/filter/html/htmltabw.cxx7
-rw-r--r--sw/source/filter/html/makefile.mk4
-rw-r--r--sw/source/filter/html/wrthtml.cxx8
-rw-r--r--sw/source/filter/inc/fltshell.hxx5
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx147
-rw-r--r--sw/source/filter/rtf/rtffld.cxx88
-rw-r--r--sw/source/filter/rtf/rtffly.cxx45
-rw-r--r--sw/source/filter/rtf/rtfnum.cxx9
-rw-r--r--sw/source/filter/rtf/rtftbl.cxx210
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx1933
-rw-r--r--sw/source/filter/rtf/swparrtf.hxx139
-rw-r--r--sw/source/filter/writer/writer.cxx41
-rw-r--r--sw/source/filter/ww1/fltshell.cxx18
-rw-r--r--sw/source/filter/ww8/dump/dump8a.cxx4
-rw-r--r--sw/source/filter/ww8/escher.hxx9
-rw-r--r--sw/source/filter/ww8/makefile.mk5
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx94
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx37
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx7
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx63
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx85
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx10
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx20
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx10
-rw-r--r--sw/source/filter/ww8/ww8glsy.cxx14
-rw-r--r--sw/source/filter/ww8/ww8glsy.hxx7
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx62
-rw-r--r--sw/source/filter/ww8/ww8graf.hxx7
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx42
-rw-r--r--sw/source/filter/ww8/ww8par.cxx747
-rw-r--r--sw/source/filter/ww8/ww8par.hxx202
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx100
-rw-r--r--sw/source/filter/ww8/ww8par2.hxx8
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx18
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx179
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx1581
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx214
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx12
-rw-r--r--sw/source/filter/ww8/ww8struc.hxx134
-rw-r--r--sw/source/filter/xml/swxml.cxx16
-rw-r--r--sw/source/filter/xml/xmlexpit.cxx12
-rw-r--r--sw/source/filter/xml/xmliteme.cxx8
-rw-r--r--sw/source/filter/xml/xmltbli.cxx101
-rw-r--r--sw/source/filter/xml/xmltexte.cxx63
-rw-r--r--sw/source/filter/xml/xmltexte.hxx9
57 files changed, 3531 insertions, 3915 deletions
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index f6954fdb6099..940a1baa7193 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: parasc.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: hbrinkm $ $Date: 2002-12-04 14:51:35 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,8 @@
*
************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
#ifdef PCH
#include "filt_pch.hxx"
#endif
@@ -135,409 +137,6 @@
#define ASC_BUFFLEN 4096
-
-#ifdef ASYNCHRON
-
-class _SvLockBytes
-{
- AutoTimer aTimer;
- SvStream& rIn;
-
- ULONG nDataRead;
- Link aCallDataRead;
-
- DECL_STATIC_LINK( _SvLockBytes, DataRead, Timer* );
-
-public:
- _SvLockBytes( SvStream& rInput, const Link& rCallBack );
- ~_SvLockBytes();
-
- ErrCode ReadAt( ULONG nPos, void* pArr, ULONG nCount, ULONG* pReadCnt );
-
- SvStream& GetStream() const { return rIn; }
-};
-
-
-// client vom Standard SwPageDesc. Wird dieser geloescht, dann
-// der Reader auch beendet werden!!
-class SwAsynchLoader : public SvRefBase, public SwClient
-{
-protected:
-
- SwDoc* pDoc;
- SwPaM* pPam;
-
- BOOL bInCall;
- _SvLockBytes* pLoader;
-
- DECL_STATIC_LINK( SwAsynchLoader, NewData, _SvLockBytes* );
-
-protected:
- virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
- virtual ~SwAsynchLoader();
-
- virtual ULONG NextData() = 0;
-
-public:
- SwAsynchLoader( SvStream& rIn, const SwPaM& rCrsr );
-
- ULONG CallParser();
-};
-
-SV_DECL_REF(SwAsynchLoader)
-SV_IMPL_REF(SwAsynchLoader)
-
-
-class SwASCIIParser : public SwAsynchLoader
-{
- char* pArr, *pStt, *pEnd, *pLastStt;
-
- long nLineLen;
- ULONG nError, nReadCnt, nFileSize;
-
- const SwAsciiOptions& rOpt;
- char cLastCRLF;
-
- virtual ULONG NextData();
-
-protected:
- virtual ~SwASCIIParser();
-
-public:
- SwASCIIParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
- int bReadNewDoc, const SwAsciiOptions& rOpts);
-};
-
-SV_DECL_REF(SwASCIIParser)
-SV_IMPL_REF(SwASCIIParser)
-
-
-// Aufruf fuer die allg. Reader-Schnittstelle
-ULONG AsciiReader::Read( SwDoc &rDoc, SwPaM &rPam, const String & )
-{
- if( !pStrm )
- {
- ASSERT( !this, "ASCII-Read ohne Stream" );
- return ERR_SWG_READ_ERROR;
- }
-
- //JP 18.01.96: Alle Ueberschriften sind normalerweise ohne
- // Kapitelnummer. Darum hier explizit abschalten
- // weil das Default jetzt wieder auf AN ist.
- if( !bInsertMode )
- Reader::SetNoOutlineNum( rDoc );
-
- SwASCIIParserRef xParser( new SwASCIIParser( &rDoc, rPam, *pStrm,
- !bInsertMode, eCodeSet ));
- ULONG nRet = xParser->CallParser();
- // nach dem Lesen sofort wieder defaulten
- eCodeSet = GetSystemCharSet();
- return ERRCODE_IO_PENDING == nRet ? 0 : nRet;
-}
-
-
-/* */
-
-SwASCIIParser::SwASCIIParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
- int bReadNewDoc, CharSet eSrc )
- : SwAsynchLoader( rIn, rCrsr ),
- eCodeSet( eSrc )
-{
- pArr = new char [ ASC_BUFFLEN + 1 ];
-
- pStt = pEnd = pLastStt = pArr;
-
- cLastCRLF = 0;
- nLineLen = 0;
- nError = 0;
- nReadCnt = 0;
-
- rIn.Seek(STREAM_SEEK_TO_END);
- rIn.ResetError();
-
- nFileSize = rIn.Tell();
- rIn.Seek(STREAM_SEEK_TO_BEGIN);
- rIn.ResetError();
-
-}
-
-SwASCIIParser::~SwASCIIParser()
-{
- delete pArr;
-}
-
-
-ULONG SwASCIIParser::NextData()
-{
- SvStream& rInput = pLoader->GetStream();
- do {
- if( pStt >= pEnd )
- {
- if( pLastStt != pStt )
- {
- pDoc->Insert( *pPam, pLastStt, eCodeSet );
- pLastStt = pStt;
- }
-
- // lese einen neuen Block ein
- ULONG lGCount;
-
- if (SVSTREAM_OK != rInput.GetError() || 0 != ( nError = pLoader->
- ReadAt( nReadCnt, pArr, ASC_BUFFLEN, &lGCount )) ||
- ( rInput.IsEof() && !lGCount ))
- {
- if( ERRCODE_IO_PENDING != nError || !lGCount )
- break; // aus der WHILE-Schleife heraus
- }
-
- pEnd = pArr + lGCount;
- nReadCnt += lGCount;
- *pEnd = 0;
- pStt = pLastStt = pArr;
-
- ::SetProgressState( nReadCnt, pDoc->GetDocShell() );
-
- if( cLastCRLF )
- {
- if( ( 0x0a == *pStt && 0x0d == cLastCRLF ) ||
- ( 0x0d == *pStt && 0x0a == cLastCRLF ))
- pLastStt = ++pStt;
- cLastCRLF = 0;
- nLineLen = 0;
- // JP 03.04.96: das letze am Ende nehmen wir nicht
- if( !rInput.IsEof() || !(pEnd == pStt ||
- ( !*pEnd && pEnd == pStt+1 ) ) )
- pDoc->SplitNode( *pPam->GetPoint() );
- }
- }
-
- BOOL bIns = TRUE, bSplitNode = FALSE;
- switch( *pStt )
- {
- case 0:
- pEnd = pStt;
- bIns = FALSE;
- break;
-
- case 0x0a:
- bIns = FALSE;
- *pStt = 0;
- if( ++pStt == pEnd )
- cLastCRLF = 0x0a;
- else
- {
- if( 0x0d == *pStt )
- pStt++;
- // JP 03.04.96: das letze am Ende nehmen wir nicht
- if( !rInput.IsEof() || !(pEnd == pStt ||
- ( !*pEnd && pEnd == pStt+1 ) ) )
- bSplitNode = TRUE;
- }
- break;
-
- case 0x0d:
- bIns = FALSE;
- *pStt = 0;
- if( ++pStt == pEnd )
- cLastCRLF = 0x0d;
- else
- {
- if( 0x0a == *pStt )
- pStt++;
- // JP 03.04.96: das letze am Ende nehmen wir nicht
- if( !rInput.IsEof() || !(pEnd == pStt ||
- ( !*pEnd && pEnd == pStt+1 ) ) )
- bSplitNode = TRUE;
- }
- break;
-
- case '\t': break;
-
- case 0x0c:
- {
- // dann mal einen harten Seitenumbruch einfuegen
- *pStt++ = 0;
- if( nLineLen )
- pDoc->Insert( *pPam, pLastStt, eCodeSet );
- pDoc->SplitNode( *pPam->GetPoint() );
- pDoc->Insert( *pPam, SvxFmtBreakItem(
- SVX_BREAK_PAGE_BEFORE ));
- pLastStt = pStt;
- nLineLen = 0;
- bIns = FALSE;
- }
- break;
-
- case 0x1a:
- if( nReadCnt == nFileSize && pStt+1 == pEnd )
- *pStt = 0;
- else
- *pStt = '#'; // Ersatzdarstellung
- break;
-
- default:
-
- if( (BYTE)' ' > (BYTE)*pStt )
- // Ctrl-Zchn gefunden ersetze durch '#'
- *pStt = '#';
- }
-
- if( bIns )
- {
- if( ( nLineLen >= MAX_ASCII_PARA - 100 ) &&
- ( ( *pStt == ' ' ) || ( nLineLen >= MAX_ASCII_PARA - 1 ) ) )
- {
- char c = *pStt;
- *pStt = 0;
- pDoc->Insert( *pPam, pLastStt, eCodeSet );
- pDoc->SplitNode( *pPam->GetPoint() );
- pLastStt = pStt;
- nLineLen = 0;
- *pStt = c;
- }
- ++pStt;
- ++nLineLen;
- }
- else if( bSplitNode )
- {
- // es wurde ein CR/LF erkannt, also speichere den Text
- pDoc->Insert( *pPam, pLastStt, eCodeSet );
- pDoc->SplitNode( *pPam->GetPoint() );
- pLastStt = pStt;
- nLineLen = 0;
- }
- } while( TRUE );
-
- return nError;
-}
-
-
-/* */
-
-SwAsynchLoader::SwAsynchLoader( SvStream& rIn, const SwPaM& rCrsr )
- : SwClient( 0 )
-{
- bInCall = FALSE;
- pDoc = (SwDoc*)rCrsr.GetDoc();
- pPam = new SwPaM( pDoc, *rCrsr.GetPoint() );
-
- SwPageDesc& rDesc = pDoc->_GetPageDesc( 0 );
- rDesc.Add( this );
-
- pLoader = new _SvLockBytes( rIn,
- STATIC_LINK( this, SwAsynchLoader, NewData ) );
-}
-
-SwAsynchLoader::~SwAsynchLoader()
-{
- delete pPam;
- delete pLoader;
-}
-
-void SwAsynchLoader::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
-{
- switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
- {
- case RES_OBJECTDYING:
- if( ((SwPtrMsgPoolItem *)pOld)->pObject == pRegisteredIn )
- {
- // dann uns selbst beenden
- pRegisteredIn->Remove( this );
- ReleaseRef(); // ansonsten sind wir fertig!
- }
- break;
- }
-}
-
-IMPL_STATIC_LINK( SwAsynchLoader, NewData, _SvLockBytes*, p )
-{
- ULONG nRet = 0;
- if( !pThis->bInCall ) // kein mehrfaches Aufrufen
- {
- pThis->bInCall = TRUE;
-
- BOOL bModify = pThis->pDoc->IsModified();
- nRet = pThis->NextData();
- if( !bModify )
- pThis->pDoc->ResetModified();
-
- if( ERRCODE_IO_PENDING != nRet )
- pThis->ReleaseRef(); // ansonsten sind wir fertig!
-
- pThis->bInCall = FALSE;
- }
-
- return nRet;
-}
-
-
-ULONG SwAsynchLoader::CallParser()
-{
- bInCall = TRUE;
- AddRef();
- ULONG nRet = NextData();
- if( ERRCODE_IO_PENDING != nRet )
- ReleaseRef(); // ansonsten sind wir fertig!
-
- // Sind wir im Pending-Status, wird ueber den Callback "geidelt" bis
- // alles gelesen ist oder ein Fehler aufgetreten ist!
-
- // Was passiert dann ???
-
- bInCall = FALSE;
- return nRet;
-}
-
-/* */
-
-_SvLockBytes::_SvLockBytes( SvStream& rInput, const Link& rCallback )
- : rIn( rInput ), aCallDataRead( rCallback )
-{
- nDataRead = 0;
-
- aTimer.SetTimeout( 1000 ); // jede Sekunde 100 Zeichen lesen
- aTimer.SetTimeoutHdl( STATIC_LINK( this, _SvLockBytes, DataRead ));
- aTimer.Start();
-}
-
-_SvLockBytes::~_SvLockBytes()
-{
- aTimer.Stop();
-}
-
-ErrCode _SvLockBytes::ReadAt( ULONG nPos, void* pArr, ULONG nCount,
- ULONG* pReadCnt )
-{
- ErrCode nRet = 0;
- if( nPos + nCount > nDataRead )
- {
- nCount = nDataRead - nPos;
- nRet = ERRCODE_IO_PENDING;
- }
-
- if( nCount )
- {
- rIn.Seek( nPos );
- *pReadCnt = rIn.Read( pArr, nCount );
- }
- else
- *pReadCnt = 0;
- return rIn.GetError() ? rIn.GetError()
- : ( rIn.IsEof() ? 0 : nRet );
-}
-
-IMPL_STATIC_LINK( _SvLockBytes, DataRead, Timer*, pTimer )
-{
- pThis->nDataRead += 100;
- pThis->aCallDataRead.Call( pThis );
-
- return 0;
-}
-
-/* */
-
-#else
-
class SwASCIIParser
{
SwDoc* pDoc;
@@ -548,7 +147,7 @@ class SwASCIIParser
SfxItemSet* pItemSet;
long nFileSize;
USHORT nScript;
- BOOL bNewDoc;
+ bool bNewDoc;
ULONG ReadChars();
void InsertText( const String& rStr );
@@ -612,7 +211,7 @@ SwASCIIParser::SwASCIIParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
}
if( rOpt.GetFontName().Len() )
{
- BOOL bDelete = FALSE;
+ bool bDelete = false;
const SfxFont* pFnt = 0;
if( pDoc->GetPrt() )
pFnt = pDoc->GetPrt()->GetFontByName( rOpt.GetFontName() );
@@ -620,7 +219,7 @@ SwASCIIParser::SwASCIIParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
if( !pFnt )
{
pFnt = new SfxFont( FAMILY_DONTKNOW, rOpt.GetFontName() );
- bDelete = TRUE;
+ bDelete = true;
}
SvxFontItem aFont( pFnt->GetFamily(), pFnt->GetName(),
aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet() );
@@ -662,6 +261,17 @@ ULONG SwASCIIParser::CallParser()
nSttCntnt = pPam->GetPoint()->nContent.GetIndex();
}
+ SwTxtFmtColl *pColl = 0;
+
+ if (bNewDoc)
+ {
+ pColl = pDoc->GetTxtCollFromPoolSimple(RES_POOLCOLL_HTML_PRE, false);
+ if (!pColl)
+ pColl = pDoc->GetTxtCollFromPoolSimple(RES_POOLCOLL_STANDARD,false);
+ if (pColl)
+ pDoc->SetTxtFmtColl(*pPam, pColl);
+ }
+
ULONG nError = ReadChars();
if( pItemSet )
@@ -686,40 +296,39 @@ ULONG SwASCIIParser::CallParser()
{
if( bNewDoc )
{
- // Using the pool defaults for the font causes significant
- // trouble for the HTML filter, because it is not able
- // to export the pool defaults (or to be more precice:
- // the HTML filter is not able to detect whether a pool
- // default has changed or not. Even a comparison with the
- // HTMLi template does not work, because the defaults are
- // not copied when a new doc is created. The result of
- // comparing pool defaults therfor would be that the
- // defaults are exported always if the have changed for
- // text documents in general. That's not sensible, as well
- // as it is not sensible to export them always.
- SwTxtFmtColl *pColl = 0;
- sal_uInt16 aWhichIds[4] = { RES_CHRATR_FONT,
- RES_CHRATR_CJK_FONT,
- RES_CHRATR_CTL_FONT,
- 0 };
- sal_uInt16 *pWhichIds = aWhichIds;
- const SfxPoolItem *pItem;
- while( *pWhichIds )
+ if (pColl)
{
- if( SFX_ITEM_SET == pItemSet->GetItemState( *pWhichIds,
- sal_False,
- &pItem ) )
+ // Using the pool defaults for the font causes significant
+ // trouble for the HTML filter, because it is not able
+ // to export the pool defaults (or to be more precice:
+ // the HTML filter is not able to detect whether a pool
+ // default has changed or not. Even a comparison with the
+ // HTMLi template does not work, because the defaults are
+ // not copied when a new doc is created. The result of
+ // comparing pool defaults therfor would be that the
+ // defaults are exported always if the have changed for
+ // text documents in general. That's not sensible, as well
+ // as it is not sensible to export them always.
+ sal_uInt16 aWhichIds[4] =
+ {
+ RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CTL_FONT, 0
+ };
+ sal_uInt16 *pWhichIds = aWhichIds;
+ while (*pWhichIds)
{
- if( !pColl )
- pColl = pDoc->GetTxtCollFromPoolSimple
- ( RES_POOLCOLL_STANDARD, FALSE );
- pColl->SetAttr( *pItem );
- pItemSet->ClearItem( *pWhichIds );
+ const SfxPoolItem *pItem;
+ if (SFX_ITEM_SET == pItemSet->GetItemState(*pWhichIds,
+ false, &pItem))
+ {
+ pColl->SetAttr( *pItem );
+ pItemSet->ClearItem( *pWhichIds );
+ }
+ ++pWhichIds;
}
- ++pWhichIds;
}
- if( pItemSet->Count() )
- pDoc->SetDefault( *pItemSet );
+ if (pItemSet->Count())
+ pDoc->SetDefault(*pItemSet);
}
else if( pInsPam )
{
@@ -829,7 +438,8 @@ ULONG SwASCIIParser::ReadChars()
(
RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
- RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE
),
&nInfo,
&nCntBytes );
@@ -875,35 +485,35 @@ ULONG SwASCIIParser::ReadChars()
}
}
- BOOL bIns = TRUE, bSplitNode = FALSE;
+ bool bIns = true, bSplitNode = false;
switch( *pStt )
{
//JP 12.11.2001: task 94636 - don't ignore all behind the zero character,
// change it to the default "control character"
// case 0:
// pEnd = pStt;
-// bIns = FALSE;
+// bIns = false ;
// break;
case 0x0a: if( LINEEND_LF == pUseMe->GetParaFlags() )
{
- bIns = FALSE;
+ bIns = false;
*pStt = 0;
++pStt;
// JP 03.04.96: das letze am Ende nehmen wir nicht
if( !rInput.IsEof() || pEnd != pStt )
- bSplitNode = TRUE;
+ bSplitNode = true;
}
break;
case 0x0d: if( LINEEND_LF != pUseMe->GetParaFlags() )
{
- bIns = FALSE;
+ bIns = false;
*pStt = 0;
++pStt;
- BOOL bChkSplit = FALSE;
+ bool bChkSplit = false;
if( LINEEND_CRLF == pUseMe->GetParaFlags() )
{
if( pStt == pEnd )
@@ -911,15 +521,15 @@ ULONG SwASCIIParser::ReadChars()
else if( 0x0a == *pStt )
{
++pStt;
- bChkSplit = TRUE;
+ bChkSplit = true;
}
}
else
- bChkSplit = TRUE;
+ bChkSplit = true;
// JP 03.04.96: das letze am Ende nehmen wir nicht
if( bChkSplit && ( !rInput.IsEof() || pEnd != pStt ))
- bSplitNode = TRUE;
+ bSplitNode = true;
}
break;
@@ -938,7 +548,7 @@ ULONG SwASCIIParser::ReadChars()
SVX_BREAK_PAGE_BEFORE ));
pLastStt = pStt;
nLineLen = 0;
- bIns = FALSE;
+ bIns = false;
}
break;
@@ -983,7 +593,7 @@ ULONG SwASCIIParser::ReadChars()
pLastStt = pStt;
nLineLen = 0;
}
- } while( TRUE );
+ } while(true);
if( hConverter )
{
@@ -1002,6 +612,4 @@ void SwASCIIParser::InsertText( const String& rStr )
nScript |= pBreakIt->GetAllScriptsOfText( rStr );
}
-
-#endif
-
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 92423f1b210b..e590db76f459 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fltini.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: cmc $ $Date: 2002-10-31 12:39:39 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -376,28 +376,24 @@ ULONG StgReader::OpenMainStream( SvStorageStreamRef& rRef, USHORT& rBuffSize )
ULONG Sw3Reader::Read( SwDoc &rDoc, SwPaM &rPam, const String & )
{
ULONG nRet;
- if( pStg )
+ if( pStg && pIO )
{
- Sw3Io aSw3Io( rDoc );
- if( bOrganizerMode )
- nRet = aSw3Io.LoadStyles( pStg );
- else
+ // TRUE: Vorlagen ueberschreiben
+ pIO->SetReadOptions( aOpt,TRUE );
+ if( !bInsertMode )
{
- // TRUE: Vorlagen ueberschreiben
- aSw3Io.SetReadOptions( aOpt,TRUE );
- if( !bInsertMode )
- {
- // Im Laden-Modus darf der PaM-Content-Teil nicht
- // in den Textbereich zeigen (Nodes koennen geloescht werden)
- rPam.GetBound( TRUE ).nContent.Assign( 0, 0 );
- rPam.GetBound( FALSE ).nContent.Assign( 0, 0 );
- }
- nRet = aSw3Io.Load( pStg, bInsertMode ? &rPam : 0 );
+ // Im Laden-Modus darf der PaM-Content-Teil nicht
+ // in den Textbereich zeigen (Nodes koennen geloescht werden)
+ rPam.GetBound( TRUE ).nContent.Assign( 0, 0 );
+ rPam.GetBound( FALSE ).nContent.Assign( 0, 0 );
}
+ nRet = pIO->Load( pStg, bInsertMode ? &rPam : 0 );
+ aOpt.ResetAllFmtsOnly();
+ pIO->SetReadOptions( aOpt, TRUE );
}
else
{
- ASSERT( !this, "Sw3-Read ohne Storage" );
+ ASSERT( !this, "Sw3-Read ohne Storage und/oder IO-System" );
nRet = ERR_SWG_READ_ERROR;
}
return nRet;
@@ -415,10 +411,8 @@ USHORT Sw3Reader::GetSectionList( SfxMedium& rMedium,
if( pFlt && pFlt->GetVersion() )
aStg->SetVersion( (long)pFlt->GetVersion() );
- {
- Sw3Io aSw3Io;
- aSw3Io.GetSectionList( &aStg, rStrings );
- }
+ if( pIO )
+ pIO->GetSectionList( &aStg, rStrings );
return rStrings.Count();
}
@@ -426,13 +420,21 @@ USHORT Sw3Reader::GetSectionList( SfxMedium& rMedium,
ULONG Sw3Writer::WriteStorage()
{
ULONG nRet;
+ if( pIO )
+ {
+ // der gleiche Storage -> Save, sonst SaveAs aufrufen
+ if( !bSaveAs )
+ nRet = pIO->Save( pOrigPam, bWriteAll );
+ else
+ nRet = pIO->SaveAs( pStg, pOrigPam, bWriteAll );
- // der gleiche Storage -> Save, sonst SaveAs aufrufen
- Sw3Io aSw3Io( *pDoc );
- if( bOrganizerMode )
- nRet = aSw3Io.SaveStyles( pStg );
+ pIO = 0; // nach dem Schreiben ist der Pointer ungueltig !!
+ }
else
- nRet = aSw3Io.SaveAs( pStg, pOrigPam, bWriteAll );
+ {
+ ASSERT( !this, "Sw3-Writer ohne IO-System" )
+ nRet = ERR_SWG_WRITE_ERROR;
+ }
return nRet;
}
@@ -916,7 +918,6 @@ void CalculateFlySize( SfxItemSet& rFlySet, SwNodeIndex& rAnchor,
}
/* */
-
struct CharSetNameMap
{
rtl_TextEncoding eCode;
@@ -1002,6 +1003,7 @@ const CharSetNameMap *GetCharSetNameMap()
IMPLENTRY(ISO_2022_JP),
IMPLENTRY(ISO_2022_CN),
IMPLENTRY(KOI8_R),
+ IMPLENTRY(KOI8_U),
IMPLENTRY(UTF7),
IMPLENTRY(UTF8),
IMPLENTRY(ISO_8859_10),
@@ -1307,6 +1309,7 @@ static String NameFromLanguage(LanguageType nLang)
return String::CreateFromAscii(pRet);
}
+
// for the automatic conversion (mail/news/...)
// The user data contains the options for the ascii import/export filter.
// The format is:
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 637a5fdd46ad..6a7fd522b949 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: shellio.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: hbrinkm $ $Date: 2002-12-04 15:14:21 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -201,6 +201,11 @@ ULONG SwReader::Read( const Reader& rOptions )
GetDoc();
+ // am Sw3-Reader noch den pIo-Pointer "loeschen"
+ if( po == ReadSw3 && pDoc->GetDocShell() &&
+ ((Sw3Reader*)po)->GetSw3Io() != pDoc->GetDocShell()->GetIoSystem() )
+ ((Sw3Reader*)po)->SetSw3Io( pDoc->GetDocShell()->GetIoSystem() );
+
// waehrend des einlesens kein OLE-Modified rufen
Link aOLELink( pDoc->GetOle2Link() );
pDoc->SetOle2Link( Link() );
@@ -465,15 +470,18 @@ ULONG SwReader::Read( const Reader& rOptions )
}
if(bUpdate)
{
+ SfxMedium* pMedium = pDoc->GetDocShell()->GetMedium();
+ SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
+ Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
if( pDoc->GetRootFrm() && !pDoc->GetEditShell( &pVSh ) && !pVSh )
{
ViewShell aVSh( *pDoc, 0, 0 );
SET_CURR_SHELL( &aVSh );
- pDoc->GetLinkManager().UpdateAllLinks( bAskUpdate , TRUE, FALSE );
+ pDoc->GetLinkManager().UpdateAllLinks( bAskUpdate , TRUE, FALSE, pDlgParent );
}
else
- pDoc->GetLinkManager().UpdateAllLinks( bAskUpdate, TRUE, FALSE );
+ pDoc->GetLinkManager().UpdateAllLinks( bAskUpdate, TRUE, FALSE, pDlgParent );
}
}
@@ -488,6 +496,9 @@ ULONG SwReader::Read( const Reader& rOptions )
if( pCrsr ) // das Doc ist jetzt modifiziert
pDoc->SetModified();
+ if( po == ReadSw3 ) // am Sw3-Reader noch den pIo-Pointer "loeschen"
+ ((Sw3Reader*)po)->SetSw3Io( 0 );
+
po->SetReadUTF8( FALSE );
po->SetBlockMode( FALSE );
po->SetOrganizerMode( FALSE );
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 6c43b78a2af2..884c0dc9ea52 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlatr.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: hbrinkm $ $Date: 2002-12-04 15:25:18 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -354,6 +354,14 @@ void SwHTMLWriter::OutAndSetDefList( USHORT nNewLvl )
// eventuell muss erst mal eine Liste aufgemacht werden
if( nDefListLvl < nNewLvl )
{
+ // output </pre> for the previous(!) pararagraph, if required.
+ // Preferable, the <pre> is exported by OutHTML_SwFmtOff for the
+ // previous paragraph already, but that's not possible, because a very
+ // deep look at the next paragraph (this one) is required to figure
+ // out that a def list starts here.
+
+ ChangeParaToken( 0 );
+
// entsprechend dem Level-Unterschied schreiben!
for( USHORT i=nDefListLvl; i<nNewLvl; i++ )
{
diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx
index 29edf7bb5c77..195a182f9a4a 100644
--- a/sw/source/filter/html/htmlbas.cxx
+++ b/sw/source/filter/html/htmlbas.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlbas.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: os $ $Date: 2001-09-28 06:27:53 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -170,7 +170,7 @@ void SwHTMLParser::EndScript()
// Ausser StarBasic und unbenutzem JavaScript jedes Script oder den
// Modulnamen in einem Feld merken merken
- if( bInsSrcIntoFld )
+ if( bInsSrcIntoFld && !bIgnoreHTMLComments )
{
SwScriptFieldType *pType =
(SwScriptFieldType*)pDoc->GetSysFldType( RES_SCRIPTFLD );
diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index e1b8d81dd4b6..7fae34471223 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlfly.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: mib $ $Date: 2002-11-21 13:11:50 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,6 +98,9 @@
#ifndef _GOODIES_IMAPOBJ_HXX
#include <svtools/imapobj.hxx>
#endif
+#ifndef _OFA_HTMLCFG_HXX //autogen
+#include <offmgr/htmlcfg.hxx>
+#endif
#ifndef _XOUTBMP_HXX //autogen
#include <svx/xoutbmp.hxx>
@@ -403,6 +406,9 @@ USHORT SwHTMLWriter::GuessFrmType( const SwFrmFmt& rFrmFmt,
void SwHTMLWriter::CollectFlyFrms()
{
+ ASSERT( HTML_CFG_MAX+1 == MAX_BROWSERS,
+ "number of browser configurations has changed" );
+
BYTE nSz = (BYTE)Min( pDoc->GetSpzFrmFmts()->Count(), USHORT(255) );
SwPosFlyFrms aFlyPos( nSz, nSz );
pDoc->GetAllFlyFmts( aFlyPos, bWriteAll ? 0 : pCurPam, TRUE );
diff --git a/sw/source/filter/html/htmlfly.hxx b/sw/source/filter/html/htmlfly.hxx
index 3b8c2346f81c..a6e6166a059a 100644
--- a/sw/source/filter/html/htmlfly.hxx
+++ b/sw/source/filter/html/htmlfly.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlfly.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:14:55 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -125,7 +125,7 @@ enum SwHTMLFrmType
const USHORT MAX_FRMTYPES = HTML_FRMTYPE_END;
-const USHORT MAX_BROWSERS = 5;
+const USHORT MAX_BROWSERS = 4;
extern BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS];
extern BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS];
diff --git a/sw/source/filter/html/htmlflyt.cxx b/sw/source/filter/html/htmlflyt.cxx
index ee8f2f272ad5..0cff3aa7d54e 100644
--- a/sw/source/filter/html/htmlflyt.cxx
+++ b/sw/source/filter/html/htmlflyt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlflyt.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: os $ $Date: 2001-09-28 06:27:53 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,7 +75,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle
TE(TBLNODE, BEFORE, NONE), // HTML 3.2
TE(DIV, PREFIX, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
TE(DIV, PREFIX, NONE), // SW
TE(DIV, PREFIX, NONE) // Netscape 4!
},
@@ -83,7 +82,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle und Ueberschrift
TE(TBLNODE, BEFORE, NONE), // HTML 3.2
TE(DIV, PREFIX, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
TE(DIV, PREFIX, NONE), // SW
TE(DIV, PREFIX, NONE) // Netscape 4
},
@@ -91,7 +89,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// spaltiger Rahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, PREFIX, NONE), // IE 4
- TE(MULTICOL,BEFORE, NONE), // Netscape 3
TE(MULTICOL,PREFIX, NONE), // SW
TE(MULTICOL,PREFIX, DIV) // Netscape 4
},
@@ -99,7 +96,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// leerer Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(DIV, PREFIX, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(DIV, PREFIX, NONE), // SW
TE(DIV, PREFIX, NONE) // Netscape 4
},
@@ -107,7 +103,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstiger Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(DIV, PREFIX, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(DIV, PREFIX, NONE), // SW
TE(DIV, PREFIX, NONE) // Netscape 4
},
@@ -115,7 +110,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Grafik-Node
TE(GRFNODE, INSIDE, NONE), // HTML 3.2
TE(GRFNODE, PREFIX, NONE), // IE 4
- TE(GRFNODE, INSIDE, NONE), // Netscape 3
TE(GRFNODE, PREFIX, NONE), // SW
TE(GRFNODE, PREFIX, SPAN) // Netscape 4
},
@@ -123,7 +117,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Plugin
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, PREFIX, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, PREFIX, NONE), // SW
TE(OLENODE, PREFIX, SPAN) // Netscape 4
},
@@ -131,7 +124,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Applet
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, PREFIX, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, PREFIX, NONE), // SW
TE(OLENODE, PREFIX, SPAN) // Netscape 4
},
@@ -139,7 +131,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Floating-Frame
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLENODE, PREFIX, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLENODE, PREFIX, NONE), // SW
TE(OLEGRF, PREFIX, SPAN) // Netscape 4
},
@@ -147,7 +138,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige OLE-Objekte
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLEGRF, PREFIX, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLEGRF, PREFIX, NONE), // SW
TE(OLEGRF, PREFIX, SPAN) // Netscape 4
},
@@ -155,7 +145,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Laufschrift
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(AMARQUEE,PREFIX, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(AMARQUEE,PREFIX, NONE), // SW
TE(GRFFRM, PREFIX, SPAN) // Netscape 4
},
@@ -163,7 +152,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Controls
TE(CONTROL, INSIDE, NONE), // HTML 3.2
TE(CONTROL, PREFIX, NONE), // IE 4
- TE(CONTROL, INSIDE, NONE), // Netscape 3
TE(CONTROL, PREFIX, NONE), // SW
// Netscape schaltet FORM bei Controls in abs.-pos. SPAN aus.
TE(CONTROL, INSIDE, NONE) // Netscape 4
@@ -172,7 +160,6 @@ BYTE aHTMLOutFrmPageFlyTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige Zeichen-Objekte
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, PREFIX, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(GRFFRM, PREFIX, NONE), // SW
TE(GRFFRM, PREFIX, SPAN) // Netscape 4
}
@@ -184,7 +171,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle
TE(TBLNODE, BEFORE, NONE), // HTML 3.2
TE(TBLNODE, BEFORE, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
TE(TBLNODE, BEFORE, NONE), // SW
TE(TBLNODE, BEFORE, NONE) // Netscape 4
},
@@ -192,7 +178,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle und Ueberschrift
TE(TBLNODE, BEFORE, NONE), // HTML 3.2
TE(DIV, BEFORE, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
TE(DIV, BEFORE, NONE), // SW
TE(TBLNODE, BEFORE, NONE) // Netscape 4
},
@@ -200,7 +185,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// spaltiger Rahmen
TE(GRFFRM, BEFORE, NONE), // HTML 3.2
TE(GRFFRM, BEFORE, NONE), // IE 4
- TE(MULTICOL,BEFORE, NONE), // Netscape 3
TE(MULTICOL,BEFORE, NONE), // SW
TE(MULTICOL,BEFORE, DIV) // Netscape 4
},
@@ -208,7 +192,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// leerer Textreahmen
TE(GRFFRM, BEFORE, NONE), // HTML 3.2
TE(DIV, BEFORE, NONE), // IE 4
- TE(SPACER, BEFORE, NONE), // Netscape 3
TE(SPACER, BEFORE, NONE), // SW
TE(SPACER, BEFORE, NONE) // Netscape 4
},
@@ -216,7 +199,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstiger Textreahmen
TE(GRFFRM, BEFORE, NONE), // HTML 3.2
TE(DIV, BEFORE, NONE), // IE 4
- TE(GRFFRM, BEFORE, NONE), // Netscape 3
TE(DIV, BEFORE, NONE), // SW
TE(DIV, BEFORE, NONE) // Netscape 4
},
@@ -224,7 +206,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Grafik-Node
TE(GRFNODE, BEFORE, NONE), // HTML 3.2
TE(GRFNODE, BEFORE, NONE), // IE 4
- TE(GRFNODE, BEFORE, NONE), // Netscape 3
TE(GRFNODE, BEFORE, NONE), // SW
TE(GRFNODE, BEFORE, NONE) // Netscape 4
},
@@ -232,7 +213,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Plugin
TE(OLENODE, BEFORE, NONE), // HTML 3.2
TE(OLENODE, BEFORE, NONE), // IE 4
- TE(OLENODE, BEFORE, NONE), // Netscape 3
TE(OLENODE, BEFORE, NONE), // SW
TE(OLENODE, BEFORE, NONE) // Netscape 4
},
@@ -240,7 +220,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Applet
TE(OLENODE, BEFORE, NONE), // HTML 3.2
TE(OLENODE, BEFORE, NONE), // IE 4
- TE(OLENODE, BEFORE, NONE), // Netscape 3
TE(OLENODE, BEFORE, NONE), // SW
TE(OLENODE, BEFORE, NONE) // Netscape 4
},
@@ -248,7 +227,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Floating-Frame
TE(OLEGRF, BEFORE, NONE), // HTML 3.2
TE(OLENODE, BEFORE, NONE), // IE 4
- TE(OLEGRF, BEFORE, NONE), // Netscape 3
TE(OLENODE, BEFORE, NONE), // SW
TE(OLEGRF, BEFORE, NONE) // Netscape 4
},
@@ -256,7 +234,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige OLE-Objekte
TE(OLEGRF, BEFORE, NONE), // HTML 3.2
TE(OLEGRF, BEFORE, NONE), // IE 4
- TE(OLEGRF, BEFORE, NONE), // Netscape 3
TE(OLEGRF, BEFORE, NONE), // SW
TE(OLEGRF, BEFORE, NONE) // Netscape 4
},
@@ -265,7 +242,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// die LAufschrift an der richtigen Stelle erscheint
TE(GRFFRM, BEFORE, NONE), // HTML 3.2
TE(AMARQUEE,BEFORE, NONE), // IE 4
- TE(GRFFRM, BEFORE, NONE), // Netscape 3
TE(AMARQUEE,BEFORE, NONE), // SW
TE(GRFFRM, BEFORE, NONE) // Netscape 4
},
@@ -273,7 +249,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Controls
TE(CONTROL, INSIDE, NONE), // HTML 3.2
TE(CONTROL, BEFORE, NONE), // IE 4
- TE(CONTROL, INSIDE, NONE), // Netscape 3
TE(CONTROL, BEFORE, NONE), // SW
// hier koennte man einen Container draus machen (Import fehlt)
TE(CONTROL, BEFORE, NONE) // Netscape 4
@@ -282,7 +257,6 @@ BYTE aHTMLOutFrmParaFrameTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige Zeichen-Objekte
TE(GRFFRM, BEFORE, NONE), // HTML 3.2
TE(GRFFRM, BEFORE, NONE), // IE 4
- TE(GRFFRM, BEFORE, NONE), // Netscape 3
TE(GRFFRM, BEFORE, NONE), // SW
TE(GRFFRM, BEFORE, NONE) // Netscape 4
}
@@ -292,31 +266,15 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
{
{
// Textrahmen mit Tabelle
-#if 0
- TE(TBLNODE, BEFORE, NONE), // HTML 3.2
- TE(TBLNODE, BEFORE, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
- TE(TBLNODE, BEFORE, NONE), // SW
- TE(TBLNODE, BEFORE, NONE) // Netscape 4
-#endif
TE(TBLNODE, INSIDE, NONE), // HTML 3.2
TE(TBLNODE, INSIDE, NONE), // IE 4
- TE(TBLNODE, INSIDE, NONE), // Netscape 3
TE(TBLNODE, INSIDE, NONE), // SW
TE(TBLNODE, INSIDE, NONE) // Netscape 4
},
{
// Textrahmen mit Tabelle und Ueberschrift
-#if 0
- TE(TBLNODE, BEFORE, NONE), // HTML 3.2
- TE(DIV, BEFORE, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
- TE(DIV, BEFORE, NONE), // SW
- TE(DIV, BEFORE, NONE) // Netscape 4
-#endif
TE(TBLNODE, INSIDE, NONE), // HTML 3.2
TE(SPAN, INSIDE, NONE), // IE 4
- TE(TBLNODE, INSIDE, NONE), // Netscape 3
TE(SPAN, INSIDE, NONE), // SW
TE(SPAN, INSIDE, NONE) // Netscape 4
},
@@ -324,7 +282,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// spaltiger Rahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(MULTICOL,INSIDE, NONE), // Netscape 3
TE(MULTICOL,INSIDE, NONE), // SW
TE(MULTICOL,INSIDE, SPAN) // Netscape 4
},
@@ -332,7 +289,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// leerer Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(SPAN, INSIDE, NONE), // IE 4
- TE(SPACER, INSIDE, NONE), // Netscape 3
TE(SPACER, INSIDE, NONE), // SW
TE(SPACER, INSIDE, NONE) // Netscape 4
},
@@ -340,7 +296,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstiger Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(SPAN, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(SPAN, INSIDE, NONE), // SW
TE(SPAN, INSIDE, NONE) // Netscape 4
},
@@ -348,7 +303,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Grafik-Node
TE(GRFNODE, INSIDE, NONE), // HTML 3.2
TE(GRFNODE, INSIDE, NONE), // IE 4
- TE(GRFNODE, INSIDE, NONE), // Netscape 3
TE(GRFNODE, INSIDE, NONE), // SW
TE(GRFNODE, INSIDE, NONE) // Netscape 4
},
@@ -356,7 +310,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Plugin
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLENODE, INSIDE, NONE) // Netscape 4
},
@@ -364,7 +317,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Applet
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLENODE, INSIDE, NONE) // Netscape 4
},
@@ -372,7 +324,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Floating-Frame
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLEGRF, INSIDE, NONE) // Netscape 4
},
@@ -380,7 +331,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige OLE-Objekte
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLEGRF, INSIDE, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLEGRF, INSIDE, NONE), // SW
TE(OLEGRF, INSIDE, NONE) // Netscape 4
},
@@ -388,7 +338,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Laufschrift
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(AMARQUEE,INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(AMARQUEE,INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, NONE) // Netscape 4
},
@@ -396,7 +345,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Controls
TE(CONTROL, INSIDE, NONE), // HTML 3.2
TE(CONTROL, INSIDE, NONE), // IE 4
- TE(CONTROL, INSIDE, NONE), // Netscape 3
TE(CONTROL, INSIDE, NONE), // SW
// hier koennte man einen Container draus machen (Import fehlt)
TE(CONTROL, INSIDE, NONE) // Netscape 4
@@ -405,7 +353,6 @@ BYTE aHTMLOutFrmParaPrtAreaTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige Zeichen-Objekte
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(GRFFRM, INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, NONE) // Netscape 4
}
@@ -417,7 +364,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle
TE(TBLNODE, BEFORE, NONE), // HTML 3.2
TE(SPAN, INSIDE, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
TE(SPAN, INSIDE, NONE), // SW
TE(SPAN, INSIDE, NONE) // Netscape 4
},
@@ -425,7 +371,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle und Ueberschrift
TE(TBLNODE, BEFORE, NONE), // HTML 3.2
TE(SPAN, INSIDE, NONE), // IE 4
- TE(TBLNODE, BEFORE, NONE), // Netscape 3
TE(SPAN, INSIDE, NONE), // SW
TE(SPAN, INSIDE, NONE) // Netscape 4
},
@@ -433,7 +378,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// spaltiger Rahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(MULTICOL,BEFORE, NONE), // Netscape 3
TE(MULTICOL,INSIDE, NONE), // SW
TE(MULTICOL,INSIDE, SPAN) // Netscape 4
},
@@ -441,7 +385,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// leerer Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(SPAN, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(SPAN, INSIDE, NONE), // SW
TE(SPAN, INSIDE, NONE) // Netscape 4
},
@@ -449,7 +392,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstiger Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(SPAN, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(SPAN, INSIDE, NONE), // SW
TE(SPAN, INSIDE, NONE) // Netscape 4
},
@@ -457,7 +399,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Grafik-Node
TE(GRFNODE, INSIDE, NONE), // HTML 3.2
TE(GRFNODE, INSIDE, NONE), // IE 4
- TE(GRFNODE, INSIDE, NONE), // Netscape 3
TE(GRFNODE, INSIDE, NONE), // SW
TE(GRFNODE, INSIDE, SPAN) // Netscape 4
},
@@ -465,7 +406,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Plugin
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLENODE, INSIDE, SPAN) // Netscape 4
},
@@ -473,7 +413,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Applet
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLENODE, INSIDE, SPAN) // Netscape 4
},
@@ -481,7 +420,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Floating-Frame
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLEGRF, INSIDE, SPAN) // Netscape 4
},
@@ -489,7 +427,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige OLE-Objekte
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLEGRF, INSIDE, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLEGRF, INSIDE, NONE), // SW
TE(OLEGRF, INSIDE, SPAN) // Netscape 4
},
@@ -497,7 +434,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Laufschrift
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(AMARQUEE,INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(AMARQUEE,INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, SPAN) // Netscape 4
},
@@ -505,7 +441,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Controls
TE(CONTROL, INSIDE, NONE), // HTML 3.2
TE(CONTROL, INSIDE, NONE), // IE 4
- TE(CONTROL, INSIDE, NONE), // Netscape 3
TE(CONTROL, INSIDE, NONE), // SW
// Netscape schaltet FORM bei Controls in abs.-pos. SPAN aus.
TE(CONTROL, INSIDE, NONE) // Netscape 4
@@ -514,7 +449,6 @@ BYTE aHTMLOutFrmParaOtherTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige Zeichen-Objekte
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(GRFFRM, INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, SPAN) // Netscape 4
}
@@ -526,7 +460,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(GRFFRM, INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, NONE) // Netscape 4
},
@@ -534,7 +467,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Textrahmen mit Tabelle und Ueberschrift
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(GRFFRM, INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, NONE) // Netscape 4
},
@@ -542,7 +474,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// spaltiger Rahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(MULTICOL,INSIDE, NONE), // Netscape 3
TE(MULTICOL,INSIDE, NONE), // SW
TE(MULTICOL,INSIDE, NONE) // Netscape 4
},
@@ -550,7 +481,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// leerer Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(SPACER, INSIDE, NONE), // Netscape 3
TE(SPACER, INSIDE, NONE), // SW
TE(SPACER, INSIDE, NONE) // Netscape 4
},
@@ -558,7 +488,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstiger Textreahmen
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(GRFFRM, INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, NONE) // Netscape 4
},
@@ -566,7 +495,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Grafik-Node
TE(GRFNODE, INSIDE, NONE), // HTML 3.2
TE(GRFNODE, INSIDE, NONE), // IE 4
- TE(GRFNODE, INSIDE, NONE), // Netscape 3
TE(GRFNODE, INSIDE, NONE), // SW
TE(GRFNODE, INSIDE, NONE) // Netscape 4
},
@@ -574,7 +502,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Plugin
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLENODE, INSIDE, NONE) // Netscape 4
},
@@ -582,7 +509,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Applet
TE(OLENODE, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLENODE, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLENODE, INSIDE, NONE) // Netscape 4
},
@@ -590,7 +516,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Floating-Frame
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLENODE, INSIDE, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLENODE, INSIDE, NONE), // SW
TE(OLEGRF, INSIDE, NONE) // Netscape 4
},
@@ -598,7 +523,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige OLE-Objekte
TE(OLEGRF, INSIDE, NONE), // HTML 3.2
TE(OLEGRF, INSIDE, NONE), // IE 4
- TE(OLEGRF, INSIDE, NONE), // Netscape 3
TE(OLEGRF, INSIDE, NONE), // SW
TE(OLEGRF, INSIDE, NONE) // Netscape 4
},
@@ -607,7 +531,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// der Inhalt an der richtigen Stelle erscheint
TE(MARQUEE, INSIDE, NONE), // HTML 3.2
TE(MARQUEE, INSIDE, NONE), // IE 4
- TE(MARQUEE, INSIDE, NONE), // Netscape 3
TE(MARQUEE, INSIDE, NONE), // SW
TE(MARQUEE, INSIDE, NONE) // Netscape 4
},
@@ -615,7 +538,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// Controls
TE(CONTROL, INSIDE, NONE), // HTML 3.2
TE(CONTROL, INSIDE, NONE), // IE 4
- TE(CONTROL, INSIDE, NONE), // Netscape 3
TE(CONTROL, INSIDE, NONE), // SW
TE(CONTROL, INSIDE, NONE) // Netscape 4
},
@@ -623,7 +545,6 @@ BYTE aHTMLOutFrmAsCharTable[MAX_FRMTYPES][MAX_BROWSERS] =
// sonstige Zeichen-Objekte
TE(GRFFRM, INSIDE, NONE), // HTML 3.2
TE(GRFFRM, INSIDE, NONE), // IE 4
- TE(GRFFRM, INSIDE, NONE), // Netscape 3
TE(GRFFRM, INSIDE, NONE), // SW
TE(GRFFRM, INSIDE, NONE) // Netscape 4
}
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 7de0965b7120..1cede3a4decb 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlform.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: od $ $Date: 2002-09-03 15:02:20 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -741,7 +741,7 @@ void SwHTMLImageWatcher::complete( sal_Int32 Status,
}
}
-void SwHTMLImageWatcher::disposing(const lang::EventObject& evt)
+void SwHTMLImageWatcher::disposing(const lang::EventObject& evt) throw ( ::com::sun::star::uno::RuntimeException)
{
Reference< awt::XImageConsumer > xTmp;
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 9ba9284928ae..bf6111ee131b 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlgrin.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: mib $ $Date: 2002-11-21 13:11:48 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,9 @@
#ifndef _SFXSTRITEM_HXX
#include <svtools/stritem.hxx>
#endif
+#ifndef _SVX_FHGTITEM_HXX //autogen
+#include <svx/fhgtitem.hxx>
+#endif
#ifndef _SVX_LRSPITEM_HXX //autogen
#include <svx/lrspitem.hxx>
#endif
@@ -703,7 +706,6 @@ IMAGE_SETEVENT:
Size aGrfSz( 0, 0 );
BOOL bSetTwipSize = TRUE; // Twip-Size am Node setzen?
BOOL bChangeFrmSize = FALSE; // Frame-Format nachtraeglich anpassen?
- BOOL bGrfSzValid = FALSE; // aGrfSz enthaelt die Grafik-Groesse
BOOL bRequestGrfNow = FALSE;
BOOL bSetScaleImageMap = FALSE;
BYTE nPrcWidth = 0, nPrcHeight = 0;
@@ -711,104 +713,46 @@ IMAGE_SETEVENT:
if( !nWidth || !nHeight )
{
// Es fehlt die Breite oder die Hoehe
-
- // JP 28.05.96: dann suche doch mal in unserem QuickDraw-Cache, ob
- // die Groesse dieser Grafik schon vorhanden ist.
- bGrfSzValid =
-#ifdef NEW_GRFOBJ
- FindGrfSizeFromCache( sGrfNm, aGrfSz )
-#else
- FALSE;
-#endif
- ;
-
// Wenn die Grfik in einer Tabelle steht, wird sie gleich
// angefordert, damit sie eventuell schon da ist, bevor die
// Tabelle layoutet wird.
- if( !bGrfSzValid && pTable!=0 && !nWidth )
+ if( pTable!=0 && !nWidth )
{
bRequestGrfNow = TRUE;
IncGrfsThatResizeTable();
}
- if( bGrfSzValid && aGrfSz.Width() && aGrfSz.Height() )
+ // Die Groesse des Rahmens wird nachtraeglich gesetzt
+ bChangeFrmSize = TRUE;
+ aGrfSz = aTwipSz;
+ if( !nWidth && !nHeight )
{
- // wir haben eine Groesse und koenen sie setzen
- if( !nWidth && !nHeight )
- {
- // Hoehe und Breite fehlen
- aTwipSz = aGrfSz;
- }
- else if( nWidth )
+ aTwipSz.Width() = HTML_DFLT_IMG_WIDTH;
+ aTwipSz.Height() = HTML_DFLT_IMG_HEIGHT;
+ }
+ else if( nWidth )
+ {
+ // eine %-Angabe
+ if( bPrcWidth )
{
- // nur die Breite fehlt
- if( bPrcWidth )
- {
- // %-Breite uebernehmen und Hoehe skalieren
- nPrcWidth = (BYTE)nWidth;
- nPrcHeight = 255;
- }
- else
- {
- // Breite uebernehmen und Hoehe berechnen
- aTwipSz.Height() = (aGrfSz.Height() * aTwipSz.Width())
- / aGrfSz.Width();
- }
+ nPrcWidth = (BYTE)nWidth;
+ nPrcHeight = 255;
}
- else if( nHeight )
+ else
{
- // nur die Hoehe fehlt
- if( bPrcHeight )
- {
- // %-Hoehe lassen und Breite skalieren
- nPrcHeight = (BYTE)nHeight;
- nPrcWidth = 255;
- }
- else
- {
- // Hoehe uebernehmen und Breite berechnen
- aTwipSz.Width() = (aGrfSz.Width() * aTwipSz.Height())
- / aGrfSz.Height();
- }
+ aTwipSz.Height() = HTML_DFLT_IMG_HEIGHT;
}
}
- else
+ else if( nHeight )
{
- // wir haben keine Groesse gefunden (und sind in keiner
- // Tabelle oder haben zumindest die Breite der Grafik)
-
- // Die Groesse des Rahmens wird nachtraeglich gesetzt
- bChangeFrmSize = TRUE;
- aGrfSz = aTwipSz;
- if( !nWidth && !nHeight )
+ if( bPrcHeight )
{
- aTwipSz.Width() = HTML_DFLT_IMG_WIDTH;
- aTwipSz.Height() = HTML_DFLT_IMG_HEIGHT;
+ nPrcHeight = (BYTE)nHeight;
+ nPrcWidth = 255;
}
- else if( nWidth )
- {
- // eine %-Angabe
- if( bPrcWidth )
- {
- nPrcWidth = (BYTE)nWidth;
- nPrcHeight = 255;
- }
- else
- {
- aTwipSz.Height() = HTML_DFLT_IMG_HEIGHT;
- }
- }
- else if( nHeight )
+ else
{
- if( bPrcHeight )
- {
- nPrcHeight = (BYTE)nHeight;
- nPrcWidth = 255;
- }
- else
- {
- aTwipSz.Width() = HTML_DFLT_IMG_WIDTH;
- }
+ aTwipSz.Width() = HTML_DFLT_IMG_WIDTH;
}
}
}
@@ -816,14 +760,6 @@ IMAGE_SETEVENT:
{
// Breite und Hoehe wurden angegeben und brauchen nicht gesetzt
// zu werden
- bGrfSzValid =
-#ifdef NEW_GRFOBJ
- FindGrfSizeFromCache( sGrfNm, aGrfSz )
-#else
- FALSE;
-#endif
- ;
-
bSetTwipSize = FALSE;
if( bPrcWidth )
@@ -850,31 +786,8 @@ IMAGE_SETEVENT:
if( pImgMap )
{
SwFmtURL aURL; aURL.SetMap( pImgMap );//wird kopieiert
- if( bGrfSzValid )
- {
- BOOL bScale = FALSE;
-
- Fraction aScaleX( 1, 1 ), aScaleY( 1, 1);
- if( !nPrcWidth && aGrfSz.Width() && aTwipSz.Width() &&
- aGrfSz.Width() != aTwipSz.Width() )
- {
- aScaleX = Fraction( aGrfSz.Width(), aTwipSz.Width() );
- bScale = TRUE;
- }
-
- if( !nPrcHeight && aGrfSz.Height() && aTwipSz.Height() &&
- aGrfSz.Height() != aTwipSz.Height() )
- {
- aScaleY = Fraction( aGrfSz.Height(), aTwipSz.Height() );
- bScale = TRUE;
- }
-
- if( bScale )
- aURL.GetMap()->Scale( aScaleX, aScaleY );
- }
- else
- bSetScaleImageMap = !nPrcWidth || !nPrcHeight;
+ bSetScaleImageMap = !nPrcWidth || !nPrcHeight;
aFrmSet.Put( aURL );
}
else
@@ -887,8 +800,7 @@ IMAGE_SETEVENT:
// die Grafik muss beim SetTwipSize skaliert werden, wenn
// wir keine Groesse am Node gesetzt haben oder die Groesse
// nicht der Grafikgroesse entsprach.
- bSetScaleImageMap = !bSetTwipSize || !bGrfSzValid ||
- !nPrcWidth || !nPrcHeight;
+ bSetScaleImageMap = sal_True;
}
}
@@ -950,7 +862,7 @@ IMAGE_SETEVENT:
if( bSetTwipSize )
pGrfNd->SetTwipSize( aGrfSz );
- pGrfNd->SetChgTwipSize( bChangeFrmSize );
+ pGrfNd->SetChgTwipSize( bChangeFrmSize, bChangeFrmSize );
if( bSetScaleImageMap )
pGrfNd->SetScaleImageMap( TRUE );
@@ -1175,13 +1087,31 @@ void SwHTMLParser::InsertBodyOptions()
SfxItemSet aItemSet( pDoc->GetAttrPool(), pCSS1Parser->GetWhichMap() );
SvxCSS1PropertyInfo aPropInfo;
String aDummy;
- ParseStyleOptions( aDummy, aDummy, aStyle, aItemSet, aPropInfo, 0, &aDir );
+ ParseStyleOptions( aStyle, aDummy, aDummy, aItemSet, aPropInfo, 0, &aDir );
// Ein par Attribute muessen an der Seitenvorlage gesetzt werden,
// und zwar die, die nicht vererbit werden
pCSS1Parser->SetPageDescAttrs( bSetBrush ? &aBrushItem : 0,
&aItemSet );
+ const SfxPoolItem *pItem;
+ static USHORT aWhichIds[3] = { RES_CHRATR_FONTSIZE,
+ RES_CHRATR_CJK_FONTSIZE,
+ RES_CHRATR_CTL_FONTSIZE };
+ for( USHORT i=0; i<3; i++ )
+ {
+ if( SFX_ITEM_SET == aItemSet.GetItemState( aWhichIds[i], FALSE,
+ &pItem ) &&
+ static_cast <const SvxFontHeightItem * >(pItem)->GetProp() != 100)
+ {
+ sal_uInt32 nHeight =
+ ( aFontHeights[2] *
+ static_cast <const SvxFontHeightItem * >(pItem)->GetProp() ) / 100;
+ SvxFontHeightItem aNewItem( nHeight, 100, aWhichIds[i] );
+ aItemSet.Put( aNewItem );
+ }
+ }
+
// alle noch uebrigen Optionen koennen an der Standard-Vorlage
// gesetzt werden und gelten dann automatisch als defaults
pCSS1Parser->GetTxtCollFromPool( RES_POOLCOLL_STANDARD )
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 489d0cbe2859..fd489fb2a8a4 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmltab.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mib $ $Date: 2002-11-21 13:11:49 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -968,9 +968,24 @@ void HTMLTableRow::Shrink( sal_uInt16 nCells )
{
ASSERT( nCells < pCells->Count(), "Anzahl Zellen falsch" );
-#ifdef DEBUG
+ // The colspan of empty cells at the end has to be fixed to the new
+ // number of cells.
+ sal_uInt16 i=nCells;
sal_uInt16 nEnd = pCells->Count();
- for( sal_uInt16 i=nCells; i<nEnd; i++ )
+ while( i )
+ {
+ HTMLTableCell *pCell = (*pCells)[--i];
+ if( !pCell->GetContents() )
+ {
+ ASSERT( pCell->GetColSpan() == nEnd - i,
+ "invalid col span for empty cell at row end" );
+ pCell->SetColSpan( nCells-i);
+ }
+ else
+ break;
+ }
+#ifdef DEBUG
+ for( i=nCells; i<nEnd; i++ )
{
HTMLTableCell *pCell = (*pCells)[i];
ASSERT( pCell->GetRowSpan() == 1,
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 38ff3d31614e..1b429f91e8f8 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmltabw.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: mib $ $Date: 2002-11-21 13:11:50 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -757,7 +757,8 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, SwHoriOrient eAlign,
sOut += sHTML_table;
sal_uInt16 nOldDirection = rWrt.nDirection;
- rWrt.nDirection = rWrt.GetHTMLDirection( pFrmFmt->GetAttrSet() );
+ if( pFrmFmt )
+ rWrt.nDirection = rWrt.GetHTMLDirection( pFrmFmt->GetAttrSet() );
if( rWrt.bOutFlyFrame || nOldDirection != rWrt.nDirection )
{
rWrt.Strm() << sOut.GetBuffer();
diff --git a/sw/source/filter/html/makefile.mk b/sw/source/filter/html/makefile.mk
index c616410904d0..7a24784c0a9c 100644
--- a/sw/source/filter/html/makefile.mk
+++ b/sw/source/filter/html/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: obo $ $Date: 2002-10-10 14:04:54 $
+# last change: $Author: hr $ $Date: 2003-03-27 15:41:50 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 4003b42f4186..1b2f9ac4e255 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrthtml.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: hbrinkm $ $Date: 2002-12-04 15:33:05 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1096,7 +1096,9 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs()
const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
{
ByteString sOut( sHTML_doctype );
- (sOut += ' ') += sHTML_doctype32;
+ (sOut += ' ') +=
+ (HTML_CFG_HTML32==nExportMode ? sHTML_doctype32
+ : sHTML_doctype40);
HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.GetBuffer() );
// baue den Vorspann
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index d20bfd9517de..0e028d7172d3 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fltshell.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: cmc $ $Date: 2002-11-18 13:47:19 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -671,5 +671,6 @@ public:
BOOL GetCaseVersalien();
};
+void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset);
#endif
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index a3a89530bcfa..f9993dc43688 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rtfatr.cxx,v $
*
- * $Revision: 1.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: cmc $ $Date: 2002-12-04 12:07:34 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,8 @@
*
************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
/*
* Dieses File enthaelt alle Ausgabe-Funktionen des RTF-Writers;
* fuer alle Nodes, Attribute, Formate und Chars.
@@ -941,6 +943,9 @@ RTFEndPosLst::~RTFEndPosLst()
int RTFEndPosLst::Insert( const SfxPoolItem& rAttr, xub_StrLen nStt,
xub_StrLen nEnd )
{
+ if (rAttr.Which() == RES_TXTATR_INETFMT)
+ return false;
+
if( nStt == nEnd )
return FALSE;
@@ -1082,12 +1087,14 @@ void RTFEndPosLst::EndAttrs( xub_StrLen nStrPos )
for( USHORT nAttr = rAttrs.Count(); nAttr; )
switch( rAttrs[ --nAttr ]->Which() )
{
+#if 0
case RES_TXTATR_INETFMT:
// Hyperlinks werden als Felder geschrieben, aber der
// "FieldResult" steht als Text im TextNode. Also muss
// bei diesen Attributen am Ende 2 Klammern stehen!
rWrt.Strm() << "}}";
break;
+#endif
case RES_TXTATR_CJK_RUBY:
rWrt.Strm() << ")}{" << sRTF_FLDRSLT << " }}";
@@ -1294,6 +1301,82 @@ void OutRTF_SwRTL(SwRTFWriter& rWrt, const SwTxtNode *pNd)
OutSvxFrmDir(rWrt, SvxFrameDirectionItem(eDir));
}
+static Writer& OutRTF_SwTxtINetFmt( Writer& rWrt, const SfxPoolItem& rHt )
+{
+ const SwFmtINetFmt& rURL = (const SwFmtINetFmt&)rHt;
+ SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt;
+ if( rURL.GetValue().Len() )
+ {
+ rWrt.Strm() << '{' << sRTF_FIELD << '{' << sRTF_IGNORE
+ << sRTF_FLDINST << " HYPERLINK ";
+
+ String sURL( rURL.GetValue() );
+ if( INET_MARK_TOKEN != sURL.GetChar(0) )
+ {
+ INetURLObject aTmp( INetURLObject::AbsToRel( sURL ) );
+ sURL = aTmp.GetURLNoMark( INetURLObject::DECODE_UNAMBIGUOUS);
+/* if( INET_PROT_FILE == aTmp.GetProtocol() )
+ {
+ // WW97 wollen keine FILE-URL haben, sondern einen normalen
+ // Dateinamen. Aber ab WW2000 kennen sie FileURLs.
+ sURL = aTmp.GetFull();
+ }
+*/ rWrt.Strm() << '\"';
+ RTFOutFuncs::Out_String( rWrt.Strm(), sURL, DEF_ENCODING,
+ rRTFWrt.bWriteHelpFmt ) << "\" ";
+ sURL = aTmp.GetMark();
+ }
+
+ if( sURL.Len() )
+ {
+ rWrt.Strm() << "\\\\l \"";
+ sURL.Erase( 0, 1 );
+ RTFOutFuncs::Out_String( rWrt.Strm(), sURL, DEF_ENCODING,
+ rRTFWrt.bWriteHelpFmt ) << "\" ";
+ }
+
+ if( rURL.GetTargetFrame().Len() )
+ {
+ rWrt.Strm() << "\\\\t \"";
+ RTFOutFuncs::Out_String( rWrt.Strm(), rURL.GetTargetFrame(),
+ DEF_ENCODING, rRTFWrt.bWriteHelpFmt ) << "\" ";
+ }
+
+ rWrt.Strm() << "}{" << sRTF_FLDRSLT << ' ';
+ rRTFWrt.bOutFmtAttr = FALSE;
+
+ // und dann noch die Attributierung ausgeben
+ const SwCharFmt* pFmt;
+ const SwTxtINetFmt* pTxtAtr = rURL.GetTxtINetFmt();
+ if( pTxtAtr && 0 != ( pFmt = pTxtAtr->GetCharFmt() ))
+ OutRTF_SwFmt( rWrt, *pFmt );
+ }
+ return rWrt;
+}
+
+void HandleHyperlinks(Writer& rWrt, const SwpHints* pTxtAttrs, xub_StrLen nPos)
+{
+ USHORT nCount = pTxtAttrs ? pTxtAttrs->Count() : 0;
+ for(USHORT i = 0; i < nCount; ++i )
+ {
+ const SwTxtAttr* pHt = (*pTxtAttrs)[i];
+ const SfxPoolItem &rItem = pHt->GetAttr();
+ if (rItem.Which() == RES_TXTATR_INETFMT)
+ {
+ const xub_StrLen* pEnd;
+ if (nPos == *pHt->GetStart())
+ OutRTF_SwTxtINetFmt(rWrt, rItem);
+ if (0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd)
+ {
+ // Hyperlinks werden als Felder geschrieben, aber der
+ // "FieldResult" // steht als Text im TextNode. Also muss bei
+ // diesen Attributen am // Ende 2 Klammern stehen!
+ rWrt.Strm() << "}}";
+ }
+ }
+ }
+}
+
static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
{
SwTxtNode * pNd = &((SwTxtNode&)rNode);
@@ -1488,6 +1571,8 @@ static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
rRTFWrt.bTxtAttr = TRUE;
rRTFWrt.bOutFmtAttr = FALSE;
+ HandleHyperlinks(rWrt, pNd->GetpSwpHints(), nStrPos);
+
if( nAttrPos < nCntAttr && *pHt->GetStart() == nStrPos
&& nStrPos != nEnde )
{
@@ -2764,59 +2849,6 @@ static Writer& OutRTF_SwNoLinebreakHere( Writer& rWrt, const SfxPoolItem& )
}
#endif
-static Writer& OutRTF_SwTxtINetFmt( Writer& rWrt, const SfxPoolItem& rHt )
-{
- const SwFmtINetFmt& rURL = (const SwFmtINetFmt&)rHt;
- SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt;
- if( rURL.GetValue().Len() )
- {
- rWrt.Strm() << '{' << sRTF_FIELD << '{' << sRTF_IGNORE
- << sRTF_FLDINST << " HYPERLINK ";
-
- String sURL( rURL.GetValue() );
- if( INET_MARK_TOKEN != sURL.GetChar(0) )
- {
- INetURLObject aTmp( INetURLObject::AbsToRel( sURL ) );
- sURL = aTmp.GetURLNoMark( INetURLObject::DECODE_UNAMBIGUOUS);
-/* if( INET_PROT_FILE == aTmp.GetProtocol() )
- {
- // WW97 wollen keine FILE-URL haben, sondern einen normalen
- // Dateinamen. Aber ab WW2000 kennen sie FileURLs.
- sURL = aTmp.GetFull();
- }
-*/ rWrt.Strm() << '\"';
- RTFOutFuncs::Out_String( rWrt.Strm(), sURL, DEF_ENCODING,
- rRTFWrt.bWriteHelpFmt ) << "\" ";
- sURL = aTmp.GetMark();
- }
-
- if( sURL.Len() )
- {
- rWrt.Strm() << "\\\\l \"";
- sURL.Erase( 0, 1 );
- RTFOutFuncs::Out_String( rWrt.Strm(), sURL, DEF_ENCODING,
- rRTFWrt.bWriteHelpFmt ) << "\" ";
- }
-
- if( rURL.GetTargetFrame().Len() )
- {
- rWrt.Strm() << "\\\\t \"";
- RTFOutFuncs::Out_String( rWrt.Strm(), rURL.GetTargetFrame(),
- DEF_ENCODING, rRTFWrt.bWriteHelpFmt ) << "\" ";
- }
-
- rWrt.Strm() << "}{" << sRTF_FLDRSLT << ' ';
- rRTFWrt.bOutFmtAttr = FALSE;
-
- // und dann noch die Attributierung ausgeben
- const SwCharFmt* pFmt;
- const SwTxtINetFmt* pTxtAtr = rURL.GetTxtINetFmt();
- if( pTxtAtr && 0 != ( pFmt = pTxtAtr->GetCharFmt() ))
- OutRTF_SwFmt( rWrt, *pFmt );
- }
- return rWrt;
-}
-
static Writer& OutRTF_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt )
{
const SwFmtCharFmt& rChrFmt = (const SwFmtCharFmt&)rHt;
@@ -3017,6 +3049,9 @@ static Writer& OutRTF_SwFmtLRSpace( Writer& rWrt, const SfxPoolItem& rHt )
rWrt.Strm() << sRTF_LI;
rWrt.OutLong( rLR.GetTxtLeft() ) << sRTF_RI;
rWrt.OutLong( rLR.GetRight() );
+ rWrt.Strm() << sRTF_LIN;
+ rWrt.OutLong( rLR.GetTxtLeft() ) << sRTF_RIN;
+ rWrt.OutLong( rLR.GetRight() );
rWrt.Strm() << sRTF_FI;
rWrt.OutLong( rLR.GetTxtFirstLineOfst() );
}
@@ -4123,4 +4158,4 @@ SwNodeFnTab aRTFNodeFnTab = {
/* RES_OLENODE */ OutRTF_SwOLENode
};
-
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 11f3236f673f..c6c43c2e09a2 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rtffld.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: mmaher $ $Date: 2002-12-02 17:26:54 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,8 @@
*
************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
#ifdef PRECOMPILED
#include "filt_pch.hxx"
#endif
@@ -176,19 +178,19 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext )
{
// Strings sind PascalStrings; Laenge steht an 1. Stellen, dadurch wird
// sich der Aufruf von strlen erspart!!!
- sal_Char __READONLY_DATA sTOC[]= "\3toc";
- sal_Char __READONLY_DATA sIMPORT[]= "\6import";
- sal_Char __READONLY_DATA sINDEX[]= "\5index";
- sal_Char __READONLY_DATA sSYMBOL[]= "\6symbol";
- sal_Char __READONLY_DATA sPAGE[]= "\4page";
- sal_Char __READONLY_DATA sNUMPAGES[]= "\x8numpages";
- sal_Char __READONLY_DATA sDATE[]= "\4date";
- sal_Char __READONLY_DATA sTIME[]= "\4time";
- sal_Char __READONLY_DATA sDATA[]= "\4data";
- sal_Char __READONLY_DATA sMERGEFLD[]= "\10mergefield";
- sal_Char __READONLY_DATA sIMPORT2[]= "\16includepicture";
- sal_Char __READONLY_DATA sHYPERLINK[]= "\x9hyperlink";
- sal_Char __READONLY_DATA sEQ[]= "\2eq";
+ sal_Char __READONLY_DATA sTOC[]= "\x03""toc";
+ sal_Char __READONLY_DATA sIMPORT[]= "\x06""import";
+ sal_Char __READONLY_DATA sINDEX[]= "\x05""index";
+ sal_Char __READONLY_DATA sSYMBOL[]= "\x06""symbol";
+ sal_Char __READONLY_DATA sPAGE[]= "\x04""page";
+ sal_Char __READONLY_DATA sNUMPAGES[]= "\x08""numpages";
+ sal_Char __READONLY_DATA sDATE[]= "\x04""date";
+ sal_Char __READONLY_DATA sTIME[]= "\x04""time";
+ sal_Char __READONLY_DATA sDATA[]= "\x04""data";
+ sal_Char __READONLY_DATA sMERGEFLD[]= "\x0A""mergefield";
+ sal_Char __READONLY_DATA sIMPORT2[]= "\x0E""includepicture";
+ sal_Char __READONLY_DATA sHYPERLINK[]= "\x09""hyperlink";
+ sal_Char __READONLY_DATA sEQ[]= "\x02""eq";
struct _Dummy_RTF_FLD_TYPES
{
@@ -247,27 +249,24 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext )
static USHORT CheckNumberFmtStr( const String& rNStr )
{
- // zur Kontrolle, falls jemand meint, neue Werte zufuegen zu muessen
-#define NUMBERTAB_SZ 8
- sal_Char __READONLY_DATA
- sNType0[] = "\10ALPHABETIC", /* CHARS_UPPER_LETTER*/
- sNType1[] = "\10alphabetic", /* CHARS_LOWER_LETTER*/
- sNType2[] = "\5ROMAN", /* ROMAN_UPPER */
- sNType3[] = "\5roman", /* ROMAN_LOWER */
- sNType4[] = "\6ARABIC", /* ARABIC */
- sNType5[] = "\4NONE", /* NUMBER_NONE */
- sNType6[] = "\4CHAR", /* CHAR_SPECIAL */
- sNType7[] = "\4PAGE"; /* PAGEDESC */
- static const sal_Char* __READONLY_DATA aNumberTypeTab[ NUMBERTAB_SZ ] =
+ const static sal_Char* aNumberTypeTab[] =
{
- sNType0, sNType1, sNType2, sNType3, sNType4,
- sNType5, sNType6, sNType7
+ "\x0A""ALPHABETIC", /* CHARS_UPPER_LETTER*/
+ "\x0A""alphabetic", /* CHARS_LOWER_LETTER*/
+ "\x05""ROMAN", /* ROMAN_UPPER */
+ "\x05""roman", /* ROMAN_LOWER */
+ "\x06""ARABIC", /* ARABIC */
+ "\x04""NONE", /* NUMBER_NONE */
+ "\x04""CHAR", /* CHAR_SPECIAL */
+ "\x04""PAGE" /* PAGEDESC */
};
+ ASSERT(sizeof(aNumberTypeTab) / sizeof(sal_Char *)
+ >= SVX_NUM_PAGEDESC - SVX_NUM_CHARS_UPPER_LETTER, "impossible");
- for( USHORT n = SVX_NUM_CHARS_UPPER_LETTER; n <= SVX_NUM_PAGEDESC; n++ )
+ for (USHORT n = SVX_NUM_CHARS_UPPER_LETTER; n <= SVX_NUM_PAGEDESC; ++n)
{
- const sal_Char* pCmp = aNumberTypeTab[ n ];
+ const sal_Char* pCmp = aNumberTypeTab[n - SVX_NUM_CHARS_UPPER_LETTER];
int nLen = *pCmp++;
if( rNStr.EqualsAscii( pCmp, 0, nLen ))
return 2 <= n ? n : (n + SVX_NUM_CHARS_UPPER_LETTER_N);
@@ -365,7 +364,7 @@ xub_StrLen lcl_FindEndBracket( const String& rStr )
void lcl_ScanEquationField( const String& rStr, RTF_EquationData& rData,
sal_Unicode nSttKey )
{
- int nSubSupFlag;
+ int nSubSupFlag(0);
RtfFieldSwitch aRFS( rStr );
while( !aRFS.IsAtEnd() )
{
@@ -936,8 +935,10 @@ void SwRTFParser::ReadField()
String sFieldStr, sFieldNm;
BYTE cCh;
- while( nOpenBrakets && IsParserWorking() )
- switch( GetNextToken() )
+ int nToken;
+ while (nOpenBrakets && IsParserWorking())
+ {
+ switch (nToken = GetNextToken())
{
case '}':
{
@@ -965,13 +966,9 @@ void SwRTFParser::ReadField()
}
sFieldStr.Erase();
}
- else if( RTFFLD_UNKNOWN == nRet ) // FieldResult wurde eingelesen
+ else if (RTFFLD_UNKNOWN == nRet)
{
- // der String ist der Wert vom Feld
-// sFieldStr.Insert( '"', 0 );
-// sFieldStr.Insert( '"' );
-
- // besorge mal das Feld:
+ // FieldResult wurde eingelesen
SwTxtNode* pTxtNd = pPam->GetPoint()->nNode.GetNode().GetTxtNode();
SwTxtAttr* pFldAttr = pTxtNd->GetTxtAttr(
pPam->GetPoint()->nContent.GetIndex()-1 );
@@ -1109,14 +1106,17 @@ INSINGLECHAR:
sFieldStr.Insert( sTmp, 3 );
}
break;
+ default:
+ SvxRTFParser::NextToken( nToken );
+ break;
+ }
}
- if( RTFFLD_IMPORT == nRet && sFieldNm.Len() )
- {
- // Grafik einfuegen
+ // Grafik einfuegen
+ if (RTFFLD_IMPORT == nRet && sFieldNm.Len())
InsPicture( sFieldNm );
- }
SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet
}
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx
index e25ec129fccd..b6f76a26f51c 100644
--- a/sw/source/filter/rtf/rtffly.cxx
+++ b/sw/source/filter/rtf/rtffly.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rtffly.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: cmc $ $Date: 2002-07-18 09:41:38 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -176,6 +176,9 @@
#ifndef _FLTINI_HXX
#include <fltini.hxx>
#endif
+#ifndef __SGI_STL_VECTOR
+#include <vector>
+#endif
#define ANCHOR(p) ((SwFmtAnchor*)p)
@@ -333,7 +336,7 @@ void SwRTFParser::SetFlysInDoc()
{
// !! von Oben abarbeiten, CntntPos ist kein Index !
SwNodes & rNds = pDoc->GetNodes();
- SvPtrarr aPrevFmts( 255 < aFlyArr.Count() ? aFlyArr.Count() : 255 );
+ ::std::vector <SwFlyFrmFmt*> aPrevFmts;
SwFrmFmt* pParent = pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME );
for( USHORT n = 0; n < aFlyArr.Count(); ++n )
{
@@ -564,8 +567,8 @@ void SwRTFParser::SetFlysInDoc()
// the prev position
{
ULONG nSttNd = pSttNd->GetIndex(),
- nEndNd = pSttNd->EndOfSectionIndex();
- for( USHORT nPrevFmts = aPrevFmts.Count(); nPrevFmts; )
+ nEndNd = pSttNd->EndOfSectionIndex();
+ for( USHORT nPrevFmts = aPrevFmts.size(); nPrevFmts; )
{
SwFmt* pTmpFmt = (SwFmt*)aPrevFmts[ --nPrevFmts ];
const SwFmtAnchor& rAn = pTmpFmt->GetAnchor();
@@ -577,12 +580,11 @@ void SwRTFParser::SetFlysInDoc()
pTmpFmt->SetAttr( aAnchor );
}
else
- // then forget it
- aPrevFmts.Remove( nPrevFmts, 1 );
+ // then forget it
+ aPrevFmts.erase( aPrevFmts.begin()+nPrevFmts, aPrevFmts.begin()+nPrevFmts+1);
}
-
void* p = (void*)pFmt;
- aPrevFmts.Insert( p, aPrevFmts.Count() );
+ aPrevFmts.push_back(pFmt);
}
}
delete pFlySave;
@@ -1062,6 +1064,13 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
pFlySave->nDropAnchor = nDropCapAnchor;
pFlySave->nDropLines = nDropCapLines;
}
+ if (nFlyArrCnt >0){
+ SwFlySave* pFlySavePrev = aFlyArr[nFlyArrCnt-1];
+ if (pFlySave->nSttNd.GetIndex() < pFlySavePrev->nEndNd.GetIndex())
+ {
+ pFlySavePrev->nEndNd=pFlySave->nSttNd;
+ }
+ }
aFlyArr.Insert( pFlySave, nFlyArrCnt++ );
}
}
@@ -1465,20 +1474,18 @@ void SwRTFParser::_SetPictureSize( const SwNoTxtNode& rNd,
void SwRTFParser::GetPageSize( Size& rSize )
{
- const SwFrmFmt& rPgFmt = pDoc->GetPageDesc(nAktPageDesc).GetMaster();
+ ASSERT(!maSegments.empty(), "not possible");
- const SwFmtFrmSize& rSz = rPgFmt.GetFrmSize();
- const SvxLRSpaceItem& rLR = rPgFmt.GetLRSpace();
- const SvxULSpaceItem& rUL = rPgFmt.GetULSpace();
- const SwFmtCol& rCol = rPgFmt.GetCol();
+ const rtfSection &rSect = maSegments.back();
- rSize.Width() = rSz.GetWidth() - rLR.GetLeft() - rLR.GetRight();
- rSize.Height() = rSz.GetHeight() - rUL.GetUpper() - rUL.GetLower();
+ rSize.Width() = rSect.maPageInfo.mnPgwsxn - rSect.maPageInfo.mnMarglsxn - rSect.maPageInfo.mnMargrsxn;
+ rSize.Height() = rSect.maPageInfo.mnPghsxn - rSect.maPageInfo.mnMargtsxn - rSect.maPageInfo.mnMargbsxn;
- if( 1 < rCol.GetNumCols() )
+ long nCols = rSect.NoCols();
+ if (1 < nCols)
{
- rSize.Width() /= rCol.GetNumCols();
- rSize.Height() /= rCol.GetNumCols();
+ rSize.Width() /= nCols;
+ rSize.Height() /= nCols;
}
}
diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx
index 6375a26fdaf5..177de0b38ed6 100644
--- a/sw/source/filter/rtf/rtfnum.cxx
+++ b/sw/source/filter/rtf/rtfnum.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rtfnum.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jp $ $Date: 2001-05-28 10:55:33 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -802,7 +802,7 @@ const Font* SwRTFParser::FindFontOfItem( const SvxFontItem& rItem ) const
}
-void SwRTFParser::ReadNumSecLevel( int nToken )
+SwNumRule *SwRTFParser::ReadNumSecLevel( int nToken )
{
// lese die \pnseclvl - Gruppe
// nTokenValue gibt schon den richtigen Level vor 1 - 9!
@@ -835,7 +835,7 @@ void SwRTFParser::ReadNumSecLevel( int nToken )
default:
SkipGroup();
- return ;
+ return 0;
}
}
@@ -1102,6 +1102,7 @@ NUMATTR_SETUNDERLINE:
}
SkipToken( -1 ); // die schliesende Klammer wird "oben" ausgewertet
+ return pCurRule;
}
diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx
index e1ccd06a21de..bd40ed97443f 100644
--- a/sw/source/filter/rtf/rtftbl.cxx
+++ b/sw/source/filter/rtf/rtftbl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: rtftbl.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: os $ $Date: 2002-12-10 14:30:11 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,6 +58,9 @@
*
*
************************************************************************/
+
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
#ifdef PRECOMPILED
#include "filt_pch.hxx"
#endif
@@ -138,6 +141,67 @@ class SwShareBoxFmts;
extern void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* = 0,
BOOL = TRUE, const BOOL = TRUE, SwShareBoxFmts* = 0 );
+struct Row
+{
+ bool mbUseLeftRowPad, mbUseRightRowPad, mbUseTopRowPad, mbUseBottomRowPad;
+ long mnLeftRowPad, mnRightRowPad, mnTopRowPad, mnBottomRowPad;
+ USHORT mnBrdDist;
+ Row() :
+ mbUseLeftRowPad(false), mbUseRightRowPad(false),
+ mbUseTopRowPad(false), mbUseBottomRowPad(false),
+ mnLeftRowPad(0), mnRightRowPad(0), mnTopRowPad(0), mnBottomRowPad(0),
+ mnBrdDist(MIN_BORDER_DIST)
+ {}
+};
+
+static void SetRowBorder(SfxItemSet& rSet, const Row &rRow)
+{
+#if 1
+ SvxBoxItem aBox((const SvxBoxItem&)rSet.Get(RES_BOX, false));
+ aBox.SetDistance(rRow.mbUseLeftRowPad ? rRow.mnLeftRowPad : rRow.mnBrdDist,
+ BOX_LINE_LEFT);
+
+ aBox.SetDistance(rRow.mbUseRightRowPad ? rRow.mnRightRowPad : rRow.mnBrdDist,
+ BOX_LINE_RIGHT);
+
+ aBox.SetDistance(rRow.mbUseTopRowPad ? rRow.mnTopRowPad : 0,
+ BOX_LINE_TOP);
+
+ aBox.SetDistance(rRow.mbUseBottomRowPad ? rRow.mnBottomRowPad : 0,
+ BOX_LINE_BOTTOM);
+
+ rSet.Put(aBox);
+#else
+ const SfxPoolItem* pItem;
+ if (SFX_ITEM_SET == rSet.GetItemState(RES_BOX, FALSE, &pItem))
+ {
+ SvxBoxItem aBox( *(SvxBoxItem*)pItem );
+ aBox.SetDistance(rRow.mbUseLeftRowPad ? rRow.mnLeftRowPad : rRow.mnBrdDist,
+ BOX_LINE_LEFT);
+
+ aBox.SetDistance(rRow.mbUseRightRowPad ? rRow.mnRightRowPad : rRow.mnBrdDist,
+ BOX_LINE_RIGHT);
+
+ aBox.SetDistance(rRow.mbUseTopRowPad ? rRow.mnTopRowPad : 0,
+ BOX_LINE_TOP);
+
+ aBox.SetDistance(rRow.mbUseBottomRowPad ? rRow.mnBottomRowPad : 0,
+ BOX_LINE_BOTTOM);
+
+ rSet.Put(aBox);
+ }
+#endif
+}
+
+void rtfSections::PrependedInlineNode(const SwPosition &rPos,
+ const SwNode &rNode)
+{
+ ASSERT(!maSegments.empty(),
+ "should not be possible, must be at least one segment");
+ if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
+ maSegments.back().maStart = SwNodeIndex(rNode);
+}
+
void SwRTFParser::ReadTable( int nToken )
{
nInsTblRow = USHRT_MAX;
@@ -191,10 +255,7 @@ void SwRTFParser::ReadTable( int nToken )
SwHoriOrient eAdjust = HORI_LEFT; // default fuer Tabellen
SwTwips nLSpace = 0;
- USHORT nBrdDist = MIN_BORDER_DIST;
- bool bUseLeftRowPad = false, bUseRightRowPad = false,
- bUseTopRowPad = false, bUseBottomRowPad = false;
- long nLeftRowPad = 0, nRightRowPad = 0, nTopRowPad = 0, nBottomRowPad = 0;
+ Row aRow;
bool bUseLeftCellPad = false, bUseRightCellPad = false,
bUseTopCellPad = false, bUseBottomCellPad = false;
@@ -209,37 +270,33 @@ void SwRTFParser::ReadTable( int nToken )
BOOL bHeadlineRepeat = FALSE;
SvxFrameDirection eDir = FRMDIR_HORI_LEFT_TOP;
-#ifdef SET_TRGAPH
- SvxLRSpaceItem aLR;
-#endif
-
int bWeiter = TRUE;
do {
switch( nToken )
{
case RTF_TRPADDFL:
- bUseLeftRowPad = (nTokenValue == 3) ? true : false;
+ aRow.mbUseLeftRowPad = (nTokenValue == 3) ? true : false;
break;
case RTF_TRPADDFT:
- bUseTopRowPad = (nTokenValue == 3) ? true : false;
+ aRow.mbUseTopRowPad = (nTokenValue == 3) ? true : false;
break;
case RTF_TRPADDFR:
- bUseRightRowPad = (nTokenValue == 3) ? true : false;
+ aRow.mbUseRightRowPad = (nTokenValue == 3) ? true : false;
break;
case RTF_TRPADDFB:
- bUseBottomRowPad = (nTokenValue == 3) ? true : false;
+ aRow.mbUseBottomRowPad = (nTokenValue == 3) ? true : false;
break;
case RTF_TRPADDL:
- nLeftRowPad = nTokenValue;
+ aRow.mnLeftRowPad = nTokenValue;
break;
case RTF_TRPADDT:
- nTopRowPad = nTokenValue;
+ aRow.mnTopRowPad = nTokenValue;
break;
case RTF_TRPADDR:
- nRightRowPad = nTokenValue;
+ aRow.mnRightRowPad = nTokenValue;
break;
case RTF_TRPADDB:
- nBottomRowPad = nTokenValue;
+ aRow.mnBottomRowPad = nTokenValue;
break;
case RTF_CLPADFL:
@@ -298,13 +355,7 @@ void SwRTFParser::ReadTable( int nToken )
}
else
{
- // Platz zwischen den Spalten angeben und ist
- // diese auch kleiner als die Breite der Box
-#ifdef SET_TRGAPH
- if( aLR.GetLeft() && 2L * aLR.GetLeft() < nSize )
- pBoxFmt->SetAttr( aLR );
- aLR.SetLeft( 0 ); aLR.SetRight( 0 );
-#endif
+ SetRowBorder((SfxItemSet&)pBoxFmt->GetAttrSet(), aRow);
aBoxFmts.Insert( pBoxFmt, aBoxFmts.Count() );
pBoxFmt = pDoc->MakeTableBoxFmt();
}
@@ -327,6 +378,65 @@ void SwRTFParser::ReadTable( int nToken )
if (bUseTopCellPad)
aBox.SetDistance(nTopCellPad, BOX_LINE_LEFT);
+
+ /*#106415# The Cell Borders are now balanced on import to
+ improve the layout of tables.
+ */
+
+ if ( aBoxFmts.Count()>1)
+ {
+
+ SwTableBoxFmt* prevpFmt = aBoxFmts[ aBoxFmts.Count()-2 ];
+ SvxBoxItem prevaBox(prevpFmt->GetBox());
+ USHORT prevWidthRight=0;
+ USHORT currWidthLeft=0;
+ const SvxBorderLine* brdrline ;
+ if(prevaBox.GetRight())
+ {
+ brdrline=prevaBox.GetRight();
+ prevWidthRight = brdrline->GetOutWidth();
+ }
+ if(aBox.GetLeft())
+ {
+ brdrline=aBox.GetLeft();
+ currWidthLeft = brdrline->GetOutWidth();
+
+ }
+ if(currWidthLeft >0 || prevWidthRight >0 )
+ {
+ USHORT newBorderWidth=(currWidthLeft+prevWidthRight)/2 ;
+ if(newBorderWidth /2 ==DEF_LINE_WIDTH_0 )
+ {
+ newBorderWidth =DEF_LINE_WIDTH_0;
+ }
+ else if(newBorderWidth /2 >=(DEF_LINE_WIDTH_4-DEF_LINE_WIDTH_3))
+ {
+ newBorderWidth =DEF_LINE_WIDTH_4;
+ }
+ else if(newBorderWidth /2 >=(DEF_LINE_WIDTH_3-DEF_LINE_WIDTH_2))
+ {
+ newBorderWidth =DEF_LINE_WIDTH_3;
+ }
+ else if(newBorderWidth /2>=(DEF_LINE_WIDTH_2-DEF_LINE_WIDTH_1))
+ {
+ newBorderWidth =DEF_LINE_WIDTH_2;
+ }
+ else if(newBorderWidth /2>=(DEF_LINE_WIDTH_1 - DEF_LINE_WIDTH_0) )
+ {
+ newBorderWidth =DEF_LINE_WIDTH_1;
+ }
+ else
+ {
+ newBorderWidth =DEF_LINE_WIDTH_0;
+ }
+ const SvxBorderLine newbrdrline(0, newBorderWidth,0,0);
+ aBox.SetLine(&newbrdrline,BOX_LINE_LEFT);
+ prevaBox.SetLine(&newbrdrline,BOX_LINE_RIGHT);
+ prevpFmt->SetAttr(prevaBox);
+ }
+
+ }
+
pFmt->SetAttr(aBox);
bUseLeftCellPad = false;
@@ -337,13 +447,7 @@ void SwRTFParser::ReadTable( int nToken )
break;
case RTF_TRGAPH:
- {
- nBrdDist = (USHORT)nTokenValue;
-#ifdef SET_TRGAPH
- aLR.SetLeft( USHORT( nTokenValue ));
- aLR.SetRight( USHORT( nTokenValue ));
-#endif
- }
+ aRow.mnBrdDist = (USHORT)nTokenValue;
break;
case RTF_TRQL: eAdjust = HORI_LEFT; break;
@@ -403,40 +507,11 @@ void SwRTFParser::ReadTable( int nToken )
if( aMergeBoxes[ nBoxCnt ] )
break;
- const SfxPoolItem* pItem;
SfxItemSet& rSet = (SfxItemSet&)pBoxFmt->GetAttrSet();
ReadBorderAttr( nToken, rSet, TRUE );
- if (SFX_ITEM_SET == rSet.GetItemState(RES_BOX, FALSE, &pItem))
- {
- SvxBoxItem aBox( *(SvxBoxItem*)pItem );
-#if 1
- aBox.SetDistance(bUseLeftRowPad ? nLeftRowPad : nBrdDist,
- BOX_LINE_LEFT);
-
- aBox.SetDistance(bUseRightRowPad ? nRightRowPad : nBrdDist,
- BOX_LINE_RIGHT);
-
- aBox.SetDistance(bUseTopRowPad ? nTopRowPad : 0,
- BOX_LINE_TOP);
-
- aBox.SetDistance(bUseBottomRowPad ? nBottomRowPad : 0,
- BOX_LINE_BOTTOM);
-
- rSet.Put(aBox);
-#else
- BOOL bChg = FALSE;
- for (int nLn = 0; nLn < 4; ++nLn)
- {
- if( aBox.GetLine( nLn ) && !aBox.GetDistance( nLn ) )
- {
- aBox.SetDistance( 2 > nLn ? 18 : nBrdDist, nLn );
- bChg = TRUE;
- }
- }
- if (bChg)
- rSet.Put( aBox );
+#if 0
+ SetRowBorder(aRow);
#endif
- }
}
else if( RTF_TABLEDEF != (nToken & ~(0xff | RTF_SWGDEFS)) )
{
@@ -638,6 +713,12 @@ void SwRTFParser::ReadTable( int nToken )
GetIndex() - 5 ]->GetTableNode();
ASSERT( pTableNode, "Wo ist mein TabellenNode?" );
+ if (pTableNode)
+ {
+ maSegments.PrependedInlineNode(*pPam->GetPoint(),
+ *pTableNode);
+ }
+
SwTableLines& rLns = pTableNode->GetTable().GetTabLines();
pNewLine = rLns[ rLns.Count()-1 ];
@@ -882,5 +963,4 @@ void SwRTFParser::CheckInsNewTblLine()
}
}
-
-
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index feda53718702..7b3a904bcb79 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swparrtf.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: cmc $ $Date: 2002-12-06 16:21:55 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PRECOMPILED
@@ -115,6 +114,9 @@
#ifndef _SVX_FRMDIRITEM_HXX
#include <svx/frmdiritem.hxx>
#endif
+#ifndef _SVX_HYZNITEM_HXX
+#include <svx/hyznitem.hxx>
+#endif
#ifndef _FMTPDSC_HXX //autogen
#include <fmtpdsc.hxx>
@@ -227,6 +229,13 @@
#ifndef _SHELLRES_HXX // for the pagedescname from the ShellRes
#include <shellres.hxx>
#endif
+#ifndef _SW_HF_EAT_SPACINGITEM_HXX
+#include <hfspacingitem.hxx>
+#endif
+
+#ifndef _FLTSHELL_HXX
+#include <fltshell.hxx>
+#endif
#ifndef _SWSWERROR_H
#include <swerror.h>
@@ -287,8 +296,9 @@ ULONG RtfReader::Read( SwDoc &rDoc,SwPaM &rPam, const String &)
}
SwRTFParser::SwRTFParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
- int bReadNewDoc )
+ int bReadNewDoc )
: SvxRTFParser( pD->GetAttrPool(), rIn, bReadNewDoc ),
+ maSegments(*this),
pDoc( pD ),
pTableNode( 0 ), pOldTblNd( 0 ), nAktBox( 0 ), nNewNumSectDef( USHRT_MAX ),
nAktPageDesc( 0 ), nAktFirstPageDesc( 0 ),
@@ -302,7 +312,7 @@ SwRTFParser::SwRTFParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn,
{
mbIsFootnote = mbReadNoTbl = bReadSwFly = bSwPageDesc = bStyleTabValid =
bInPgDscTbl = bNewNumList = false;
- bFirstContinue = bFirstDocControl = true;
+ bFirstContinue = true;
pPam = new SwPaM( *rCrsr.GetPoint() );
SetInsPos( SwxPosition( pPam ) );
@@ -331,6 +341,18 @@ SvParserState SwRTFParser::CallParser()
return SvxRTFParser::CallParser();
}
+bool lcl_UsedPara(SwPaM &rPam)
+{
+ const SwCntntNode* pCNd;
+ const SwAttrSet* pSet;
+ if( rPam.GetPoint()->nContent.GetIndex() ||
+ ( 0 != ( pCNd = rPam.GetCntntNode()) &&
+ 0 != ( pSet = pCNd->GetpSwAttrSet()) &&
+ ( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE ) ||
+ SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, FALSE ))))
+ return true;
+ return false;
+}
void SwRTFParser::Continue( int nToken )
{
@@ -381,17 +403,11 @@ void SwRTFParser::Continue( int nToken )
if( SVPAR_PENDING == GetStatus() )
return ; // weiter gehts beim naechsten mal
- // Laufbalken bei asynchronen Call nicht einschalten !!!
- ::EndProgress( pDoc->GetDocShell() );
-
+ // JP 13.08.98: TabellenUmrandungen optimieren - Bug 53525
+ for( USHORT n = aTblFmts.Count(); n; )
{
- // JP 13.08.98: TabellenUmrandungen optimieren - Bug 53525
- for( USHORT n = aTblFmts.Count(); n; )
- {
- SwTable* pTbl = SwTable::FindTable( (SwFrmFmt*)aTblFmts[ --n ] );
- if( pTbl )
- pTbl->GCBorderLines();
- }
+ if (SwTable* pTbl = SwTable::FindTable( (SwFrmFmt*)aTblFmts[ --n ] ))
+ pTbl->GCBorderLines();
}
pRelNumRule->SetNumRelSpaces( *pDoc );
@@ -472,6 +488,10 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() )
delete pRegionEndIdx, pRegionEndIdx = 0;
}
+ sal_uInt16 nPageDescOffset = pDoc->GetPageDescCnt();
+ maSegments.InsertSegments(IsNewDoc());
+ UpdatePageDescs(*pDoc, nPageDescOffset);
+
if( aFlyArr.Count() )
SetFlysInDoc();
@@ -487,7 +507,7 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() )
if( pTmp->IsCntntNode() && !pTmp->FindTableNode() )
DelLastNode();
}
- else if( 0 != ( pAktNd = pDoc->GetNodes()[ nNodeIdx ]->GetTxtNode()) )
+ else if (0 != (pAktNd = pDoc->GetNodes()[nNodeIdx]->GetTxtNode()))
{
if( pAktNd->CanJoinNext( &pPos->nNode ))
{
@@ -507,7 +527,6 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() )
}
}
}
-
// nun noch das SplitNode vom Ende aufheben
else if( !IsNewDoc() )
{
@@ -547,6 +566,479 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() )
delete pSttNdIdx, pSttNdIdx = 0;
delete pRegionEndIdx, pRegionEndIdx = 0;
RemoveUnusedNumRules();
+
+ // Laufbalken bei asynchronen Call nicht einschalten !!!
+ ::EndProgress( pDoc->GetDocShell() );
+}
+
+bool rtfSections::SetCols(SwFrmFmt &rFmt, const rtfSection &rSection,
+ USHORT nNettoWidth)
+{
+ //sprmSCcolumns - Anzahl der Spalten - 1
+ USHORT nCols = rSection.NoCols();
+
+ if (nCols < 2)
+ return false; // keine oder bloedsinnige Spalten
+
+ SwFmtCol aCol; // Erzeuge SwFmtCol
+
+ //sprmSDxaColumns - Default-Abstand 1.25 cm
+ USHORT nColSpace = rSection.StandardColSeperation();
+
+#if 0
+ // sprmSLBetween
+ if (rSection.maSep.fLBetween)
+ {
+ aCol.SetLineAdj( COLADJ_TOP ); // Line
+ aCol.SetLineHeight( 100 );
+ aCol.SetLineColor( Color( COL_BLACK ));
+ aCol.SetLineWidth( 1 );
+ }
+#endif
+ aCol.Init( nCols, nColSpace, nNettoWidth );
+
+ // not SFEvenlySpaced
+ if (rSection.maPageInfo.maColumns.size())
+ {
+ aCol._SetOrtho(false);
+ USHORT nWishWidth = 0, nHalfPrev = 0;
+ for (USHORT n = 0, i = 0; n < rSection.maPageInfo.maColumns.size(); n += 2, ++i )
+ {
+ SwColumn* pCol = aCol.GetColumns()[ i ];
+ pCol->SetLeft( nHalfPrev );
+ USHORT nSp = rSection.maPageInfo.maColumns[ n+1 ];
+ nHalfPrev = nSp / 2;
+ pCol->SetRight( nSp - nHalfPrev );
+ pCol->SetWishWidth(rSection.maPageInfo.maColumns[ n ] +
+ pCol->GetLeft() + pCol->GetRight());
+ nWishWidth += pCol->GetWishWidth();
+ }
+ aCol.SetWishWidth( nWishWidth );
+ }
+
+ rFmt.SetAttr(aCol);
+ return true;
+}
+
+void rtfSections::SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt,
+ const rtfSection &rSection, bool bIgnoreCols)
+{
+ // 1. Orientierung
+ rInPageDesc.SetLandscape(rSection.IsLandScape());
+
+ // 2. Papiergroesse
+ SwFmtFrmSize aSz(rFmt.GetFrmSize());
+ aSz.SetWidth(rSection.GetPageWidth());
+ aSz.SetHeight(rSection.GetPageHeight());
+ rFmt.SetAttr(aSz);
+
+ rFmt.SetAttr(
+ SvxLRSpaceItem(rSection.GetPageLeft(), rSection.GetPageRight()));
+
+ if (!bIgnoreCols)
+ {
+ SetCols(rFmt, rSection, rSection.GetPageWidth() -
+ rSection.GetPageLeft() - rSection.GetPageRight());
+ }
+}
+
+void rtfSections::GetPageULData(const rtfSection &rSection, bool bFirst,
+ rtfSections::wwULSpaceData& rData)
+{
+ short nWWUp = rSection.maPageInfo.mnMargtsxn;
+ short nWWLo = rSection.maPageInfo.mnMargbsxn;
+ short nWWHTop = rSection.maPageInfo.mnHeadery;
+ short nWWFBot = rSection.maPageInfo.mnFootery;
+
+#if 0
+ /*
+ If there is gutter in 97+ and the dop says put it on top then get the
+ gutter distance and set it to the top margin. When we are "two pages
+ in one" the gutter is put at the top of odd pages, and bottom of
+ even pages, something we cannot do. So we will put it on top of all
+ pages, that way the pages are at least the right size.
+ */
+ if ( mrReader.pWDop->doptypography.f2on1 ||
+ (!mrReader.bVer67 && mrReader.pWDop->iGutterPos &&
+ rSection.maSep.fRTLGutter)
+ )
+ {
+ nWWUp += rSection.maSep.dzaGutter;
+ }
+#endif
+
+ if (bFirst)
+ {
+ if (
+ rSection.mpTitlePage &&
+ SFX_ITEM_SET == rSection.mpTitlePage->GetMaster().GetItemState(RES_HEADER)
+ )
+ {
+ rData.bHasHeader = true;
+ }
+ }
+ else
+ {
+ if (rSection.mpPage &&
+ (
+ SFX_ITEM_SET == rSection.mpPage->GetMaster().GetItemState(RES_HEADER)
+ || rSection.mpPage->GetLeft().GetItemState(RES_HEADER)
+ )
+ )
+ {
+ rData.bHasHeader = true;
+ }
+ }
+
+ if( rData.bHasHeader )
+ {
+ rData.nSwUp = nWWHTop; // Header -> umrechnen
+ rData.nSwHLo = nWWUp - nWWHTop;
+
+ if (rData.nSwHLo < MM50)
+ rData.nSwHLo = MM50;
+ }
+ else // kein Header -> Up einfach uebernehmen
+ rData.nSwUp = nWWUp;
+
+ if (bFirst)
+ {
+ if (
+ rSection.mpTitlePage &&
+ SFX_ITEM_SET == rSection.mpTitlePage->GetMaster().GetItemState(RES_FOOTER)
+ )
+ {
+ rData.bHasFooter = true;
+ }
+ }
+ else
+ {
+ if (rSection.mpPage &&
+ (
+ SFX_ITEM_SET == rSection.mpPage->GetMaster().GetItemState(RES_FOOTER)
+ || rSection.mpPage->GetLeft().GetItemState(RES_FOOTER)
+ )
+ )
+ {
+ rData.bHasFooter = true;
+ }
+ }
+
+ if( rData.bHasFooter )
+ {
+ rData.nSwLo = nWWFBot; // Footer -> Umrechnen
+ rData.nSwFUp = nWWLo - nWWFBot;
+
+ if (rData.nSwFUp < MM50)
+ rData.nSwFUp = MM50;
+ }
+ else // kein Footer -> Lo einfach uebernehmen
+ rData.nSwLo = nWWLo;
+}
+
+void rtfSections::SetPageULSpaceItems(SwFrmFmt &rFmt,
+ rtfSections::wwULSpaceData& rData)
+{
+ if (rData.bHasHeader) // ... und Header-Lower setzen
+ {
+ //Kopfzeilenhoehe minimal sezten
+ if (SwFrmFmt* pHdFmt = (SwFrmFmt*)rFmt.GetHeader().GetHeaderFmt())
+ {
+ pHdFmt->SetAttr(SwFmtFrmSize(ATT_MIN_SIZE, 0, rData.nSwHLo));
+ SvxULSpaceItem aHdUL(pHdFmt->GetULSpace());
+ aHdUL.SetLower(rData.nSwHLo - MM50);
+ pHdFmt->SetAttr(aHdUL);
+ pHdFmt->SetAttr(SwHeaderAndFooterEatSpacingItem(
+ RES_HEADER_FOOTER_EAT_SPACING, true));
+ }
+ }
+
+ if (rData.bHasFooter) // ... und Footer-Upper setzen
+ {
+ if (SwFrmFmt* pFtFmt = (SwFrmFmt*)rFmt.GetFooter().GetFooterFmt())
+ {
+ pFtFmt->SetAttr(SwFmtFrmSize(ATT_MIN_SIZE, 0, rData.nSwFUp));
+ SvxULSpaceItem aFtUL(pFtFmt->GetULSpace());
+ aFtUL.SetUpper(rData.nSwFUp - MM50);
+ pFtFmt->SetAttr(aFtUL);
+ pFtFmt->SetAttr(SwHeaderAndFooterEatSpacingItem(
+ RES_HEADER_FOOTER_EAT_SPACING, true));
+ }
+ }
+
+ SvxULSpaceItem aUL(rData.nSwUp, rData.nSwLo); // Page-UL setzen
+ rFmt.SetAttr(aUL);
+}
+
+void rtfSections::SetSegmentToPageDesc(const rtfSection &rSection,
+ bool bTitlePage, bool bIgnoreCols)
+{
+ SwPageDesc &rPage = bTitlePage ? *rSection.mpTitlePage : *rSection.mpPage;
+
+// SetNumberingType(rSection, rPage);
+
+ SwFrmFmt &rFmt = rPage.GetMaster();
+// mrReader.SetDocumentGrid(rFmt, rSection);
+
+ wwULSpaceData aULData;
+ GetPageULData(rSection, bTitlePage, aULData);
+ SetPageULSpaceItems(rFmt, aULData);
+
+ SetPage(rPage, rFmt, rSection, bIgnoreCols);
+}
+
+void rtfSections::CopyFrom(const SwPageDesc &rFrom, SwPageDesc &rDest)
+{
+ UseOnPage ePage = rFrom.ReadUseOn();
+ rDest.WriteUseOn(ePage);
+ mrReader.pDoc->CopyHeader(rFrom.GetMaster(), rDest.GetMaster());
+ mrReader.pDoc->CopyHeader(rFrom.GetLeft(), rDest.GetLeft());
+ mrReader.pDoc->CopyFooter(rFrom.GetMaster(), rDest.GetMaster());
+ mrReader.pDoc->CopyFooter(rFrom.GetLeft(), rDest.GetLeft());
+}
+
+void rtfSections::SetHdFt(rtfSection &rSection)
+{
+ ASSERT(rSection.mpPage, "makes no sense to call without a main page");
+ if (rSection.mpPage && rSection.maPageInfo.mpPageHdFt)
+ CopyFrom(*rSection.maPageInfo.mpPageHdFt, *rSection.mpPage);
+
+ if (rSection.mpTitlePage && rSection.maPageInfo.mpTitlePageHdFt)
+ CopyFrom(*rSection.maPageInfo.mpTitlePageHdFt, *rSection.mpTitlePage);
+}
+
+SwSectionFmt *rtfSections::InsertSection(SwPaM& rMyPaM, rtfSection &rSection)
+{
+ SwSection aSection(CONTENT_SECTION, mrReader.pDoc->GetUniqueSectionName());
+
+ SfxItemSet aSet( mrReader.pDoc->GetAttrPool(), aFrmFmtSetRange );
+
+ sal_uInt8 nRTLPgn = maSegments.empty() ? 0 : maSegments.back().IsBiDi();
+ aSet.Put(SvxFrameDirectionItem(
+ nRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP));
+
+#if 0
+ if (2 == mrReader.pWDop->fpc)
+ aSet.Put( SwFmtFtnAtTxtEnd(FTNEND_ATTXTEND));
+ if (0 == mrReader.pWDop->epc)
+ aSet.Put( SwFmtEndAtTxtEnd(FTNEND_ATTXTEND));
+#endif
+
+ rSection.mpSection = mrReader.pDoc->Insert( rMyPaM, aSection, &aSet );
+ ASSERT(rSection.mpSection, "section not inserted!");
+ if (!rSection.mpSection)
+ return 0;
+
+ SwPageDesc *pPage = 0;
+ mySegrIter aEnd = maSegments.rend();
+ for (mySegrIter aIter = maSegments.rbegin(); aIter != aEnd; ++aIter)
+ {
+ if (pPage = aIter->mpPage)
+ break;
+ }
+
+ ASSERT(pPage, "no page outside this section!");
+
+ if (!pPage)
+ pPage = &mrReader.pDoc->_GetPageDesc(0);
+
+ if (!pPage)
+ return 0;
+
+ SwFrmFmt& rFmt = pPage->GetMaster();
+ const SwFmtFrmSize& rSz = rFmt.GetFrmSize();
+ const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
+ SwTwips nWidth = rSz.GetWidth();
+ long nLeft = rLR.GetTxtLeft();
+ long nRight = rLR.GetRight();
+
+ SwSectionFmt *pFmt = rSection.mpSection->GetFmt();
+ ASSERT(pFmt, "impossible");
+ if (!pFmt)
+ return 0;
+ SetCols(*pFmt, rSection, (USHORT)(nWidth - nLeft - nRight) );
+
+#if 0
+ //Set the columns to be UnBalanced if compatability option is set
+ if (mrReader.pWDop->fNoColumnBalance )
+ {
+ SwSectionFmt *pFmt = rSection.mpSection->GetFmt();
+ pFmt->SetAttr(SwFmtNoBalancedColumns(true));
+ }
+#endif
+
+ return pFmt;
+}
+
+void rtfSections::InsertSegments(bool bNewDoc)
+{
+ sal_uInt16 nDesc(0);
+ mySegIter aEnd = maSegments.end();
+ mySegIter aStart = maSegments.begin();
+ for (mySegIter aIter = aStart; aIter != aEnd; ++aIter)
+ {
+ mySegIter aNext = aIter+1;
+
+ bool bInsertSection = aIter != aStart ? aIter->IsContinous() : false;
+
+ if (!bInsertSection)
+ {
+ /*
+ If a cont section follow this section then we won't be
+ creating a page desc with 2+ cols as we cannot host a one
+ col section in a 2+ col pagedesc and make it look like
+ word. But if the current section actually has columns then
+ we are forced to insert a section here as well as a page
+ descriptor.
+ */
+
+ /*
+ Note for the future:
+ If we want to import "protected sections" the here is
+ where we would also test for that and force a section
+ insertion if that was true.
+ */
+ bool bIgnoreCols = false;
+ if (aNext != aEnd && aNext->IsContinous())
+ {
+ bIgnoreCols = true;
+ if (aIter->NoCols() > 1)
+ bInsertSection = true;
+ }
+
+ if (aIter->HasTitlePage())
+ {
+ if (bNewDoc && aIter == aStart)
+ {
+ aIter->mpTitlePage =
+ mrReader.pDoc->GetPageDescFromPool(RES_POOLPAGE_FIRST);
+ }
+ else
+ {
+ USHORT nPos = mrReader.pDoc->MakePageDesc(
+ ViewShell::GetShellRes()->GetPageDescName(nDesc)
+ , 0, false);
+ aIter->mpTitlePage = &mrReader.pDoc->_GetPageDesc(nPos);
+ }
+ ASSERT(aIter->mpTitlePage, "no page!");
+ if (!aIter->mpTitlePage)
+ continue;
+
+ SetSegmentToPageDesc(*aIter, true, bIgnoreCols);
+ }
+
+ if (bNewDoc && aIter == aStart)
+ {
+ aIter->mpPage =
+ mrReader.pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD);
+ }
+ else
+ {
+ USHORT nPos = mrReader.pDoc->MakePageDesc(
+ ViewShell::GetShellRes()->GetPageDescName(nDesc,
+ false, aIter->HasTitlePage()),
+ aIter->mpTitlePage, false);
+ aIter->mpPage = &mrReader.pDoc->_GetPageDesc(nPos);
+ }
+ ASSERT(aIter->mpPage, "no page!");
+ if (!aIter->mpPage)
+ continue;
+
+ SetHdFt(*aIter);
+
+ if (aIter->mpTitlePage)
+ SetSegmentToPageDesc(*aIter, true, bIgnoreCols);
+ SetSegmentToPageDesc(*aIter, false, bIgnoreCols);
+
+ SwFmtPageDesc aPgDesc(aIter->HasTitlePage() ?
+ aIter->mpTitlePage : aIter->mpPage);
+
+ if (aIter->mpTitlePage)
+ aIter->mpTitlePage->SetFollow(aIter->mpPage);
+
+ if (aIter->PageRestartNo())
+ aPgDesc.SetNumOffset(aIter->PageStartAt());
+
+ /*
+ If its a table here, apply the pagebreak to the table
+ properties, otherwise we add it to the para at this
+ position
+ */
+ if (aIter->maStart.GetNode().IsTableNode())
+ {
+ SwTable& rTable =
+ aIter->maStart.GetNode().GetTableNode()->GetTable();
+ SwFrmFmt* pApply = rTable.GetFrmFmt();
+ ASSERT(pApply, "impossible");
+ if (pApply)
+ pApply->SetAttr(aPgDesc);
+ }
+ else
+ {
+ SwPosition aPamStart(aIter->maStart);
+ aPamStart.nContent.Assign(
+ aIter->maStart.GetNode().GetCntntNode(), 0);
+ SwPaM aPage(aPamStart);
+
+ mrReader.pDoc->Insert(aPage, aPgDesc);
+ }
+ ++nDesc;
+ }
+
+ SwTxtNode* pTxtNd = 0;
+ if (bInsertSection)
+ {
+ SwPaM aSectPaM(*mrReader.pPam);
+ SwNodeIndex aAnchor(aSectPaM.GetPoint()->nNode);
+ if (aNext != aEnd)
+ {
+ aAnchor = aNext->maStart;
+ aSectPaM.GetPoint()->nNode = aAnchor;
+ aSectPaM.GetPoint()->nContent.Assign(
+ aNext->maStart.GetNode().GetCntntNode(), 0);
+ aSectPaM.Move(fnMoveBackward);
+ }
+
+ const SwPosition* pPos = aSectPaM.GetPoint();
+ const SwTxtNode* pSttNd =
+ mrReader.pDoc->GetNodes()[ pPos->nNode ]->GetTxtNode();
+ const SwTableNode* pTableNd = pSttNd ? pSttNd->FindTableNode() : 0;
+ if (pTableNd)
+ {
+ pTxtNd =
+ mrReader.pDoc->GetNodes().MakeTxtNode(aAnchor,
+ mrReader.pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
+
+ aSectPaM.GetPoint()->nNode = SwNodeIndex(*pTxtNd);
+ aSectPaM.GetPoint()->nContent.Assign(
+ aSectPaM.GetCntntNode(), 0);
+ }
+
+ aSectPaM.SetMark();
+
+ aSectPaM.GetPoint()->nNode = aIter->maStart;
+ aSectPaM.GetPoint()->nContent.Assign(
+ aSectPaM.GetCntntNode(), 0);
+
+ SwSectionFmt *pRet = InsertSection(aSectPaM, *aIter);
+ //The last section if continous is always unbalanced
+ if (aNext == aEnd && pRet)
+ pRet->SetAttr(SwFmtNoBalancedColumns(true));
+ }
+
+ if (pTxtNd)
+ {
+ SwNodeIndex aIdx(*pTxtNd);
+ SwPosition aPos(aIdx);
+ SwPaM aTest(aPos);
+ mrReader.pDoc->DelFullPara(aTest);
+ pTxtNd = 0;
+ }
+ }
+
+ myDummyIter aDEnd = maDummyPageNos.end();
+ for (myDummyIter aDummy = maDummyPageNos.begin(); aDummy != aDEnd; ++aDummy)
+ mrReader.pDoc->DelPageDesc(*aDummy);
}
SwRTFParser::~SwRTFParser()
@@ -605,6 +1097,21 @@ void SwRTFParser::NextToken( int nToken )
break;
case RTF_PN:
+ if( bNewNumList )
+ SkipGroup();
+ else
+ {
+ bStyleTabValid = TRUE;
+ if (SwNumRule* pRule = ReadNumSecLevel( nToken ))
+ {
+ GetAttrSet().Put( SwNumRuleItem( pRule->GetName() ));
+
+ if( SFX_ITEM_SET != GetAttrSet().GetItemState( FN_PARAM_NUM_LEVEL, FALSE ))
+ GetAttrSet().Put( SfxUInt16Item( FN_PARAM_NUM_LEVEL, 0 ));
+ }
+ }
+ break;
+
case RTF_PNSECLVL:
if( bNewNumList )
SkipGroup();
@@ -634,18 +1141,10 @@ void SwRTFParser::NextToken( int nToken )
break;
case RTF_PAGE:
- {
- const SwCntntNode* pCNd;
- const SwAttrSet* pSet;
- if( pPam->GetPoint()->nContent.GetIndex() ||
- ( 0 != ( pCNd = pPam->GetCntntNode()) &&
- 0 != ( pSet = pCNd->GetpSwAttrSet()) &&
- ( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE ) ||
- SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, FALSE ))))
- InsertPara();
- CheckInsNewTblLine();
- pDoc->Insert( *pPam, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE ) );
- }
+ if (lcl_UsedPara(*pPam))
+ InsertPara();
+ CheckInsNewTblLine();
+ pDoc->Insert(*pPam, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE));
break;
case RTF_SECT:
@@ -982,29 +1481,6 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
// dann setze ueber diesen Bereich die Attrbiute
SetSwgValues( rSet.GetAttrSet() );
-
-#if 0
-///!!!!!!!!!!!!!!!!!!!!!
- if( !rSet.GetAttrSet().GetParent() )
- {
- const SfxItemPool& rPool = pDoc->GetAttrPool();
- SfxItemSet &rAttrSet = rSet.GetAttrSet();
- SfxItemIter aIter( rAttrSet );
- USHORT nWhich = aIter.GetCurItem()->Which();
- while( TRUE )
- {
- if( SFX_WHICH_MAX < nWhich ||
- rPool.GetDefaultItem( nWhich ) == *aIter.GetCurItem() )
- rAttrSet.ClearItem( nWhich ); // loeschen
-
- if( aIter.IsAtEnd() )
- break;
- nWhich = aIter.NextItem()->Which();
- }
- }
- if( rSet.GetAttrSet().Count() )
-#endif
-
pDoc->Insert( aPam, rSet.GetAttrSet(), SETATTR_DONTCHGNUMRULE );
}
@@ -1050,48 +1526,112 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
}
}
+DocPageInformation::DocPageInformation()
+ : mnPaperw(12240), mnPaperh(15840), mnMargl(1800), mnMargr(1800),
+ mnMargt(1440), mnMargb(1440), mnGutter(0), mnPgnStart(1), mbFacingp(false),
+ mbLandscape(false), mbRTLdoc(false)
+{
+}
-// lese alle Dokument-Controls ein
-void SwRTFParser::ReadDocControls( int nToken )
+SectPageInformation::SectPageInformation(const DocPageInformation &rDoc)
+ :
+ mpTitlePageHdFt(0), mpPageHdFt(0),
+ mnPgwsxn(rDoc.mnPaperw), mnPghsxn(rDoc.mnPaperh),
+ mnMarglsxn(rDoc.mnMargl), mnMargrsxn(rDoc.mnMargr),
+ mnMargtsxn(rDoc.mnMargt), mnMargbsxn(rDoc.mnMargb),
+ mnGutterxsn(rDoc.mnGutter), mnHeadery(720), mnFootery(720), mnPgnStarts(1),
+ mnCols(1), mnColsx(720), mnStextflow(rDoc.mbRTLdoc ? 3 : 0), mnBkc(2),
+ mbLndscpsxn(rDoc.mbLandscape), mbTitlepg(false), mbFacpgsxn(rDoc.mbFacingp),
+ mbRTLsection(rDoc.mbRTLdoc), mbPgnrestart(false)
{
- int bWeiter = TRUE;
+};
+
+SectPageInformation::SectPageInformation(const SectPageInformation &rSect)
+ : maColumns(rSect.maColumns), maNumType(rSect.maNumType),
+ mpTitlePageHdFt(rSect.mpTitlePageHdFt), mpPageHdFt(rSect.mpPageHdFt),
+ mnPgwsxn(rSect.mnPgwsxn), mnPghsxn(rSect.mnPghsxn),
+ mnMarglsxn(rSect.mnMarglsxn), mnMargrsxn(rSect.mnMargrsxn),
+ mnMargtsxn(rSect.mnMargtsxn), mnMargbsxn(rSect.mnMargbsxn),
+ mnGutterxsn(rSect.mnGutterxsn), mnHeadery(rSect.mnHeadery),
+ mnFootery(rSect.mnFootery), mnPgnStarts(rSect.mnPgnStarts),
+ mnCols(rSect.mnCols), mnColsx(rSect.mnColsx),
+ mnStextflow(rSect.mnStextflow), mnBkc(rSect.mnBkc),
+ mbLndscpsxn(rSect.mbLndscpsxn), mbTitlepg(rSect.mbTitlepg),
+ mbFacpgsxn(rSect.mbFacpgsxn), mbRTLsection(rSect.mbRTLsection),
+ mbPgnrestart(rSect.mbPgnrestart)
+{
+};
- SwFmtFrmSize aFrmSize(ATT_FIX_SIZE, 12240, 15840 );
- SvxULSpaceItem aUL;
- SvxLRSpaceItem aLR;
- SwFtnInfo aFtnInfo;
- SwEndNoteInfo aEndInfo;
- UseOnPage eUseOn;
- USHORT nPgStart = USHRT_MAX;
+rtfSection::rtfSection(const SwPosition &rPos,
+ const SectPageInformation &rPageInfo)
+ : maStart(rPos.nNode), maPageInfo(rPageInfo), mpSection(0), mpTitlePage(0),
+ mpPage(0)
+{
+}
- SvxFrameDirectionItem aFrmDir;
- if( bFirstDocControl )
- {
- // RTF-Defaults setzen
- SwFmtFrmSize aFrmSize(ATT_FIX_SIZE, 12240, 15840 );
+void rtfSections::push_back(const rtfSection &rSect)
+{
+ if (!maSegments.empty() && (maSegments.back().maStart == rSect.maStart))
+ maSegments.pop_back();
+ maSegments.push_back(rSect);
+}
- aUL.SetUpper( 1440 ); aUL.SetLower( 1440 );
- aLR.SetRight( 1800 ); aLR.SetLeft( 1800 );
- eUseOn = UseOnPage(PD_ALL | PD_HEADERSHARE | PD_FOOTERSHARE);
- aFtnInfo.ePos = FTNPOS_CHAPTER; aFtnInfo.eNum = FTNNUM_DOC;
- bFirstDocControl = FALSE;
+// lese alle Dokument-Controls ein
+void SwRTFParser::SetPageInformationAsDefault(const DocPageInformation &rInfo)
+{
+ maSegments.push_back(rtfSection(*pPam->GetPoint(),
+ SectPageInformation(rInfo)));
- aFrmDir.SetValue(FRMDIR_HORI_LEFT_TOP);
- }
- else
+ if (!bSwPageDesc && IsNewDoc())
{
- const SwPageDesc& rStdPgDsc = pDoc->GetPageDesc( 0 );
- aFrmSize = rStdPgDsc.GetMaster().GetFrmSize();
- aUL = rStdPgDsc.GetMaster().GetULSpace();
- aLR = rStdPgDsc.GetMaster().GetLRSpace();
+ SwFmtFrmSize aFrmSize(ATT_FIX_SIZE, rInfo.mnPaperw, rInfo.mnPaperh);
- eUseOn = rStdPgDsc.ReadUseOn();
+ SvxLRSpaceItem aLR(rInfo.mnMargl, rInfo.mnMargr);
+ SvxULSpaceItem aUL(rInfo.mnMargt, rInfo.mnMargb);
+
+ UseOnPage eUseOn;
+ if (rInfo.mbFacingp)
+ eUseOn = UseOnPage(PD_MIRROR | PD_HEADERSHARE | PD_FOOTERSHARE);
+ else
+ eUseOn = UseOnPage(PD_ALL | PD_HEADERSHARE | PD_FOOTERSHARE);
- aEndInfo = pDoc->GetEndNoteInfo();
- aFtnInfo = pDoc->GetFtnInfo();
+ USHORT nPgStart(rInfo.mnPgnStart);
- aFrmDir = rStdPgDsc.GetMaster().GetFrmDir();
+ SvxFrameDirectionItem aFrmDir(rInfo.mbRTLdoc ?
+ FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP);
+
+ // direkt an der Standartseite drehen
+ SwPageDesc& rPg = pDoc->_GetPageDesc( 0 );
+ rPg.WriteUseOn( eUseOn );
+
+ if (rInfo.mbLandscape)
+ rPg.SetLandscape(true);
+
+ SwFrmFmt &rFmt1 = rPg.GetMaster(), &rFmt2 = rPg.GetLeft();
+
+ rFmt1.SetAttr( aFrmSize ); rFmt2.SetAttr( aFrmSize );
+ rFmt1.SetAttr( aLR ); rFmt2.SetAttr( aLR );
+ rFmt1.SetAttr( aUL ); rFmt2.SetAttr( aUL );
+ rFmt1.SetAttr( aFrmDir ); rFmt2.SetAttr( aFrmDir );
+
+ // StartNummer der Seiten setzen
+ if (nPgStart != 1)
+ {
+ SwFmtPageDesc aPgDsc( &rPg );
+ aPgDsc.SetNumOffset( nPgStart );
+ pDoc->Insert( *pPam, aPgDsc );
+ }
}
+}
+
+// lese alle Dokument-Controls ein
+void SwRTFParser::ReadDocControls( int nToken )
+{
+ int bWeiter = true;
+
+ SwFtnInfo aFtnInfo;
+ SwEndNoteInfo aEndInfo;
+ bool bSetHyph = false;
BOOL bEndInfoChgd = FALSE, bFtnInfoChgd = FALSE;
@@ -1099,46 +1639,45 @@ void SwRTFParser::ReadDocControls( int nToken )
USHORT nValue = USHORT( nTokenValue );
switch( nToken )
{
-/* case '}': --nOpenBrakets; nToken = RTF_DOCFMT; break;
- case '{': ++nOpenBrakets; nToken = RTF_DOCFMT; break;
- case RTF_IGNOREFLAG: nToken = RTF_DOCFMT; break;
-*/
-
case RTF_RTLDOC:
- aFrmDir.SetValue(FRMDIR_HORI_RIGHT_TOP);
+ maPageDefaults.mbRTLdoc = true;
break;
case RTF_LTRDOC:
- aFrmDir.SetValue(FRMDIR_HORI_LEFT_TOP);
+ maPageDefaults.mbRTLdoc = false;
+ break;
+ case RTF_LANDSCAPE:
+ maPageDefaults.mbLandscape = true;
break;
case RTF_PAPERW:
if( 0 < nTokenValue )
- aFrmSize.SetWidth( nTokenValue );
+ maPageDefaults.mnPaperw = nTokenValue;
break;
case RTF_PAPERH:
if( 0 < nTokenValue )
- aFrmSize.SetHeight( nTokenValue );
+ maPageDefaults.mnPaperh = nTokenValue;
break;
case RTF_MARGL:
if( 0 <= nTokenValue )
- aLR.SetLeft( nValue );
+ maPageDefaults.mnMargl = nTokenValue;
break;
case RTF_MARGR:
if( 0 <= nTokenValue )
- aLR.SetRight( nValue );
+ maPageDefaults.mnMargr = nTokenValue;
break;
case RTF_MARGT:
if( 0 <= nTokenValue )
- aUL.SetUpper( nValue );
+ maPageDefaults.mnMargt = nTokenValue;
break;
case RTF_MARGB:
if( 0 <= nTokenValue )
- aUL.SetLower( nValue );
+ maPageDefaults.mnMargb = nTokenValue;
+ break;
+ case RTF_FACINGP:
+ maPageDefaults.mbFacingp = true;
+ break;
+ case RTF_PGNSTART:
+ maPageDefaults.mnPgnStart = nTokenValue;
break;
-
- case RTF_FACINGP: eUseOn = UseOnPage(PD_MIRROR | PD_HEADERSHARE | PD_FOOTERSHARE);
- break;
- case RTF_PGNSTART: nPgStart = nValue; break;
-
case RTF_ENDDOC:
case RTF_ENDNOTES:
aFtnInfo.ePos = FTNPOS_CHAPTER; bFtnInfoChgd = TRUE;
@@ -1196,16 +1735,30 @@ void SwRTFParser::ReadDocControls( int nToken )
case RTF_AFTNNAR:
aEndInfo.aFmt.SetNumberingType(SVX_NUM_ARABIC); bEndInfoChgd = TRUE; break;
case RTF_AFTNNALC:
- aEndInfo.aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER_N); bEndInfoChgd = TRUE; break;
+ aEndInfo.aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER_N);
+ bEndInfoChgd = TRUE;
+ break;
case RTF_AFTNNAUC:
- aEndInfo.aFmt.SetNumberingType(SVX_NUM_CHARS_UPPER_LETTER_N); bEndInfoChgd = TRUE; break;
+ aEndInfo.aFmt.SetNumberingType(SVX_NUM_CHARS_UPPER_LETTER_N);
+ bEndInfoChgd = TRUE;
+ break;
case RTF_AFTNNRLC:
- aEndInfo.aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER); bEndInfoChgd = TRUE; break;
+ aEndInfo.aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
+ bEndInfoChgd = TRUE;
+ break;
case RTF_AFTNNRUC:
- aEndInfo.aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER); bEndInfoChgd = TRUE; break;
+ aEndInfo.aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER);
+ bEndInfoChgd = TRUE;
+ break;
case RTF_AFTNNCHI:
- aEndInfo.aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); bEndInfoChgd = TRUE; break;
-
+ aEndInfo.aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ bEndInfoChgd = TRUE;
+ break;
+ case RTF_HYPHAUTO:
+ if (nTokenValue)
+ bSetHyph = true;
+ //FOO//
+ break;
case '{':
{
short nSkip = 0;
@@ -1240,7 +1793,7 @@ void SwRTFParser::ReadDocControls( int nToken )
nToken = GetNextToken();
} while( bWeiter && IsParserWorking() );
- if( IsNewDoc() )
+ if (IsNewDoc())
{
if( bEndInfoChgd )
pDoc->SetEndNoteInfo( aEndInfo );
@@ -1248,45 +1801,32 @@ void SwRTFParser::ReadDocControls( int nToken )
pDoc->SetFtnInfo( aFtnInfo );
}
- if( !bSwPageDesc )
+ if (!bSwPageDesc)
{
- if( IsNewDoc() )
+ SetPageInformationAsDefault(maPageDefaults);
+
+ MakeStyleTab();
+
+ SwTxtFmtColl* pColl = aTxtCollTbl.Get(0);
+ if (!pColl)
{
- // direkt an der Standartseite drehen
- SwPageDesc& rPg = pDoc->_GetPageDesc( 0 );
- rPg.WriteUseOn( eUseOn );
- SwFrmFmt &rFmt1 = rPg.GetMaster(), &rFmt2 = rPg.GetLeft();
+ pColl = pDoc->GetTxtCollFromPoolSimple(RES_POOLCOLL_STANDARD,
+ FALSE );
+ }
- rFmt1.SetAttr( aFrmSize ); rFmt2.SetAttr( aFrmSize );
- rFmt1.SetAttr( aLR ); rFmt2.SetAttr( aLR );
- rFmt1.SetAttr( aUL ); rFmt2.SetAttr( aUL );
- rFmt1.SetAttr( aFrmDir ); rFmt2.SetAttr( aFrmDir );
+ ASSERT(pColl, "impossible to have no standard style");
- // StartNummer der Seiten setzen
- if( USHRT_MAX != nPgStart )
+ if (pColl)
+ {
+ if (
+ IsNewDoc() && bSetHyph &&
+ SFX_ITEM_SET != pColl->GetItemState(RES_PARATR_HYPHENZONE,
+ false)
+ )
{
- SwFmtPageDesc* pCurPgDsc = GetCurrentPageDesc(pPam);
- if(pCurPgDsc)
- {
- pCurPgDsc->SetNumOffset( nPgStart );
- }
- else
- {
- SwFmtPageDesc aPgDsc( &rPg );
- aPgDsc.SetNumOffset( nPgStart );
- pDoc->Insert( *pPam, aPgDsc );
- }
+ pColl->SetAttr(SvxHyphenZoneItem(true));
}
- }
- MakeStyleTab();
- // das default-Style schon gleich am ersten Node setzen
-// if( IsNewDoc() )
- {
- SwTxtFmtColl* pColl = aTxtCollTbl.Get( 0 );
- if( !pColl )
- pColl = pDoc->GetTxtCollFromPoolSimple( RES_POOLCOLL_STANDARD,
- FALSE );
pDoc->SetTxtFmtColl( *pPam, pColl );
}
}
@@ -1450,892 +1990,301 @@ SwFmtPageDesc* SwRTFParser::GetCurrentPageDesc(SwPaM *pPam)
return aFmtPageDsc;
}
-// lese alle Section-Controls ein
-void SwRTFParser::ReadSectControls( int nToken )
+void SwRTFParser::DoHairyWriterPageDesc(int nToken)
{
int bWeiter = TRUE;
-
- // werden die eigenen PageDesc - Informationen gelesen, dann alles
- // ueberlesen
- // Wird in ein bestehendes Doc eingelesen oder wurden eigene PageDesc
- // gelesen, dann sind nur die Bereiche von interresse
- BOOL bInsPageDesc = IsNewDoc() && !bSwPageDesc;
-
- if( bInPgDscTbl )
- {
- do {
- if( '{' == nToken )
+ do {
+ if( '{' == nToken )
+ {
+ switch( nToken = GetNextToken() )
{
- switch( nToken = GetNextToken() )
+ case RTF_IGNOREFLAG:
+ if( RTF_SECTFMT != (( nToken = GetNextToken() )
+ & ~(0xff | RTF_SWGDEFS)) )
{
- case RTF_IGNOREFLAG:
- if( RTF_SECTFMT != (( nToken = GetNextToken() )
- & ~(0xff | RTF_SWGDEFS)) )
- {
- SkipToken( -2 ); // Ignore und Token wieder zurueck
- bWeiter = FALSE;
- break;
- }
- // kein break, Gruppe ueberspringen
-
- case RTF_FOOTER:
- case RTF_HEADER:
- case RTF_FOOTERR:
- case RTF_HEADERR:
- case RTF_FOOTERL:
- case RTF_HEADERL:
- case RTF_FOOTERF:
- case RTF_HEADERF:
- SkipGroup(); // erstmal komplett ueberlesen
- // ueberlese noch die schliessende Klammer
- GetNextToken();
- break;
-
- default:
- SkipToken( -1 ); // Ignore wieder zurueck
+ SkipToken( -2 ); // Ignore und Token wieder zurueck
bWeiter = FALSE;
break;
}
- }
- else if( RTF_SECTFMT == (nToken & ~(0xff | RTF_SWGDEFS)) ||
- RTF_UNKNOWNCONTROL == nToken )
- SvxRTFParser::NextToken( nToken );
- else
- bWeiter = FALSE;
- if( bWeiter )
- nToken = GetNextToken();
- } while( bWeiter && IsParserWorking() );
- SkipToken( -1 ); // letztes Token wieder zurueck
- return;
- }
-
- // RTF-Defaults setzen
- BOOL bFirstCall = 1 == pDoc->GetPageDescCnt();
- BOOL bHeaderUL = FALSE, bHeaderLR = FALSE,
- bFooterUL = FALSE, bFooterLR = FALSE;
- bool bIsRTL=false;
-
- USHORT nLastPageDesc = nAktPageDesc,
- nLastFirstPageDesc = nAktFirstPageDesc;
+ // kein break, Gruppe ueberspringen
+
+ case RTF_FOOTER:
+ case RTF_HEADER:
+ case RTF_FOOTERR:
+ case RTF_HEADERR:
+ case RTF_FOOTERL:
+ case RTF_HEADERL:
+ case RTF_FOOTERF:
+ case RTF_HEADERF:
+ SkipGroup(); // erstmal komplett ueberlesen
+ // ueberlese noch die schliessende Klammer
+ GetNextToken();
+ break;
- BOOL bMakeNewPageDesc = RTF_SECT == nToken;
- BOOL bInsNewPageDesc = bMakeNewPageDesc || bFirstCall || bSwPageDesc;
- SwPageDesc* pAkt, *pFirst = 0;
- if( bInsNewPageDesc )
- {
- pAkt = _MakeNewPageDesc( FALSE );
- if( bMakeNewPageDesc )
- {
- nToken = GetNextToken();
- // some export filter write the RTF_SECT in brakets -> skip over
- while( '}' == nToken )
- {
- NextToken( nToken );
- nToken = GetNextToken();
+ default:
+ SkipToken( -1 ); // Ignore wieder zurueck
+ bWeiter = FALSE;
+ break;
}
}
- }
- else
- {
- pAkt = &pDoc->_GetPageDesc( nAktPageDesc );
- if( nAktFirstPageDesc )
- pFirst = &pDoc->_GetPageDesc( nAktFirstPageDesc );
- }
-
- SwFmtFrmSize aSz( pAkt->GetMaster().GetFrmSize() ), aHSz( ATT_MIN_SIZE );
- SvxULSpaceItem aUL( pAkt->GetMaster().GetULSpace() ), aHUL, aFUL;
- SvxLRSpaceItem aLR( pAkt->GetMaster().GetLRSpace() ), aHLR, aFLR;
- BOOL bPgWiChgd = FALSE, bPgHeChgd = FALSE,
- bPgUpChgd = FALSE, bPgLoChgd = FALSE,
- bPgLeChgd = FALSE, bPgRiChgd = FALSE,
- bPgFcChgd = FALSE,
- bNoBalancedCols = FALSE;
+ else if( RTF_SECTFMT == (nToken & ~(0xff | RTF_SWGDEFS)) ||
+ RTF_UNKNOWNCONTROL == nToken )
+ SvxRTFParser::NextToken( nToken );
+ else
+ bWeiter = FALSE;
+ if( bWeiter )
+ nToken = GetNextToken();
+ } while( bWeiter && IsParserWorking() );
+ SkipToken( -1 ); // letztes Token wieder zurueck
+ return;
+}
+void SwRTFParser::ReadSectControls( int nToken )
+{
+ AttrGroupEnd(); //#106493#
- USHORT nRestoreUpper = USHRT_MAX, nRestoreLower = USHRT_MAX;
- SwFrmFmt* pFmt = (SwFrmFmt*)pAkt->GetMaster().GetHeader().GetHeaderFmt();
- if( pFmt )
+ //this is some hairy stuff to try and retain writer style page descriptors
+ //in rtf, almost certainy a bad idea, but we've inherited it, so here it
+ //stays
+ if (bInPgDscTbl)
{
- aHUL = pFmt->GetULSpace();
- aHLR = pFmt->GetLRSpace();
- aHSz = pFmt->GetFrmSize();
- if( aHSz.GetHeight() )
- {
- nRestoreUpper = (USHORT)aHSz.GetHeight();
- aUL.SetUpper( aUL.GetUpper() + nRestoreUpper );
- aHSz.SetHeight( 0 );
- }
+ DoHairyWriterPageDesc(nToken);
+ return;
}
- if( 0 != (pFmt = (SwFrmFmt*)pAkt->GetMaster().GetFooter().GetFooterFmt()) )
+ ASSERT(!maSegments.empty(), "suspicious to have a section with no "
+ "page info, though probably legal");
+ if (maSegments.empty())
{
- aFUL = pFmt->GetULSpace();
- aFLR = pFmt->GetLRSpace();
- if( aFUL.GetUpper() )
- {
- nRestoreLower = aFUL.GetUpper();
- aUL.SetLower( aUL.GetLower() + nRestoreLower );
- aFUL.SetUpper( 0 );
- }
+ maSegments.push_back(rtfSection(*pPam->GetPoint(),
+ SectPageInformation(maPageDefaults)));
}
- BOOL bCheckEqualPgDesc = TRUE, bPgDescChgd = FALSE;
- SvxBreak eBreak = SVX_BREAK_PAGE_BEFORE;
-
- USHORT nCols = USHRT_MAX, nColSpace = USHRT_MAX, nAktCol = 0;
- SvUShorts aColumns;
-
- USHORT nPgStart = USHRT_MAX;
- SvxNumberType aNumType;
-
- SvxFrameDirectionItem aFrmDir(FRMDIR_HORI_LEFT_TOP);
+ SectPageInformation aNewSection(maSegments.back().maPageInfo);
+ int bWeiter = true;
do {
- BOOL bIsSectToken = FALSE;
+ bool bIsSectToken = false;
USHORT nValue = USHORT( nTokenValue );
switch( nToken )
{
- case RTF_SECT:
- bWeiter = FALSE;
- break;
-
- case RTF_SECTD:
- {
- // Wert von der StandardPage holen !
- const SwFrmFmt& rFmt = pDoc->GetPageDesc(0).GetMaster();
- aSz = rFmt.GetFrmSize();
- aUL = rFmt.GetULSpace();
- aLR = rFmt.GetLRSpace();
-
- nRestoreUpper = USHRT_MAX, nRestoreLower = USHRT_MAX;
- aHUL.SetUpper( 720 ); aHUL.SetLower( 0 );
- aFUL.SetUpper( 0 ); aFUL.SetLower( 720 );
- aHLR.SetLeft( 0 ); aHLR.SetRight( 0 );
- aFLR.SetLeft( 0 ); aFLR.SetRight( 0 );
- pAkt->WriteUseOn( UseOnPage(PD_ALL | PD_HEADERSHARE | PD_FOOTERSHARE) );
- pAkt->SetLandscape( FALSE );
- aFrmDir.SetValue( FRMDIR_HORI_LEFT_TOP );
-
- // remove Columns/Header/Footer
- pAkt->GetMaster().ResetAttr( RES_COL );
- if( pFirst )
- pFirst->GetMaster().ResetAttr( RES_COL );
-
- nPgStart = USHRT_MAX;
-
- SwFmtPageDesc* pCurPgDsc = GetCurrentPageDesc(pPam);
- if(pCurPgDsc)
+ case RTF_SECT:
+// bWeiter = false;
+ break;
+ case RTF_SECTD:
+ //Reset to page defaults
+ aNewSection = SectPageInformation(maPageDefaults);
+ break;
+ case RTF_PGWSXN:
+ if (0 < nTokenValue)
+ aNewSection.mnPgwsxn = nTokenValue;
+ break;
+ case RTF_PGHSXN:
+ if (0 < nTokenValue)
+ aNewSection.mnPghsxn = nTokenValue;
+ break;
+ case RTF_MARGLSXN:
+ if (0 <= nTokenValue)
+ aNewSection.mnMarglsxn = nTokenValue;
+ break;
+ case RTF_MARGRSXN:
+ if (0 <= nTokenValue)
+ aNewSection.mnMargrsxn = nTokenValue;
+ break;
+ case RTF_MARGTSXN:
+ if (0 <= nTokenValue)
+ aNewSection.mnMargtsxn = nTokenValue;
+ break;
+ case RTF_MARGBSXN:
+ if (0 <= nTokenValue)
+ aNewSection.mnMargbsxn = nTokenValue;
+ break;
+ case RTF_FACPGSXN:
+ aNewSection.mbFacpgsxn = true;
+ break;
+ case RTF_HEADERY:
+ aNewSection.mnHeadery = nTokenValue;
+ break;
+ case RTF_FOOTERY:
+ aNewSection.mnFootery = nTokenValue;
+ break;
+ case RTF_LNDSCPSXN:
+ aNewSection.mbLndscpsxn = true;
+ break;
+ case RTF_PGNSTARTS:
+ aNewSection.mnPgnStarts = nTokenValue;
+ break;
+ case RTF_PGNDEC:
+ aNewSection.maNumType.SetNumberingType(SVX_NUM_ARABIC);
+ break;
+ case RTF_PGNUCRM:
+ aNewSection.maNumType.SetNumberingType(SVX_NUM_ROMAN_UPPER);
+ break;
+ case RTF_PGNLCRM:
+ aNewSection.maNumType.SetNumberingType(SVX_NUM_ROMAN_LOWER);
+ break;
+ case RTF_PGNUCLTR:
+ aNewSection.maNumType.SetNumberingType(
+ SVX_NUM_CHARS_UPPER_LETTER_N);
+ break;
+ case RTF_PGNLCLTR:
+ aNewSection.maNumType.SetNumberingType(
+ SVX_NUM_CHARS_LOWER_LETTER_N);
+ break;
+ case RTF_SBKNONE:
+ aNewSection.mnBkc = 0;
+ break;
+ case RTF_SBKCOL:
+ aNewSection.mnBkc = 1;
+ break;
+ case RTF_ENDNHERE:
+ case RTF_BINFSXN:
+ case RTF_BINSXN:
+ case RTF_SBKPAGE:
+ case RTF_SBKEVEN:
+ case RTF_SBKODD:
+ case RTF_LINEBETCOL:
+ case RTF_LINEMOD:
+ case RTF_LINEX:
+ case RTF_LINESTARTS:
+ case RTF_LINERESTART:
+ case RTF_LINEPAGE:
+ case RTF_LINECONT:
+ case RTF_GUTTERSXN:
+ case RTF_PGNCONT:
+ case RTF_PGNRESTART:
+ case RTF_PGNX:
+ case RTF_PGNY:
+ case RTF_VERTALT:
+ case RTF_VERTALB:
+ case RTF_VERTALC:
+ case RTF_VERTALJ:
+ break;
+ case RTF_TITLEPG:
+ aNewSection.mbTitlepg = true;
+ break;
+ case RTF_HEADER:
+ case RTF_HEADERL:
+ case RTF_HEADERR:
+ case RTF_FOOTER:
+ case RTF_FOOTERL:
+ case RTF_FOOTERR:
+ if (!aNewSection.mpPageHdFt)
{
- nPgStart = pCurPgDsc->GetNumOffset();
+ String aName(RTL_CONSTASCII_STRINGPARAM("rtfHdFt"));
+ aName += String::CreateFromInt32(maSegments.size());
+ sal_uInt16 nPageNo = pDoc->MakePageDesc(aName);
+ aNewSection.mpPageHdFt = &pDoc->_GetPageDesc(nPageNo);
+ maSegments.maDummyPageNos.push_back(nPageNo);
}
-
- nCols = USHRT_MAX;
- nColSpace = USHRT_MAX;
- aNumType.SetNumberingType(SVX_NUM_ARABIC);
- bHeaderUL = bHeaderLR = bFooterUL = bFooterLR = TRUE;
- eBreak = SVX_BREAK_PAGE_BEFORE;
- nNewNumSectDef = USHRT_MAX;
-
- bPgWiChgd = bPgHeChgd = bPgUpChgd = bPgLoChgd = bPgLeChgd =
- bPgRiChgd = bPgFcChgd = TRUE;
- bPgDescChgd = TRUE;
- }
- break;
-
- case RTF_PGWSXN:
- if( 0 < nTokenValue )
- {
- aSz.SetWidth( nTokenValue );
- bPgWiChgd = TRUE;
- bPgDescChgd = TRUE;
- }
- break;
-
- case RTF_PGHSXN:
- if( 0 < nTokenValue )
- {
- aSz.SetHeight( nTokenValue );
- bPgHeChgd = TRUE;
- bPgDescChgd = TRUE;
- }
- break;
- case RTF_MARGLSXN:
- if( 0 <= nTokenValue )
- {
- aLR.SetLeft( nValue );
- bPgLeChgd =TRUE;
- bPgDescChgd = TRUE;
- }
- break;
- case RTF_MARGRSXN:
- if( 0 <= nTokenValue )
- {
- aLR.SetRight( nValue );
- bPgRiChgd = TRUE;
- bPgDescChgd = TRUE;
- }
- break;
-
- case RTF_MARGTSXN:
- if( 0 <= nTokenValue )
- {
- nRestoreUpper = USHRT_MAX;
- aUL.SetUpper( nValue );
- bPgUpChgd = TRUE;
- bPgDescChgd = TRUE;
- }
- break;
-
- case RTF_MARGBSXN:
- if( 0 <= nTokenValue )
- {
- nRestoreLower = USHRT_MAX;
- aUL.SetLower( nValue );
- bPgLoChgd = TRUE;
- bPgDescChgd = TRUE;
- }
- break;
-
- case RTF_FACPGSXN:
- pAkt->SetUseOn( UseOnPage(PD_MIRROR | ( pAkt->GetUseOn() &
- ~(PD_HEADERSHARE | PD_FOOTERSHARE) )));
- bPgDescChgd = TRUE;
- break;
-
- case RTF_HEADERY:
- aHUL.SetUpper( nValue );
- bHeaderUL = TRUE;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_FOOTERY:
- aFUL.SetLower( nValue );
- bFooterUL = TRUE;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_LNDSCPSXN:
- pAkt->SetLandscape( TRUE );
- bPgFcChgd = TRUE;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_PGNSTARTS:
- nPgStart = nValue;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_PGNDEC:
- aNumType.SetNumberingType(SVX_NUM_ARABIC);
- bPgDescChgd = TRUE;
- break;
- case RTF_PGNUCRM:
- aNumType.SetNumberingType(SVX_NUM_ROMAN_UPPER);
- bPgDescChgd = TRUE;
- break;
- case RTF_PGNLCRM:
- aNumType.SetNumberingType(SVX_NUM_ROMAN_LOWER);
- bPgDescChgd = TRUE;
- break;
- case RTF_PGNUCLTR:
- aNumType.SetNumberingType(SVX_NUM_CHARS_UPPER_LETTER_N);
- bPgDescChgd = TRUE;
- break;
- case RTF_PGNLCLTR:
- aNumType.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER_N);
- bPgDescChgd = TRUE;
- break;
-
- case RTF_SBKNONE:
- bIsSectToken = TRUE;
- eBreak = SVX_BREAK_NONE;
- bPgDescChgd = !bFirstCall;
- break;
-
- case RTF_SBKCOL:
- eBreak = SVX_BREAK_COLUMN_BEFORE;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_ENDNHERE:
- case RTF_BINFSXN:
- case RTF_BINSXN:
- case RTF_SBKPAGE:
- case RTF_SBKEVEN:
- case RTF_SBKODD:
- case RTF_LINEBETCOL:
- case RTF_LINEMOD:
- case RTF_LINEX:
- case RTF_LINESTARTS:
- case RTF_LINERESTART:
- case RTF_LINEPAGE:
- case RTF_LINECONT:
- case RTF_GUTTERSXN:
- case RTF_PGNCONT:
- case RTF_PGNRESTART:
- case RTF_PGNX:
- case RTF_PGNY:
- case RTF_VERTALT:
- case RTF_VERTALB:
- case RTF_VERTALC:
- case RTF_VERTALJ:
- break;
-
- case RTF_TITLEPG:
- if( bInsPageDesc && !pFirst )
- pFirst = _MakeNewPageDesc( TRUE );
- bCheckEqualPgDesc = FALSE;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_HEADER:
- case RTF_HEADERL:
- case RTF_HEADERR:
- case RTF_FOOTER:
- case RTF_FOOTERL:
- case RTF_FOOTERR:
- if( bInsPageDesc )
- ReadHeaderFooter( nToken, pAkt );
- else
- SkipGroup(), GetNextToken(); //Gruppe mit schl. Klammer lesen
- bCheckEqualPgDesc = FALSE;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_FOOTERF:
- case RTF_HEADERF:
- if( bInsPageDesc )
- {
- if( !pFirst )
- pFirst = _MakeNewPageDesc( TRUE );
- ReadHeaderFooter( nToken, pFirst );
- }
- else
- SkipGroup(), GetNextToken(); //Gruppe mit schl. Klammer lesen
- bCheckEqualPgDesc = FALSE;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_COLS:
- bIsSectToken = TRUE;
- nCols = nValue;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_COLSX:
- bIsSectToken = TRUE;
- nColSpace = nValue;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_COLNO:
- bIsSectToken = TRUE;
- nAktCol = nValue;
- if( RTF_COLW == GetNextToken() )
- {
- USHORT nWidth = USHORT( nTokenValue ), nSpace = 0;
- if( RTF_COLSR == GetNextToken() )
- nSpace = USHORT( nTokenValue );
- else
- SkipToken( -1 ); // wieder zurueck
-
- if( --nAktCol == ( aColumns.Count() / 2 ) )
+ ReadHeaderFooter(nToken, aNewSection.mpPageHdFt);
+ break;
+ case RTF_FOOTERF:
+ case RTF_HEADERF:
+ if (!aNewSection.mpTitlePageHdFt)
{
- aColumns.Insert( nWidth, aColumns.Count() );
- aColumns.Insert( nSpace, aColumns.Count() );
+ String aTitle(RTL_CONSTASCII_STRINGPARAM("rtfTitleHdFt"));
+ aTitle += String::CreateFromInt32(maSegments.size());
+ sal_uInt16 nPageNo = pDoc->MakePageDesc(aTitle);
+ aNewSection.mpTitlePageHdFt = &pDoc->_GetPageDesc(nPageNo);
+ maSegments.maDummyPageNos.push_back(nPageNo);
}
- }
- bPgDescChgd = TRUE;
- break;
-
- case RTF_STEXTFLOW:
- switch( nValue )
- {
- case 0: // Text flows left to right and top to bottom
- aFrmDir.SetValue( FRMDIR_HORI_LEFT_TOP );
- bPgDescChgd = TRUE;
+ ReadHeaderFooter(nToken, aNewSection.mpTitlePageHdFt);
break;
- case 1: // Text flows top to bottom and right to left, vertical
- case 5: // Text flows vertically, non-vertical font
- aFrmDir.SetValue( FRMDIR_VERT_TOP_RIGHT );
- bPgDescChgd = TRUE;
+ case RTF_COLS:
+ aNewSection.mnCols = nTokenValue;
break;
-// case 2: // Text flows left to right and bottom to top
-// aFrmDir.SetValue( ?? ); break;
- case 3: // Text flows right to left and top to bottom
- aFrmDir.SetValue( FRMDIR_HORI_RIGHT_TOP );
- bPgDescChgd = TRUE;
+ case RTF_COLSX:
+ aNewSection.mnColsx = nTokenValue;
break;
- case 4: // Text flows left to right and top to bottom, vertical
- aFrmDir.SetValue( FRMDIR_VERT_TOP_LEFT );
- bPgDescChgd = TRUE;
- break;
- }
- break;
-
- case RTF_RTLSECT:
- bIsRTL=true;
- bPgDescChgd = TRUE;
- break;
-
- case RTF_LTRSECT:
- bIsRTL=false;
- bPgDescChgd = TRUE;
- break;
-
- case '{':
- {
- short nSkip = 0;
- if( RTF_IGNOREFLAG != ( nToken = GetNextToken() ))
- nSkip = -1;
- else if( RTF_SECTFMT != (( nToken = GetNextToken() )
- & ~(0xff | RTF_SWGDEFS)) &&
- ( RTF_DOCFMT != ( nToken & ~(0xff | RTF_SWGDEFS))) )
- nSkip = -2;
- else
+ case RTF_COLNO:
{
- bPgDescChgd = TRUE;
- switch( nToken )
+ long nAktCol = nValue;
+ if (RTF_COLW == GetNextToken())
{
- case RTF_HEADER_YB:
- aHUL.SetLower( USHORT(nTokenValue) );
- bHeaderUL = TRUE;
- if( RTF_HEADER_XL == GetNextToken() &&
- RTF_HEADER_XR == GetNextToken() )
- {
- bHeaderLR = TRUE;
- aHLR.SetLeft( USHORT(GetStackPtr( -1 )->nTokenValue) );
- aHLR.SetRight( USHORT(nTokenValue));
- }
+ long nWidth = nTokenValue, nSpace = 0;
+ if( RTF_COLSR == GetNextToken() )
+ nSpace = nTokenValue;
else
- SkipGroup();
- break;
-
- case RTF_FOOTER_YT:
- aFUL.SetUpper( USHORT(nTokenValue));
- bFooterUL = TRUE;
- if( RTF_FOOTER_XL == GetNextToken() &&
- RTF_FOOTER_XR == GetNextToken() )
+ SkipToken( -1 ); // wieder zurueck
+
+ if (--nAktCol == (aNewSection.maColumns.size() / 2 ))
{
- bFooterLR = TRUE;
- aFLR.SetLeft( USHORT(GetStackPtr( -1 )->nTokenValue) );
- aFLR.SetRight( USHORT(nTokenValue));
+ aNewSection.maColumns.push_back(nWidth);
+ aNewSection.maColumns.push_back(nSpace);
}
- else
- SkipGroup();
- break;
-
- case RTF_BALANCED_COLUMN:
- bIsSectToken = TRUE;
- bPgDescChgd = TRUE;
- bNoBalancedCols = TRUE;
- break;
-
- default:
- SkipGroup(); // erstmal komplett ueberlesen
- break;
}
-
- // ueberlese noch die schliessende Klammer
- GetNextToken();
}
- if( nSkip )
+ break;
+ case RTF_STEXTFLOW:
+ aNewSection.mnStextflow = nTokenValue;
+ break;
+ case RTF_RTLSECT:
+ aNewSection.mbRTLsection = true;
+ break;
+ case RTF_LTRSECT:
+ aNewSection.mbRTLsection = false;
+ break;
+ case '{':
{
- bWeiter = -1 == nSkip && (
- RTF_FOOTER == nToken || RTF_HEADER == nToken ||
- RTF_FOOTERR == nToken || RTF_HEADERR == nToken ||
- RTF_FOOTERL == nToken || RTF_HEADERL == nToken ||
- RTF_FOOTERF == nToken || RTF_HEADERF == nToken );
- SkipToken( nSkip ); // Ignore wieder zurueck
+ short nSkip = 0;
+ if( RTF_IGNOREFLAG != ( nToken = GetNextToken() ))
+ nSkip = -1;
+ else if( RTF_SECTFMT != (( nToken = GetNextToken() )
+ & ~(0xff | RTF_SWGDEFS)) &&
+ ( RTF_DOCFMT != ( nToken & ~(0xff | RTF_SWGDEFS))) )
+ nSkip = -2;
+ else
+ {
+ // erstmal komplett ueberlesen
+ SkipGroup();
+ // ueberlese noch die schliessende Klammer
+ GetNextToken();
+ }
+ if (nSkip)
+ {
+ bWeiter = ((-1 == nSkip) &&
+ (
+ RTF_FOOTER == nToken || RTF_HEADER == nToken ||
+ RTF_FOOTERR == nToken || RTF_HEADERR == nToken ||
+ RTF_FOOTERL == nToken || RTF_HEADERL == nToken ||
+ RTF_FOOTERF == nToken || RTF_HEADERF == nToken
+ ));
+ SkipToken (nSkip); // Ignore wieder zurueck
+ }
}
- }
- break;
-
- case RTF_PAPERW:
- case RTF_PAPERH:
- case RTF_MARGL:
- case RTF_MARGR:
- case RTF_MARGT:
- case RTF_MARGB:
- case RTF_FACINGP:
- {
- ReadDocControls( nToken );
-
- // set the new Values
- const SwPageDesc& rStdPgDsc = pDoc->GetPageDesc( 0 );
- const SwFmtFrmSize& rSz = rStdPgDsc.GetMaster().GetFrmSize();
- const SvxULSpaceItem rUL = rStdPgDsc.GetMaster().GetULSpace();
- const SvxLRSpaceItem rLR = rStdPgDsc.GetMaster().GetLRSpace();
-
- if( !bPgWiChgd ) aSz.SetWidth( rSz.GetWidth() );
- if( !bPgHeChgd ) aSz.SetHeight( rSz.GetHeight() );
- if( !bPgUpChgd ) aUL.SetUpper( rUL.GetUpper() );
- if( !bPgLoChgd ) aUL.SetLower( rUL.GetLower() );
- if( !bPgLeChgd ) aLR.SetLeft( rLR.GetLeft() );
- if( !bPgRiChgd ) aLR.SetRight( rLR.GetRight() );
- if( !bPgFcChgd ) pAkt->SetLandscape( rStdPgDsc.GetLandscape() );
- }
- break;
- default:
- if( RTF_DOCFMT == (nToken & ~(0xff | RTF_SWGDEFS)) )
+ break;
+ case RTF_PAPERW:
+ case RTF_PAPERH:
+ case RTF_MARGL:
+ case RTF_MARGR:
+ case RTF_MARGT:
+ case RTF_MARGB:
+ case RTF_FACINGP:
+ ASSERT(!this, "why are these tokens found in this section?");
ReadDocControls( nToken );
- else if( RTF_SECTFMT == (nToken & ~(0xff | RTF_SWGDEFS)) ||
- RTF_UNKNOWNCONTROL == nToken )
- SvxRTFParser::NextToken( nToken );
- else
- bWeiter = FALSE;
- break;
- }
-
-
- if( bWeiter )
- {
- // kein eigener Bereich und kein Section Attribut?
- if( !bInsPageDesc && !bIsSectToken )
- bCheckEqualPgDesc = FALSE;
- nToken = GetNextToken();
- }
- } while( bWeiter && IsParserWorking() );
-
-
- if( !bPgDescChgd )
- {
- // der aktuelle muss wieder entnfernt werden
- if( bInsNewPageDesc )
- {
- pDoc->DelPageDesc( nAktPageDesc );
- if( pFirst )
- pDoc->DelPageDesc( nAktFirstPageDesc );
- nAktPageDesc = nLastPageDesc;
- nAktFirstPageDesc = nLastFirstPageDesc;
- }
- SkipToken( -1 );
- return ;
- }
-
-
- // den letzen Bereich wieder zumachen
- if( pRegionEndIdx )
- {
- DelLastNode();
- pPam->GetPoint()->nNode = *pRegionEndIdx;
- pPam->Move( fnMoveForward, fnGoNode );
- delete pRegionEndIdx, pRegionEndIdx = 0;
- }
-
-
- pFmt = &pAkt->GetMaster();
-
- if (bInsPageDesc)
- {
- if( bHeaderUL )
- {
- if( aUL.GetUpper() > aHUL.GetUpper() )
- {
- aHSz.SetHeight( aUL.GetUpper() - aHUL.GetUpper() );
- aHUL.SetUpper( 0 );
- aUL.SetUpper( USHORT(aUL.GetUpper() - aHSz.GetHeight()) );
-
- if( !pFmt->GetHeader().GetHeaderFmt() )
- pFmt->SetAttr( SwFmtHeader( (BOOL)TRUE ));
- if( pFirst && !pFirst->GetMaster().GetHeader().GetHeaderFmt() )
- pFirst->GetMaster().SetAttr( SwFmtHeader( (BOOL)TRUE ));
- }
- }
- else if( USHRT_MAX != nRestoreUpper )
- aUL.SetUpper( aUL.GetUpper() - nRestoreUpper );
-
- if( bFooterUL )
- {
- if( aUL.GetLower() > aFUL.GetLower() )
- {
- aFUL.SetUpper( aUL.GetLower() - aFUL.GetLower() );
- aUL.SetLower( aFUL.GetLower() );
- aFUL.SetLower( 0 );
- if( !pFmt->GetFooter().GetFooterFmt() )
- pFmt->SetAttr( SwFmtFooter( (BOOL)TRUE ));
- if( pFirst && !pFirst->GetMaster().GetFooter().GetFooterFmt() )
- pFirst->GetMaster().SetAttr( SwFmtFooter( (BOOL)TRUE ));
- }
- else
- {
- aUL.SetLower( aFUL.GetLower() );
- aFUL.SetLower( 0 );
- }
- }
- else if( USHRT_MAX != nRestoreLower )
- aUL.SetLower( aUL.GetLower() - nRestoreLower );
-
- pFmt->SetAttr( aSz );
- pFmt->SetAttr( aLR );
- pFmt->SetAttr( aUL );
-
- if (bIsRTL && aFrmDir.GetValue() == FRMDIR_HORI_LEFT_TOP)
- aFrmDir.SetValue(FRMDIR_HORI_RIGHT_TOP);
-
- pFmt->SetAttr( aFrmDir );
-
- pAkt->SetNumType( aNumType );
- if( pFirst )
- pFirst->SetNumType( aNumType );
-
- if( ( bHeaderUL || bHeaderLR ) &&
- 0 != (pFmt = (SwFrmFmt*)pAkt->GetMaster().GetHeader().GetHeaderFmt()) )
- {
- if( bHeaderUL && aHSz.GetHeight() ) pFmt->SetAttr( aHSz );
- if( bHeaderLR ) pFmt->SetAttr( aHLR );
- }
-
- if( ( bFooterUL || bFooterLR ) &&
- 0 != ( pFmt = (SwFrmFmt*)pAkt->GetMaster().GetFooter().GetFooterFmt()) )
- {
- if( bFooterUL ) pFmt->SetAttr( aFUL );
- if( bFooterLR ) pFmt->SetAttr( aFLR );
- }
- }
-
-
- if( nCols && USHRT_MAX != nCols )
- {
- if( ::lcl_SetFmtCol( pAkt->GetMaster(), nCols, nColSpace, aColumns )
- && pFirst )
- pFirst->GetMaster().SetAttr( pAkt->GetMaster().GetAttr( RES_COL ));
-
- //JP 19.03.99 - Spaltigkeit NIE an der Seite setzen - dieses
- // ist immer ein Kennzeichen fuer einen Bereich, weil
- // die Seitenspalten NIE vom Layout aufgebrochen werden.
- //JP 24.02.00 - but dont insert column section into a column page
- // Bug 73480
- if( bSwPageDesc )
- {
- const SwPageDesc& rOld = pDoc->GetPageDesc( nLastPageDesc );
- if( rOld.GetMaster().GetAttr( RES_COL ) !=
- pAkt->GetMaster().GetAttr( RES_COL ) )
- {
- bCheckEqualPgDesc = TRUE;
- bInsPageDesc = FALSE;
- eBreak = SVX_BREAK_NONE;
-
-// !! ???? muss das hier passieren ??
- // fuer den Absatz dahinter sorgen
- pDoc->AppendTxtNode(*pPam->GetPoint());
- pPam->Move( fnMoveBackward );
- pPam->SetMark();
- }
- }
- }
- else if( bInsNewPageDesc )
- {
- pAkt->GetMaster().ResetAttr( RES_COL );
- if( pFirst )
- pFirst->GetMaster().ResetAttr( RES_COL );
- }
-
- if( pFirst )
- {
- // setze am ersten den richtigen Follow
- pFirst->SetFollow( pAkt );
-
- // und setze noch die die Werte aus PageDesc:
- pFirst->SetLandscape( pAkt->GetLandscape() );
-
- pFmt = &pFirst->GetMaster();
-
- pFmt->SetAttr( aSz );
- pFmt->SetAttr( aLR );
- pFmt->SetAttr( aUL );
- if( !( aFrmDir == pFmt->GetAttr( RES_FRAMEDIR )) )
- pFmt->SetAttr( aFrmDir );
-
- if( ( bHeaderUL || bHeaderLR ) &&
- 0 != (pFmt = (SwFrmFmt*)pFirst->GetMaster().GetHeader().GetHeaderFmt()) )
- {
- if( bHeaderUL && aHSz.GetHeight() ) pFmt->SetAttr( aHSz );
- if( bHeaderLR ) pFmt->SetAttr( aHLR );
- }
-
- if( ( bFooterUL || bFooterLR ) &&
- 0 != ( pFmt = (SwFrmFmt*)pFirst->GetMaster().GetFooter().GetFooterFmt()) )
- {
- if( bFooterUL ) pFmt->SetAttr( aFUL );
- if( bFooterLR ) pFmt->SetAttr( aFLR );
- }
- }
-
- const SwPageDesc& rOld = pDoc->GetPageDesc( nLastPageDesc );
- if( bInsNewPageDesc && pFirst &&
- pDoc->GetPageDesc( nLastFirstPageDesc ).GetFollow() != &rOld )
- {
- bCheckEqualPgDesc = FALSE;
- }
-
- if( bInsPageDesc && ( !bCheckEqualPgDesc || !bInsNewPageDesc ||
- // dann pruefe ob die Attribute beider PageDesc gleich sind
- !::lcl_CompareRTFPageDesc(pDoc->GetPageDesc( nLastPageDesc ), *pAkt ))
- || ( bMakeNewPageDesc && SVX_BREAK_NONE != eBreak ) )
- {
- // Pagedescriptoren am Dokument updaten (nur so werden auch die
- // linken Seiten usw. eingestellt).
-
- // Spaltigkeit in den Set uebernehmen
- SfxItemSet* pSet = 0;
- const SfxPoolItem* pItem;
- SfxItemSet aSet( pDoc->GetAttrPool(), RES_COL, RES_FRAMEDIR );
- if( SFX_ITEM_SET == pAkt->GetMaster().GetItemState(
- RES_COL, FALSE, &pItem )
- && 1 < ((SwFmtCol*)pItem)->GetColumns().Count() )
- {
- aSet.Put( *pItem );
- pSet = &aSet;
- pAkt->GetMaster().ResetAttr( RES_COL );
- if( pFirst )
- pFirst->GetMaster().ResetAttr( RES_COL );
- }
-
- if (bIsRTL && aFrmDir.GetValue() == FRMDIR_HORI_LEFT_TOP)
- aFrmDir.SetValue(FRMDIR_HORI_RIGHT_TOP);
- aSet.Put(aFrmDir);
-
- pDoc->ChgPageDesc( nAktPageDesc, *pAkt );
-
- if( pSet )
- {
- SwSection aSect( CONTENT_SECTION, pDoc->GetUniqueSectionName() );
- SwSection* pSect = pDoc->Insert( *pPam, aSect, &aSet);
- pPam->DeleteMark();
-
- SwSectionNode* pSectNd = pSect->GetFmt()->GetSectionNode( TRUE );
- if( pRegionEndIdx )
- *pRegionEndIdx = *pSectNd->EndOfSectionNode();
- else
- pRegionEndIdx = new SwNodeIndex( *pSectNd->EndOfSectionNode());
-
- pPam->GetPoint()->nNode = *pSectNd;
- pPam->Move( fnMoveForward, fnGoNode );
-
- // Attribut Enden ggfs. anpassen!!!!
- if( GetAttrStack().Count() )
- {
- // Attribut Stack-Eintraege, muessen ans Ende des vorherigen
- // Nodes verschoben werden.
- for( USHORT n = GetAttrStack().Count(); n; )
+ break;
+ default:
+ if (RTF_DOCFMT == (nToken & ~(0xff | RTF_SWGDEFS)))
+ ReadDocControls( nToken );
+ else if (RTF_SECTFMT == (nToken & ~(0xff | RTF_SWGDEFS)) ||
+ RTF_UNKNOWNCONTROL == nToken)
{
- SvxRTFItemStackType* pStkEntry = (SvxRTFItemStackType*)
- GetAttrStack()[ --n ];
- if( pRegionEndIdx->GetIndex() == pStkEntry->GetSttNode().GetIdx() )
- pStkEntry->SetStartPos( SwxPosition( pPam ) );
+ SvxRTFParser::NextToken(nToken);
}
- }
- }
-
- if( bInsNewPageDesc )
- {
- SwFmtPageDesc aPgDsc( pAkt );
-
- if( pFirst )
- {
- // Pagedescriptoren am Dokument updaten (nur so werden auch die
- // linken Seiten usw. eingestellt).
- pDoc->ChgPageDesc( nAktFirstPageDesc, *pFirst );
- pFirst->Add( &aPgDsc );
- }
-
- if( USHRT_MAX != nPgStart )
- aPgDsc.SetNumOffset( nPgStart );
- pDoc->Insert( *pPam, aPgDsc );
- }
- }
- else
- {
- // sollte es ein BereichsWechsel sein?
- if( bCheckEqualPgDesc && SVX_BREAK_NONE == eBreak
- /*&& (!bInsPageDesc || neuen Bereich aufsetzen
- rOld.GetMaster().GetCol() != pAkt->GetMaster().GetCol() )*/ )
- {
- // Spaltigkeit in den Set uebernehmen
- SfxItemSet* pSet = 0;
- const SfxPoolItem* pItem;
- SfxItemSet aSet( pDoc->GetAttrPool(), RES_COL, RES_FRAMEDIR);
- if( SFX_ITEM_SET == pAkt->GetMaster().GetItemState(
- RES_COL, FALSE, &pItem )
- && 1 < ((SwFmtCol*)pItem)->GetColumns().Count() )
- {
- aSet.Put( *pItem );
- pSet = &aSet;
- }
-
- if( bNoBalancedCols )
- {
- aSet.Put( SwFmtNoBalancedColumns( TRUE ) );
- pSet = &aSet;
- }
-
- if (bIsRTL && aFrmDir.GetValue() == FRMDIR_HORI_LEFT_TOP)
- aFrmDir.SetValue(FRMDIR_HORI_RIGHT_TOP);
- aSet.Put(aFrmDir);
-
- if( !bFirstCall || pSet )
- {
- SwSection aSect( CONTENT_SECTION, pDoc->GetUniqueSectionName() );
- SwSection* pSect = pDoc->Insert( *pPam, aSect, &aSet );
- pPam->DeleteMark();
-
- SwSectionNode* pSectNd = pSect->GetFmt()->GetSectionNode( TRUE );
- if( pRegionEndIdx )
- *pRegionEndIdx = *pSectNd->EndOfSectionNode();
else
- pRegionEndIdx = new SwNodeIndex( *pSectNd->EndOfSectionNode());
-
- pPam->GetPoint()->nNode = *pSectNd;
- pPam->Move( fnMoveForward, fnGoNode );
-
- // Attribut Enden ggfs. anpassen!!!!
- if( GetAttrStack().Count() )
- {
- // Attribut Stack-Eintraege, muessen ans Ende des vorherigen
- // Nodes verschoben werden.
- for( USHORT n = GetAttrStack().Count(); n; )
- {
- SvxRTFItemStackType* pStkEntry = (SvxRTFItemStackType*)
- GetAttrStack()[ --n ];
- if( pRegionEndIdx->GetIndex() == pStkEntry->GetSttNode().GetIdx() )
- pStkEntry->SetStartPos( SwxPosition( pPam ) );
- }
- }
- }
- }
- else if( bInsPageDesc )
- {
- if(SVX_BREAK_COLUMN_BEFORE == eBreak )
- pDoc->Insert( *pPam, SvxFmtBreakItem( eBreak ));
- else if( SVX_BREAK_NONE != eBreak )
- {
- SwFmtPageDesc aPgDsc( ( pFirst && &rOld ==
- pDoc->GetPageDesc( nLastFirstPageDesc ).GetFollow() )
- ? &pDoc->_GetPageDesc( nLastFirstPageDesc )
- : &rOld );
-
- if( USHRT_MAX != nPgStart )
- aPgDsc.SetNumOffset( nPgStart );
- pDoc->Insert( *pPam, aPgDsc );
- }
- }
-
- // der aktuelle muss wieder entnfernt werden
- if( bInsNewPageDesc )
- {
- pDoc->DelPageDesc( nAktPageDesc );
- if( pFirst )
- pDoc->DelPageDesc( nAktFirstPageDesc );
- nAktPageDesc = nLastPageDesc;
- nAktFirstPageDesc = nLastFirstPageDesc;
+ bWeiter = false;
+ break;
}
- }
- SkipToken( -1 );
-}
+ if (bWeiter)
+ nToken = GetNextToken();
+ } while (bWeiter && IsParserWorking());
+ maSegments.push_back(rtfSection(*pPam->GetPoint(), aNewSection));
+ SkipToken(-1);
+}
void SwRTFParser::ReadPageDescTbl()
{
@@ -2359,7 +2308,7 @@ void SwRTFParser::ReadPageDescTbl()
SetChkStyleAttr(FALSE); // Attribute nicht gegen die Styles checken
- bInPgDscTbl = TRUE;
+ bInPgDscTbl = true;
USHORT nPos = 0;
SwPageDesc* pPg;
SwFrmFmt* pPgFmt;
@@ -2410,11 +2359,14 @@ void SwRTFParser::ReadPageDescTbl()
break;
case RTF_PGDSC:
- if( nPos) // kein && wg MAC
- if (nPos != pDoc->MakePageDesc(
- String::CreateFromInt32( nTokenValue ),
- FALSE ) )
- ASSERT( FALSE, "PageDesc an falscher Position" );
+ if (nPos) // kein && wg MAC
+ {
+ if (nPos != pDoc->MakePageDesc(
+ String::CreateFromInt32(nTokenValue)))
+ {
+ ASSERT( FALSE, "PageDesc an falscher Position" );
+ }
+ }
pPg = &pDoc->_GetPageDesc( nPos );
pPg->SetLandscape( FALSE );
@@ -2630,10 +2582,10 @@ void SwRTFParser::ReadPageDescTbl()
SetChkStyleAttr( bSaveChkStyleAttr );
- bInPgDscTbl = FALSE;
+ bInPgDscTbl = false;
nAktPageDesc = 0;
nAktFirstPageDesc = 0;
- bSwPageDesc = TRUE;
+ bSwPageDesc = true;
SkipToken( -1 );
}
@@ -2863,6 +2815,11 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
pPam->GetPoint()->nNode = *pNode->EndOfSectionNode();
pPam->Move( fnMoveBackward );
+ SwTxtFmtColl* pColl = aTxtCollTbl.Get( 0 );
+ if( !pColl )
+ pColl = pDoc->GetTxtCollFromPoolSimple( RES_POOLCOLL_STANDARD, FALSE );
+ pDoc->SetTxtFmtColl( *pPam, pColl );
+
SetNewGroup( TRUE );
while( !( nOpenBrakets == GetOpenBrakets() && !GetStackPos()) && IsParserWorking() )
@@ -3560,3 +3517,5 @@ xub_StrLen SwxPosition::GetCntIdx() const
{
return pPam->GetPoint()->nContent.GetIndex();
}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx
index 7c6214928039..ef2ad13664d9 100644
--- a/sw/source/filter/rtf/swparrtf.hxx
+++ b/sw/source/filter/rtf/swparrtf.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swparrtf.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: os $ $Date: 2002-12-10 14:30:10 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:41:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,12 +58,21 @@
*
*
************************************************************************/
+
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
#ifndef _SWPARRTF_HXX
#define _SWPARRTF_HXX
#ifndef __SGI_STL_MAP
#include <map>
#endif
+#ifndef __SGI_STL_DEQUE
+#include <deque>
+#endif
+#ifndef __SGI_STL_VECTOR
+#include <vector>
+#endif
#ifndef _SVSTDARR_HXX
#define _SVSTDARR_BOOLS
@@ -72,6 +81,9 @@
#ifndef _SVXRTF_HXX //autogen
#include <svx/svxrtf.hxx>
#endif
+#ifndef _SVX_NUMITEM_HXX
+#include <svx/numitem.hxx>
+#endif
#ifndef _NDINDEX_HXX
#include <ndindex.hxx>
@@ -162,10 +174,124 @@ typedef SwFlySave* SwFlySavePtr;
SV_DECL_PTRARR_DEL( SwFlySaveArr, SwFlySavePtr, 0, 20 )
SV_DECL_VARARR( SwListArr, SwListEntry, 0, 20 )
+struct DocPageInformation
+{
+ long mnPaperw;
+ long mnPaperh;
+ long mnMargl;
+ long mnMargr;
+ long mnMargt;
+ long mnMargb;
+ long mnGutter;
+ long mnPgnStart;
+ bool mbFacingp;
+ bool mbLandscape;
+ bool mbRTLdoc;
+ DocPageInformation();
+};
+
+struct SectPageInformation
+{
+ std::vector<long> maColumns;
+ SvxNumberType maNumType;
+ SwPageDesc *mpTitlePageHdFt;
+ SwPageDesc *mpPageHdFt;
+ long mnPgwsxn;
+ long mnPghsxn;
+ long mnMarglsxn;
+ long mnMargrsxn;
+ long mnMargtsxn;
+ long mnMargbsxn;
+ long mnGutterxsn;
+ long mnHeadery;
+ long mnFootery;
+ long mnPgnStarts;
+ long mnCols;
+ long mnColsx;
+ long mnStextflow;
+ int mnBkc;
+ bool mbLndscpsxn;
+ bool mbTitlepg;
+ bool mbFacpgsxn;
+ bool mbRTLsection;
+ bool mbPgnrestart;
+ SectPageInformation(const DocPageInformation &rDoc);
+ SectPageInformation(const SectPageInformation &rSect);
+};
+
+class rtfSection
+{
+public:
+ rtfSection(const SwPosition &rPos,
+ const SectPageInformation &rPageInfo);
+ SwNodeIndex maStart;
+ SectPageInformation maPageInfo;
+ SwSection *mpSection;
+ SwPageDesc *mpTitlePage;
+ SwPageDesc *mpPage;
+
+ bool IsContinous() const { return maPageInfo.mnBkc == 0; }
+ long NoCols() const { return maPageInfo.mnCols; }
+ long StandardColSeperation() const { return maPageInfo.mnColsx; }
+ bool HasTitlePage() const { return maPageInfo.mbTitlepg; }
+ long PageStartAt() const { return maPageInfo.mnPgnStarts; }
+ bool PageRestartNo() const { return maPageInfo.mbPgnrestart; }
+ bool IsBiDi() const { return maPageInfo.mbRTLsection; }
+ sal_uInt16 GetPageWidth() const { return maPageInfo.mnPgwsxn; }
+ sal_uInt16 GetPageHeight() const { return maPageInfo.mnPghsxn; }
+ sal_uInt16 GetPageLeft() const { return maPageInfo.mnMarglsxn; }
+ sal_uInt16 GetPageRight() const { return maPageInfo.mnMargrsxn; }
+ bool IsLandScape() const { return maPageInfo.mbLndscpsxn; }
+};
+
+class rtfSections
+{
+private:
+ SwRTFParser &mrReader;
+ std::deque<rtfSection> maSegments;
+ typedef std::deque<rtfSection>::iterator mySegIter;
+ typedef std::deque<rtfSection>::reverse_iterator mySegrIter;
+
+ struct wwULSpaceData
+ {
+ bool bHasHeader, bHasFooter;
+ short nSwHLo, nHdUL, nSwFUp, nFtUL, nSwUp, nSwLo;
+ wwULSpaceData() : bHasHeader(false), bHasFooter(false) {}
+ };
+
+ void SetSegmentToPageDesc(const rtfSection &rSection, bool bTitlePage,
+ bool bIgnoreCols);
+ SwSectionFmt *InsertSection(SwPaM& rMyPaM, rtfSection &rSection);
+ void SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt,
+ const rtfSection &rSection, bool bIgnoreCols);
+ void GetPageULData(const rtfSection &rSection, bool bFirst,
+ wwULSpaceData& rData);
+ void SetPageULSpaceItems(SwFrmFmt &rFmt, wwULSpaceData& rData);
+ bool SetCols(SwFrmFmt &rFmt, const rtfSection &rSection,
+ USHORT nNettoWidth);
+ void SetHdFt(rtfSection &rSection);
+ void CopyFrom(const SwPageDesc &rFrom, SwPageDesc &rDest);
+public:
+ bool empty() const { return maSegments.empty(); }
+ int size() const { return maSegments.size(); }
+ void push_back(const rtfSection &rSect);
+ rtfSection& back() { return maSegments.back(); }
+ const rtfSection& back() const { return maSegments.back(); }
+ void InsertSegments(bool bIsNewDoc);
+ rtfSections(SwRTFParser &rReader) : mrReader(rReader) {}
+ std::vector<sal_uInt16> maDummyPageNos;
+ typedef std::vector<sal_uInt16>::iterator myDummyIter;
+ void PrependedInlineNode(const SwPosition &rPos,
+ const SwNode &rNode);
+};
class SwRTFParser : public SvxRTFParser
{
- ::std::map<SwTableNode *, SwNodeIndex *> maTables;
+ friend class rtfSections;
+ DocPageInformation maPageDefaults;
+ rtfSections maSegments;
+
+ std::map<SwTableNode *, SwNodeIndex *> maTables;
SwRTFStyleTbl aTxtCollTbl;
SwRTFCharStyleTbl aCharFmtTbl;
SwFlySaveArr aFlyArr; // Flys als Letzes im Doc setzen
@@ -196,7 +322,6 @@ class SwRTFParser : public SvxRTFParser
bool bInPgDscTbl; // beim PageDescTbl lesen
bool bNewNumList; // Word 7.0 NumList gelesen, 6.0 ueberspringen
bool bFirstContinue; // 1.Call ins Continue
- bool bFirstDocControl; // 1.Call of ReadDocControl
/*
#i9243#
@@ -220,7 +345,7 @@ class SwRTFParser : public SvxRTFParser
void ReadListLevel( SwNumRule& rRule, BYTE nLvl );
void ReadListTable();
void ReadListOverrideTable();
- void ReadNumSecLevel( int nToken );
+ SwNumRule *ReadNumSecLevel( int nToken );
SwNumRule* GetNumRuleOfListNo( long nListNo,
BOOL bRemoveFromList = FALSE );
void RemoveUnusedNumRule( SwNumRule* );
@@ -281,7 +406,9 @@ protected:
void ReadField();
void ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc = 0 );
void ReadDocControls( int nToken );
+ void SetPageInformationAsDefault(const DocPageInformation &rInfo);
void ReadSectControls( int nToken );
+ void DoHairyWriterPageDesc(int nToken);
void ReadFly( int nToken, SfxItemSet* pFillSet = 0 );
void ReadTable( int nToken );
void ReadPageDescTbl();
@@ -303,5 +430,5 @@ public:
#endif
- //_SWPARRTF_HXX
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 5beba34636cd..2bd0e368bc17 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: writer.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: cmc $ $Date: 2002-04-08 12:47:23 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -561,7 +561,7 @@ void Writer::_AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont )
else
pItem = (SvxFontItem*)&rPool.Put( rFont );
- if( 1 < pItem->GetRef() )
+ if( 1 < pItem->GetRefCount() )
rPool.Remove( *pItem );
else
{
@@ -588,7 +588,6 @@ void Writer::CreateBookmarkTbl()
// search alle Bookmarks in the range and return it in the Array
-// this is exclusive of bookmarks on the end point of the range
USHORT Writer::GetBookmarks( const SwCntntNode& rNd, xub_StrLen nStt,
xub_StrLen nEnd, SvPtrarr& rArr )
{
@@ -598,23 +597,31 @@ USHORT Writer::GetBookmarks( const SwCntntNode& rNd, xub_StrLen nStt,
SvPtrarr* pArr = pImpl->pBkmkNodePos ? pImpl->pBkmkNodePos->Get( nNd ) : 0;
if( pArr )
{
- for( USHORT n = 0; n < pArr->Count(); ++n )
+ // there exist some bookmarks, search now all which is in the range
+ if( !nStt && nEnd == rNd.Len() )
+ // all
+ rArr.Insert( pArr, 0 );
+ else
{
+ USHORT n;
xub_StrLen nCntnt;
- void* p = (*pArr)[ n ];
- const SwBookmark& rBkmk = *(SwBookmark*)p;
- if( rBkmk.GetPos().nNode == nNd &&
- (nCntnt = rBkmk.GetPos().nContent.GetIndex() ) >= nStt &&
- nCntnt < nEnd )
+ for( n = 0; n < pArr->Count(); ++n )
{
- rArr.Insert( p, rArr.Count() );
- }
- else if( rBkmk.GetOtherPos() && nNd ==
- rBkmk.GetOtherPos()->nNode.GetIndex() && (nCntnt =
- rBkmk.GetOtherPos()->nContent.GetIndex() ) >= nStt &&
+ void* p = (*pArr)[ n ];
+ const SwBookmark& rBkmk = *(SwBookmark*)p;
+ if( rBkmk.GetPos().nNode == nNd &&
+ (nCntnt = rBkmk.GetPos().nContent.GetIndex() ) >= nStt &&
nCntnt < nEnd )
- {
- rArr.Insert( p, rArr.Count() );
+ {
+ rArr.Insert( p, rArr.Count() );
+ }
+ else if( rBkmk.GetOtherPos() && nNd ==
+ rBkmk.GetOtherPos()->nNode.GetIndex() && (nCntnt =
+ rBkmk.GetOtherPos()->nContent.GetIndex() ) >= nStt &&
+ nCntnt < nEnd )
+ {
+ rArr.Insert( p, rArr.Count() );
+ }
}
}
}
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 1d0dd51d60f2..dae105bab0bb 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fltshell.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: cmc $ $Date: 2002-12-06 16:36:26 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2193,3 +2193,17 @@ void SwFltShell::NextStyle(USHORT nWhich, USHORT nNext)
*pColls[nNext]->GetColl() );
}
+// UpdatePageDescs muss am Ende des Einlesevorganges aufgerufen werden, damit
+// der Writer den Inhalt der Pagedescs wirklich akzeptiert
+void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset)
+{
+ // Pagedescriptoren am Dokument updaten (nur so werden auch die
+ // linken Seiten usw. eingestellt).
+
+ // PageDesc "Standard"
+ rDoc.ChgPageDesc(0, rDoc.GetPageDesc(0));
+
+ // PageDescs "Konvert..."
+ for (sal_uInt16 i = nInPageDescOffset; i < rDoc.GetPageDescCnt(); ++i)
+ rDoc.ChgPageDesc(i, rDoc.GetPageDesc(i));
+}
diff --git a/sw/source/filter/ww8/dump/dump8a.cxx b/sw/source/filter/ww8/dump/dump8a.cxx
index fa4cb5d3cdb7..8f600b156cbe 100644
--- a/sw/source/filter/ww8/dump/dump8a.cxx
+++ b/sw/source/filter/ww8/dump/dump8a.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dump8a.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: cmc $ $Date: 2002-12-06 16:39:31 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx
index de208f41c6b7..69540d71c497 100644
--- a/sw/source/filter/ww8/escher.hxx
+++ b/sw/source/filter/ww8/escher.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: escher.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _ESCHER_HXX
@@ -95,6 +94,8 @@ protected:
virtual INT32 WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType,
EscherPropertyContainer& rPropOpt);
+ void WritePicture(EscherPropertyContainer &rPropOpt,
+ const Graphic &rGraphic, const SdrObject &rObj, sal_uInt32 nShapeId);
void WriteGrfAttr(const SwNoTxtNode& rNd,EscherPropertyContainer& rPropOpt);
INT32 DrawModelToEmu(INT32 nVal) const
@@ -160,3 +161,5 @@ private:
};
#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/makefile.mk b/sw/source/filter/ww8/makefile.mk
index 871fb0e1905b..bb764bcf8090 100644
--- a/sw/source/filter/ww8/makefile.mk
+++ b/sw/source/filter/ww8/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.6 $
+# $Revision: 1.7 $
#
-# last change: $Author: vg $ $Date: 2002-08-27 15:35:22 $
+# last change: $Author: hr $ $Date: 2003-03-27 15:42:06 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -121,6 +121,7 @@ SLOFILES = \
$(SLO)$/ww8scan.obj
EXCEPTIONSFILES = \
+ $(SLO)$/ww8par5.obj \
$(SLO)$/ww8graf2.obj
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 5e79c975b557..3df30b6a441f 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtw8esh.cxx,v $
*
- * $Revision: 1.57 $
+ * $Revision: 1.58 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,8 @@
*
************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
#ifdef PCH
#include "filt_pch.hxx"
#endif
@@ -160,6 +162,9 @@
#ifndef _SVX_UNOAPI_HXX_
#include <svx/unoapi.hxx>
#endif
+#ifndef _SVDXCGV_HXX
+#include <svx/svdxcgv.hxx>
+#endif
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
@@ -1377,29 +1382,9 @@ INT32 SwBasicEscherEx::WriteOLEFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId)
#endif
OpenContainer(ESCHER_SpContainer);
- AddShape(ESCHER_ShpInst_PictureFrame, 0xa10, nShapeId);
EscherPropertyContainer aPropOpt;
+ WritePicture(aPropOpt, aGraphic, *pSdrObj, nShapeId);
- GraphicObject aGraphicObject(aGraphic);
- ByteString aId = aGraphicObject.GetUniqueID();
- if (aId.Len())
- {
- Size aSz(rOLENd.GetTwipSize());
- aSz.Width() = DrawModelToEmu(aSz.Width());
- aSz.Height() = DrawModelToEmu(aSz.Height());
- Rectangle aRect(Point(0,0), aSz);
-
- sal_uInt32 nBlibId = GetBlibID(*QueryPicStream(), aId, aRect, 0);
- if (nBlibId)
- {
- aPropOpt.AddOpt(ESCHER_Prop_fillType, ESCHER_FillPicture);
- aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True);
- }
- }
-
- SetPicId(*pSdrObj, nShapeId, aPropOpt);
-
- aPropOpt.AddOpt(ESCHER_Prop_pictureActive, 0x10000);
nBorderThick = WriteFlyFrameAttr(rFmt, mso_sptPictureFrame, aPropOpt);
WriteGrfAttr(rOLENd, aPropOpt);
aPropOpt.Commit(GetStream());
@@ -1768,21 +1753,6 @@ void SwEscherEx::FinishEscher()
pEscherStrm->Seek(0);
*rWrt.pTableStrm << *pEscherStrm;
delete pEscherStrm, pEscherStrm = 0;
-
- /*#82587# Everytime MS 2000 creates an escher stream there is always an
- ObjectPool dir (even if empty). It turns out that if a copy of MS 2000 is
- used to open a document that contains escher graphics exported from
- StarOffice without this empty dir then *if* that copy of MS Office has
- never been used to open a MSOffice document that has escher graphics (and
- an ObjectPool dir of course) and that copy of office has not been used to
- draw escher graphics then our exported graphics do not appear. Once you
- do open a ms document with escher graphics or draw an escher graphic with
- that copy of word, then all documents from staroffice that contain escher
- work from then on. Tricky to track down, some sort of late binding
- trickery in MS where solely for first time initialization the existence
- of an ObjectPool dir is necessary for triggering some magic. cmc*/
- rWrt.GetStorage().OpenStorage(CREATE_CONST_ASC(SL::aObjectPool),
- STREAM_READWRITE | STREAM_SHARE_DENYALL);
}
extern "C"
@@ -2402,22 +2372,47 @@ INT32 SwEscherEx::WriteTxtFlyFrame(const SwFrmFmt& rFmt, UINT32 nShapeId,
return nBorderThick;
}
+void SwBasicEscherEx::WritePicture(EscherPropertyContainer &rPropOpt,
+ const Graphic &rGraphic, const SdrObject &rObj, sal_uInt32 nShapeId)
+{
+ AddShape( ESCHER_ShpInst_PictureFrame, 0xa10, nShapeId );
+
+ GraphicObject aGraphicObject(rGraphic);
+ ByteString aId = aGraphicObject.GetUniqueID();
+ if (aId.Len())
+ {
+ Rectangle aRect = rObj.GetLogicRect();
+ aRect.SetPos(Point(0,0));
+ aRect.Right() = DrawModelToEmu(aRect.Right());
+ aRect.Bottom() = DrawModelToEmu(aRect.Bottom());
+ sal_uInt32 nBlibId = GetBlibID(*QueryPicStream(), aId, aRect, 0);
+ if (nBlibId)
+ {
+ rPropOpt.AddOpt(ESCHER_Prop_fillType, ESCHER_FillPicture);
+ rPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True);
+ }
+ }
+
+ SetPicId(rObj, nShapeId, rPropOpt);
+ rPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
+}
+
void SwEscherEx::WriteOCXControl( const SwFrmFmt& rFmt, UINT32 nShapeId )
{
if (const SdrObject* pSdrObj = rFmt.FindRealSdrObject())
{
OpenContainer( ESCHER_SpContainer );
- AddShape( ESCHER_ShpInst_PictureFrame, 0xa10, nShapeId );
+ SdrModel *pModel = rWrt.pDoc->GetDrawModel();
+ OutputDevice *pDevice = Application::GetDefaultDevice();
+ ASSERT(pModel && pDevice, "no model or device");
+ SdrExchangeView aExchange(pModel, pDevice);
+ Graphic aGraphic(aExchange.GetObjGraphic(pModel,
+ const_cast<SdrObject*>(pSdrObj)));
EscherPropertyContainer aPropOpt;
- Size aSz( pSdrObj->GetLogicRect().GetSize() );
- aSz.Width() = DrawModelToEmu( aSz.Width() );
- aSz.Height() = DrawModelToEmu( aSz.Height() );
+ WritePicture(aPropOpt, aGraphic, *pSdrObj, nShapeId);
- SetPicId(*pSdrObj, nShapeId, aPropOpt);
-
- aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
WriteFlyFrameAttr( rFmt, mso_sptPictureFrame , aPropOpt );
aPropOpt.Commit( GetStream() );
@@ -2554,10 +2549,11 @@ bool SwMSConvertControls::ExportControl(Writer &rWrt, const SdrObject *pObj)
//I think I painted myself into a little bit of a
//corner by trying to use the uno interface for
//controls export
- Size aTempSize=pFormObj->GetLogicRect().GetSize();
+ Rectangle aRect = pFormObj->GetLogicRect();
+ aRect.SetPos(Point(0,0));
awt::Size aSize;
- aSize.Width = TWIPS_TO_MM(aTempSize.A());
- aSize.Height = TWIPS_TO_MM(aTempSize.B());
+ aSize.Width = TWIPS_TO_MM(aRect.Right());
+ aSize.Height = TWIPS_TO_MM(aRect.Bottom());
//Open the ObjectPool
SvStorageRef xObjPool = rWW8Wrt.GetStorage().OpenStorage(
@@ -2600,3 +2596,5 @@ bool SwMSConvertControls::ExportControl(Writer &rWrt, const SdrObject *pObj)
rWW8Wrt.OutField( 0, 87, aEmptyStr, WRITEFIELD_END | WRITEFIELD_CLOSE );
return true;
}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 6892c7b64b3e..52d61a085d48 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtw8nds.cxx,v $
*
- * $Revision: 1.46 $
+ * $Revision: 1.47 $
*
- * last change: $Author: cmc $ $Date: 2002-12-05 17:53:19 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -447,7 +446,7 @@ WW8_SwAttrIter::WW8_SwAttrIter(SwWW8Writer& rWr, const SwTxtNode& rTxtNd)
}
}
- ::std::sort(maFlyFrms.begin(), maFlyFrms.end(), sortswflys());
+ std::sort(maFlyFrms.begin(), maFlyFrms.end(), sortswflys());
maFlyIter = maFlyFrms.begin();
@@ -1095,7 +1094,7 @@ void WW8_SwAttrIter::FieldVanish( const String& rTxt )
void WW8_SwAttrIter::OutSwTOXMark(const SwTOXMark& rAttr, bool bStart)
{
// its a field; so get the Text form the Node and build the field
- ASSERT( !bStart, "calls only with the endposition!" );
+ ASSERT( bStart, "calls only with the startposition!" );
String sTxt;
const SwTxtTOXMark& rTxtTOXMark = *rAttr.GetTxtTOXMark();
@@ -1162,7 +1161,7 @@ bool WW8_SwAttrIter::OutAttrWithRange( xub_StrLen nPos )
OutSwFmtINetFmt((SwFmtINetFmt&)*pItem, true);
bRet = true;
}
- else if (nPos == *pHt->GetEnd())
+ if( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
OutSwFmtINetFmt((SwFmtINetFmt&)*pItem, false);
}
break;
@@ -1176,10 +1175,11 @@ bool WW8_SwAttrIter::OutAttrWithRange( xub_StrLen nPos )
OutSwFmtRefMark((SwFmtRefMark&)*pItem, false);
break;
case RES_TXTATR_TOXMARK:
- if( nPos == *pHt->GetStart() )
+ if (nPos == *pHt->GetStart())
+ {
+ OutSwTOXMark((SwTOXMark&)*pItem, true);
bRet = true;
- if( 0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd )
- OutSwTOXMark((SwTOXMark&)*pItem, false);
+ }
break;
case RES_TXTATR_CJK_RUBY:
if( nPos == *pHt->GetStart() )
@@ -1454,10 +1454,10 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
if( nNextAttr > nEnd )
nNextAttr = nEnd;
- //Append bookmarks in this range, exclusive of final position
- //of this range
- rWW8Wrt.AppendBookmarks( *pNd, nAktPos, nNextAttr - nAktPos );
aAttrIter.OutFlys(nAktPos);
+ //Append bookmarks in this range after flys, exclusive of final
+ //position of this range
+ rWW8Wrt.AppendBookmarks( *pNd, nAktPos, nNextAttr - nAktPos );
bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
bool bAttrWithRange = aAttrIter.OutAttrWithRange( nAktPos );
@@ -1475,10 +1475,10 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
bRedlineAtEnd = true;
else
{
- //insert final bookmarks if any before CR
- rWW8Wrt.AppendBookmarks( *pNd, nEnd, 1 );
//insert final graphic anchors if any before CR
aAttrIter.OutFlys(nEnd);
+ //insert final bookmarks if any before CR and after flys
+ rWW8Wrt.AppendBookmarks( *pNd, nEnd, 1 );
if( pTOXSect )
rWW8Wrt.EndTOX( *pTOXSect );
rWW8Wrt.WriteCR(); // CR danach
@@ -1494,7 +1494,8 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
// Ausnahme: Fussnoten am Zeilenende
if( nNextAttr == nEnd )
{
- aAttrIter.OutAttrWithRange( nEnd );
+ if (nAktPos != nEnd)
+ aAttrIter.OutAttrWithRange(nEnd);
if( pO->Count() )
{
rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(),
@@ -1504,10 +1505,10 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
if( bTxtAtr || bAttrWithRange || bRedlineAtEnd )
{
- //insert final bookmarks if any before CR
- rWW8Wrt.AppendBookmarks( *pNd, nEnd, 1 );
//insert final graphic anchors if any before CR
aAttrIter.OutFlys(nEnd);
+ //insert final bookmarks if any before CR and after flys
+ rWW8Wrt.AppendBookmarks( *pNd, nEnd, 1 );
if( pTOXSect )
rWW8Wrt.EndTOX( *pTOXSect );
@@ -2498,4 +2499,4 @@ SwNodeFnTab aWW8NodeFnTab = {
/* RES_OLENODE */ OutWW8_SwOleNode,
};
-
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index e026691b6e7a..d141e30bfd8d 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtw8num.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -759,4 +758,4 @@ bool SwWW8Writer::Out_SwNum(const SwTxtNode* pNd)
return bRet;
}
-
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index ef300ddcd85a..b70026858c55 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtw8sty.cxx,v $
*
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
*
- * last change: $Author: cmc $ $Date: 2002-11-07 16:54:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,8 @@
*
************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
#ifdef PCH
#include "filt_pch.hxx"
#endif
@@ -1284,7 +1286,8 @@ bool WW8_WrPlcSepx::WriteKFTxt(SwWW8Writer& rWrt)
rWrt.pISet = pOldI;
- bOutPgDscSet = false;
+ if (nBreakCode == 0)
+ bOutPgDscSet = false;
}
}
@@ -1448,36 +1451,39 @@ bool WW8_WrPlcSepx::WriteKFTxt(SwWW8Writer& rWrt)
? &pPd->GetFollow()->GetMaster()
: &pPd->GetLeft();
- SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
- SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
- if( !pPd->IsHeaderShared() || bLeftRightPgChain )
- SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
- if( !pPd->IsFooterShared() || bLeftRightPgChain )
- SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
- if( pPdFmt != pPdFirstPgFmt )
+ if (nBreakCode != 0)
{
- // es gibt eine ErsteSeite:
- SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST );
- SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST );
- }
+ SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
+ SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
+ if( !pPd->IsHeaderShared() || bLeftRightPgChain )
+ SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
+ if( !pPd->IsFooterShared() || bLeftRightPgChain )
+ SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
+ if( pPdFmt != pPdFirstPgFmt )
+ {
+ // es gibt eine ErsteSeite:
+ SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST );
+ SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST );
+ }
- if( nHeadFootFlags && !rWrt.bWrtWW8 )
- {
- BYTE nTmpFlags = nHeadFootFlags;
- if( rWrt.pDop->fFacingPages )
+ if( nHeadFootFlags && !rWrt.bWrtWW8 )
{
- if( !(nTmpFlags & WW8_FOOTER_EVEN) &&
- (nTmpFlags & WW8_FOOTER_ODD ) )
- nTmpFlags |= WW8_FOOTER_EVEN;
+ BYTE nTmpFlags = nHeadFootFlags;
+ if( rWrt.pDop->fFacingPages )
+ {
+ if( !(nTmpFlags & WW8_FOOTER_EVEN) &&
+ (nTmpFlags & WW8_FOOTER_ODD ) )
+ nTmpFlags |= WW8_FOOTER_EVEN;
- if( !(nTmpFlags & WW8_HEADER_EVEN) &&
- (nTmpFlags & WW8_HEADER_ODD ) )
- nTmpFlags |= WW8_HEADER_EVEN;
- }
+ if( !(nTmpFlags & WW8_HEADER_EVEN) &&
+ (nTmpFlags & WW8_HEADER_ODD ) )
+ nTmpFlags |= WW8_HEADER_EVEN;
+ }
- // sprmSGprfIhdt, wird nur noch im WW95 benoetigt
- pO->Insert( 153, pO->Count() );
- pO->Insert( nTmpFlags, pO->Count() );
+ // sprmSGprfIhdt, wird nur noch im WW95 benoetigt
+ pO->Insert( 153, pO->Count() );
+ pO->Insert( nTmpFlags, pO->Count() );
+ }
}
if( pO->Count() )
@@ -1976,3 +1982,4 @@ const SvULongs* WW8_WrPlcSubDoc::GetShapeIdArr() const
return 0;
}
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index d9c6c19fd2ba..d63167058d06 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtww8.cxx,v $
*
- * $Revision: 1.50 $
+ * $Revision: 1.51 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,8 @@
*
************************************************************************/
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
#ifdef PCH
#include "filt_pch.hxx"
#pragma hdrstop
@@ -280,7 +282,8 @@ class WW8_WrtBookmarks
private:
SvULongs aSttCps, aEndCps; // Array of Start- and End CPs
SvBools aFieldBookmarks; // If the bookmark is in a field result
- ::std::vector<String> maSwBkmkNms; // Array of Sw - Bookmarknames
+ std::vector<String> maSwBkmkNms; // Array of Sw - Bookmarknames
+ typedef std::vector<String>::iterator myIter;
USHORT GetPos( const String& rNm );
@@ -301,7 +304,7 @@ public:
class WW8_WrtRedlineAuthor
{
private:
- ::std::vector<String> maAuthors; // Array of Sw - Bookmarknames
+ std::vector<String> maAuthors; // Array of Sw - Bookmarknames
USHORT GetPos( const String& rNm );
@@ -1323,15 +1326,19 @@ void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm )
{
// new -> insert as start position
nPos = aSttCps.Count();
+ myIter aIter = maSwBkmkNms.end();
// sort by startposition
// theory: write continuous -> then the new position is at end
while( nPos && aSttCps[ nPos - 1 ] > ULONG( nStartCp ))
+ {
--nPos;
+ --aIter;
+ }
aSttCps.Insert(nStartCp, nPos);
aEndCps.Insert(nStartCp, nPos);
aFieldBookmarks.Insert(BOOL(false), nPos);
- maSwBkmkNms.push_back(rNm);
+ maSwBkmkNms.insert(aIter, rNm);
}
else
{
@@ -1375,7 +1382,7 @@ void WW8_WrtBookmarks::Write( SwWW8Writer& rWrt )
rWrt.pFib->fcPlcfbkf = rStrm.Tell();
for( i = 0; i < nCount; ++i )
SwWW8Writer::WriteLong( rStrm, aSttCps[ i ] );
- SwWW8Writer::WriteLong( rStrm, rWrt.pFib->ccpText );
+ SwWW8Writer::WriteLong(rStrm, rWrt.pFib->ccpText + rWrt.pFib->ccpTxbx);
for( i = 0; i < nCount; ++i )
{
ULONG nEndCP = aEndCps[ i ];
@@ -1397,7 +1404,7 @@ void WW8_WrtBookmarks::Write( SwWW8Writer& rWrt )
rWrt.pFib->fcPlcfbkl = rStrm.Tell();
for( i = 0; i < nCount; ++i )
SwWW8Writer::WriteLong( rStrm, aEndSortTab[ i ] );
- SwWW8Writer::WriteLong( rStrm, rWrt.pFib->ccpText );
+ SwWW8Writer::WriteLong(rStrm, rWrt.pFib->ccpText + rWrt.pFib->ccpTxbx);
rWrt.pFib->lcbPlcfbkl = rStrm.Tell() - rWrt.pFib->fcPlcfbkl;
}
}
@@ -1487,8 +1494,8 @@ void SwWW8Writer::AppendBookmark( const String& rName, USHORT nOffset )
USHORT WW8_WrtRedlineAuthor::AddName( const String& rNm )
{
USHORT nRet;
- typedef ::std::vector<String>::iterator myiter;
- myiter aIter = ::std::find(maAuthors.begin(), maAuthors.end(), rNm);
+ typedef std::vector<String>::iterator myiter;
+ myiter aIter = std::find(maAuthors.begin(), maAuthors.end(), rNm);
if (aIter != maAuthors.end())
nRet = aIter - maAuthors.begin();
else
@@ -1518,7 +1525,7 @@ USHORT SwWW8Writer::AddRedlineAuthor( USHORT nId )
//--------------------------------------------------------------------------
/* */
-void SwWW8Writer::WriteAsStringTable(const ::std::vector<String>& rStrings,
+void SwWW8Writer::WriteAsStringTable(const std::vector<String>& rStrings,
INT32& rfcSttbf, INT32& rlcbSttbf, USHORT nExtraLen)
{
USHORT n, nCount = rStrings.size();
@@ -1997,6 +2004,32 @@ void SwWW8Writer::WriteFkpPlcUsw()
pFldTxtBxs->Write( *this ); // Fields ( Textboxes )
pFldHFTxtBxs->Write( *this ); // Fields ( Head/Foot-Textboxes )
+ if (pEscher || pDoc->ContainsMSVBasic())
+ {
+ /*
+ #82587# Everytime MS 2000 creates an escher stream there is always
+ an ObjectPool dir (even if empty). It turns out that if a copy of
+ MS 2000 is used to open a document that contains escher graphics
+ exported from StarOffice without this empty dir then *if* that
+ copy of MS Office has never been used to open a MSOffice document
+ that has escher graphics (and an ObjectPool dir of course) and
+ that copy of office has not been used to draw escher graphics then
+ our exported graphics do not appear. Once you do open a ms
+ document with escher graphics or draw an escher graphic with that
+ copy of word, then all documents from staroffice that contain
+ escher work from then on. Tricky to track down, some sort of late
+ binding trickery in MS where solely for first time initialization
+ the existence of an ObjectPool dir is necessary for triggering
+ some magic. cmc
+ */
+ /*
+ #10570# Similiarly having msvbasic storage seems to also trigger
+ creating this stream
+ */
+ GetStorage().OpenStorage(CREATE_CONST_ASC(SL::aObjectPool),
+ STREAM_READWRITE | STREAM_SHARE_DENYALL);
+ }
+
// dggInfo - escher stream
WriteEscher();
@@ -2011,6 +2044,9 @@ void SwWW8Writer::WriteFkpPlcUsw()
OutListTab(); // listformats - LSTF
OutOverrideListTab(); // - "" - - LFO
OutListNamesTab(); // - "" - - ListNames
+
+ RestoreMacroCmds();
+
pMagicTable->Write( *this );
pPiece->WritePc( *this ); // Piece-Table
@@ -2500,3 +2536,32 @@ void WW8_WrPlcTxtBoxes::WritePlc( SwWW8Writer& rWrt ) const
rWrt.pFib->lcbPlcfHdrtxbxTxt );
}
}
+
+void SwWW8Writer::RestoreMacroCmds()
+{
+ pFib->fcCmds = pTableStrm->Tell();
+
+ SvStorageRef xSrcRoot(pDoc->GetDocShell()->GetStorage());
+ SvStorageStreamRef xSrcStream =
+ xSrcRoot->OpenStream(CREATE_CONST_ASC(SL::aMSMacroCmds),
+ STREAM_STD_READ | STREAM_NOCREATE );
+
+ if (xSrcStream.Is() && SVSTREAM_OK == xSrcStream->GetError())
+ {
+ xSrcStream->Seek(STREAM_SEEK_TO_END);
+ pFib->lcbCmds = xSrcStream->Tell();
+ xSrcStream->Seek(0);
+
+ sal_uInt8 *pBuffer = new sal_uInt8[pFib->lcbCmds];
+ xSrcStream->Read(pBuffer, pFib->lcbCmds);
+ pTableStrm->Write(pBuffer, pFib->lcbCmds);
+ delete[] pBuffer;
+
+ }
+
+ // set len to FIB
+ pFib->lcbCmds = pTableStrm->Tell() - pFib->fcCmds;
+}
+
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 17e293158737..693ae2a09550 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtww8.hxx,v $
*
- * $Revision: 1.42 $
+ * $Revision: 1.43 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:15 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _WRTWW8_HXX
@@ -449,6 +448,9 @@ friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode );
void OutListTab();
void OutOverrideListTab();
void OutListNamesTab();
+
+ void RestoreMacroCmds();
+
void InitFontTable();
public:
SwPosFlyFrms maFlyPos; // Pointer auf die aktuelle "FlyFrmTabelle"
@@ -958,3 +960,5 @@ Writer& OutWW8_SwFmtVertOrient( Writer& rWrt, const SfxPoolItem& rHt );
#endif // _WRTWW8_HXX
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 1f910c57884d..7b7dd1a8d67d 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtww8gr.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: cmc $ $Date: 2002-12-02 10:29:38 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PRECOMPILED
@@ -68,8 +67,8 @@
#pragma hdrstop
-#ifndef _TOOLS_SOLMATH_H
-#include <tools/solmath.hxx>
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
#endif
#ifndef _FILTER_HXX //autogen
@@ -436,7 +435,10 @@ void SwWW8Writer::OutGrf( const SwNoTxtNode* pNd )
GetItem(RES_CHRATR_FONTSIZE)).GetHeight();
nHeight-=nFontHeight/20;
- Set_UInt16( pArr, 0x4845 );
+ if (bWrtWW8)
+ Set_UInt16( pArr, 0x4845 );
+ else
+ Set_UInt8( pArr, 101 );
Set_UInt16( pArr, -((INT16)nHeight));
}
}
@@ -651,7 +653,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const SwNoTxtNode* pNd,
if( aGrTwipSz.Width() + nXSizeAdd ) // set mx
{
double fVal = nWidth * 1000.0 / (aGrTwipSz.Width() + nXSizeAdd);
- Set_UInt16( pArr, (USHORT)SolarMath::Round(fVal) );
+ Set_UInt16( pArr, (USHORT)::rtl::math::round(fVal) );
}
else
pArr += 2;
@@ -659,7 +661,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const SwNoTxtNode* pNd,
if( aGrTwipSz.Height() + nYSizeAdd ) // set my
{
double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd);
- Set_UInt16( pArr, (USHORT)SolarMath::Round(fVal) );
+ Set_UInt16( pArr, (USHORT)::rtl::math::round(fVal) );
}
else
pArr += 2;
@@ -854,3 +856,5 @@ void SwWW8WrGrf::Write()
}
}
}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 254e096b02b9..7aa202240167 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8atr.cxx,v $
*
- * $Revision: 1.56 $
+ * $Revision: 1.57 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:15 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
/*
@@ -2921,6 +2920,8 @@ ULONG SwWW8Writer::ReplaceCr( BYTE nChar )
{
// then write as normal char
WriteChar(nChar);
+ pPiece->SetParaBreak();
+ pPapPlc->AppendFkpEntry(rStrm.Tell());
nRetPos = rStrm.Tell();
}
#ifdef PRODUCT
@@ -4451,5 +4452,4 @@ SwAttrFnTab aWW8AttrFnTab = {
/* RES_UNKNOWNATR_CONTAINER */ 0
};
-
-
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index 718879b9c7a8..3e3a482373a2 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8glsy.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:15 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PRECOMPILED
@@ -150,8 +149,8 @@ bool WW8Glossary::HasBareGraphicEnd(SwDoc *pDoc,SwNodeIndex &rIdx)
}
bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks,
- bool bSaveRelFile, const ::std::vector<String>& rStrings,
- const ::std::vector<String>& rExtra)
+ bool bSaveRelFile, const std::vector<String>& rStrings,
+ const std::vector<String>& rExtra)
{
// this code will be called after reading all text into the
// empty sections
@@ -254,8 +253,8 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile )
if( pGlossary->IsGlossaryFib() && rBlocks.StartPutMuchBlockEntries() )
{
//read the names of the autotext entries
- ::std::vector<String> aStrings;
- ::std::vector<String> aExtra;
+ std::vector<String> aStrings;
+ std::vector<String> aExtra;
rtl_TextEncoding eStructCharSet =
WW8Fib::GetFIBCharset(pGlossary->chseTables);
@@ -388,3 +387,4 @@ UINT32 WW8GlossaryFib::FindGlossaryFibOffset(SvStream &rTableStrm,
return nEndLastPage;
}
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8glsy.hxx b/sw/source/filter/ww8/ww8glsy.hxx
index 446b3bb98ac1..3780e79c33da 100644
--- a/sw/source/filter/ww8/ww8glsy.hxx
+++ b/sw/source/filter/ww8/ww8glsy.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8glsy.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:15 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _WW8GLSY_HXX
@@ -130,3 +129,5 @@ private:
WW8Glossary& operator=(const WW8Glossary&);
};
#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index e95418262017..af0a29d65524 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8graf.cxx,v $
*
- * $Revision: 1.91 $
+ * $Revision: 1.92 $
*
- * last change: $Author: cmc $ $Date: 2002-12-12 13:50:33 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#pragma hdrstop
@@ -311,9 +310,8 @@ void wwFrameNamer::SetUniqueGraphName(SwFrmFmt *pFrmFmt, const String &rFixed)
{
if (mbIsDisabled || !rFixed.Len())
return;
- mnImportedGraphicsCount++;
String aName(msSeed);
- aName += String::CreateFromInt32(mnImportedGraphicsCount);
+ aName += String::CreateFromInt32(++mnImportedGraphicsCount);
aName.APPEND_CONST_ASC( ": " );
aName += rFixed;
pFrmFmt->SetName( aName );
@@ -346,7 +344,7 @@ bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz,
if( eAnchor == FLY_AT_CNTNT )
{
if( SVBT8ToByte( pDo->bx ) == 1 ) // Pos: echt links
- nDrawXOfs2 -= nPgLeft;
+ nDrawXOfs2 -= maSectionManager.GetPageLeft();
if( nInTable ) // Obj in Table
nDrawXOfs2 -= GetTableLeft(); // -> siehe Kommentar
// bei GetTableLeft()
@@ -354,9 +352,11 @@ bool SwWW8ImplReader::ReadGrafStart(void* pData, short nDataSiz,
else
{
if( SVBT8ToByte( pDo->bx ) != 1 )
- nDrawXOfs2 += nPgLeft;
+ nDrawXOfs2 += maSectionManager.GetPageLeft();
+#if 0
if( SVBT8ToByte( pDo->by ) == 0 )
- nDrawYOfs2 += nPgTop;
+ nDrawYOfs2 += maSectionManager.GetPageTop();
+#endif
}
return true;
@@ -2168,9 +2168,9 @@ void SwWW8ImplReader::SetAttributesAtGrfNode( SvxMSDffImportRec* pRecord,
//gamma
if (WW8ITEMVALUE(rOldSet, SDRATTR_GRAFGAMMA, SdrGrafGamma100Item))
{
- SwGammaGrf aGamma(WW8ITEMVALUE(rOldSet, SDRATTR_GRAFGAMMA,
- SdrGrafGamma100Item));
- pGrfNd->SetAttr( aGamma );
+ double fVal = WW8ITEMVALUE(rOldSet, SDRATTR_GRAFGAMMA,
+ SdrGrafGamma100Item);
+ pGrfNd->SetAttr(SwGammaGrf(fVal/100.));
}
//drawmode
@@ -2380,8 +2380,8 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord,
if (rParentHori.GetRelationOrient() == REL_PG_FRAME)
{
- pFSPA->nXaLeft -= nPgLeft;
- pFSPA->nXaRight -= nPgLeft;
+ pFSPA->nXaLeft -= maSectionManager.GetPageLeft();
+ pFSPA->nXaRight -= maSectionManager.GetPageLeft();
}
}
}
@@ -2686,7 +2686,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
pRecord = aData.GetRecord(nTxbx);
if (pRecord && pRecord->pObj && pRecord->aTextId.nTxBxS)
{
- MungeTextIntoDrawBox(pRecord->pObj, pRecord,
+ pRetFrmFmt = MungeTextIntoDrawBox(pRecord->pObj, pRecord,
nGrafAnchorCp, pRetFrmFmt);
}
}
@@ -2718,14 +2718,13 @@ void SwWW8ImplReader::RemoveAutoAnchor(const SwFrmFmt *pFmt)
pAnchorStck->RemoveAnchor(pFmt);
}
-void SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject,
+SwFrmFmt* SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject,
SvxMSDffImportRec *pRecord, long nGrafAnchorCp, SwFrmFmt* pRetFrmFmt)
{
SdrTextObj* pSdrTextObj;
// Pruefen, ob Gruppenobjekt (z.B. zwei Klammern) vorliegt
- SdrObjGroup* pThisGroup = PTR_CAST(SdrObjGroup, pRecord->pObj);
- if( pThisGroup )
+ if (SdrObjGroup* pThisGroup = PTR_CAST(SdrObjGroup, pRecord->pObj))
{
// Gruppenobjekte haben keinen Text. Fuege ein Textobjekt in die
// Gruppe ein, um den Text zu halten.
@@ -2751,23 +2750,7 @@ void SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject,
pThisGroup->GetSubList()->NbcInsertObject(pSdrTextObj);
}
else
- {
pSdrTextObj = PTR_CAST(SdrTextObj, pRecord->pObj);
- /*
- Die Frage: was tun, wenn hier false hereuskommt, z.B. bei
- 3D-Objekten (nicht von SdrTextObj abgeleitet)
-
- Wunsch: neues SdrTextObj hinzufuegen, das mit dem alten in einer
- neu zu schaffenden Gruppe geklammert wird.
-
- Implementierung: nicht zur 5.1 (jp und khz am 11.02.1999)
-
- if( !pSdrTextObj )
- {
- ...
- }
- */
- }
if( pSdrTextObj )
{
@@ -2785,7 +2768,7 @@ void SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject,
bEraseThisObject, 0, 0, 0, 0, pRecord);
// wurde dieses Objekt ersetzt ??
- if( bEraseThisObject )
+ if (bEraseThisObject)
{
if( pGroupObject || (pSdrTextObj != pTrueObject) )
{
@@ -2814,6 +2797,7 @@ void SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject,
// und FrameFormat entfernen, da durch Grafik ersetzt (dies
// loescht auch das Objekt)
rDoc.DelFrmFmt( pRetFrmFmt );
+ pRetFrmFmt = 0;
// auch den Objektmerker loeschen
pRecord->pObj = 0;
}
@@ -2830,6 +2814,7 @@ void SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject,
pSdrTextObj->SetItemSetAndBroadcast(aItemSet);
}
}
+ return pRetFrmFmt;
}
SwFlyFrmFmt* SwWW8ImplReader::ConvertDrawTextToFly(SdrObject* &rpObject,
@@ -2903,10 +2888,9 @@ SwFlyFrmFmt* SwWW8ImplReader::ConvertDrawTextToFly(SdrObject* &rpObject,
contact object, while a raw rpOutNewObject stored here becomes
deleted and useless.
*/
- pMSDffManager->StoreShapeOrder( pF->nSpId,
+ pMSDffManager->StoreShapeOrder(pF->nSpId,
(((ULONG)pRecord->aTextId.nTxBxS) << 16) +
- pRecord->aTextId.nSequence, 0, pRetFrmFmt,
- nActSectionNo + bIsHeader ? 1 : 0 + bIsFooter ? 2 : 0 );
+ pRecord->aTextId.nSequence, 0, pRetFrmFmt);
// Das Kontakt-Objekt MUSS in die Draw-Page gesetzt werden, damit
// in SwWW8ImplReader::LoadDoc1() die Z-Order festgelegt werden
@@ -3015,7 +2999,7 @@ SwFlyFrmFmt* SwWW8ImplReader::ImportReplaceableDrawables( SdrObject* &rpObject,
SetAttributesAtGrfNode( pRecord, pRetFrmFmt, pF );
}
// mehrfaches Auftreten gleicher Grafik-Namen vermeiden
- aGrfNameGenerator.SetUniqueGraphName(pRetFrmFmt, aObjectName);
+ maGrfNameGenerator.SetUniqueGraphName(pRetFrmFmt, aObjectName);
}
//falls alles Ok, Zeiger auf neues Objekt ermitteln und Z-Order-Liste
//entsprechend korrigieren (oder Eintrag loeschen)
@@ -3135,3 +3119,5 @@ void SwWW8FltAnchorStack::Flush()
--nCnt;
}
}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8graf.hxx b/sw/source/filter/ww8/ww8graf.hxx
index d39a060a3fd4..c0e09d1efc95 100644
--- a/sw/source/filter/ww8/ww8graf.hxx
+++ b/sw/source/filter/ww8/ww8graf.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8graf.hxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: cmc $ $Date: 2002-12-12 10:16:26 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _WW8GRAF_HXX
@@ -121,3 +120,5 @@ public:
void WW8FSPAShadowToReal( WW8_FSPA_SHADOW* pFSPAS, WW8_FSPA* pPic );
#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 8bfb65e9a2da..e839f69147f3 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8graf2.cxx,v $
*
- * $Revision: 1.45 $
+ * $Revision: 1.46 $
*
- * last change: $Author: cmc $ $Date: 2002-12-12 10:16:26 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -269,6 +268,7 @@ void wwZOrderer::InsertDrawingObject(SdrObject* pObj, short nWwHeight)
void wwZOrderer::InsertTextLayerObject(SdrObject* pObject)
{
+ pObject->SetLayer(mnHeaven);
if (maIndexes.empty())
{
InsertObject(pObject, mnNoInitialObjects + mnInlines);
@@ -319,7 +319,7 @@ ULONG wwZOrderer::GetDrawingObjectPos(short nWwHeight)
bool wwZOrderer::InsertObject(SdrObject* pObject, ULONG nPos)
{
- if (!mpDrawPg->IsInserted())
+ if (!pObject->IsInserted())
{
mpDrawPg->InsertObject(pObject, nPos);
return true;
@@ -876,9 +876,7 @@ SwFrmFmt* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj,
pRet = InsertOle(*((SdrOle2Obj*)pObject),aAttrSet);
else
{
- SdrGrafObj* pGraphObject = 0;
- pGraphObject = PTR_CAST(SdrGrafObj, pObject);
- if( pGraphObject )
+ if (SdrGrafObj* pGraphObject = PTR_CAST(SdrGrafObj, pObject))
{
// Nun den Link bzw. die Grafik ins Doc stopfen
const Graphic& rGraph = pGraphObject->GetGraphic();
@@ -925,6 +923,8 @@ SwFrmFmt* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj,
}
}
}
+ else
+ pRet = rDoc.Insert(*pPaM, *pObject, &aAttrSet);
}
// also nur, wenn wir ein *Insert* gemacht haben
if (pRet)
@@ -935,21 +935,23 @@ SwFrmFmt* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj,
if (pObject->HasSetName())
pRet->SetName(pObject->GetName());
else
- aGrfNameGenerator.SetUniqueGraphName(pRet,aObjectName);
+ maGrfNameGenerator.SetUniqueGraphName(pRet,aObjectName);
// Zeiger auf neues Objekt ermitteln und Z-Order-Liste
// entsprechend korrigieren (oder Eintrag loeschen)
- SdrObject* pOurNewObject = CreateContactObject(pRet);
- if (pOurNewObject)
+ if (SdrObject* pOurNewObject = CreateContactObject(pRet))
{
- pMSDffManager->ExchangeInShapeOrder( pObject, 0, 0,
- pOurNewObject );
-
- // altes SdrGrafObj aus der Page loeschen und
- // zerstoeren
- if (pObject->GetPage())
- pDrawPg->RemoveObject(pObject->GetOrdNum());
- delete pObject;
+ if (pOurNewObject != pObject)
+ {
+ pMSDffManager->ExchangeInShapeOrder( pObject, 0, 0,
+ pOurNewObject );
+
+ // altes SdrGrafObj aus der Page loeschen und
+ // zerstoeren
+ if (pObject->GetPage())
+ pDrawPg->RemoveObject(pObject->GetOrdNum());
+ delete pObject;
+ }
}
else
pMSDffManager->RemoveFromShapeOrder( pObject );
@@ -961,7 +963,7 @@ SwFrmFmt* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj,
if (pTextObj && !bTextObjWasGrouped && pTextObj->GetPage())
pDrawPg->RemoveObject( pTextObj->GetOrdNum() );
}
- pMSDffManager->EnableFallbackStream();
+ pMSDffManager->EnableFallbackStream();
}
else if (aPic.lcb >= 58)
pRet = ImportGraf1(aPic, pDataStream, nPicLocFc);
@@ -1041,3 +1043,5 @@ void WW8FSPAShadowToReal( WW8_FSPA_SHADOW * pFSPAS, WW8_FSPA * pFSPA )
pFSPA->nTxbx = SVBT32ToLong( pFSPAS->nTxbx );
}
#endif // defined __WW8_NEEDS_COPY
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index bfe106dcfc40..cd6912e468c8 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par.cxx,v $
*
- * $Revision: 1.102 $
+ * $Revision: 1.103 $
*
- * last change: $Author: aidan $ $Date: 2002-12-10 15:51:51 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -228,6 +227,9 @@
#ifndef _UNODRAW_HXX
#include <unodraw.hxx>
#endif
+#ifndef _SWTABLE_HXX
+#include <swtable.hxx> // class SwTableLines, ...
+#endif
#ifndef _COM_SUN_STAR_I18N_FORBIDDENCHARACTERS_HPP_
#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
@@ -265,23 +267,19 @@ SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr )
UINT32 SwMSDffManager::GetFilterFlags()
{
- UINT32 nFlags = 0;
- const OfaFilterOptions* pOpt = OFF_APP()->GetFilterOptions();
- if( pOpt->IsMathType2Math() )
- nFlags |= OLE_MATHTYPE_2_STARMATH;
-/*
- // !! don't convert the OLE-Object into the own format
- if( pOpt->IsWinWord2Writer() )
- nFlags |= OLE_WINWORD_2_STARWRITER;
-*/
- if( pOpt->IsExcel2Calc() )
- nFlags |= OLE_EXCEL_2_STARCALC;
- if( pOpt->IsPowerPoint2Impress() )
- nFlags |= OLE_POWERPOINT_2_STARIMPRESS;
+ UINT32 nFlags(0);
+ if (const OfaFilterOptions* pOpt = OFF_APP()->GetFilterOptions())
+ {
+ if (pOpt->IsMathType2Math())
+ nFlags |= OLE_MATHTYPE_2_STARMATH;
+ if (pOpt->IsExcel2Calc())
+ nFlags |= OLE_EXCEL_2_STARCALC;
+ if (pOpt->IsPowerPoint2Impress())
+ nFlags |= OLE_POWERPOINT_2_STARIMPRESS;
+ }
return nFlags;
}
-
/*
* I would like to override the default OLE importing to add a test
* and conversion of OCX controls from their native OLE type into our
@@ -771,8 +769,8 @@ void SwWW8ImplReader::ImportDop()
{
DateTime aLastPrinted(
WW8ScannerBase::WW8DTTM2DateTime(pWDop->dttmLastPrint));
- SfxDocumentInfo* pNeuDocInf = new SfxDocumentInfo(*rDoc.GetpInfo());
- SfxStamp aPrinted(pNeuDocInf->GetPrinted());
+ SfxDocumentInfo aNeuDocInf(*rDoc.GetpInfo());
+ SfxStamp aPrinted(aNeuDocInf.GetPrinted());
if (aPrinted.GetTime() != aLastPrinted)
{
// check if WW8 date was set
@@ -785,9 +783,8 @@ void SwWW8ImplReader::ImportDop()
else
aPrinted.SetTime( aLastPrinted );
- pNeuDocInf->SetPrinted( aPrinted );
- rDoc.SetInfo( *pNeuDocInf );
- delete pNeuDocInf;
+ aNeuDocInf.SetPrinted( aPrinted );
+ rDoc.SetInfo(aNeuDocInf);
}
}
@@ -879,12 +876,9 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp)
mpSFlyPara(pRdr->pSFlyPara), mpTableDesc(pRdr->pTableDesc),
mnInTable(pRdr->nInTable), mnAktColl(pRdr->nAktColl),
mcSymbol(pRdr->cSymbol), mbIgnoreText(pRdr->bIgnoreText),
- mbDontCreateSep(pRdr->bDontCreateSep), mbSymbol(pRdr->bSymbol),
- mbHdFtFtnEdn(pRdr->bHdFtFtnEdn), mbTxbxFlySection(pRdr->bTxbxFlySection),
- mbAnl(pRdr->bAnl), mbInHyperlink(pRdr->bInHyperlink),
- mbPgSecBreak(pRdr->bPgSecBreak),
- //Honestly should inherit this from parent environment so don't reset this
- mbVerticalEnviron(pRdr->bVerticalEnviron),
+ mbSymbol(pRdr->bSymbol), mbHdFtFtnEdn(pRdr->bHdFtFtnEdn),
+ mbTxbxFlySection(pRdr->bTxbxFlySection), mbAnl(pRdr->bAnl),
+ mbInHyperlink(pRdr->bInHyperlink), mbPgSecBreak(pRdr->bPgSecBreak),
mbWasParaEnd(pRdr->bWasParaEnd), mbHasBorder(pRdr->bHasBorder)
{
pRdr->bHdFtFtnEdn = true;
@@ -906,13 +900,17 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp)
// rette die Attributverwaltung: dies ist noetig, da der neu anzulegende
// PLCFx Manager natuerlich auf die gleichen FKPs zugreift, wie der alte
// und deren Start-End-Positionen veraendert...
- pRdr->pPlcxMan->SaveAllPLCFx(maPLCFxSave);
+ if (pRdr->pPlcxMan)
+ pRdr->pPlcxMan->SaveAllPLCFx(maPLCFxSave);
if (nStartCp != -1)
{
pRdr->pPlcxMan = new WW8PLCFMan(pRdr->pSBase,
mpOldPlcxMan->GetManType(), nStartCp);
}
+
+ maOldApos.push_back(false);
+ maOldApos.swap(pRdr->maApos);
}
void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr )
@@ -923,13 +921,11 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr )
pRdr->cSymbol = mcSymbol;
pRdr->bSymbol = mbSymbol;
pRdr->bIgnoreText = mbIgnoreText;
- pRdr->bDontCreateSep = mbDontCreateSep;
pRdr->bHdFtFtnEdn = mbHdFtFtnEdn;
pRdr->bTxbxFlySection = mbTxbxFlySection;
pRdr->nInTable = mnInTable;
pRdr->bAnl = mbAnl;
pRdr->bInHyperlink = mbInHyperlink;
- pRdr->bVerticalEnviron = mbVerticalEnviron;
pRdr->bWasParaEnd = mbWasParaEnd;
pRdr->bPgSecBreak = mbPgSecBreak;
pRdr->nAktColl = mnAktColl;
@@ -954,7 +950,9 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr )
delete pRdr->pPlcxMan;
pRdr->pPlcxMan = mpOldPlcxMan;
}
- pRdr->pPlcxMan->RestoreAllPLCFx(maPLCFxSave);
+ if (pRdr->pPlcxMan)
+ pRdr->pPlcxMan->RestoreAllPLCFx(maPLCFxSave);
+ pRdr->maApos.swap(maOldApos);
}
void SwWW8ImplReader::Read_HdFtFtnText( const SwNodeIndex* pSttIdx,
@@ -1044,38 +1042,17 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
return 0;
}
-//-----------------------------------------
-// Header und Footer
-//-----------------------------------------
-
-void SwWW8ImplReader::Read_HdFtText(long nStartCp, long nLen, SwPageDesc* pPD,
- bool bUseLeft, bool bFooter)
+void SwWW8ImplReader::Read_HdFtText(long nStart, long nLen, SwFrmFmt* pHdFtFmt)
{
- SwFrmFmt* pFmt = ( bUseLeft ) ? &pPD->GetLeft() : &pPD->GetMaster();
- SwFrmFmt* pHdFtFmt;
-
- if( bFooter )
- {
- bIsFooter = true;
- pFmt->SetAttr(SwFmtFooter(true));
- pHdFtFmt = (SwFrmFmt*)pFmt->GetFooter().GetFooterFmt();
- }else
- {
- bIsHeader = true;
- pFmt->SetAttr(SwFmtHeader(true));
- pHdFtFmt = (SwFrmFmt*)pFmt->GetHeader().GetHeaderFmt();
- }
-
const SwNodeIndex* pSttIdx = pHdFtFmt->GetCntnt().GetCntntIdx();
if (!pSttIdx)
return;
SwPosition aTmpPos( *pPaM->GetPoint() ); // merke alte Cursorposition
- Read_HdFtFtnText( pSttIdx, nStartCp, nLen - 1, MAN_HDFT );
+ Read_HdFtFtnText(pSttIdx, nStart, nLen - 1, MAN_HDFT);
*pPaM->GetPoint() = aTmpPos;
- bIsHeader = bIsFooter = false;
}
BYTE SwWW8ImplReader::HdFtCorrectPara( BYTE nPara )
@@ -1084,7 +1061,8 @@ BYTE SwWW8ImplReader::HdFtCorrectPara( BYTE nPara )
long nLen;
BYTE nNewPara = nPara;
- for( BYTE nI = 0x20; nI; nI >>= 1 )
+ for (BYTE nI = 0x20; nI; nI >>= 1)
+ {
if( ( nI & nPara )
&& pHdFt
&& ( !pHdFt->GetTextPos( nPara, nI, start, nLen ) || nLen <= 2 ) )
@@ -1092,13 +1070,15 @@ BYTE SwWW8ImplReader::HdFtCorrectPara( BYTE nPara )
{
nNewPara &= ~nI; // leere KF-Texte nicht anlegen
}
+ }
// Wenn im Doc keine Facing Pages vorhanden sind, sollen
// die geraden Header/Footer ignoriert werden.
// Die Facing Pages lassen sich nur Doc-weit,
// nicht aber abschnittsweise umschalten !
if( pWDop->fFacingPages )
- { // Wenn pDoc->FacingPages
+ {
+ // Wenn pDoc->FacingPages
// if( nNewPara & WW8_HEADER_ODD ) // und ungerader Header vorhanden
// nNewPara |= WW8_HEADER_EVEN; // ... dann muss auch ein gerader
// Header erzeugt werden
@@ -1112,7 +1092,8 @@ BYTE SwWW8ImplReader::HdFtCorrectPara( BYTE nPara )
return nNewPara;
}
-void SwWW8ImplReader::Read_HdFt1( BYTE nPara, BYTE nWhichItems, SwPageDesc* pPD )
+void SwWW8ImplReader::Read_HdFt(BYTE nWhichItems, int nSect, SwPageDesc* pPD,
+ const SwPageDesc *pPrev)
{
if( pHdFt )
{
@@ -1121,83 +1102,73 @@ void SwWW8ImplReader::Read_HdFt1( BYTE nPara, BYTE nWhichItems, SwPageDesc* pPD
BYTE nNumber = 5;
for( BYTE nI = 0x20; nI; nI >>= 1, nNumber-- )
- if( nI & nWhichItems )
+ {
+ if (nI & nWhichItems)
{
bool bOk = true;
if( bVer67 )
- bOk = ( pHdFt->GetTextPos( nPara, nI, start, nLen ) && nLen >= 2 );
+ bOk = ( pHdFt->GetTextPos( nWhichItems, nI, start, nLen ) && nLen >= 2 );
else
{
- pHdFt->GetTextPosExact(nNumber+ (nActSectionNo+1)*6, start, nLen);
+ pHdFt->GetTextPosExact(nNumber + (nSect+1)*6, start, nLen);
bOk = ( 2 <= nLen );
}
- if( bOk )
+
+ bool bUseLeft
+ = (nI & ( WW8_HEADER_EVEN | WW8_FOOTER_EVEN )) ? true: false;
+ bool bFooter
+ = (nI & ( WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST )) ? true: false;
+
+ SwFrmFmt* pFmt = bUseLeft ? &pPD->GetLeft() : &pPD->GetMaster();
+ SwFrmFmt* pHdFtFmt;
+ if (bFooter)
+ {
+ bIsFooter = true;
+ pFmt->SetAttr(SwFmtFooter(true));
+ pHdFtFmt = (SwFrmFmt*)pFmt->GetFooter().GetFooterFmt();
+ }
+ else
{
- bool bUseLeft
- = (nI & ( WW8_HEADER_EVEN | WW8_FOOTER_EVEN )) ? true: false;
- bool bFooter
- = (nI & ( WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST )) ? true: false;
- Read_HdFtText( start, nLen, pPD, bUseLeft, bFooter );
+ bIsHeader = true;
+ pFmt->SetAttr(SwFmtHeader(true));
+ pHdFtFmt = (SwFrmFmt*)pFmt->GetHeader().GetHeaderFmt();
}
+
+ if (bOk)
+ Read_HdFtText(start, nLen, pHdFtFmt);
+ else if (!bOk && pPrev)
+ CopyPageDescHdFt(pPrev, pPD, nI);
+
+ bIsHeader = bIsFooter = false;
}
+ }
}
}
-void SwWW8ImplReader::SetHdFt( SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1,
- BYTE nIPara )
+void wwSectionManager::SetHdFt(wwSection &rSection, int nSect,
+ const wwSection *pPrevious)
{
-
- // Header / Footer nicht da oder StyleDef
- if( !nCorrIhdt || ( pAktColl != 0 ) )
+ // Header / Footer nicht da
+ if (!rSection.maSep.grpfIhdt)
return;
- long nOldDoc = pStrm->Tell( ); // WW-Scanner: alles retten
- long nOldTbl = pTableStream->Tell(); // WW-Scanner: alles retten
- WW8PLCFxSaveAll aSave;
- pPlcxMan->SaveAllPLCFx( aSave ); // Attributverwaltung sichern
- WW8PLCFMan* pOldPlcxMan = pPlcxMan;
-
- if( !pPageDesc1 ){ // 1 Pagedesc reicht
-
- Read_HdFt1( nIPara,
- nCorrIhdt & ~( WW8_HEADER_FIRST | WW8_FOOTER_FIRST ),
- pPageDesc0 );
-
- }else{ // 2 Pagedescs noetig: 1.Seite und folgende
-
-
- // 1. Seite einlesen
- Read_HdFt1( nIPara,
- nCorrIhdt & ( WW8_HEADER_FIRST | WW8_FOOTER_FIRST ),
- pPageDesc0 );
+ ASSERT(rSection.mpPage, "makes no sense to call with a main page");
+ if (rSection.mpPage)
+ {
+ // 1 Pagedesc reicht
+ mrReader.Read_HdFt(
+ rSection.maSep.grpfIhdt & ~(WW8_HEADER_FIRST | WW8_FOOTER_FIRST),
+ nSect, rSection.mpPage, pPrevious ? pPrevious->mpPage : 0);
- // Folgeseiten einlesen
- Read_HdFt1( nIPara,
- nCorrIhdt & ~( WW8_HEADER_FIRST | WW8_FOOTER_FIRST ),
- pPageDesc1 );
}
- // dann WW-Scanner-Kram restoren
- pPlcxMan = pOldPlcxMan; // Attributverwaltung restoren
- pPlcxMan->RestoreAllPLCFx( aSave );
- pStrm->Seek( nOldDoc ); // FilePos dito (Sprms)
- pTableStream->Seek( nOldTbl ); // FilePos dito (Sprms)
-}
-
-//-----------------------------------------
-// PageDescs
-//-----------------------------------------
-
-void SwWW8ImplReader::SetLastPgDeskIdx()
-{
- if( 0 == pWDop->epc // store NodeIndex for adding section when FT-/End-Note
- || 2 == pWDop->fpc ) // found that shall be on end of section.
+ if (rSection.mpTitlePage)
{
- if( pLastPgDeskIdx )
- *pLastPgDeskIdx = pPaM->GetPoint()->nNode;
- else
- pLastPgDeskIdx = new SwNodeIndex( pPaM->GetPoint()->nNode );
- (*pLastPgDeskIdx)--;
+ // 2 Pagedescs noetig: 1.Seite und folgende
+ // 1. Seite einlesen
+ mrReader.Read_HdFt(
+ rSection.maSep.grpfIhdt & (WW8_HEADER_FIRST | WW8_FOOTER_FIRST),
+ nSect, rSection.mpTitlePage, pPrevious ? pPrevious->mpTitlePage : 0);
}
}
@@ -1263,7 +1234,9 @@ void SwWW8ImplReader::AppendTxtNode(SwPosition& rPos)
{
//Give ourselves a leeway of 1 twip.
if ((*pTabStop)[nI].GetTabPos() + pLR->GetTxtLeft() + 1
- >= nPgWidth-nPgRight-nPgLeft)
+ >= maSectionManager.GetPageWidth()
+ - maSectionManager.GetPageRight()
+ - maSectionManager.GetPageLeft())
{
pPaM->SetMark();
pPaM->GetMark()->nContent-=nDiff;
@@ -1281,131 +1254,41 @@ void SwWW8ImplReader::AppendTxtNode(SwPosition& rPos)
pAnchorStck->Flush();
}
-SwPageDesc* SwWW8ImplReader::CreatePageDesc(SwPageDesc* pFirstPageDesc,
- SwPaM** ppPaMWanted)
+USHORT SwWW8ImplReader::TabRowSprm(int nLevel) const
{
- ASSERT(pFirstPageDesc || ppPaMWanted, "!pFirstPageDesc but NO ppPaMWanted");
-
- bool bFollow = ( pFirstPageDesc != 0 );
- SwPageDesc* pNewPD;
- USHORT nPos;
-
- if( bFollow
- && pFirstPageDesc->GetFollow() != pFirstPageDesc )
- return pFirstPageDesc; // Fehler: hat schon Follow
-
- // compose name of PageDescriptor
- USHORT nPageDescCount = rDoc.GetPageDescCnt();
- nPos = rDoc.MakePageDesc(
- ViewShell::GetShellRes()->GetPageDescName(nPageDescCount,false,bFollow),
- bFollow ? pFirstPageDesc : 0, false);
-
- pNewPD = &rDoc._GetPageDesc( nPos );
-
- if (bFollow)
- {
- // Dieser ist der folgende von pPageDesc
- pFirstPageDesc->SetFollow( pNewPD );
- pNewPD->SetFollow( pNewPD );
- }
- else
- {
- // setze PgDesc-Attr ins Doc
- if (InAnyApo() || bTxbxFlySection)
- {
- // PageDesc *muss* ausserhalb des Apo stehen
- if( pSFlyPara && pSFlyPara->pMainTextPos )
- {
- SwPaM aMyPaM( *pSFlyPara->GetMainTextPos() );
- if( 1 < nPageDescCount )
- AppendTxtNode( *aMyPaM.GetPoint() );
- SwFmtCol* pCol;
- RemoveCols( *pNewPD, pCol );
- rDoc.Insert( aMyPaM, SwFmtPageDesc( pNewPD ) );
- if( ppPaMWanted )
- *ppPaMWanted = new SwPaM( aMyPaM );
- if( pCol )
- {
- InsertSectionWithWithoutCols( aMyPaM, pCol );
- delete pCol;
- }
- else
- SetLastPgDeskIdx();
- }
- }
- else
- {
- if( 0 < pPaM->GetPoint()->nContent.GetIndex() )
- AppendTxtNode( *pPaM->GetPoint() );
- SwFmtCol* pCol;
- RemoveCols( *pNewPD, pCol );
- if( ppPaMWanted )
- *ppPaMWanted = new SwPaM( *pPaM );
-
- rDoc.Insert( *pPaM, SwFmtPageDesc( pNewPD ) );
- if( pCol )
- {
- InsertSectionWithWithoutCols( *pPaM, pCol );
- delete pCol;
- }
- else
- SetLastPgDeskIdx();
- }
- }
- return pNewPD;
+ if (bVer67)
+ return 25;
+ return nLevel ? 0x244C : 0x2417;
}
-// UpdatePageDescs muss am Ende des Einlesevorganges aufgerufen werden, damit
-// der Writer den Inhalt der Pagedescs wirklich akzeptiert
-void SwWW8ImplReader::UpdatePageDescs(USHORT nInPageDescOffset)
+void SwWW8ImplReader::EndSpecial()
{
- USHORT i;
-
- // Pagedescriptoren am Dokument updaten (nur so werden auch die
- // linken Seiten usw. eingestellt).
-
- // PageDesc "Standard"
- rDoc.ChgPageDesc( 0, rDoc.GetPageDesc( 0 ));
+ // Frame / Table / Anl
+ if (bAnl)
+ StopAnl(); // -> bAnl = false
- // PageDescs "Konvert..."
- for ( i=nInPageDescOffset; i < rDoc.GetPageDescCnt(); i++ )
+ while(maApos.size() > 1)
{
- const SwPageDesc* pPD = &rDoc.GetPageDesc( i );
- rDoc.ChgPageDesc( i, *pPD );
+ StopTable();
+ maApos.pop_back();
+ --nInTable;
+ if (maApos[nInTable] == true)
+ StopApo();
}
-}
-USHORT SwWW8ImplReader::TabRowSprm(int nLevel) const
-{
- if (bVer67)
- return 25;
- return nLevel ? 0x244C : 0x2417;
+ if (maApos[0] == true)
+ StopApo();
+
+ ASSERT(!nInTable, "unclosed table!");
}
-bool SwWW8ImplReader::ProcessSpecial(bool bAllEnd, bool* pbReSync,
- WW8_CP nStartCp) // Frame / Table / Anl
+bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
{
+ // Frame / Table / Anl
if (bInHyperlink)
return false;
- *pbReSync = false;
- if (bAllEnd)
- {
- if( bAnl )
- StopAnl(); // -> bAnl = false
-#if 1 //revisit
- ASSERT(!nInTable, "unclosed table!");
- ASSERT(maApos.size() == 1, "unclosed apo environments!");
-#else
- if( nInTable && !bFtnEdn ) // Tabelle in FtnEdn nicht erlaubt
- StopTable();
- if( bApo )
- StopApo();
- --nInTable;
- bApo = false;
-#endif
- return false;
- }
+ rbReSync = false;
ASSERT(nInTable >= 0,"nInTable < 0!");
@@ -1455,7 +1338,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool bAllEnd, bool* pbReSync,
{
WW8PLCFxSave1 aSave;
pPlcxMan->GetPap()->Save( aSave );
- *pbReSync = true;
+ rbReSync = true;
WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
WW8_CP nMyStartCp=nStartCp;
@@ -1533,7 +1416,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool bAllEnd, bool* pbReSync,
maApos[nInTable] = StartApo(pSprm29, pNowStyleApo, pTabPos);
// nach StartApo ist ein ReSync noetig ( eigentlich nur, falls die Apo
// ueber eine FKP-Grenze geht
- *pbReSync = true;
+ rbReSync = true;
}
if (bStartTab)
{
@@ -1547,7 +1430,7 @@ bool SwWW8ImplReader::ProcessSpecial(bool bAllEnd, bool* pbReSync,
}
// nach StartTable ist ein ReSync noetig ( eigentlich nur, falls die
// Tabelle ueber eine FKP-Grenze geht
- *pbReSync = true;
+ rbReSync = true;
}
return bTableRowEnd;
}
@@ -1750,7 +1633,11 @@ bool SwWW8ImplReader::ReadChars(long& rPos, long nNextAttr, long nTextEnd,
while (true)
{
if (ReadPlainChars(rPos, nEnd, nCpOfs))
- return false; // Fertig, kein CR
+ {
+ if (!maApos.back()) //a para end in apo doesn't count
+ bWasParaEnd = false; //kein CR
+ return false; // Fertig
+ }
bool bStartLine = ReadChar(rPos, nCpOfs);
rPos++;
@@ -1761,6 +1648,7 @@ bool SwWW8ImplReader::ReadChars(long& rPos, long nNextAttr, long nTextEnd,
bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
{
+ bool bNewParaEnd = false;
// Unicode-Flag neu setzen und notfalls File-Pos korrigieren
// merke: Seek kostet nicht viel, da inline geprueft wird,
// ob die korrekte FilePos nicht schon erreicht ist.
@@ -1821,6 +1709,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
}
break;
case 0x7:
+ bNewParaEnd = true;
TabCellEnd(); // table cell end (Flags abfragen!)
break;
case 0xf:
@@ -1921,7 +1810,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
}
break;
case 0xd:
- bRet = true;
+ bNewParaEnd = bRet = true;
if (nInTable > 1)
{
WW8PLCFspecial* pTest = pPlcxMan->GetMagicTables();
@@ -1955,6 +1844,8 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
RTL_TEXTENCODING_MS_1252 );
AddTextToParagraph(sInsert);
}
+ if (!maApos.back()) //a para end in apo doesn't count
+ bWasParaEnd = bNewParaEnd;
return bRet;
}
@@ -1982,8 +1873,7 @@ void SwWW8ImplReader::ProcessAktCollChange(WW8PLCFManResult& rRes,
{
bool bReSync;
// Frame / Table / Autonumbering List Level
- bTabRowEnd = ProcessSpecial(false, &bReSync,
- rRes.nAktCp + pPlcxMan->GetCpOfs() );
+ bTabRowEnd = ProcessSpecial(bReSync, rRes.nAktCp+pPlcxMan->GetCpOfs());
if( bReSync )
*pStartAttr = pPlcxMan->Get( &rRes ); // hole Attribut-Pos neu
}
@@ -2009,7 +1899,8 @@ long SwWW8ImplReader::ReadTextAttr(long& rTxtPos, bool& rbStartLine)
if (aRes.nFlags & MAN_MASK_NEW_SEP) // neue Section
{
ASSERT(pPaM->GetNode()->GetTxtNode(), "Missing txtnode");
- CreateSep( rTxtPos, bPgSecBreak ); // PageDesc erzeugen und fuellen
+ // PageDesc erzeugen und fuellen
+ maSectionManager.CreateSep(rTxtPos, bPgSecBreak);
// -> 0xc war ein Sectionbreak, aber
// kein Pagebreak;
bPgSecBreak = false; // PageDesc erzeugen und fuellen
@@ -2027,7 +1918,6 @@ long SwWW8ImplReader::ReadTextAttr(long& rTxtPos, bool& rbStartLine)
// position of last CP that's to be ignored
long nSkipPos = -1;
- bool bOldDontCreateSep = bDontCreateSep;
if( 0 < aRes.nSprmId ) // leere Attrs ignorieren
{
@@ -2064,7 +1954,7 @@ long SwWW8ImplReader::ReadTextAttr(long& rTxtPos, bool& rbStartLine)
pStrm->Seek(pSBase->WW8Cp2Fc( pPlcxMan->GetCpOfs() + rTxtPos, &bIsUnicode));
// Find next Attr position (and Skip attributes of field contents if needed)
- if( nSkipChars && !bIgnoreText )
+ if (nSkipChars && !bIgnoreText)
pCtrlStck->MarkAllAttrsOld();
bool bOldIgnoreText = bIgnoreText;
bIgnoreText = true;
@@ -2085,7 +1975,6 @@ long SwWW8ImplReader::ReadTextAttr(long& rTxtPos, bool& rbStartLine)
}
while( nSkipPos >= nNext );
bIgnoreText = bOldIgnoreText;
- bDontCreateSep = bOldDontCreateSep;
if( nSkipChars )
{
pCtrlStck->KillUnlockedAttrs( *pPaM->GetPoint() );
@@ -2139,8 +2028,7 @@ void SwWW8ImplReader::CloseAttrEnds()
aStack.pop();
}
- bool bDummyReSync;
- ProcessSpecial(true, &bDummyReSync, -1);
+ EndSpecial();
}
bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, short nType)
@@ -2166,28 +2054,6 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, short nType)
pStrm->Seek( pSBase->WW8Cp2Fc( nStartCp + nCpOfs, &bIsUnicode ) );
- if ( (0 == nStartCp+nCpOfs) && SetCols(0, pPlcxMan->GetSepPLCF(), 0, true) )
- {
- // Start of text:
- //
- // look for cols and insert a section at the very beginning...
- if( !pPageDesc )
- pPageDesc = &rDoc._GetPageDesc( 0 );
- SwFrmFmt &rFmt = pPageDesc->GetMaster();
- USHORT nLIdx = ( ( pWwFib->lid & 0xff ) == 0x9 ) ? 1 : 0;
- SetPage1( pPageDesc, rFmt, pPlcxMan->GetSepPLCF(), nLIdx, false);
- const SwFmtCol& rCol = rFmt.GetCol();
- // if PageDesc has been inserted and has cols
- // insert a *section* with cols instead
- if( rCol.GetNumCols() )
- {
- InsertSectionWithWithoutCols( *pPaM, &rCol );
- // remove columns from PageDesc
- SwFmtCol aCol;
- rFmt.SetAttr( aCol );
- }
- }
-
WW8_CP l = nStartCp;
while ( l<nStartCp+nTextLen )
{
@@ -2198,7 +2064,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, short nType)
if( l>= nStartCp + nTextLen )
break;
- bStartLine = bWasParaEnd = ReadChars(l, nNext, nStartCp+nTextLen, nCpOfs);
+ bStartLine = ReadChars(l, nNext, nStartCp+nTextLen, nCpOfs);
if (bStartLine) // Zeilenende
AppendTxtNode(*pPaM->GetPoint());
@@ -2217,7 +2083,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, short nType)
// pagebreak then look it up to see if it is a section break, and
// if it is not then insert a page break. If it is a section break
// it will be handled as such in the ReadAttrs of the next loop
- if( bPgSecBreak)
+ if (bPgSecBreak)
{
// We need only to see if a section is ending at this cp,
// the plcf will already be sitting on the correct location
@@ -2228,29 +2094,8 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, short nType)
pPlcxMan->GetSepPLCF()->GetSprms(&aTemp);
if ((aTemp.nStartPos != l) && (aTemp.nEndPos != l))
{
- /*
- #74468#, ##515##
- Insert additional node only WHEN the Pagebreak is contained in
- a NODE that is NOT EMPTY. Word can have empty paragraphs with
- numbering information before a section break that are not
- closed before the section break. In this case they are ignored
- and not numbered, this is 74468's problem. But word can have
- open paragraphs that only contain a node that in word can be
- anchored, i.e. a single character indicating that a graphic or
- an ole node or a text box is anchored here. In this case then
- we should close the paragraph to ensure that it is is anchored
- to the current page, and not pushed to the next page, this is
- 515's problem. nLastFlyNode is set on insertion of 0x01 and
- 0x08 graphics as well as on insertion of old ww6 textboxes.
- */
- SwPosition& rPt = *pPaM->GetPoint();
- if ( (nLastFlyNode == rPt.nNode.GetIndex())
- || (0 < rPt.nContent.GetIndex()) )
- {
- AppendTxtNode( rPt );
- }
-
- rDoc.Insert( *pPaM, SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE ) );
+// AppendTxtNode(*pPaM->GetPoint());
+ rDoc.Insert(*pPaM, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE));
bPgSecBreak = false;
}
}
@@ -2262,10 +2107,8 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, short nType)
CloseAttrEnds();
if (!bInHyperlink)
bJoined = JoinNode(*pPaM);
- if( nType == MAN_MAINTEXT )
- UpdatePageDescs( nPageDescOffset ); // muss passieren, solange es den
// PlcxMan noch gibt
- DELETEZ( pPlcxMan );
+ delete pPlcxMan, pPlcxMan = 0;
return bJoined;
}
@@ -2276,9 +2119,9 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, short nType)
SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage,
SvStream* pSt, SwDoc& rD, bool bNewDoc)
: pStg(pStorage), pStrm(pSt), pTableStream(0), pDataStream(0), rDoc(rD),
- aGrfNameGenerator(bNewDoc,String('G')), pMSDffManager(0), mpAtnNames(0),
- pAuthorInfos(0), pOleMap(0), pTabNode(0), pLastPgDeskIdx(0),
- mbNewDoc(bNewDoc)
+ maSectionManager(*this), maSectionNameGenerator(rD,CREATE_CONST_ASC("WW")),
+ maGrfNameGenerator(bNewDoc,String('G')), pMSDffManager(0), mpAtnNames(0),
+ pAuthorInfos(0), pOleMap(0), pTabNode(0), mbNewDoc(bNewDoc)
{
pStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
nWantedVersion = nVersionPara;
@@ -2303,29 +2146,22 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage,
nObjLocFc = nPicLocFc = 0;
nInTable=0;
bReadNoTbl = bPgSecBreak = bSpec = bObj = bTxbxFlySection
- = bHasBorder = bSymbol = bIgnoreText = bDontCreateSep
+ = bHasBorder = bSymbol = bIgnoreText
= bWasTabRowEnd = false;
bShdTxtCol = bCharShdTxtCol = bAnl = bHdFtFtnEdn = bFtnEdn
- = bIsHeader = bIsFooter = bSectionHasATitlePage
- = bIsUnicode = bCpxStyle = bStyNormal = bWWBugNormal = false;
+ = bIsHeader = bIsFooter = bIsUnicode = bCpxStyle = bStyNormal =
+ bWWBugNormal = false;
bNoAttrImport = bPgChpLevel = bEmbeddObj = false;
bAktAND_fNumberAcross = false;
bNoLnNumYet = true;
- bRestartLnNumPerSection = false;
bInHyperlink = false;
- bVerticalEnviron = false;
bWasParaEnd = false;
nProgress = 0;
- nPgWidth = lA4Width;
- nPgLeft = nPgRight = nPgTop = MM_250;
- nCorrIhdt = 0;
nSwNumLevel = nWwNumType = 0xff;
pTableDesc = 0;
pNumRule = 0;
pNumOlst = 0;
- pAfterSection = 0;
- pLastInsertedSection = 0;
pNode_FLY_AT_CNTNT = 0;
pDrawModel = 0;
pDrawPg = 0;
@@ -2342,11 +2178,9 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage,
nLFOPosition = USHRT_MAX;
nListLevel = WW8ListManager::nMaxLevel;
- mbRTLPgn = false;
eHardCharSet = RTL_TEXTENCODING_DONTKNOW;
- pPageDesc = 0;
- nNfcPgn = nPgChpDelim = nPgChpLevel = 0;
+ nPgChpDelim = nPgChpLevel = 0;
maApos.push_back(false);
}
@@ -2365,6 +2199,231 @@ void SwWW8ImplReader::DeleteStk(SwFltControlStack* pStck)
}
}
+void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection,
+ bool bTitlePage, bool bIgnoreCols)
+{
+ SwPageDesc &rPage = bTitlePage ? *rSection.mpTitlePage : *rSection.mpPage;
+
+ SetNumberingType(rSection, rPage);
+
+ SwFrmFmt &rFmt = rPage.GetMaster();
+ mrReader.SetDocumentGrid(rFmt, rSection);
+
+ wwULSpaceData aULData;
+ GetPageULData(rSection, bTitlePage, aULData);
+ SetPageULSpaceItems(rFmt, aULData);
+
+ SetPage(rPage, rFmt, rSection, bIgnoreCols);
+}
+
+void wwSectionManager::SetUseOn(wwSection &rSection)
+{
+ bool bEven = (rSection.maSep.grpfIhdt & (WW8_HEADER_EVEN|WW8_FOOTER_EVEN)) ?
+ true : false;
+
+ UseOnPage eUseBase = mrReader.pWDop->fMirrorMargins ? PD_MIRROR : PD_ALL;
+ UseOnPage eUse = eUseBase;
+ if (!bEven)
+ eUse = (UseOnPage)(eUse | PD_HEADERSHARE | PD_FOOTERSHARE);
+
+ ASSERT(rSection.mpPage, "Makes no sense to call me with no pages to set");
+ if (rSection.mpPage)
+ rSection.mpPage->WriteUseOn(eUse);
+ if (rSection.mpTitlePage)
+ {
+ rSection.mpTitlePage->WriteUseOn(
+ (UseOnPage) (eUseBase | PD_HEADERSHARE | PD_FOOTERSHARE));
+ }
+}
+
+void wwSectionManager::InsertSegments(bool bIsNewDoc)
+{
+ sal_uInt16 nDesc(0);
+ mySegIter aEnd = maSegments.end();
+ mySegIter aStart = maSegments.begin();
+ for (mySegIter aIter = aStart; aIter != aEnd; ++aIter)
+ {
+ mySegIter aNext = aIter+1;
+
+ bool bInsertSection = aIter != aStart ? aIter->IsContinous() : false;
+
+ if (!bInsertSection)
+ {
+ /*
+ If a cont section follow this section then we won't be
+ creating a page desc with 2+ cols as we cannot host a one
+ col section in a 2+ col pagedesc and make it look like
+ word. But if the current section actually has columns then
+ we are forced to insert a section here as well as a page
+ descriptor.
+ */
+
+ /*
+ Note for the future:
+ If we want to import "protected sections" the here is
+ where we would also test for that and force a section
+ insertion if that was true.
+ */
+ bool bIgnoreCols = false;
+ if (aNext != aEnd && aNext->IsContinous())
+ {
+ bIgnoreCols = true;
+ if (aIter->NoCols() > 1)
+ bInsertSection = true;
+ }
+
+ if (aIter->maSep.fTitlePage)
+ {
+ if (bIsNewDoc && aIter == aStart)
+ {
+ aIter->mpTitlePage =
+ mrReader.rDoc.GetPageDescFromPool(RES_POOLPAGE_FIRST);
+ }
+ else
+ {
+ USHORT nPos = mrReader.rDoc.MakePageDesc(
+ ViewShell::GetShellRes()->GetPageDescName(nDesc)
+ , 0, false);
+ aIter->mpTitlePage = &mrReader.rDoc._GetPageDesc(nPos);
+ }
+ ASSERT(aIter->mpTitlePage, "no page!");
+ if (!aIter->mpTitlePage)
+ continue;
+
+ SetSegmentToPageDesc(*aIter, true, bIgnoreCols);
+ }
+
+ if (bIsNewDoc && aIter == aStart)
+ {
+ aIter->mpPage =
+ mrReader.rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD);
+ }
+ else
+ {
+ USHORT nPos = mrReader.rDoc.MakePageDesc(
+ ViewShell::GetShellRes()->GetPageDescName(nDesc,
+ false, aIter->maSep.fTitlePage),
+ aIter->mpTitlePage, false);
+ aIter->mpPage = &mrReader.rDoc._GetPageDesc(nPos);
+ }
+ ASSERT(aIter->mpPage, "no page!");
+ if (!aIter->mpPage)
+ continue;
+
+ const wwSection *pPrevious = 0;
+ if (aIter != aStart)
+ pPrevious = &(*(aIter-1));
+ SetHdFt(*aIter, std::distance(aStart, aIter), pPrevious);
+ SetUseOn(*aIter);
+
+ if (aIter->mpTitlePage)
+ SetSegmentToPageDesc(*aIter, true, bIgnoreCols);
+ SetSegmentToPageDesc(*aIter, false, bIgnoreCols);
+
+ SwFmtPageDesc aPgDesc(aIter->maSep.fTitlePage ?
+ aIter->mpTitlePage : aIter->mpPage);
+
+ if (aIter->mpTitlePage)
+ aIter->mpTitlePage->SetFollow(aIter->mpPage);
+
+ if (aIter->PageRestartNo())
+ aPgDesc.SetNumOffset(aIter->PageStartAt());
+
+ /*
+ If its a table here, apply the pagebreak to the table
+ properties, otherwise we add it to the para at this
+ position
+ */
+ if (aIter->maStart.GetNode().IsTableNode())
+ {
+ SwTable& rTable =
+ aIter->maStart.GetNode().GetTableNode()->GetTable();
+ SwFrmFmt* pApply = rTable.GetFrmFmt();
+ ASSERT(pApply, "impossible");
+ if (pApply)
+ pApply->SetAttr(aPgDesc);
+ }
+ else
+ {
+ SwPosition aPamStart(aIter->maStart);
+ aPamStart.nContent.Assign(
+ aIter->maStart.GetNode().GetCntntNode(), 0);
+ SwPaM aPage(aPamStart);
+
+ mrReader.rDoc.Insert(aPage, aPgDesc);
+ }
+ ++nDesc;
+ }
+
+ SwTxtNode* pTxtNd = 0;
+ if (bInsertSection)
+ {
+ SwPaM aSectPaM(*mrReader.pPaM);
+ SwNodeIndex aAnchor(aSectPaM.GetPoint()->nNode);
+ if (aNext != aEnd)
+ {
+ aAnchor = aNext->maStart;
+ aSectPaM.GetPoint()->nNode = aAnchor;
+ aSectPaM.GetPoint()->nContent.Assign(
+ aNext->maStart.GetNode().GetCntntNode(), 0);
+ aSectPaM.Move(fnMoveBackward);
+ }
+
+ const SwPosition* pPos = aSectPaM.GetPoint();
+ const SwTxtNode* pSttNd =
+ mrReader.rDoc.GetNodes()[ pPos->nNode ]->GetTxtNode();
+ const SwTableNode* pTableNd = pSttNd ? pSttNd->FindTableNode() : 0;
+ if (pTableNd)
+ {
+ pTxtNd =
+ mrReader.rDoc.GetNodes().MakeTxtNode(aAnchor,
+ mrReader.rDoc.GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
+
+ aSectPaM.GetPoint()->nNode = SwNodeIndex(*pTxtNd);
+ aSectPaM.GetPoint()->nContent.Assign(
+ aSectPaM.GetCntntNode(), 0);
+ }
+
+ aSectPaM.SetMark();
+
+ aSectPaM.GetPoint()->nNode = aIter->maStart;
+ aSectPaM.GetPoint()->nContent.Assign(
+ aSectPaM.GetCntntNode(), 0);
+
+ SwSectionFmt *pRet = InsertSection(aSectPaM, *aIter);
+ //The last section if continous is always unbalanced
+ if (aNext == aEnd && pRet)
+ pRet->SetAttr(SwFmtNoBalancedColumns(true));
+ }
+
+ if (pTxtNd)
+ {
+ SwNodeIndex aIdx(*pTxtNd);
+ SwPosition aPos(aIdx);
+ SwPaM aTest(aPos);
+ mrReader.rDoc.DelFullPara(aTest);
+ pTxtNd = 0;
+ }
+ }
+}
+
+void SwWW8ImplReader::StoreMacroCmds()
+{
+ if (pWwFib->lcbCmds)
+ {
+ pTableStream->Seek(pWwFib->fcCmds);
+
+ SvStorageRef xDestRoot(rDoc.GetDocShell()->GetStorage());
+ SvStorageStreamRef xDestStream =
+ xDestRoot->OpenStream(CREATE_CONST_ASC(SL::aMSMacroCmds));
+
+ sal_uInt8 *pBuffer = new sal_uInt8[pWwFib->lcbCmds];
+ pTableStream->Read(pBuffer, pWwFib->lcbCmds);
+ xDestStream->Write(pBuffer, pWwFib->lcbCmds);
+ delete[] pBuffer;
+ }
+}
+
ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
{
ULONG nErrRet = 0;
@@ -2386,7 +2445,7 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
pAnchorStck = new SwWW8FltAnchorStack(&rDoc, nFieldFlags);
- nPageDescOffset = rDoc.GetPageDescCnt();
+ sal_uInt16 nPageDescOffset = rDoc.GetPageDescCnt();
SwNodeIndex aSttNdIdx( rDoc.GetNodes() );
SwRelNumRuleSpaces aRelNumRule(rDoc, mbNewDoc);
@@ -2425,6 +2484,7 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
// praktische Hilfsvariablen besetzen:
bVer67 = ( (6 == pWwFib->nVersion)
|| (7 == pWwFib->nVersion) ); // z.B.: altes Sprm-Id-Format!
+
bVer6 = (6 == pWwFib->nVersion);
bVer7 = (7 == pWwFib->nVersion);
bVer8 = (8 == pWwFib->nVersion);
@@ -2665,12 +2725,6 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
::SetProgressState( nProgress, rDoc.GetDocShell() ); // Update
- if (pCollA)
- {
- SetOutLineStyles();
- delete[] pCollA;
- }
-
if (pDrawPg && pMSDffManager && pMSDffManager->GetShapeOrders())
{
// Hilfsarray zum Verketten der (statt SdrTxtObj) eingefuegten
@@ -2707,10 +2761,8 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
{
SvxMSDffShapeOrder *pNextOrder =
aTxBxSort.GetObject(nTxBxNum+1);
- if( (0xFFFF0000 & pOrder->nTxBxComp)
- == (0xFFFF0000 & pNextOrder->nTxBxComp)
- && pOrder->nHdFtSection
- == pNextOrder->nHdFtSection )
+ if ((0xFFFF0000 & pOrder->nTxBxComp)
+ == (0xFFFF0000 & pNextOrder->nTxBxComp))
pNextFlyFmt = pNextOrder->pFly;
}
// ggfs. Vorgaenger ermitteln
@@ -2718,15 +2770,13 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
{
SvxMSDffShapeOrder *pPrevOrder =
aTxBxSort.GetObject(nTxBxNum-1);
- if( (0xFFFF0000 & pOrder->nTxBxComp)
- == (0xFFFF0000 & pPrevOrder->nTxBxComp)
- && pOrder->nHdFtSection
- == pPrevOrder->nHdFtSection )
+ if ((0xFFFF0000 & pOrder->nTxBxComp)
+ == (0xFFFF0000 & pPrevOrder->nTxBxComp))
pPrevFlyFmt = pPrevOrder->pFly;
}
// Falls Nachfolger oder Vorgaenger vorhanden,
// die Verkettung am Fly-Frame-Format eintragen
- if( pNextFlyFmt || pPrevFlyFmt )
+ if (pNextFlyFmt || pPrevFlyFmt)
{
aChain.SetNext( pNextFlyFmt );
aChain.SetPrev( pPrevFlyFmt );
@@ -2744,7 +2794,7 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
eMode |= REDLINE_ON;
if( pWDop->fRMView )
eMode |= REDLINE_SHOW_DELETE;
- if(pStg && !pGloss) /*meaningless for a glossary, cmc*/
+ if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
{
const OfaFilterOptions* pVBAFlags =
OFF_APP()->GetFilterOptions();
@@ -2756,9 +2806,19 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
int nRet = aVBasic.Import( s1, s2 );
if( 2 & nRet )
rDoc.SetContainsMSVBasic(true);
+
+ StoreMacroCmds();
}
}
+ maSectionManager.InsertSegments(mbNewDoc);
+
+ if (pCollA)
+ {
+ SetOutLineStyles();
+ delete[] pCollA;
+ }
+
DELETEZ( pStyles );
if( pFormImpl )
@@ -2768,13 +2828,12 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
DELETEZ( pHdFt );
DELETEZ( pLstManager );
DELETEZ( pSBase );
- DELETEZ( pWDop );
+ delete pWDop;
DELETEZ( pFonts );
delete mpAtnNames;
DELETEZ( pAuthorInfos );
DELETEZ( pOleMap );
DELETEZ( pTabNode );
- DELETEZ( pLastPgDeskIdx );
delete mpSprmParser;
::EndProgress( rDoc.GetDocShell() );
}
@@ -2783,15 +2842,15 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
}
if (!pGloss)
- DELETEZ( pWwFib );
+ DELETEZ(pWwFib);
DeleteCtrlStk();
mpRedlineStack->closeall(*pPaM->GetPoint());
delete mpRedlineStack;
DeleteAnchorStk();
DeleteRefStk();
- aRelNumRule.SetNumRelSpaces( rDoc );
- if( !mbNewDoc && !nErrRet && aSttNdIdx.GetIndex() )
+ aRelNumRule.SetNumRelSpaces(rDoc);
+ if (!mbNewDoc && !nErrRet && aSttNdIdx.GetIndex())
{
aSttNdIdx++;
aRelNumRule.SetOultineRelSpaces( aSttNdIdx,
@@ -2804,36 +2863,9 @@ ULONG SwWW8ImplReader::LoadDoc1( SwPaM& rPaM ,WW8Glossary *pGloss)
if (mbNewDoc)
rDoc.SetRedlineMode( eMode );
- //If there is no content after the end of the final section, we want to delete
- //the final node and turn the column balancing off. All sections but the last
- //one, have column balancing turned on unless NoColumnBalancing is set in
- //MS Office's compatibility options.
- if (pAfterSection)
- {
- // set NoBallanced flag on last inserted section and remove the trailing
- // para that inserting the section pushed after the PaM
- if(pLastInsertedSection || pPageDesc)
- {
- SwSectionFmt *pFmt = pLastInsertedSection->GetFmt();
- pFmt->SetAttr(SwFmtNoBalancedColumns(true));
- }
- if (mbNewDoc)
- {
- //Needed to unlock last node so that we can delete it without
- //giving writer a fit. Necessary for deleting the para after a
- //section.
- rPaM.GetBound(true).nContent.Assign( 0, 0 );
- rPaM.GetBound(false).nContent.Assign( 0, 0 );
-
- pPaM->SetMark();
- pPaM->GetPoint()->nNode = *pAfterSection;
- pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0);
+ UpdatePageDescs(rDoc, nPageDescOffset);
- rDoc.DeleteAndJoin(*pPaM);
- }
- delete pAfterSection;
- }
- DELETEZ(pPaM);
+ delete pPaM, pPaM = 0;
return nErrRet;
}
@@ -3308,3 +3340,4 @@ bool SwWW8ImplReader::InEqualApo(int nLvl) const
return maApos[nLvl];
}
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index f0e37ffd8ebf..e742126bac42 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par.hxx,v $
*
- * $Revision: 1.106 $
+ * $Revision: 1.107 $
*
- * last change: $Author: aidan $ $Date: 2002-12-10 15:51:51 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _WW8PAR_HXX
@@ -75,6 +74,9 @@
#ifndef _MSOCXIMEX_HXX
#include <svx/msocximex.hxx>
#endif
+#ifndef _SVX_FRMDIR_HXX
+#include <svx/frmdir.hxx>
+#endif
#ifndef _FLTSHELL_HXX
#include <fltshell.hxx> // fuer den Attribut Stack
@@ -163,12 +165,9 @@ class GDIMetaFile;
struct ESelection;
class SfxItemSet;
struct WW8PLCFxDesc;
-
-class SdrAttrObj;
-struct WW8ULSpaceData;
class _ReadFieldParams;
+class SdrAttrObj;
class wwZOrderer;
-
namespace com{namespace sun {namespace star{
namespace beans{ class XPropertySet;}
namespace form { class XFormComponent;}
@@ -421,6 +420,7 @@ class WW8ReaderSave
private:
WW8PLCFxSaveAll maPLCFxSave;
SwPosition maTmpPos;
+ std::deque<bool> maOldApos;
SwWW8FltControlStack* mpOldStck;
SwWW8FltAnchorStack* mpOldAnchorStck;
wwRedlineStack *mpOldRedlines;
@@ -432,14 +432,12 @@ private:
USHORT mnAktColl;
sal_Unicode mcSymbol;
bool mbIgnoreText;
- bool mbDontCreateSep;
bool mbSymbol;
bool mbHdFtFtnEdn;
bool mbTxbxFlySection;
bool mbAnl;
bool mbInHyperlink;
bool mbPgSecBreak;
- bool mbVerticalEnviron;
bool mbWasParaEnd;
bool mbHasBorder;
public:
@@ -583,6 +581,97 @@ public:
void EnableFallbackStream();
};
+class wwSection
+{
+public:
+ wwSection(const SwPosition &rPos);
+ SEPr maSep;
+ WW8_BRC brc[4];
+ SwNodeIndex maStart;
+ SwSection *mpSection;
+ SwPageDesc *mpTitlePage;
+ SwPageDesc *mpPage;
+ SvxFrameDirection meDir;
+
+ short nPgWidth;
+ short nPgLeft;
+ short nPgRight;
+
+ BYTE mnBorders;
+ bool mbHasFootnote;
+ void SetDirection();
+ bool DoesContainFootnote() const { return mbHasFootnote; }
+ bool IsContinous() const { return maSep.bkc == 0; }
+ bool IsVertical() const;
+ long NoCols() const { return maSep.ccolM1 + 1; }
+ long StandardColSeperation() const { return maSep.dxaColumns; }
+ bool HasTitlePage() const { return maSep.fTitlePage ? true : false; }
+ long PageStartAt() const { return maSep.pgnStart; }
+ bool PageRestartNo() const { return maSep.fPgnRestart ? true : false; }
+ bool IsBiDi() const { return maSep.fBiDi ? true : false; }
+ sal_uInt16 GetPageWidth() const { return nPgWidth; }
+ sal_uInt16 GetPageHeight() const { return maSep.yaPage; }
+ sal_uInt16 GetPageLeft() const { return nPgLeft; }
+ sal_uInt16 GetPageRight() const { return nPgRight; }
+ bool IsLandScape() const { return maSep.dmOrientPage ? true : false; }
+};
+
+class wwSectionManager
+{
+private:
+ /*
+ A queue of the ms sections in the document
+ */
+ SwWW8ImplReader& mrReader;
+ std::deque<wwSection> maSegments;
+ typedef ::std::deque<wwSection>::iterator mySegIter;
+ typedef ::std::deque<wwSection>::reverse_iterator mySegrIter;
+
+ struct wwULSpaceData
+ {
+ bool bHasHeader, bHasFooter;
+ short nSwHLo, nHdUL, nSwFUp, nFtUL, nSwUp, nSwLo;
+ wwULSpaceData() : bHasHeader(false), bHasFooter(false) {}
+ };
+
+ void SetSegmentToPageDesc(const wwSection &rSection, bool bTitlePage,
+ bool bIgnoreCols);
+
+ void GetPageULData(const wwSection &rNewSection, bool bFirst,
+ wwULSpaceData& rData);
+ void SetPageULSpaceItems(SwFrmFmt &rFmt, wwULSpaceData& rData);
+
+ void SetPage(SwPageDesc &rPageDesc, SwFrmFmt &rFmt,
+ const wwSection &rSection, bool bIgnoreCols);
+
+ void SetNumberingType(const wwSection &rNewSection, SwPageDesc &rPageDesc);
+
+ void SetUseOn(wwSection &rSection);
+ void SetHdFt(wwSection &rSection, int nSect, const wwSection *pPrevious);
+
+ SwSectionFmt *InsertSection(SwPaM& rMyPaM, wwSection &rSection);
+ bool SetCols(SwFrmFmt &rFmt, const wwSection &rSection, USHORT nNettoWidth);
+ void SetLeftRight(wwSection &rSection);
+
+ //No copying
+ wwSectionManager(const wwSectionManager&);
+ wwSectionManager& operator=(const wwSectionManager&);
+public:
+ wwSectionManager(SwWW8ImplReader &rReader) : mrReader(rReader)
+ {};
+ void SetCurrentSectionHasFootnote();
+ bool CurrentSectionIsVertical() const;
+ void PrependedInlineNode(const SwPosition &rPos, const SwNode &rNode);
+ USHORT CurrentSectionColCount() const;
+ bool WillHavePageDescHere(SwNodeIndex aIdx) const;
+ void CreateSep(const long nTxtPos, bool bMustHaveBreak);
+ void InsertSegments(bool bIsNewDoc);
+ void JoinNode(const SwPosition &rPos, const SwNode &rNode);
+ short GetPageLeft() const;
+ short GetPageRight() const;
+ short GetPageWidth() const;
+};
+
class wwFrameNamer
{
private:
@@ -599,6 +688,22 @@ public:
{ }
};
+class wwSectionNamer
+{
+private:
+ const SwDoc &mrDoc;
+ String msFileLinkSeed;
+ int mnFileSectionNo;
+ //No copying
+ wwSectionNamer(const wwSectionNamer&);
+ wwSectionNamer& operator=(const wwSectionNamer&);
+public:
+ String UniqueName();
+ wwSectionNamer(const SwDoc &rDoc, const String &rSeed)
+ : mrDoc(rDoc), msFileLinkSeed(rSeed), mnFileSectionNo(0)
+ { }
+};
+
//-----------------------------------------
// Storage-Reader
//-----------------------------------------
@@ -614,6 +719,7 @@ friend class WW8FlySet;
friend class SwMSDffManager;
friend class SwWW8FltControlStack;
friend class WW8FormulaControl;
+friend class wwSectionManager;
SvStorage* pStg; // Input-Storage
SvStream* pStrm; // Input-(Storage)Stream
@@ -661,6 +767,16 @@ friend class WW8FormulaControl;
typedef std::deque<USHORT>::const_iterator mycFieldIter;
/*
+ A queue of the ms sections in the document
+ */
+ wwSectionManager maSectionManager;
+
+ /*
+ Creates unique names to give to (file link) sections (WW1/WW2/...)
+ */
+ wwSectionNamer maSectionNameGenerator;
+
+ /*
Knows how to split a series of bytes into sprms and their arguments
*/
wwSprmParser *mpSprmParser;
@@ -668,7 +784,7 @@ friend class WW8FormulaControl;
/*
Creates unique names to give to graphics
*/
- wwFrameNamer aGrfNameGenerator;
+ wwFrameNamer maGrfNameGenerator;
/*
Stack of textencoding being used as we progress through the document text
@@ -705,7 +821,6 @@ friend class WW8FormulaControl;
const SwTxtFmtColl* pDfltTxtFmtColl; // Default
SwFmt* pStandardFmtColl;// "Standard"
- SwPageDesc* pPageDesc; // fuer uebernommene KF-Zeilen
WW8PLCF_HdFt* pHdFt; // Pointer auf Header / Footer - Scannerklasse
WW8FlyPara* pWFlyPara; // WW-Parameter
@@ -717,8 +832,6 @@ friend class WW8FormulaControl;
SwNumRule* pNumRule; // fuer Nummerierung / Aufzaehlungen im Text
WW8_OLST* pNumOlst; // Gliederung im Text
- SwNodeIndex* pAfterSection;
- SwSection* pLastInsertedSection; // last Section that was inserted into the doc
SwNode* pNode_FLY_AT_CNTNT; // set: WW8SwFlyPara() read: CreateSwTable()
@@ -745,9 +858,6 @@ friend class WW8FormulaControl;
SwNodeIndex *pTabNode;
xub_StrLen nTabCntnt;
- SwNodeIndex* pLastPgDeskIdx;// for inserting a section when Ft-/End-Note
- // with flag 'on end of section' set
-
// Ini-Flags:
ULONG nIniFlags; // Flags aus der writer.ini
ULONG nIniFlags1; // dito ( zusaetzliche Flags )
@@ -772,18 +882,12 @@ friend class WW8FormulaControl;
USHORT nProgress; // %-Angabe fuer Progressbar
USHORT nColls; // Groesse des Arrays
USHORT nAktColl; // gemaess WW-Zaehlung
- USHORT nPageDescOffset; // fuer UpdatePageDescs
USHORT nDrawTxbx; // Nummer der Textbox ( noetig ?? )
USHORT nFldNum; // laufende Nummer dafuer
USHORT nLFOPosition;
- short nActSectionNo; // aktuelle Abschnitts-Nummer (in CreateSep() gesetzt)
short nCharFmt; // gemaess WW-Zaehlung, <0 fuer keine
short nAlign2;
- short nPgWidth;
- short nPgTop; // fuer APOs
- short nPgLeft; // Seitenraender, z.B. fuer APOs, Tabellen
- short nPgRight; // dito
short nLeftParaMgn; // Absatz L-Space
short nTxtFirstLineOfst; // Absatz 1st line ofset
@@ -803,14 +907,9 @@ friend class WW8FormulaControl;
sal_Int8 nDrawHeaven, nDrawHell;
BYTE nListLevel;
- BYTE nNfcPgn; // Formatting of PageNum
- bool mbRTLPgn; // Direction of page
BYTE nPgChpDelim; // ChapterDelim from PageNum
BYTE nPgChpLevel; // ChapterLevel of Heading from PageNum
- BYTE nCorrIhdt; // used in CreateSep()
- bool bSectionHasATitlePage; // used in CreateSep()
-
bool mbNewDoc; // Neues Dokument ?
bool bReadNoTbl; // Keine Tabellen
bool bPgSecBreak; // Page- oder Sectionbreak ist noch einzufuegen
@@ -820,7 +919,6 @@ friend class WW8FormulaControl;
bool bHasBorder; // fuer Buendelung der Border
bool bSymbol; // z.B. Symbol statt Times
bool bIgnoreText; // z.B. fuer FieldVanish
- bool bDontCreateSep; // e.g. when skipping result of multi-column index-field
int nInTable; // wird gerade eine Tabelle eingelesen
bool bWasTabRowEnd; // Tabelle : Row End Mark
@@ -843,7 +941,6 @@ friend class WW8FormulaControl;
bool bNoAttrImport; // Attribute ignorieren zum Ignorieren v. Styles
bool bInHyperlink; // Sonderfall zum einlesen eines 0x01
// siehe: SwWW8ImplReader::Read_F_Hyperlink()
- bool bVerticalEnviron;
bool bWasParaEnd;
// praktische Hilfsvariablen:
@@ -859,8 +956,6 @@ friend class WW8FormulaControl;
bool bNoLnNumYet; // no Line Numbering has been activated yet (we import
// the very 1st Line Numbering and ignore the rest)
- bool bRestartLnNumPerSection;
-
@@ -869,33 +964,18 @@ friend class WW8FormulaControl;
void AppendTxtNode(SwPosition& rPos);
void GetNoninlineNodeAttribs(const SwTxtNode *pNode,
std::vector<const xub_StrLen*> &rPositions);
- void SetLastPgDeskIdx();
-
- SwPageDesc* CreatePageDesc( SwPageDesc* pFirstPageDesc,
- SwPaM** ppPaMWanted = 0 );
- void RemoveCols( SwPageDesc& rPageDesc, SwFmtCol*& rpCol );
- bool SetCols(SwFrmFmt* pFmt, const WW8PLCFx_SEPX* pSep, USHORT nNettoWidth,
- bool bTestOnly = false);
- void SetPage1(SwPageDesc* pPageDesc, SwFrmFmt &rFmt,
- const WW8PLCFx_SEPX* pSep, USHORT nLIdx, bool bIgnoreCols);
- void SetHdFt(SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1, BYTE nIPara);
- void GetPageULData(const WW8PLCFx_SEPX* pSep, USHORT nLIdx, bool bFirst,
- WW8ULSpaceData& rData);
- void SetPageULSpaceItems(SwFrmFmt &rFmt, WW8ULSpaceData& rData);
- void SetDocumentGrid(SwFrmFmt &rFmt,const WW8PLCFx_SEPX* pSep);
-
- void SetPageBorder( SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1,
- const WW8PLCFx_SEPX* pSep, USHORT nLIdx );
- void SetUseOn(SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1, BYTE nHdFt);
- void InsertSectionWithWithoutCols( SwPaM& rMyPaM, const SwFmtCol* pCol );
- void CreateSep(const long nTxtPos, bool bMustHaveBreak);
+
+ void Read_HdFt(BYTE nWhichItems, int nSect, SwPageDesc* pPD,
+ const SwPageDesc *pPrev);
+ void Read_HdFtText(long nStartCp, long nLen, SwFrmFmt* pHdFtFmt);
+
+ void HandleLineNumbering(const wwSection &rSection);
+
bool MustCloseSection(long nTxtPos);
void CopyPageDescHdFt( const SwPageDesc* pOrgPageDesc,
SwPageDesc* pNewPageDesc, BYTE nCode );
- void UpdatePageDescs( USHORT nPageDescOffset );
-
void DeleteStk(SwFltControlStack* prStck);
void DeleteCtrlStk() { DeleteStk( pCtrlStck ); pCtrlStck = 0; }
void DeleteRefStk() { DeleteStk( pRefStck ); pRefStck = 0; }
@@ -905,6 +985,7 @@ friend class WW8FormulaControl;
bool ReadPlainChars(long& rPos, long nEnd, long nCpOfs);
bool ReadChars(long& rPos, long nNextAttr, long nTextEnd, long nCpOfs);
+ void SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection);
void ReadPlainText( long nStartCp, long nTextLen );
void ProcessAktCollChange(WW8PLCFManResult& rRes, bool* pStartAttr,
@@ -919,9 +1000,6 @@ friend class WW8FormulaControl;
void Read_HdFtFtnText( const SwNodeIndex* pSttIdx, long nStartCp,
long nLen, short nType );
- void Read_HdFt1( BYTE nPara, BYTE nWhichItems, SwPageDesc* pPD );
- void Read_HdFtText(long nStartCp, long nLen, SwPageDesc* pPD,
- bool bUseLeft, bool bFooter);
BYTE* ReadUntilToken( USHORT& rStrLen, USHORT nMaxLen, BYTE nToken );
void ImportTox( int nFldId, String aStr );
@@ -948,7 +1026,7 @@ friend class WW8FormulaControl;
bool SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc, short *pSizeArray=0,
BYTE nSetBorders=0xFF, bool bChkBtwn = false);
- void GetBorderDistance( WW8_BRC* pbrc, Rectangle& rInnerDist );
+ void GetBorderDistance(const WW8_BRC* pbrc, Rectangle& rInnerDist);
bool SetShadow(SvxShadowItem& rShadow, const SvxBoxItem& rBox,
const WW8_BRC pbrc[4]);
@@ -981,7 +1059,8 @@ friend class WW8FormulaControl;
WW8FlyPara* &pbNowStyleApo, int nCellLevel, bool bTableRowEnd,
WW8_TablePos *pTabPos);
- bool ProcessSpecial(bool bAllEnd, bool* pbReSync, WW8_CP nStartCp );
+ void EndSpecial();
+ bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp);
USHORT TabRowSprm(int nLevel) const;
ULONG ReadWmfHeader( WmfFileHd* pHd, long nPos );
@@ -1099,7 +1178,7 @@ friend class WW8FormulaControl;
SwFlyFrmFmt *ConvertDrawTextToFly( SdrObject* &rpObject,
SdrObject* &rpOurNewObject, SvxMSDffImportRec* pRecord,
RndStdIds eAnchor, WW8_FSPA *pF, SfxItemSet &rFlySet );
- void MungeTextIntoDrawBox(SdrObject* pTrueObject,
+ SwFrmFmt* MungeTextIntoDrawBox(SdrObject* pTrueObject,
SvxMSDffImportRec *pRecord, long nGrafAnchorCp, SwFrmFmt *pRetFrmFmt);
void GrafikCtor();
@@ -1159,6 +1238,8 @@ friend class WW8FormulaControl;
void SetOutLineStyles();
+ void StoreMacroCmds();
+
//No copying
SwWW8ImplReader(const SwWW8ImplReader &);
SwWW8ImplReader& operator=(const SwWW8ImplReader&);
@@ -1302,6 +1383,7 @@ public: // eigentlich private, geht aber leider nur public
void Read_SubF_Ruby( _ReadFieldParams& rReadParam);
void Read_SubF_Combined( _ReadFieldParams& rReadParam);
eF_ResT Read_F_IncludePicture( WW8FieldDesc*, String& rStr );
+ String CreateNextFileLinkName();
eF_ResT Read_F_IncludeText( WW8FieldDesc*, String& rStr );
eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr );
@@ -1341,3 +1423,5 @@ public: // eigentlich private, geht aber leider nur public
};
#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index b17099d6b693..e5e9f881f95c 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par2.cxx,v $
*
- * $Revision: 1.78 $
+ * $Revision: 1.79 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:17 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PRECOMPILED
@@ -345,13 +344,42 @@ public:
void SetNumRuleName( const String& rName );
};
+void wwSectionManager::SetCurrentSectionHasFootnote()
+{
+ ASSERT(!maSegments.empty(),
+ "should not be possible, must be at least one segment");
+ if (!maSegments.empty())
+ maSegments.back().mbHasFootnote = true;
+}
+
+bool wwSectionManager::CurrentSectionIsVertical() const
+{
+ ASSERT(!maSegments.empty(),
+ "should not be possible, must be at least one segment");
+ if (!maSegments.empty())
+ return maSegments.back().IsVertical();
+ return false;
+}
+
+short wwSectionManager::GetPageLeft() const
+{
+ return !maSegments.empty() ? maSegments.back().nPgLeft : 0;
+}
+
+short wwSectionManager::GetPageRight() const
+{
+ return !maSegments.empty() ? maSegments.back().nPgRight : 0;
+}
+
+short wwSectionManager::GetPageWidth() const
+{
+ return !maSegments.empty() ? maSegments.back().nPgWidth : 0;
+}
+
long SwWW8ImplReader::Read_Ftn(WW8PLCFManResult* pRes)
{
bool bFtEdOk = false;
- if( nIniFlags & WW8FL_NO_FTN )
- return 0;
-
/*
#84095#
Ignoring Footnote outside of the normal Text. People will put footnotes
@@ -438,30 +466,8 @@ long SwWW8ImplReader::Read_Ftn(WW8PLCFManResult* pRes)
bSymbol = false;
}
- // insert Section to get this Ft-/End-Note at the end of the section,
- // when there is no open section at the moment
- if( bFtEdOk && pLastPgDeskIdx && !pAfterSection)
- {
- const SwNodeIndex aOrgLastPgDeskIdx( *pLastPgDeskIdx );
-
- (*pLastPgDeskIdx)++;
- SwPosition aSectStart(*pLastPgDeskIdx);
- aSectStart.nContent.Assign(pLastPgDeskIdx->GetNode().GetCntntNode(), 0);
-
- SwPosition *pTemp = pPaM->GetPoint();
- if (pTableDesc)
- pTemp = pTableDesc->GetPos();
-
- SwPaM aSectPaM(aSectStart, *pTemp);
- InsertSectionWithWithoutCols( aSectPaM, 0 );
-
- if (pTableDesc)
- (*pAfterSection)--;
- pPaM->Move( fnMoveBackward );
- DELETEZ( pLastPgDeskIdx );
- // set attributes to correct position
- pCtrlStck->MoveAttrsToNextNode( aOrgLastPgDeskIdx );
- }
+ if (bFtEdOk)
+ maSectionManager.SetCurrentSectionHasFootnote();
return 1; // das Fussnotenzeichen ueberlesen!
}
@@ -2052,6 +2058,15 @@ void WW8TabDesc::SetSizePosition(SwFrmFmt* pFrmFmt)
}
}
+void wwSectionManager::PrependedInlineNode(const SwPosition &rPos,
+ const SwNode &rNode)
+{
+ ASSERT(!maSegments.empty(),
+ "should not be possible, must be at least one segment");
+ if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
+ maSegments.back().maStart = SwNodeIndex(rNode);
+}
+
void WW8TabDesc::CreateSwTable()
{
::SetProgressState( pIo->nProgress, pIo->rDoc.GetDocShell() ); // Update
@@ -2108,6 +2123,18 @@ void WW8TabDesc::CreateSwTable()
// da sich die (identischen) Zeilen eines Bandes prima duplizieren lassen
pTable = pIo->rDoc.InsertTable( *pTmpPos, nBands, nDefaultSwCols, eOri );
+ ASSERT(pTable, "insert table failed");
+ if (!pTable)
+ return;
+
+ SwTableNode* pTableNode = pTable->GetTableNode();
+ ASSERT(pTableNode, "no table node!");
+ if (pTableNode)
+ {
+ pIo->maSectionManager.PrependedInlineNode(*pIo->pPaM->GetPoint(),
+ *pTableNode);
+ }
+
// Abfrage, ob im Node, in dem die Tabelle eingefuegt werden soll, bereits
// ein Pagedesc steht. Dann wuerde der PageDesc in die naechste Zeile
// hinter der Tabelle rutschen, wo er nichts zu suchen hat. -> loeschen
@@ -2118,16 +2145,8 @@ void WW8TabDesc::CreateSwTable()
{
SfxPoolItem *pSetAttr = 0;
const SfxPoolItem* pItem;
- if (SFX_ITEM_SET == pSet->GetItemState(RES_PAGEDESC, false, &pItem))
- {
- pSetAttr = new SwFmtPageDesc( *(SwFmtPageDesc*)pItem );
- pNd->ResetAttr( RES_PAGEDESC );
- pSet = pNd->GetpSwAttrSet();
- }
- if (pSet &&
- SFX_ITEM_SET == pSet->GetItemState(RES_BREAK, false, &pItem))
+ if (SFX_ITEM_SET == pSet->GetItemState(RES_BREAK, false, &pItem))
{
- delete pSetAttr;
pSetAttr = new SvxFmtBreakItem( *(SvxFmtBreakItem*)pItem );
pNd->ResetAttr( RES_BREAK );
}
@@ -3869,5 +3888,4 @@ void SwWW8ImplReader::ReadDocInfo()
}
}
-
-
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index c6d22f29f699..45973fd97d0c 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par2.hxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: cmc $ $Date: 2002-12-03 15:57:05 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _WW8PAR2_HXX
@@ -116,6 +115,7 @@ struct WW8FlyPara
bool bGrafApo; // true: Dieser Rahmen dient allein dazu, die
// enthaltene Grafik anders als zeichengebunden
// zu positionieren
+ bool mbVertSet; // true if vertical positioning has been set
WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc = 0);
bool operator==(const WW8FlyPara& rSrc) const;
@@ -306,3 +306,5 @@ enum WW8LvlType {WW8_None, WW8_Outline, WW8_Numbering, WW8_Sequence, WW8_Pause};
WW8LvlType GetNumType(BYTE nWwLevelNo);
#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 4cd148313dac..3271567fe72d 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par3.cxx,v $
*
- * $Revision: 1.41 $
+ * $Revision: 1.42 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:17 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -2134,3 +2133,4 @@ sal_Bool SwMSConvertControls::InsertControl(
return sal_True;
}
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index aee64aacea56..1f23609be2cd 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par4.cxx,v $
*
- * $Revision: 1.36 $
+ * $Revision: 1.37 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:17 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -594,7 +593,10 @@ private:
void SetInDocAndDelete::operator()(SwFltStackEntry *pEntry)
{
SwPaM aRegion(pEntry->nMkNode);
- if (pEntry->MakeRegion(&mrDoc, aRegion, true))
+ if (
+ pEntry->MakeRegion(&mrDoc, aRegion, true) &&
+ (*aRegion.GetPoint() != *aRegion.GetMark())
+ )
{
mrDoc.SetRedlineMode(REDLINE_ON | REDLINE_SHOW_INSERT |
REDLINE_SHOW_DELETE);
@@ -681,7 +683,7 @@ void SwWW8ImplReader::Read_CRevisionMark(SwRedlineType eType,
{
// there *must* be a SprmCIbstRMark[Del] and a SprmCDttmRMark[Del]
// pointing to the very same char position as our SprmCFRMark[Del]
- if (!pPlcxMan)
+ if (!pPlcxMan || bIgnoreText)
return;
const BYTE* pSprmCIbstRMark;
const BYTE* pSprmCDttmRMark;
@@ -716,8 +718,10 @@ void SwWW8ImplReader::Read_CRevisionMark(SwRedlineType eType,
}
}
+#if 0
ASSERT(nLen < 0 || (pSprmCIbstRMark || pSprmCDttmRMark),
"The wheels have fallen off revision mark import");
+#endif
if (nLen < 0)
mpRedlineStack->close(*pPaM->GetPoint(), eType);
@@ -732,7 +736,9 @@ void SwWW8ImplReader::Read_CRevisionMark(SwRedlineType eType,
if (const WW8AuthorInfo* pAuthor = pAuthorInfos->GetObject(nPos))
{
UINT32 nWWDate = pSprmCDttmRMark ? SVBT32ToLong(pSprmCDttmRMark): 0;
+#if 0
ASSERT(nWWDate, "Date is 0, this will cause trouble!");
+#endif
DateTime aStamp(WW8ScannerBase::WW8DTTM2DateTime(nWWDate));
USHORT nAutorNo = pAuthor->nOurId;
@@ -765,3 +771,5 @@ void SwWW8ImplReader::Read_CPropRMark(USHORT , const BYTE* pData, short nLen)
// 4 bytes - chp.dttmPropRMark;
Read_CRevisionMark( REDLINE_FORMAT, pData, nLen );
}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 63b02ccb0f87..8666efd4405f 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par5.cxx,v $
*
- * $Revision: 1.62 $
+ * $Revision: 1.63 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:18 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -89,6 +88,16 @@
#include <so3/linkmgr.hxx>
#endif
+#ifndef _UCBHELPER_CONTENT_HXX_
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTBROKER_HXX_
+#include <ucbhelper/contentbroker.hxx>
+#endif
+#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
+#include <ucbhelper/commandenvironment.hxx>
+#endif
+
#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
#endif
@@ -632,21 +641,42 @@ static ULONG MSDateTimeFormatToSwFormat(String& rParams,
rParams.EraseAllChars('\'');
- rbForceJapanese = false;
- static const char aJapanese[] =
+ //#102782# & #102815# have to work at the same time :-)
+ bool bForceNatNum(false);
+ static const char aJapaneseNatNum[] =
{
- 'E', 'O', 'A', 'e', 'a', 'o', 'g', 'G'
+ 'O', 'A', 'o'
};
- for (size_t i = 0; i < sizeof(aJapanese); ++i)
+ for (size_t i = 0; i < sizeof(aJapaneseNatNum); ++i)
{
- if (STRING_NOTFOUND != rParams.Search(aJapanese[i]))
+ if (STRING_NOTFOUND != rParams.Search(aJapaneseNatNum[i]))
{
- rbForceJapanese = true;
+ bForceNatNum = true;
break;
}
}
+ if (bForceNatNum)
+ rbForceJapanese = true;
+ else
+ {
+ rbForceJapanese = false;
+ static const char aJapaneseLang[] =
+ {
+ 'E', 'e', 'g', 'G', 'a'
+ };
+
+ for (size_t i = 0; i < sizeof(aJapaneseLang); ++i)
+ {
+ if (STRING_NOTFOUND != rParams.Search(aJapaneseLang[i]))
+ {
+ rbForceJapanese = true;
+ break;
+ }
+ }
+ }
+
rParams.SearchAndReplaceAll(CREATE_CONST_ASC("EE"),
CREATE_CONST_ASC("YYYY"));
rParams.SearchAndReplaceAll('O', 'M');
@@ -655,11 +685,8 @@ static ULONG MSDateTimeFormatToSwFormat(String& rParams,
CREATE_CONST_ASC("yyyy"));
rParams.SearchAndReplaceAll('o', 'm');
- if (rbForceJapanese)
- {
+ if (bForceNatNum)
rParams.Insert(CREATE_CONST_ASC("[NatNum1][$-411]"),0);
-// rParams.Insert(CREATE_CONST_ASC("[~gengou]"),0);
- }
pFormatter->PutEntry(rParams, nCheckPos, nType, nKey, nLang);
@@ -1407,8 +1434,10 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, String& rStr )
SwSetExpFieldType( &rDoc, aSequenceName, GSE_SEQ ) );
SwSetExpField aFld( pFT, aEmptyStr, eNumFormat );
- if( sStart.Len() )
+ if (sStart.Len())
aFld.SetFormula( ( aSequenceName += '=' ) += sStart );
+ else if (!bCountOn)
+ aFld.SetFormula(aSequenceName);
if( sLevel.Len() )
{
@@ -2131,7 +2160,27 @@ eF_ResT SwWW8ImplReader::Read_F_IncludePicture( WW8FieldDesc*, String& rStr )
}
}
- if( !bEmbedded )
+ if (!bEmbedded)
+ {
+ try
+ {
+ ::ucb::Content aCnt(aGrfName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >() );
+ rtl::OUString aTitle;
+
+ aCnt.getPropertyValue(rtl::OUString::createFromAscii("Title" ))
+ >>= aTitle;
+ bEmbedded = (aTitle.getLength() <= 0);
+ }
+ catch( ... )
+ {
+ // this file did not exist, so we will not set this as graphiclink
+ bEmbedded = true;
+ }
+ }
+
+ if (!bEmbedded)
{
/*
Besonderheit:
@@ -2153,12 +2202,20 @@ eF_ResT SwWW8ImplReader::Read_F_IncludePicture( WW8FieldDesc*, String& rStr )
0, // Graphic*
&aFlySet,
0); // SwFrmFmt*
- aGrfNameGenerator.SetUniqueGraphName(pFlyFmtOfJustInsertedGraphic,
+ maGrfNameGenerator.SetUniqueGraphName(pFlyFmtOfJustInsertedGraphic,
INetURLObject(aGrfName).GetBase());
}
return FLD_READ_FSPA;
}
+
+String wwSectionNamer::UniqueName()
+{
+ String aName(msFileLinkSeed);
+ aName += String::CreateFromInt32(++mnFileSectionNo);
+ return mrDoc.GetUniqueSectionName(&aName);
+}
+
// "EINFUEGENTEXT"
eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* pF, String& rStr )
{
@@ -2192,7 +2249,6 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* pF, String& rStr )
aPara += so3::cTokenSeperator;
aPara += aBook;
}
- String aStr(CREATE_CONST_ASC( "WW" ));
/*
##509##
@@ -2202,27 +2258,33 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* pF, String& rStr )
*/
WW8ReaderSave aSave( this );
- SwSection aSection( FILE_LINK_SECTION, rDoc.GetUniqueSectionName( &aStr ) );
+ SwSection aSection(FILE_LINK_SECTION, maSectionNameGenerator.UniqueName());
aSection.SetLinkFileName( aPara );
aSection.SetProtect(true);
- pLastInsertedSection = rDoc.Insert(*pPaM, aSection, 0 ,false);
-
- const SwSectionNode* pSectionNode = pLastInsertedSection->GetFmt()->GetSectionNode();
- ASSERT(!pAfterSection, "recursive sections!");
- pAfterSection = new SwNodeIndex( *pSectionNode->EndOfSectionNode(), 1 );
+ SwSection* pSection = rDoc.Insert(*pPaM, aSection, 0 ,false);
+ ASSERT(pSection, "no section inserted");
+ if (!pSection)
+ return FLD_OK;
+ const SwSectionNode* pSectionNode = pSection->GetFmt()->GetSectionNode();
+ ASSERT(pSectionNode, "no section node!");
+ if (!pSectionNode)
+ return FLD_OK;
pPaM->GetPoint()->nNode = pSectionNode->GetIndex()+1;
pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0 );
+ //we have inserted a section before this point, so adjust pos
+ //for future page/section segment insertion
+ maSectionManager.PrependedInlineNode(aSave.GetStartPos(), *pPaM->GetNode());
+
bTxbxFlySection = true;
ReadText(pF->nSRes, pF->nLRes, pPlcxMan->GetManType());
- //SwWW8ImplReader::MustCloseSection(long nTxtPos) ??
- delete pAfterSection, pAfterSection=0;
-
aSave.Restore( this );
+ if (!maApos.back()) //a para end in apo doesn't count
+ bWasParaEnd = true;
return FLD_OK;
}
@@ -2587,6 +2649,30 @@ void lcl_toxMatchTSwitch(SwWW8ImplReader& rReader, SwTOXBase& rBase,
}
}
+USHORT wwSectionManager::CurrentSectionColCount() const
+{
+ USHORT nIndexCols = 1;
+ if (!maSegments.empty())
+ nIndexCols = maSegments.back().maSep.ccolM1 + 1;
+ return nIndexCols;
+}
+
+//Will there be a new pagebreak at this position (don't know what type
+//until later)
+bool wwSectionManager::WillHavePageDescHere(SwNodeIndex aIdx) const
+{
+ bool bRet = false;
+ if (!maSegments.empty())
+ {
+ if (!maSegments.back().IsContinous() &&
+ maSegments.back().maStart == aIdx)
+ {
+ bRet = true;
+ }
+ }
+ return bRet;
+}
+
eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
{
if( nIniFlags & WW8FL_NO_TOX )
@@ -2610,16 +2696,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
USHORT nCreateOf = (eTox == TOX_CONTENT) ? TOX_OUTLINELEVEL : TOX_MARK;
- USHORT nIndexCols = 0;
- SwSection *pTest = rDoc.GetCurrSection(*pPaM->GetPoint());
- if (pTest) //section is open, set to its no of section cols
- {
- const SwSectionFmt *pFmt = pTest->GetFmt();
- if (pFmt)
- nIndexCols = pFmt->GetCol().GetNumCols();
- }
- else if (pPageDesc) //set to current number of page cols
- nIndexCols = pPageDesc->GetMaster().GetCol().GetNumCols();
+ USHORT nIndexCols = maSectionManager.CurrentSectionColCount();
const SwTOXType* pType = rDoc.GetTOXType( eTox, 0 );
SwForm aOrigForm(eTox);
@@ -3001,13 +3078,17 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
// Update fuer TOX anstossen
rDoc.SetUpdateTOX(true);
+ //#i10028# inserting a toc implicltly acts like a parabreak
+ //in word and writer
+ if (pPaM->GetPoint()->nContent.GetIndex())
+ AppendTxtNode(*pPaM->GetPoint());
+
const SwPosition* pPos = pPaM->GetPoint();
SwFltTOX aFltTOX( pBase, nIndexCols );
// test if there is already a break item on this node
- SwCntntNode* pNd = pPos->nNode.GetNode().GetCntntNode();
- if( pNd )
+ if(SwCntntNode* pNd = pPos->nNode.GetNode().GetCntntNode())
{
const SfxItemSet* pSet = pNd->GetpSwAttrSet();
if( pSet )
@@ -3019,16 +3100,32 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
}
}
+ //Will there be a new pagebreak at this position (don't know what type
+ //until later)
+ if (maSectionManager.WillHavePageDescHere(pPos->nNode))
+ aFltTOX.SetHadPageDescItem(true);
+
// Setze Anfang in Stack
pRefStck->NewAttr( *pPos, aFltTOX );
- if( 1 < nIndexCols )
- bDontCreateSep = true;
rDoc.InsertTableOf(*pPaM->GetPoint(), *aFltTOX.GetBase());
+ //inserting a toc inserts a section before this point, so adjust pos
+ //for future page/section segment insertion
+ SwPaM aRegion(*pPaM);
+ aRegion.Move(fnMoveBackward);
+ ASSERT(rDoc.GetCurTOX(*aRegion.GetPoint()), "Misunderstood how toc works");
+ if(rDoc.GetCurTOX(*aRegion.GetPoint()))
+ {
+ maSectionManager.PrependedInlineNode(*pPaM->GetPoint(),
+ *aRegion.GetNode());
+ }
+
// Setze Ende in Stack
pRefStck->SetAttr( *pPos, RES_FLTR_TOX );
+ if (!maApos.back()) //a para end in apo doesn't count
+ bWasParaEnd = true;
return FLD_OK;
}
@@ -3299,3 +3396,5 @@ void SwWW8ImplReader::Read_Invisible( USHORT, const BYTE*, short nLen )
InsertTagField( n, aTag );
}
}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 83c256961f06..68420245131c 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par6.cxx,v $
*
- * $Revision: 1.128 $
+ * $Revision: 1.129 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:18 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#include <stdlib.h>
@@ -401,67 +400,55 @@ static SwTwips AdjustSize( USHORT nPara )
return nSi;
}
-void SwWW8ImplReader::RemoveCols( SwPageDesc& rPageDesc, SwFmtCol*& rpCol )
+void wwSection::SetDirection()
{
- SwFrmFmt &rFmt0 = rPageDesc.GetMaster();
- const SwFmtCol rCol = rFmt0.GetCol();
- if( rCol.GetNumCols() )
+ //sprmSTextFlow
+ switch (maSep.wTextFlow)
{
- rpCol = new SwFmtCol( rCol );
- SwFmtCol aCol;
- rFmt0.SetAttr( aCol );
- rPageDesc.GetLeft().SetAttr( aCol );
+ default:
+ ASSERT(!this, "Unknown layout type");
+ case 0:
+ meDir=FRMDIR_HORI_LEFT_TOP;
+ break;
+ case 1:
+ meDir=FRMDIR_VERT_TOP_RIGHT;
+ break;
+ case 2:
+ //asian letters are not rotated, western are. We can't import
+ //bottom to top going left to right, we can't do this in
+ //pages, (in drawboxes we could partly hack it with a rotated
+ //drawing box, though not frame)
+ meDir=FRMDIR_VERT_TOP_RIGHT;
+ break;
+ case 3:
+ //asian letters are not rotated, western are. We can't import
+ meDir=FRMDIR_VERT_TOP_RIGHT;
+ break;
+ case 4:
+ //asian letters are rotated, western not. We can't import
+ meDir=FRMDIR_HORI_LEFT_TOP;
+ break;
}
- else
- rpCol = 0;
+
+ sal_uInt8 nRTLPgn = maSep.fBiDi;
+ if ((meDir == FRMDIR_HORI_LEFT_TOP) && nRTLPgn)
+ meDir = FRMDIR_HORI_RIGHT_TOP;
}
-void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt,const WW8PLCFx_SEPX* pSep)
+bool wwSection::IsVertical() const
+{
+ if (meDir == FRMDIR_VERT_TOP_RIGHT || meDir == FRMDIR_VERT_TOP_LEFT)
+ return true;
+ return false;
+}
+
+void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt,
+ const wwSection &rSection)
{
if (bVer67)
return;
- SvxFrameDirection eDir=FRMDIR_HORI_LEFT_TOP;
-
- //sprmSTextFlow
- if (short nGridType = ReadULSprm(pSep, 0x5033, 0))
- {
- switch(nGridType)
- {
- default:
- ASSERT(!this, "Unknown layout type");
- case 0:
- eDir=FRMDIR_HORI_LEFT_TOP;
- break;
- case 1:
- eDir=FRMDIR_VERT_TOP_RIGHT;
- break;
- case 2:
- //asian letters are not rotated, western are. We can't import
- //bottom to top going left to right, we can't do this in
- //pages, (in drawboxes we could partly hack it with a rotated
- //drawing box, though not frame)
- eDir=FRMDIR_VERT_TOP_RIGHT;
- break;
- case 3:
- //asian letters are not rotated, western are. We can't import
- eDir=FRMDIR_VERT_TOP_RIGHT;
- break;
- case 4:
- //asian letters are rotated, western not. We can't import
- eDir=FRMDIR_HORI_LEFT_TOP;
- break;
- }
- }
- if ((eDir == FRMDIR_HORI_LEFT_TOP) && mbRTLPgn)
- eDir = FRMDIR_HORI_RIGHT_TOP;
-
- rFmt.SetAttr(SvxFrameDirectionItem(eDir));
-
- if (eDir == FRMDIR_VERT_TOP_RIGHT || eDir == FRMDIR_VERT_TOP_LEFT)
- bVerticalEnviron = true;
- else
- bVerticalEnviron = false;
+ rFmt.SetAttr(SvxFrameDirectionItem(rSection.meDir));
SwTwips nTextareaHeight = rFmt.GetFrmSize().GetHeight();
const SvxULSpaceItem &rUL = (const SvxULSpaceItem&)
@@ -475,7 +462,7 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt,const WW8PLCFx_SEPX* pSep)
nTextareaWidth -= rLR.GetLeft();
nTextareaWidth -= rLR.GetRight();
- if (bVerticalEnviron)
+ if (rSection.IsVertical())
{
SwTwips nSwap = nTextareaHeight;
nTextareaHeight = nTextareaWidth;
@@ -486,32 +473,31 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt,const WW8PLCFx_SEPX* pSep)
aGrid.SetDisplayGrid(false);
aGrid.SetPrintGrid(false);
SwTextGrid eType=GRID_NONE;
- if (short nGridType = ReadULSprm( pSep, 0x5032, 0 ))
+
+ switch (rSection.maSep.clm)
{
- switch (nGridType)
- {
- case 0:
- eType = GRID_NONE;
- break;
- default:
- ASSERT(!this, "Unknown grid type");
- case 3:
- //Text snaps to char grid, this doesn't make a lot of sense to
- //me. This is closer than LINES_CHARS
- eType = GRID_LINES_ONLY;
- break;
- case 1:
- eType = GRID_LINES_CHARS;
- break;
- case 2:
- eType = GRID_LINES_ONLY;
- break;
- }
+ case 0:
+ eType = GRID_NONE;
+ break;
+ default:
+ ASSERT(!this, "Unknown grid type");
+ case 3:
+ //Text snaps to char grid, this doesn't make a lot of sense to
+ //me. This is closer than LINES_CHARS
+ eType = GRID_LINES_ONLY;
+ break;
+ case 1:
+ eType = GRID_LINES_CHARS;
+ break;
+ case 2:
+ eType = GRID_LINES_ONLY;
+ break;
}
+
aGrid.SetGridType(eType);
//sep.dyaLinePitch
- short nLinePitch = ReadULSprm(pSep, 0x9031, 360);
+ short nLinePitch = rSection.maSep.dyaLinePitch;
aGrid.SetLines(nTextareaHeight/nLinePitch);
@@ -541,9 +527,9 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt,const WW8PLCFx_SEPX* pSep)
}
//dxtCharSpace
- if (const BYTE* pS = pSep->HasSprm(0x7030))
+ if (rSection.maSep.dxtCharSpace)
{
- UINT32 nCharSpace = SVBT32ToLong(pS);
+ UINT32 nCharSpace = rSection.maSep.dxtCharSpace;
//main lives in top 20 bits, and is signed.
INT32 nMain = (nCharSpace & 0xFFFFF000);
nMain/=0x1000;
@@ -572,35 +558,22 @@ void SwWW8ImplReader::Read_ParaBiDi(USHORT, const BYTE* pData, short nLen)
}
}
-bool SwWW8ImplReader::SetCols(SwFrmFmt* pFmt, const WW8PLCFx_SEPX* pSep,
- USHORT nNettoWidth, bool bTestOnly)
+bool wwSectionManager::SetCols(SwFrmFmt &rFmt, const wwSection &rSection,
+ USHORT nNettoWidth)
{
- if( nIniFlags & WW8FL_NO_COLS ) // ausgeschaltet
- return false;
-
//sprmSCcolumns - Anzahl der Spalten - 1
- USHORT nCols = ReadSprm( pSep, (bVer67 ? 144 : 0x500B), 0 );
+ USHORT nCols = rSection.NoCols();
- nCols ++; // Zahl der SW-Spalten
- if( nCols < 2 )
+ if (nCols < 2)
return false; // keine oder bloedsinnige Spalten
- if( bTestOnly )
- return true;
-
- if( !pFmt )
- {
- ASSERT( !this, "code error: pFmt hat Zero value!" );
- return false;
- }
-
SwFmtCol aCol; // Erzeuge SwFmtCol
//sprmSDxaColumns - Default-Abstand 1.25 cm
- USHORT nColSpace = ReadUSprm( pSep, (bVer67 ? 145 : 0x900C), 708 );
+ USHORT nColSpace = rSection.StandardColSeperation();
// sprmSLBetween
- if( ReadBSprm( pSep, (bVer67 ? 158 : 0x3019), 0 ) )
+ if (rSection.maSep.fLBetween)
{
aCol.SetLineAdj( COLADJ_TOP ); // Line
aCol.SetLineHeight( 100 );
@@ -608,145 +581,54 @@ bool SwWW8ImplReader::SetCols(SwFrmFmt* pFmt, const WW8PLCFx_SEPX* pSep,
aCol.SetLineWidth( 1 );
}
+ aCol.Init( nCols, nColSpace, nNettoWidth );
// sprmSFEvenlySpaced
- bool bEven = ReadBSprm(pSep, (bVer67 ? 138 : 0x3005), 1) ? true : false;
-
- if( bEven ) // alle Spalten sind gleich
- aCol.Init( nCols, nColSpace, nNettoWidth );
- else
+ if (!rSection.maSep.fEvenlySpaced)
{
- aCol.Init( nCols, nColSpace, USHRT_MAX );
- // Spalten unterschiedlich breit: fein, das kann der Writer inzwischen!
- USHORT nWishWidth = 0, nLeftDist = 0, nRightDist = 0;
- USHORT i;
- for( i = 0; i < nCols; i++ )
- {
- SwColumn* pCol = aCol.GetColumns()[ i ];
- pCol->SetLeft( nLeftDist );
-
- if( i < nCols-1 )
- {
- //sprmSDxaColSpacing
- const BYTE* pSD =
- pSep->HasSprm( (bVer67 ? 137 : 0xF204), BYTE( i ) );
-
- ASSERT( pSD, "+Sprm 137 (bzw. 0xF204) (Colspacing) fehlt" );
- if( pSD )
- {
- USHORT nSp = SVBT16ToShort( pSD + 1 );
- nRightDist = nSp / 2;
-
- pCol->SetRight( nSp - nRightDist );
- }
- }
- else
- nRightDist = 0; // letzte Spalte hat keinen Zwischenraum mehr
-
- //sprmSDxaColWidth
- const BYTE* pSW =
- pSep->HasSprm( (bVer67 ? 136 : 0xF203), BYTE( i ) );
-
- ASSERT( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
- if( pSW )
- pCol->SetWishWidth( SVBT16ToShort( pSW + 1 )
- + nLeftDist
- + pCol->GetRight() );
- // aufsummierte Spaltenbreiten ergeben Gesamtbreite
- nWishWidth += pCol->GetWishWidth();
- // Halber Abstand ist an naechster Spalte noch zu setzen
- nLeftDist = nRightDist;
- }
- aCol.SetWishWidth( nWishWidth );
-
-#ifdef niemalsdef
- // beim RTF-Import:
aCol._SetOrtho(false);
- USHORT nWishWidth = 0, nHalfPrev = 0;
- for( USHORT n = 0, i = 0; n < aColumns.Count(); n += 2, ++i )
+ int nIdx = 1;
+ for (USHORT i = 0; i < nCols; i++ )
{
SwColumn* pCol = aCol.GetColumns()[ i ];
- pCol->SetLeft( nHalfPrev );
- USHORT nSp = aColumns[ n+1 ];
- nHalfPrev = nSp / 2;
- pCol->SetRight( nSp - nHalfPrev );
- pCol->SetWishWidth( aColumns[ n ] +
- pCol->GetLeft() + pCol->GetRight() );
- nWishWidth += pCol->GetWishWidth();
+ USHORT nLeft = rSection.maSep.rgdxaColumnWidthSpacing[nIdx - 1]/2;
+ USHORT nRight = rSection.maSep.rgdxaColumnWidthSpacing[nIdx + 1]/2;
+ USHORT nWishWidth = rSection.maSep.rgdxaColumnWidthSpacing[nIdx]
+ + nLeft + nRight;
+ pCol->SetWishWidth(nWishWidth);
+ pCol->SetLeft(nLeft);
+ pCol->SetRight(nRight);
+ nIdx += 2;
}
- aCol.SetWishWidth( nWishWidth );
-#endif
+ aCol.SetWishWidth(nNettoWidth);
}
- pFmt->SetAttr( aCol );
+ rFmt.SetAttr(aCol);
return true;
}
-// SetPage1() setzt Orientierung, Papiergroesse, LRRaender, Spalten
-void SwWW8ImplReader::SetPage1(SwPageDesc* pInPageDesc, SwFrmFmt &rFmt,
- const WW8PLCFx_SEPX* pSep, USHORT nLIdx, bool bIgnoreCols)
+void wwSectionManager::SetLeftRight(wwSection &rSection)
{
- if( nIniFlags & WW8FL_NO_LRUL ) // Abgeschaltet
- return;
-
- static const USHORT aVer67Ids[] =
- {
- /*sprmSBOrientation*/ 162,
- /*sprmSXaPage*/ 164,
- /*sprmSYaPage*/ 165,
- /*sprmSDxaLeft*/ 166,
- /*sprmSDxaRight*/ 167,
- /*sprmSDzaGutter*/ 170
- };
-
- static const USHORT aVer8Ids[] =
- {
- /*sprmSBOrientation*/ 0x301d,
- /*sprmSXaPage*/ 0xB01F,
- /*sprmSYaPage*/ 0xB020,
- /*sprmSDxaLeft*/ 0xB021,
- /*sprmSDxaRight*/ 0xB022,
- /*sprmSDzaGutter*/ 0xB025
- };
-
- const USHORT* pIds = bVer67 ? aVer67Ids : aVer8Ids;
-
- // 1. Orientierung
- pInPageDesc->SetLandscape( 0 != ReadBSprm( pSep, pIds[0], 0 ) );
-
- // 2. Papiergroesse
- SwFmtFrmSize aSz( rFmt.GetFrmSize() );
- aSz.SetWidth(AdjustSize(ReadUSprm(pSep, pIds[1], (USHORT)lLetterWidth)));
-
- nPgWidth = (short)aSz.GetWidth(); // Merken fuer Tabellen u. ae.
- aSz.SetHeight(AdjustSize(ReadUSprm(pSep, pIds[2], (USHORT)lLetterHeight)));
-
- rFmt.SetAttr( aSz );
-
// 3. LR-Raender
- // Default-Raender fuer verschiedene nationale Versionen
- static const USHORT nLef[] = { MM_250, 1800 };
- static const USHORT nRig[] = { MM_250, 1800 };
-
- short nWWLe = MSRoundTweak(ReadULSprm( pSep, pIds[3], nLef[nLIdx]));
- short nWWRi = MSRoundTweak(ReadULSprm( pSep, pIds[4], nRig[nLIdx]));
- short nWWGu = ReadULSprm( pSep, pIds[5], 0);
+ short nWWLe = MSRoundTweak(rSection.maSep.dxaLeft);
+ short nWWRi = MSRoundTweak(rSection.maSep.dxaRight);
+ short nWWGu = rSection.maSep.dzaGutter;
/*
- 0x322A is set if the gutter is on the right, the gutter is otherwise
- placed on the left unless the global dop options are to put it on top,
- that case is handled in GetPageULData, unfortunately when we are "2 pages
- in 1" then the gutter is alternated between the top of odd pages and bottom
- of even pages, which we can't do, so ignore it in that case
+ fRTLGutter is set if the gutter is on the right, the gutter is otherwise
+ placed on the left unless the global dop options are to put it on top, that
+ case is handled in GetPageULData, unfortunately when we are "2 pages in 1"
+ then the gutter is alternated between the top of odd pages and bottom of
+ even pages, which we can't do, so ignore it in that case
*/
- if (!pWDop->doptypography.f2on1)
+ if (!mrReader.pWDop->doptypography.f2on1)
{
- if ((!bVer67) && ReadULSprm( pSep, 0x322A, 0 ))
+ if (rSection.maSep.fRTLGutter)
nWWRi += nWWGu;
- else if (!pWDop->iGutterPos)
+ else if (!mrReader.pWDop->iGutterPos)
nWWLe += nWWGu;
}
// Left / Right
- if ((aSz.GetWidth() - nWWLe - nWWRi) < MINLAY)
+ if ((rSection.nPgWidth - nWWLe - nWWRi) < MINLAY)
{
/*
There are some label templates which are "broken", they specify
@@ -761,62 +643,42 @@ void SwWW8ImplReader::SetPage1(SwPageDesc* pInPageDesc, SwFrmFmt &rFmt,
it will add up the values to give a wider page than is actually being
used.
*/
- nWWRi = aSz.GetWidth()-nWWLe-MINLAY;
+ nWWRi = rSection.nPgWidth - nWWLe - MINLAY;
}
- SvxLRSpaceItem aTemp( nWWLe, nWWRi );
- rFmt.SetAttr( aTemp );
-
- nPgLeft = nWWLe;
- nPgRight = nWWRi;
-
- if( !bIgnoreCols )
- {
- // 4. Spalten
- SetCols( &rFmt, pSep, (USHORT)(aSz.GetWidth() - nWWLe - nWWRi) );
- }
+ rSection.nPgLeft = nWWLe;
+ rSection.nPgRight = nWWRi;
}
-struct WW8ULSpaceData
+void wwSectionManager::SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt,
+ const wwSection &rSection, bool bIgnoreCols)
{
- bool bHasHeader, bHasFooter;
- short nSwHLo, nHdUL, nSwFUp, nFtUL, nSwUp, nSwLo;
- WW8ULSpaceData() : bHasHeader(false), bHasFooter(false) {}
-};
-
-void SwWW8ImplReader::GetPageULData( const WW8PLCFx_SEPX* pSep, USHORT nLIdx,
- bool bFirst, WW8ULSpaceData& rData )
-{
- if( nIniFlags & WW8FL_NO_LRUL ) // abgeschaltet
- return;
+ // 1. Orientierung
+ rInPageDesc.SetLandscape(rSection.IsLandScape());
- // Default-Raender fuer verschiedene nationale Versionen
- static const USHORT nTop[] = { MM_250, 1440 };
- static const USHORT nBot[] = { MM_200, 1440 };
+ // 2. Papiergroesse
+ SwFmtFrmSize aSz( rFmt.GetFrmSize() );
+ aSz.SetWidth(rSection.GetPageWidth());
+ aSz.SetHeight(AdjustSize(rSection.GetPageHeight()));
+ rFmt.SetAttr(aSz);
- // Einlesen der WW-Einstellungen
+ rFmt.SetAttr(
+ SvxLRSpaceItem(rSection.GetPageLeft(), rSection.GetPageRight()));
- static const USHORT aVer67Ids[] =
+ if (!bIgnoreCols)
{
- /*sprmSDyaTop*/ 168,
- /*sprmSDyaBottom*/ 169,
- /*sprmSDyaHdrTop*/ 156,
- /*sprmSDyaHdrBottom*/ 157
- };
- static const USHORT aVer8Ids[] =
- {
- /*sprmSDyaTop*/ 0x9023,
- /*sprmSDyaBottom*/ 0x9024,
- /*sprmSDyaHdrTop*/ 0xB017,
- /*sprmSDyaHdrBottom*/ 0xB018
- };
-
- const USHORT* pIds = bVer67 ? aVer67Ids : aVer8Ids;
+ SetCols(rFmt, rSection, rSection.GetPageWidth() -
+ rSection.GetPageLeft() - rSection.GetPageRight());
+ }
+}
- short nWWUp = ReadULSprm( pSep, pIds[0], nTop[nLIdx] );
- short nWWLo = ReadULSprm( pSep, pIds[1], nBot[nLIdx] );
- short nWWHTop = ReadULSprm( pSep, pIds[2], MM_125 );
- short nWWFBot = ReadULSprm( pSep, pIds[3], MM_125 );
+void wwSectionManager::GetPageULData(const wwSection &rSection, bool bFirst,
+ wwSectionManager::wwULSpaceData& rData)
+{
+ short nWWUp = rSection.maSep.dyaTop;
+ short nWWLo = rSection.maSep.dyaBottom;
+ short nWWHTop = rSection.maSep.dyaHdrTop;
+ short nWWFBot = rSection.maSep.dyaHdrBottom;
/*
If there is gutter in 97+ and the dop says put it on top then get the
@@ -825,16 +687,21 @@ void SwWW8ImplReader::GetPageULData( const WW8PLCFx_SEPX* pSep, USHORT nLIdx,
even pages, something we cannot do. So we will put it on top of all
pages, that way the pages are at least the right size.
*/
- if ( pWDop->doptypography.f2on1 ||
- (!bVer67 && pWDop->iGutterPos && !ReadULSprm( pSep, 0x322A, 0 )))
+ if ( mrReader.pWDop->doptypography.f2on1 ||
+ (!mrReader.bVer67 && mrReader.pWDop->iGutterPos &&
+ rSection.maSep.fRTLGutter)
+ )
{
- nWWUp += ReadULSprm( pSep, 0xB025, 0 );
+ nWWUp += rSection.maSep.dzaGutter;
}
if( bFirst )
- rData.bHasHeader = (nCorrIhdt & WW8_HEADER_FIRST )!=0;
+ rData.bHasHeader = (rSection.maSep.grpfIhdt & WW8_HEADER_FIRST) !=0;
else
- rData.bHasHeader = (nCorrIhdt & (WW8_HEADER_EVEN | WW8_HEADER_ODD))!=0;
+ {
+ rData.bHasHeader = (rSection.maSep.grpfIhdt &
+ (WW8_HEADER_EVEN | WW8_HEADER_ODD)) != 0;
+ }
if( rData.bHasHeader )
{
@@ -848,9 +715,12 @@ void SwWW8ImplReader::GetPageULData( const WW8PLCFx_SEPX* pSep, USHORT nLIdx,
rData.nSwUp = nWWUp;
if( bFirst )
- rData.bHasFooter = (nCorrIhdt & WW8_FOOTER_FIRST )!=0;
+ rData.bHasFooter = (rSection.maSep.grpfIhdt & WW8_FOOTER_FIRST) !=0;
else
- rData.bHasFooter = (nCorrIhdt & (WW8_FOOTER_EVEN | WW8_FOOTER_ODD))!=0;
+ {
+ rData.bHasFooter = (rSection.maSep.grpfIhdt &
+ (WW8_FOOTER_EVEN | WW8_FOOTER_ODD)) != 0;
+ }
if( rData.bHasFooter )
{
@@ -862,16 +732,12 @@ void SwWW8ImplReader::GetPageULData( const WW8PLCFx_SEPX* pSep, USHORT nLIdx,
}
else // kein Footer -> Lo einfach uebernehmen
rData.nSwLo = nWWLo;
-
- nPgTop = rData.nSwUp;
}
-void SwWW8ImplReader::SetPageULSpaceItems(SwFrmFmt &rFmt, WW8ULSpaceData& rData)
+void wwSectionManager::SetPageULSpaceItems(SwFrmFmt &rFmt,
+ wwSectionManager::wwULSpaceData& rData)
{
- if( nIniFlags & WW8FL_NO_LRUL ) // deactivated ?
- return;
-
- if( rData.bHasHeader ) // ... und Header-Lower setzen
+ if (rData.bHasHeader) // ... und Header-Lower setzen
{
//Kopfzeilenhoehe minimal sezten
if (SwFrmFmt* pHdFmt = (SwFrmFmt*)rFmt.GetHeader().GetHeaderFmt())
@@ -885,7 +751,7 @@ void SwWW8ImplReader::SetPageULSpaceItems(SwFrmFmt &rFmt, WW8ULSpaceData& rData)
}
}
- if( rData.bHasFooter ) // ... und Footer-Upper setzen
+ if (rData.bHasFooter) // ... und Footer-Upper setzen
{
if (SwFrmFmt* pFtFmt = (SwFrmFmt*)rFmt.GetFooter().GetFooterFmt())
{
@@ -898,346 +764,91 @@ void SwWW8ImplReader::SetPageULSpaceItems(SwFrmFmt &rFmt, WW8ULSpaceData& rData)
}
}
- SvxULSpaceItem aUL( rData.nSwUp, rData.nSwLo ); // Page-UL setzen
- rFmt.SetAttr( aUL );
+ SvxULSpaceItem aUL(rData.nSwUp, rData.nSwLo); // Page-UL setzen
+ rFmt.SetAttr(aUL);
}
-void SwWW8ImplReader::SetPageBorder(SwPageDesc *pPageDesc0,
- SwPageDesc *pPageDesc1, const WW8PLCFx_SEPX* pSep, USHORT nLIdx )
+SwSectionFmt *wwSectionManager::InsertSection(
+ SwPaM& rMyPaM, wwSection &rSection)
{
- WW8_BRC brc[4];
- if( !bVer67 && ::lcl_ReadBorders( bVer67, brc, 0, 0, pSep ) &&
- IsBorder( brc ))
- {
- short nPgbProp = ReadSprm( pSep, 0x522F, 0 ); //sprmSPgbProp
-
- // ogbProp - pgbApplyTo
- // 0 all Pages in this Section
- // 1 first Page in this Section
- // 2 all Pages in this Section but first
- // 3 whole document (all Sections)
- if( !pPageDesc0 && pPageDesc1 &&
- ( 2 == (nPgbProp & 0x7 ) || 1 == (nPgbProp & 0x7 )) )
- {
- // dann muss aber einer angelegt werden
- SwPaM* pPageDeskPaM = 0;
- pPageDesc0 = CreatePageDesc( 0, &pPageDeskPaM );
-
- // if PageDesc was inserted check for cols
- // and insert section instead
- if( pPageDeskPaM )
- {
- SwFrmFmt &rFmt = pPageDesc0->GetMaster();
- SetPage1(pPageDesc0, rFmt, pSep, nLIdx, false);
- const SwFmtCol& rCol = rFmt.GetCol();
- // if PageDesc has been inserted and has cols
- // insert a *section* with cols instead
- if( rCol.GetNumCols() )
- {
- InsertSectionWithWithoutCols( *pPaM, &rCol );
- // remove columns from PageDesc
- SwFmtCol aCol;
- rFmt.SetAttr( aCol );
- }
- delete pPageDeskPaM;
- }
-
- rDoc.CopyPageDesc(*pPageDesc1, *pPageDesc0, false);
- pPageDesc0->SetFollow( pPageDesc1 );
- pPageDesc1->SetFollow( pPageDesc1 );
- }
-
- SwFrmFmt* pFmt0 = 0, *pFmt1 = 0;
- if( 2 != (nPgbProp & 0x7 ) && pPageDesc0 )
- pFmt0 = &pPageDesc0->GetMaster();
-
- if( 1 != (nPgbProp & 0x7 ) && pPageDesc1 )
- pFmt1 = &pPageDesc1->GetMaster();
-
- SvxBoxItem aBox;
- SetBorder( aBox, brc );
+ SwSection aSection( CONTENT_SECTION, mrReader.rDoc.GetUniqueSectionName() );
- Rectangle aInnerDist;
- GetBorderDistance( brc, aInnerDist );
+ SfxItemSet aSet( mrReader.rDoc.GetAttrPool(), aFrmFmtSetRange );
- if( aInnerDist.Left() || aInnerDist.Top()
- || aInnerDist.Right() || aInnerDist.Bottom() )
- {
- // das muss natuerlich von den Raendern abgezogen werden!
- SwFrmFmt* pFmt = pFmt0;
- for( int i = 0; i < 2; ++i, pFmt = pFmt1 )
- if( pFmt )
- {
- SvxLRSpaceItem aLR( pFmt->GetLRSpace() );
- SvxULSpaceItem aUL( pFmt->GetULSpace() );
-
- if( 0x20 == ( nPgbProp & 0xe0 )) // distance from pageborder
- {
- // Left
- if( aInnerDist.Left() < aLR.GetLeft() )
- {
- aLR.SetLeft(aLR.GetLeft() - aInnerDist.Left());
- aBox.SetDistance( (USHORT)aInnerDist.Left(),
- BOX_LINE_LEFT );
- }
- else
- {
- aBox.SetDistance( (USHORT)aLR.GetLeft(),
- BOX_LINE_LEFT );
- aLR.SetLeft( 0 );
- }
- // Right
- if( aInnerDist.Right() < aLR.GetRight() )
- {
- aLR.SetRight(aLR.GetRight() - aInnerDist.Right());
- aBox.SetDistance( (USHORT)aInnerDist.Right(),
- BOX_LINE_RIGHT );
- }
- else
- {
- aBox.SetDistance( (USHORT)aLR.GetRight(),
- BOX_LINE_RIGHT );
- aLR.SetRight( 0 );
- }
- // Top
- if( aInnerDist.Top() < aUL.GetUpper() )
- {
- aUL.SetUpper( (USHORT)(aUL.GetUpper()
- - aInnerDist.Top() ) );
- aBox.SetDistance( (USHORT)aInnerDist.Top(),
- BOX_LINE_TOP );
- }
- else
- {
- aBox.SetDistance( aUL.GetUpper(), BOX_LINE_TOP );
- aUL.SetUpper( 0 );
- }
- // Bottom
- if( aInnerDist.Bottom() < aUL.GetLower() )
- {
- aUL.SetLower( (USHORT)(aUL.GetLower()
- - aInnerDist.Bottom() ) );
- aBox.SetDistance( (USHORT)aInnerDist.Bottom(),
- BOX_LINE_BOTTOM );
- }
- else
- {
- aBox.SetDistance( aUL.GetLower(), BOX_LINE_BOTTOM );
- aUL.SetLower( 0 );
- }
-
- pFmt->SetAttr( aLR );
- pFmt->SetAttr( aUL );
- pFmt->SetAttr( aBox );
- }
- else // distance from text
- {
- // Left
- aBox.SetDistance( (USHORT)aInnerDist.Left(),
- BOX_LINE_LEFT );
- aLR.SetLeft( Max((long)0, aLR.GetLeft()
- - aInnerDist.Left() ));
- // Right
- aBox.SetDistance( (USHORT)aInnerDist.Right(),
- BOX_LINE_RIGHT );
- aLR.SetRight(Max((long)0, aLR.GetRight()
- - aInnerDist.Right() ));
- // Top
- aBox.SetDistance( (USHORT)aInnerDist.Top(),
- BOX_LINE_TOP );
- aUL.SetUpper(Max(0, aUL.GetUpper()
- - (USHORT)aInnerDist.Top() ));
- // Bottom
- aBox.SetDistance( (USHORT)aInnerDist.Bottom(),
- BOX_LINE_BOTTOM );
- aUL.SetLower(Max(0, aUL.GetLower()
- - (USHORT)aInnerDist.Bottom() ));
-
- pFmt->SetAttr( aLR );
- pFmt->SetAttr( aUL );
- pFmt->SetAttr( aBox );
- }
- }
-
- }
- else
- {
- if( pFmt0 ) pFmt0->SetAttr( aBox );
- if( pFmt1 ) pFmt1->SetAttr( aBox );
- }
-
-
- SvxShadowItem aS;
- if( SetShadow( aS, aBox, brc))
- {
- if( pFmt0 ) pFmt0->SetAttr( aS );
- if( pFmt1 ) pFmt1->SetAttr( aS );
- }
- }
-}
+ sal_uInt8 nRTLPgn = maSegments.empty() ? 0 : maSegments.back().IsBiDi();
+ aSet.Put(SvxFrameDirectionItem(
+ nRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP));
-void SwWW8ImplReader::SetUseOn( SwPageDesc* pPageDesc0, SwPageDesc* pPageDesc1,
- BYTE nIhdt )
-{
- bool bEven = (nIhdt & ( WW8_HEADER_EVEN | WW8_FOOTER_EVEN )) ? true : false;
+ if (2 == mrReader.pWDop->fpc)
+ aSet.Put( SwFmtFtnAtTxtEnd(FTNEND_ATTXTEND));
+ if (0 == mrReader.pWDop->epc)
+ aSet.Put( SwFmtEndAtTxtEnd(FTNEND_ATTXTEND));
- UseOnPage eUseBase = pWDop->fMirrorMargins ? PD_MIRROR : PD_ALL;
- UseOnPage eUse = eUseBase;
- if( !bEven )
- eUse = (UseOnPage)( eUse | PD_HEADERSHARE | PD_FOOTERSHARE );
+ rSection.mpSection = mrReader.rDoc.Insert( rMyPaM, aSection, &aSet );
+ ASSERT(rSection.mpSection, "section not inserted!");
+ if (!rSection.mpSection)
+ return 0;
- if( !pPageDesc1 ) // 1 Pagedesc reicht
- pPageDesc0->WriteUseOn(eUse); // alle Seiten
- else // 2 Pagedescs noetig
+ SwPageDesc *pPage = 0;
+ mySegrIter aEnd = maSegments.rend();
+ for (mySegrIter aIter = maSegments.rbegin(); aIter != aEnd; ++aIter)
{
- // 1. Seite
- pPageDesc0->WriteUseOn( (UseOnPage)
- ( eUseBase | PD_HEADERSHARE | PD_FOOTERSHARE ) );
- pPageDesc1->WriteUseOn( eUse ); // Folgeseiten
+ if (pPage = aIter->mpPage)
+ break;
}
-}
-void SwWW8ImplReader::InsertSectionWithWithoutCols(SwPaM& rMyPaM,
- const SwFmtCol* pCol)
-{
- // if this Node is not empty create a new Node befor inserting the Section
- const SwPosition* pPos = rMyPaM.GetPoint();
- const SwTxtNode* pSttNd = pPos->nNode.GetNode().GetTxtNode();
- USHORT nCntPos = pPos->nContent.GetIndex();
- if( nCntPos && pSttNd->GetTxt().Len() )
- {
- if( rMyPaM.HasMark() ) // do we have a SELECTION ?
- {
- SwNodeIndex aMarkNd( rMyPaM.GetMark()->nNode, -1 );
- xub_StrLen nMarkCnt = rMyPaM.GetMark()->nContent.GetIndex();
- rDoc.SplitNode( *pPos );
-
- rMyPaM.Move( fnMoveBackward );
- aMarkNd++;
- rMyPaM.GetMark()->nNode = aMarkNd;
- rMyPaM.GetMark()->nContent.Assign(aMarkNd.GetNode().GetCntntNode(),
- nMarkCnt );
- }
- else
- rDoc.SplitNode( *pPos );
- }
+ ASSERT(pPage, "no page outside this section!");
- SwSection aSection( CONTENT_SECTION, rDoc.GetUniqueSectionName() );
+ if (!pPage)
+ pPage = &mrReader.rDoc._GetPageDesc(0);
- SfxItemSet aSet( rDoc.GetAttrPool(), aFrmFmtSetRange );
+ if (!pPage)
+ return 0;
- if( pCol )
- aSet.Put( *pCol );
+ SwFrmFmt& rFmt = pPage->GetMaster();
+ const SwFmtFrmSize& rSz = rFmt.GetFrmSize();
+ const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
+ SwTwips nWidth = rSz.GetWidth();
+ long nLeft = rLR.GetTxtLeft();
+ long nRight = rLR.GetRight();
- aSet.Put(SvxFrameDirectionItem(
- mbRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP));
+ SwSectionFmt *pFmt = rSection.mpSection->GetFmt();
+ ASSERT(pFmt, "impossible");
+ if (!pFmt)
+ return 0;
- if( 2 == pWDop->fpc )
- aSet.Put( SwFmtFtnAtTxtEnd( FTNEND_ATTXTEND ));
- if( 0 == pWDop->epc )
- aSet.Put( SwFmtEndAtTxtEnd( FTNEND_ATTXTEND ));
+ SetCols(*pFmt, rSection, (USHORT)(nWidth - nLeft - nRight) );
- pLastInsertedSection = rDoc.Insert( rMyPaM, aSection, &aSet );
//Set the columns to be UnBalanced if compatability option is set
- if (pWDop->fNoColumnBalance )
+ if (mrReader.pWDop->fNoColumnBalance )
{
- SwSectionFmt *pFmt = pLastInsertedSection->GetFmt();
+ SwSectionFmt *pFmt = rSection.mpSection->GetFmt();
pFmt->SetAttr(SwFmtNoBalancedColumns(true));
}
- // set PaM into first Node of the new Section
- const SwSectionNode* pSectionNode = pLastInsertedSection->GetFmt()->GetSectionNode();
- ASSERT( pSectionNode, "Kein Inhalt vorbereitet." );
-
- ASSERT( !pAfterSection, "pAfterSection not Null! why Recursion?");
- pAfterSection = new SwNodeIndex( *pSectionNode->EndOfSectionNode(), 1 );
- rMyPaM.GetPoint()->nNode = pSectionNode->GetIndex()+1;
- rMyPaM.GetPoint()->nContent.Assign(rMyPaM.GetCntntNode(), 0);
+ return pFmt;
}
-bool SwWW8ImplReader::MustCloseSection(long nTxtPos)
+void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
{
- // Might we have to close a section first?
- bool bSectionWasJustClosed = pAfterSection && nTxtPos;
- if( bSectionWasJustClosed )
- {
- /*
- #96598#
- When a section is created it is created with an empty para inside it.
- We should never want this para.
- */
- rDoc.DelFullPara(*pPaM);
-
- // set PaM behind section
- pPaM->GetPoint()->nNode = *pAfterSection;
- pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0);
-
- ASSERT(!pPaM->GetNode()->IsEndNode(),
- "WW8: I want to see an example of this to ease my mind");
- if (pPaM->GetNode()->IsEndNode())
- rDoc.AppendTxtNode(*pPaM->GetPoint());
-
- delete pAfterSection, pAfterSection=0;
- delete pLastPgDeskIdx, pLastPgDeskIdx=0;
- }
- return bSectionWasJustClosed;
-}
-
-
-// Bei jedem Abschnittswechsel ( auch am Anfang eines Dokuments ) wird
-// CreateSep gerufen, dass dann den / die Pagedesc(s) erzeugt und
-// mit Attributen un KF-Texten fuellt.
-// Dieses Vorgehen ist noetig geworden, da die UEbersetzung der verschiedenen
-// Seiten-Attribute zu stark verflochten ist.
-void SwWW8ImplReader::CreateSep(const long nTxtPos, bool bMustHaveBreak)
-{
- /*
- #i1909# #100688# section/page breaks should not occur in tables, word
- itself ignores them in this case. The bug is truly that this filter
- created such documents in the past!
- */
- if (nInTable)
- return;
-
- if (bTxbxFlySection || bDontCreateSep)
- return;
-
- BYTE nLastSectionCorrIhdt = nCorrIhdt;
- bool bLastSectionHadATitlePage = bSectionHasATitlePage;
-
- bool bSectionWasJustClosed = MustCloseSection(nTxtPos);
-
- SwPageDesc* pOldPageDesc = pPageDesc;
- SwPageDesc* pPageDesc1 = 0;
- WW8PLCFx_SEPX* pSep = pPlcxMan->GetSepPLCF();
-
-
// check if Line Numbering must be activated or resetted
- const BYTE* pSprmSNLnnMod = mbNewDoc ?
- pSep->HasSprm( bVer67 ? 154 : 0x5015 ) : 0;
- if( pSprmSNLnnMod && *pSprmSNLnnMod )
+ if (mbNewDoc && rSection.maSep.nLnnMod)
{
// restart-numbering-mode: 0 per page, 1 per section, 2 never restart
- const BYTE* pSprmSLnc = pSep->HasSprm( bVer67 ? 152 : 0x3013 );
- bRestartLnNumPerSection = pSprmSLnc && 1 == *pSprmSLnc;
+ bool bRestartLnNumPerSection = (1 == rSection.maSep.lnc);
- if( bNoLnNumYet )
+ if (bNoLnNumYet)
{
SwLineNumberInfo aInfo( rDoc.GetLineNumberInfo() );
aInfo.SetPaintLineNumbers(true);
- aInfo.SetRestartEachPage( !pSprmSLnc || 0 == *pSprmSLnc );
+ aInfo.SetRestartEachPage(!bRestartLnNumPerSection);
- const BYTE* pSprmSDxaLnn = pSep->HasSprm( bVer67 ? 155:0x9016 );
- if( pSprmSDxaLnn )
- {
- INT16 nSDxaLnn = SVBT16ToShort( pSprmSDxaLnn );
- aInfo.SetPosFromLeft( nSDxaLnn );
- }
-
- aInfo.SetCountBy( *pSprmSNLnnMod ); //Paint only for every n line
+ aInfo.SetPosFromLeft( rSection.maSep.dxaLnn);
+ //Paint only for every n line
+ aInfo.SetCountBy(rSection.maSep.nLnnMod);
// to be defaulted features ( HARDCODED in MS Word 6,7,8,9 )
aInfo.SetCountBlankLines(true);
@@ -1250,547 +861,327 @@ void SwWW8ImplReader::CreateSep(const long nTxtPos, bool bMustHaveBreak)
bNoLnNumYet = false;
}
- const BYTE* pSprmSLnnMin = pSep->HasSprm( bVer67 ? 160:0x501B );
- if( ( pSprmSLnnMin
- && 0 < *pSprmSLnnMin )
- || ( bRestartLnNumPerSection
- && !bNoLnNumYet ) )
+ if (
+ (0 < rSection.maSep.lnnMin) ||
+ (bRestartLnNumPerSection && !bNoLnNumYet)
+ )
{
SwFmtLineNumber aLN;
- if( pSprmSLnnMin )
- aLN.SetStartValue( 1 + *pSprmSLnnMin );
- else
- aLN.SetStartValue( 1 );
-
- NewAttr( aLN );
- pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_LINENUMBER );
+ aLN.SetStartValue(1 + rSection.maSep.lnnMin);
+ NewAttr(aLN);
+ pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_LINENUMBER);
}
bNoLnNumYet = false;
}
+}
+wwSection::wwSection(const SwPosition &rPos) : maStart(rPos.nNode),
+ mpSection(0), mpTitlePage(0), mpPage(0), meDir(FRMDIR_HORI_LEFT_TOP),
+ nPgWidth(lA4Width), nPgLeft(MM_250), nPgRight(MM_250), mnBorders(0),
+ mbHasFootnote(false)
+{
+}
- // pruefen, ob und wie umzubrechen ist break code: 0 No break
- // 1 New column
- const BYTE* pSprmBkc = pSep->HasSprm( bVer67 ? 142 : 0x3009 );// 2 New page
- BYTE nBreakCode = pSprmBkc ? *pSprmBkc : 2; // 3 Even page
- bool bContinuousBreak=(0 == nBreakCode); // 4 Odd page
+void wwSectionManager::SetNumberingType(const wwSection &rNewSection,
+ SwPageDesc &rPageDesc)
+{
+ // Seitennummernformat speichern
+ static const SvxExtNumType aNumTyp[5] =
+ {
+ SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER,
+ SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N
+ };
- // im wievielten Abschnitt stehen wir denn eigentlich?
- nActSectionNo = (short)( pSep->GetIdx() & 0x00007fff );
+ SvxNumberType aType;
+ aType.SetNumberingType(aNumTyp[rNewSection.maSep.nfcPgn]);
+ rPageDesc.SetNumType(aType);
+}
+// Bei jedem Abschnittswechsel ( auch am Anfang eines Dokuments ) wird
+// CreateSep gerufen, dass dann den / die Pagedesc(s) erzeugt und
+// mit Attributen un KF-Texten fuellt.
+// Dieses Vorgehen ist noetig geworden, da die UEbersetzung der verschiedenen
+// Seiten-Attribute zu stark verflochten ist.
+void wwSectionManager::CreateSep(const long nTxtPos, bool bMustHaveBreak)
+{
+ /*
+ #i1909# #100688# section/page breaks should not occur in tables or subpage
+ elements like frames. Word itself ignores them in this case. The bug is
+ more likely that this filter created such documents in the past!
+ */
+ if (mrReader.nInTable || mrReader.bTxbxFlySection)
+ return;
+ WW8PLCFx_SEPX* pSep = mrReader.pPlcxMan->GetSepPLCF();
+ ASSERT(pSep, "impossible!");
+ if (!pSep)
+ return;
- /*
- Welche Kopf-/Fuss-Bereiche sind
- identisch mit dem Vorgaenger-Abschnitt?
- */ // sprmSFTitlePage
- bSectionHasATitlePage = (0 != ReadBSprm( pSep, bVer67 ? 143 : 0x300A, 0 ));
+ bool bVer67(mrReader.bVer67);
- BYTE nIPara;
+ wwSection aLastSection(*mrReader.pPaM->GetPoint());
+ if (!maSegments.empty())
+ aLastSection = maSegments.back();
- BYTE nJustCopyHdFt = 0; // HdFt that are stored in previous WW section prop
- // and were NOT USED but may be copied now
- BYTE nSameHdFt = 0; // HdFt that WERE the same in previous WW section
+ //Here
+ USHORT nLIdx = ( ( mrReader.pWwFib->lid & 0xff ) == 0x9 ) ? 1 : 0;
- short aOldSectionNo[ 6 ];
- memset( &aOldSectionNo, 0, sizeof( aOldSectionNo ) );
+ //BEGIN read section values
+ wwSection aNewSection(*mrReader.pPaM->GetPoint());
- if( bVer67 )
+ if (!maSegments.empty())
{
- // sprmSGprfIhdt
- bool bSameHdFt = ( !ReadBSprmRet( nIPara, pSep, 153, 0 ) );
-
- // Leere Hd/Ft will ich nicht
- nCorrIhdt = pHdFt ? HdFtCorrectPara( nIPara ) : 0;
- if( bSameHdFt )
- {
- nSameHdFt = 0xff;
- nJustCopyHdFt = nSameHdFt;
- }
+ // Type of break: break codes are:
+ // 0 No break
+ // 1 New column
+ // 2 New page
+ // 3 Even page
+ // 4 Odd page
+ if (const BYTE* pSprmBkc = pSep->HasSprm(bVer67 ? 142 : 0x3009))
+ aNewSection.maSep.bkc = *pSprmBkc;
}
- else
- {
- if( !pHdFt )
- nCorrIhdt = 0;
- else
- {
- // nCorrIhdt ermitteln: WELCHE Hd/Ft sind ueberhaupt zu aktivieren?
- //
- nCorrIhdt = WW8_HEADER_ODD | WW8_FOOTER_ODD;
-
- if( bSectionHasATitlePage )
- nCorrIhdt |= WW8_HEADER_FIRST | WW8_FOOTER_FIRST;
-
- if( pWDop->fFacingPages )
- nCorrIhdt |= WW8_HEADER_EVEN | WW8_FOOTER_EVEN;
-
- // den PLCF analysieren:
- //
- // Hd/Ft ist gleich, wenn die Laenge des Eintrags NULL ist
- // oder die Ziel-Offsets identisch sind.
- //
- WW8_CP nStart;
- WW8_CP nOldStart=0;
- long nLen;
- long nOldLen=0;
- BYTE nHdFtInfosStored=0;
-
- for( BYTE nI = 0, nMask = 1; nI < 6; nI++, nMask <<= 1 )
- {
- // 1st find ALL Hd/Ft infos that are stored in this WW section
- // -- or in the sections before this one --
- // regardless whether they are used in this section or not
- pHdFt->GetTextPosExact( nI+ (nActSectionNo+1)*6, nStart, nLen );
- if( nLen <=2 && nActSectionNo )
- {
- short nOldSectionNo = nActSectionNo;
- do
- {
- --nOldSectionNo;
- pHdFt->GetTextPosExact( nI + (nOldSectionNo+1)*6,
- nOldStart, nOldLen);
- if( nOldLen )
- aOldSectionNo[ nI ] = nOldSectionNo;
- }
- while( nOldSectionNo && !nOldLen );
- }
- if( nLen >= 2 || nOldLen )
- nHdFtInfosStored |= nMask;
+ // Has a table page
+ aNewSection.maSep.fTitlePage =
+ (0 != ReadBSprm( pSep, bVer67 ? 143 : 0x300A, 0 ));
+ // sprmSNfcPgn
+ aNewSection.maSep.nfcPgn = ReadBSprm( pSep, (bVer67 ? 147 : 0x300E), 0 );
+ if (aNewSection.maSep.nfcPgn > 4)
+ aNewSection.maSep.nfcPgn = 0;
- if( nCorrIhdt & nMask )
- {
- if( nActSectionNo )
- {
- if( nLen < 2 ||
- ((nOldStart == nStart) && (nOldLen == nLen)) )
- {
- // same Hd/Ft as in previous Section or NO Hd/Ft
- if( nHdFtInfosStored & nMask )
- {
- // prev. sect. really DID have and USE the Hd/Ft
- if( nLastSectionCorrIhdt & nMask )
- nJustCopyHdFt |= nMask;
- // Hd/Ft may be found in one of prev. sections
- nSameHdFt |= nMask;
- }
- else
- nCorrIhdt &= ~nMask;// NO prev. Hd/Ft at all
- }
- }
- else if (nLen < 2)
- nCorrIhdt &= ~nMask;// 0 in 1.Sect.: Hd/Ft undefined
- }
- }
- }
- // Einlese-Flag auf Use-On-Flag setzen
- nIPara = nCorrIhdt;
- }
+ // sprmSFBiDi
+ if (!bVer67)
+ aNewSection.maSep.fBiDi = ReadBSprm(pSep, 0x3228, 0);
+ aNewSection.maSep.ccolM1 = ReadSprm(pSep, (bVer67 ? 144 : 0x500B), 0 );
- USHORT nLIdx = ( ( pWwFib->lid & 0xff ) == 0x9 ) ? 1 : 0;
+ //sprmSDxaColumns - Default-Abstand 1.25 cm
+ aNewSection.maSep.dxaColumns =
+ ReadUSprm( pSep, (bVer67 ? 145 : 0x900C), 708 );
- // sprmSNfcPgn
- BYTE nLastNfcPgn = nNfcPgn;
- nNfcPgn = ReadBSprm( pSep, (bVer67 ? 147 : 0x300E), 0 );
- if (nNfcPgn > 4)
- nNfcPgn = 0;
+ // sprmSLBetween
+ aNewSection.maSep.fLBetween = ReadBSprm(pSep, (bVer67 ? 158 : 0x3019), 0 );
- // sprmSFBiDi
- bool bLastRTLPgn = mbRTLPgn;
- if (!bVer67)
- mbRTLPgn = ReadBSprm(pSep, 0x3228, 0) ? true : false;
+ // sprmSFEvenlySpaced
+ aNewSection.maSep.fEvenlySpaced =
+ ReadBSprm(pSep, (bVer67 ? 138 : 0x3005), 1) ? true : false;
- /*
- Pruefen, ob wir uns den neuen Abschnitt schenken koennen, da kein
- Umbruch erforderlich ist.
- */
- if( pSep->GetIMax() > 1 )
+ if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
{
- if( nActSectionNo )
+ aNewSection.maSep.rgdxaColumnWidthSpacing[0] = 0;
+ USHORT nWidth;
+ int nCols = aNewSection.maSep.ccolM1 + 1;
+ int nIdx = 0;
+ for (int i = 0; i < nCols; ++i)
{
- // Index eins zurueck setzen
- pSep->SetIdx( nActSectionNo-1 );
- // Attribute von vorigem Abschnitt einlesen
- WW8PLCFxDesc aOther;
- pSep->GetSprms( &aOther );
- long nOtherSprmsLen = aOther.nSprmsLen;
- // Kopie der vorigen Attr. anlegen, da sie gleich ueberschrieben werden
- BYTE* pOtherMem = new BYTE[ nOtherSprmsLen ];
- memcpy( pOtherMem, aOther.pMemPos, nOtherSprmsLen );
- // Index wieder richtig setzen
- pSep->SetIdx( nActSectionNo );
- // aktuelle Attribute einlesen
- WW8PLCFxDesc aCur;
- pSep->GetSprms( &aCur );
-
- // zu ignorierende Attribute sammeln
- bool bEqual = false;
- if (bContinuousBreak)
- bEqual = true;
- else
- {
- bEqual = (bSectionHasATitlePage == bLastSectionHadATitlePage)
- && (nCorrIhdt == nLastSectionCorrIhdt)
- && (nCorrIhdt == (nCorrIhdt & nJustCopyHdFt))
- && (nNfcPgn == nLastNfcPgn) && (mbRTLPgn == bLastRTLPgn);
- }
+ //sprmSDxaColWidth
+ const BYTE* pSW =
+ pSep->HasSprm( (bVer67 ? 136 : 0xF203), BYTE( i ) );
- if (bEqual) //Give continious breaks leniency.
- {
- /*
- #95903#
- If we are a continious section, word will report the same
- headers and footers as the current (pOldPageDesc) page
- descriptor, but we would really like to use the next style,
- because thats what the user will probably expect on what to
- them is the next page, so we'll pretend that our current style
- is the follow style, and we'll disable any flags that claim we
- want to use special first page headers/footers. None of this
- dancing around widdershins to the sun would be required if our
- sections could have margins independant of the host page, like
- tables or graphics.
- */
- pOldPageDesc = pOldPageDesc ? pOldPageDesc->GetFollow() : 0;
- if (bSectionHasATitlePage)
- {
- bSectionHasATitlePage = 0;
- nSameHdFt ^= (WW8_HEADER_FIRST | WW8_FOOTER_FIRST);
- }
- /*
- If we are a continous section then are we equal to the host
- (previous) section. Relevent because margins cannot be
- different in a section than from its host page in writer but
- they can in word, if that is the case then we must make a new
- page anyway :-(
- */
- bEqual = pSep->SprmsAreEquivalent(pOtherMem,nOtherSprmsLen);
- }
+ ASSERT( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
+ if (pSW)
+ nWidth = SVBT16ToShort(pSW + 1);
- // Copy of vorigen Attr. here freed.
- delete[] pOtherMem;
+ aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
- if( bEqual )
+ if (i < nCols-1)
{
- switch( nBreakCode )
- {
- case 0:
- InsertSectionWithWithoutCols( *pPaM, 0 );
- if( pPageDesc )
- {
- SwFrmFmt& rFmt = pPageDesc->GetMaster();
- const SwFmtFrmSize& rSz = rFmt.GetFrmSize();
- const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
- SwTwips nWidth = rSz.GetWidth();
- long nLeft = rLR.GetTxtLeft();
- long nRight = rLR.GetRight();
- SetCols( pLastInsertedSection->GetFmt(), pSep,
- (USHORT)(nWidth - nLeft - nRight) );
- }
- break;
- case 1:
- if (mbNewDoc)
- {
- rDoc.Insert(*pPaM, SvxFmtBreakItem(
- SVX_BREAK_COLUMN_BEFORE ));
- }
- break;
- //case 2:
- //case 3: // alle drei Faelle -> PgDesc-Format-Einfuegung
- //case 4:
- default:
- /*
- Wir koennen den aktuellen PgDesk einsetzen, da dies
- immer der 1st-Page Deskriptor ist, nie der Follow!
-
- So geht es, auch wenn der Break auf Seite 7 kommt,
- wieder mit einer ERSTEN Seite weiter.
- */
- if (mbNewDoc)
- {
- if( pPageDesc )
- rDoc.Insert(*pPaM, SwFmtPageDesc( pPageDesc ));
- else
- // kein voriger PgDesc vorhanden?
- rDoc.Insert(*pPaM,
- SvxFmtBreakItem( SVX_BREAK_PAGE_BEFORE ));
- SetLastPgDeskIdx();
- }
- break;
- }
- return;
- // ======== Das war's Freunde, jetzt nichts wie weg hier!
- }
- }
- if (mbNewDoc &&
- ( bSectionWasJustClosed || (pPageDesc != &rDoc._GetPageDesc(0)) ))
- {
- if ((nBreakCode > 1) && bMustHaveBreak)
- {
- if( pPageDesc )
- rDoc.Insert(*pPaM, SwFmtPageDesc( pPageDesc ));
- }
- // Create and *insert* PageDesc
- SwPaM* pPageDeskPaM = 0;
- pPageDesc = CreatePageDesc( 0, &pPageDeskPaM );
- SwFrmFmt &rFmt = pPageDesc->GetMaster();
- SetPage1(pPageDesc, rFmt, pSep, nLIdx, false);
- // if PageDesc has been inserted and has cols
- // insert a *section* with cols instead
- if( pPageDeskPaM )
- {
- const SwFmtCol& rCol = rFmt.GetCol();
- if( rCol.GetNumCols() )
+ //sprmSDxaColSpacing
+ const BYTE* pSD =
+ pSep->HasSprm( (bVer67 ? 137 : 0xF204), BYTE( i ) );
+
+ ASSERT( pSD, "+Sprm 137 (bzw. 0xF204) (Colspacing) fehlt" );
+ if( pSD )
{
- InsertSectionWithWithoutCols( *pPaM, &rCol );
- // remove columns from PageDesc
- SwFmtCol aCol;
- rFmt.SetAttr( aCol );
+ nWidth = SVBT16ToShort(pSD + 1);
+ aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
}
- delete pPageDeskPaM;
}
}
}
- else if (mbNewDoc)
- pPageDesc = &rDoc._GetPageDesc( 0 ); // Standard
- if (!mbNewDoc)
- return;
+ static const USHORT aVer67Ids[] =
+ {
+ /*sprmSBOrientation*/ 162,
+ /*sprmSXaPage*/ 164,
+ /*sprmSYaPage*/ 165,
+ /*sprmSDxaLeft*/ 166,
+ /*sprmSDxaRight*/ 167,
+ /*sprmSDzaGutter*/ 170
+ };
- // Seitennummernformat speichern
+ static const USHORT aVer8Ids[] =
{
- static const SvxExtNumType aNumTyp[5] =
- {
- SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER,
- SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N
- };
+ /*sprmSBOrientation*/ 0x301d,
+ /*sprmSXaPage*/ 0xB01F,
+ /*sprmSYaPage*/ 0xB020,
+ /*sprmSDxaLeft*/ 0xB021,
+ /*sprmSDxaRight*/ 0xB022,
+ /*sprmSDzaGutter*/ 0xB025
+ };
- SvxNumberType aType; aType.SetNumberingType(aNumTyp[ nNfcPgn ]);
- pPageDesc->SetNumType( aType );
- }
+ const USHORT* pIds = bVer67 ? aVer67Ids : aVer8Ids;
+
+ // 1. Orientierung
+ aNewSection.maSep.dmOrientPage = ReadBSprm(pSep, pIds[0], 0);
+
+ // 2. Papiergroesse
+ aNewSection.maSep.xaPage = ReadUSprm(pSep, pIds[1], (USHORT)lLetterWidth);
+
+ aNewSection.nPgWidth = AdjustSize(aNewSection.maSep.xaPage);
+
+ aNewSection.maSep.yaPage = ReadUSprm(pSep, pIds[2], (USHORT)lLetterHeight);
+
+ // 3. LR-Raender
+ static const USHORT nLef[] = { MM_250, 1800 };
+ static const USHORT nRig[] = { MM_250, 1800 };
+
+ aNewSection.maSep.dxaLeft = ReadULSprm( pSep, pIds[3], nLef[nLIdx]);
+ aNewSection.maSep.dxaRight = ReadULSprm( pSep, pIds[4], nRig[nLIdx]);
+ aNewSection.maSep.dzaGutter = ReadULSprm( pSep, pIds[5], 0);
+
+ aNewSection.maSep.fRTLGutter = !bVer67 ? ReadULSprm( pSep, 0x322A, 0 ) : 0;
// Page Number Restarts - sprmSFPgnRestart
- BYTE nfPgnRestart = ReadBSprm( pSep, (bVer67 ? 150 : 0x3011), 0 );
+ aNewSection.maSep.fPgnRestart = ReadBSprm(pSep, (bVer67 ? 150 : 0x3011), 0);
- if( nfPgnRestart )
- {
- const SfxPoolItem* pItem;
- const SfxItemSet* pSet;
- if( ( 0 != (pSet = pPaM->GetCntntNode()->GetpSwAttrSet()) )
- && ( SFX_ITEM_SET ==
- pSet->GetItemState(RES_PAGEDESC, false, &pItem) ) )
- {
- // read Pagination Start attribute - sprmSPgnStart
- BYTE nPgnStart = ReadBSprm( pSep, (bVer67 ? 161 : 0x501C), 0 );
- ((SwFmtPageDesc*)pItem)->SetNumOffset( nPgnStart );
- }
- else if( pPageDesc == &rDoc.GetPageDesc( 0 ) )
- {
- // read Pagination Start attribute - sprmSPgnStart
- BYTE nPgnStart = ReadBSprm( pSep, (bVer67 ? 161 : 0x501C), 0 );
- SwFmtPageDesc aPgDesc( pPageDesc );
- aPgDesc.SetNumOffset( nPgnStart );
- rDoc.Insert( *pPaM, aPgDesc );
- SetLastPgDeskIdx();
- }
+ aNewSection.maSep.pgnStart = ReadBSprm( pSep, (bVer67 ? 161 : 0x501C), 0 );
- // Chapterlevel und Chapterdelimiter ? (sprmScnsPgn & sprmSiHeadingPgn)
- const BYTE* p = pSep->HasSprm( bVer67 ? 132 : 0x3001 );
- if( p && *p )
- {
- bPgChpLevel = true;
- nPgChpLevel = *p - 1;
- if( MAXLEVEL <= nPgChpLevel )
- nPgChpLevel = MAXLEVEL - 1;
+ if (const BYTE* p = pSep->HasSprm( bVer67 ? 132 : 0x3001 ))
+ aNewSection.maSep.iHeadingPgn = *p;
- if( 0 != (p = pSep->HasSprm( bVer67 ? 131 : 0x3000 )) )
- nPgChpDelim = *p;
- else
- nPgChpDelim = 0;
- }
- else
- bPgChpLevel = false;
- }
+ if (const BYTE* p = pSep->HasSprm( bVer67 ? 131 : 0x3000 ))
+ aNewSection.maSep.cnsPgn = *p;
- // Vorsicht: gibt es ueberhaupt einen vorigen Page Descriptor?
- if (!pOldPageDesc)
- {
- nSameHdFt = 0;
- SetLastPgDeskIdx();
- }
+ static const BYTE aPaperBinIds[17] = {5,2,4,0,3,0,0,0,0,0,0,0,0,0,0,0,1};
+ // WW SW
+ // ------------------------------
+ // 0 == default 5
+ // 1 == Upper paper tray 2
+ // 2 == Lower paper tray 4
+ // 4 == Manual paper feed 3
+ // 15 == Automatically select 0
+ // 16 == First tray available 1
+
+ if(const BYTE* pSprmSDmBinFirst = pSep->HasSprm( bVer67 ? 140 : 0x5007 ))
+ aNewSection.maSep.dmBinFirst = *pSprmSDmBinFirst;
- SwFrmFmt &rFmt0 = pPageDesc->GetMaster();
+ if (const BYTE* pSprmSDmBinOther = pSep->HasSprm( bVer67 ? 141 : 0x5008))
+ aNewSection.maSep.dmBinOther = *pSprmSDmBinOther;
+
+ static const USHORT nTop[] = { MM_250, 1440 };
+ static const USHORT nBot[] = { MM_200, 1440 };
- if( !bSectionHasATitlePage )
+ static const USHORT aVer67Ids2[] =
{
- // Gegebenenfalls Einstellungen des vorigen PgDesc uebernehmen
- // und das Einlese-Flag entsprechend korrigieren,
- // damit nur noch die Eintraege gelesen werden, die NICHT
- // vom vorigen PgDesc zu uebernehmen sind.
- //
- if( 0 < nSameHdFt )
- {
- CopyPageDescHdFt( pOldPageDesc, pPageDesc, nSameHdFt );
- if( bVer67 )
- nIPara = 0;
- else
- nIPara &= ~nSameHdFt;
- }
+ /*sprmSDyaTop*/ 168,
+ /*sprmSDyaBottom*/ 169,
+ /*sprmSDyaHdrTop*/ 156,
+ /*sprmSDyaHdrBottom*/ 157
+ };
+ static const USHORT aVer8Ids2[] =
+ {
+ /*sprmSDyaTop*/ 0x9023,
+ /*sprmSDyaBottom*/ 0x9024,
+ /*sprmSDyaHdrTop*/ 0xB017,
+ /*sprmSDyaHdrBottom*/ 0xB018
+ };
- WW8ULSpaceData aULData;
- GetPageULData(pSep, nLIdx, false, aULData);
+ pIds = bVer67 ? aVer67Ids2 : aVer8Ids2;
- // und uebrige Einstellungen updaten
- // Orientierung, Hoehe, Breite, Vertikale Formatierung
- SetPage1(pPageDesc, rFmt0, pSep, nLIdx, true);
+ aNewSection.maSep.dyaTop = ReadULSprm( pSep, pIds[0], nTop[nLIdx] );
+ aNewSection.maSep.dyaBottom = ReadULSprm( pSep, pIds[1], nBot[nLIdx] );
+ aNewSection.maSep.dyaHdrTop = ReadULSprm( pSep, pIds[2], 720 );
+ aNewSection.maSep.dyaHdrBottom = ReadULSprm( pSep, pIds[3], 720 );
- // dann Header / Footer lesen, falls noch noetig
- if( nIPara )
- SetHdFt( pPageDesc, 0, nIPara );
+ if (!bVer67)
+ {
+ aNewSection.maSep.wTextFlow = ReadULSprm(pSep, 0x5033, 0);
+ aNewSection.maSep.clm = ReadULSprm( pSep, 0x5032, 0 );
+ aNewSection.maSep.dyaLinePitch = ReadULSprm(pSep, 0x9031, 360);
+ if (const BYTE* pS = pSep->HasSprm(0x7030))
+ aNewSection.maSep.dxtCharSpace = SVBT32ToLong(pS);
- SetPageULSpaceItems( rFmt0, aULData );
- SetDocumentGrid(rFmt0, pSep);
- SetPageBorder( 0, pPageDesc, pSep, nLIdx );
+ //sprmSPgbProp
+ sal_uInt16 pgbProp = ReadSprm( pSep, 0x522F, 0 );
+ aNewSection.maSep.pgbApplyTo = pgbProp & 0x0007;
+ aNewSection.maSep.pgbPageDepth = (pgbProp & 0x0018) >> 3;
+ aNewSection.maSep.pgbOffsetFrom = (pgbProp & 0x00E0) >> 5;
+
+ aNewSection.mnBorders =
+ ::lcl_ReadBorders(bVer67, aNewSection.brc, 0, 0, pSep);
}
- else
- {
- // Hier beachten:
- // ==============
- //
- // pPageDesc = erste Seite
- // pPageDesc1 = Folge-Seiten
- //
+ // check if Line Numbering must be activated or resetted
+ if (const BYTE* pSprmSNLnnMod = pSep->HasSprm( bVer67 ? 154 : 0x5015 ))
+ aNewSection.maSep.nLnnMod = *pSprmSNLnnMod;
+
+ if (const BYTE* pSprmSLnc = pSep->HasSprm( bVer67 ? 152 : 0x3013 ))
+ aNewSection.maSep.lnc = *pSprmSLnc;
- // erst folgende PageDesc-Werte einstellen:
- //
- // Orientierung, Hoehe, Breite, Vertikale Formatierung
- SetPage1(pPageDesc, rFmt0, pSep, nLIdx, true);
+ if (const BYTE* pSprmSDxaLnn = pSep->HasSprm( bVer67 ? 155:0x9016 ))
+ aNewSection.maSep.dxaLnn = SVBT16ToShort( pSprmSDxaLnn );
- // dann den PageDesc1 anlegen fuer Folge-Seiten
- //
- pPageDesc1 = CreatePageDesc( pPageDesc );
+ if (const BYTE* pSprmSLnnMin = pSep->HasSprm( bVer67 ? 160:0x501B ))
+ aNewSection.maSep.lnnMin = *pSprmSLnnMin;
- // Gegebenenfalls Einstellungen des/der vorigen PgDesc uebernehmen
- //
- if( 0 < nSameHdFt )
+ if (bVer67)
+ aNewSection.maSep.grpfIhdt = ReadBSprm(pSep, 153, 0);
+ else if (mrReader.pHdFt)
+ {
+ aNewSection.maSep.grpfIhdt = WW8_HEADER_ODD | WW8_FOOTER_ODD;
+
+ if (aNewSection.maSep.fTitlePage)
+ aNewSection.maSep.grpfIhdt |= WW8_HEADER_FIRST | WW8_FOOTER_FIRST;
+
+ if (mrReader.pWDop->fFacingPages)
+ aNewSection.maSep.grpfIhdt |= WW8_HEADER_EVEN | WW8_FOOTER_EVEN;
+
+ //See if we have a header or footer for each enabled possibility
+ //if we do not then we inherit the previous sections header/footer,
+ for (int nI = 0, nMask = 1; nI < 6; ++nI, nMask <<= 1)
{
- // ggfs. erst den alten 1st-Seite-PgDesc suchen und dessen
- // Einstellungen uebernehmen
- //
- if( nSameHdFt & (WW8_HEADER_FIRST | WW8_FOOTER_FIRST) )
+ if (aNewSection.maSep.grpfIhdt & nMask)
{
- if( pOldPageDesc == pOldPageDesc->GetFollow() )
+ WW8_CP nStart;
+ long nLen;
+ mrReader.pHdFt->GetTextPosExact(nI + ( maSegments.size() + 1) * 6, nStart, nLen);
+ //No header or footer, inherit pervious one, or set to zero
+ //if no previous one
+ if (!nLen)
{
- // hoppla, die vorige Section hatte keine 1st Page?
- //
- // also: auslesen der in WW8 fuer die nicht vorhandene
- // 1st Page gespeicherten Hd/Ft-Einstellungen...
- //
- // Beachte: pPageDesc1 MUSS hier mit uebergeben werden,
- // obwohl wir dessen Werte ja eigentlich hier
- // gar nicht einlesen wollen!
- // Das macht aber nichts, denn wir stellen den
- // "SetHdFt( nIPara )"-Parameter so ein, dass
- // nur der 1.-Seite-PgDesc eingelesen wird.
- //
- short nSaveSectionNo = nActSectionNo;
- if( bVer67 )
- --nActSectionNo;
- else
- nActSectionNo = aOldSectionNo[ 4 ]
- ? aOldSectionNo[ 4 ] // Hd 1st
- : aOldSectionNo[ 5 ]; // Ft 1st
- SetHdFt(pPageDesc, pPageDesc1,
- nSameHdFt & (WW8_HEADER_FIRST | WW8_FOOTER_FIRST));
- nActSectionNo = nSaveSectionNo;
+ if (
+ maSegments.empty() ||
+ !(maSegments.back().maSep.grpfIhdt & nMask)
+ )
+ {
+ aNewSection.maSep.grpfIhdt &= ~nMask;
+ }
}
- else
- CopyPageDescHdFt( pOldPageDesc, pPageDesc,
- nSameHdFt & (WW8_HEADER_FIRST | WW8_FOOTER_FIRST) );
}
-
- // ggfs. Werte des vorigen PgDesc fuer Folge-Seiten uebernehmen
- //
- if( nSameHdFt & ( WW8_HEADER_EVEN | WW8_HEADER_ODD
- | WW8_FOOTER_EVEN | WW8_FOOTER_ODD ) )
- {
- CopyPageDescHdFt( pOldPageDesc, pPageDesc1,
- nSameHdFt & ( WW8_HEADER_EVEN | WW8_HEADER_ODD
- | WW8_FOOTER_EVEN | WW8_FOOTER_ODD ) );
- }
- // das Einlese-Flag entsprechend korrigieren,
- // damit nur noch die Eintraege gelesen werden, die NICHT
- // von vorigem/n PgDesc(s) zu uebernehmen sind.
- //
- if( bVer67 )
- nIPara = 0;
- else
- nIPara &= ~nSameHdFt;
}
-
- SwFrmFmt &rFmt1 = pPageDesc1->GetMaster();
-
- WW8ULSpaceData aULData0, aULData1;
- // Vertikale Formatierung
- GetPageULData(pSep, nLIdx, true, aULData0);
- // einzeln, da KF evtl. verschieden
- GetPageULData(pSep, nLIdx, false, aULData1);
-
- // dann Header / Footer lesen, falls noch noetig
- if( nIPara )
- SetHdFt( pPageDesc, pPageDesc1, nIPara );
-
- // und uebrige Einstellungen updaten
- // Vertikale Formatierung
- SetPageULSpaceItems( rFmt0, aULData0 );
- SetDocumentGrid(rFmt0, pSep);
- // einzeln, da KF evtl. verschieden
- SetPageULSpaceItems( rFmt1, aULData1 );
- SetDocumentGrid(rFmt1, pSep);
- SetPageBorder( pPageDesc, pPageDesc1, pSep, nLIdx );
}
- SetUseOn(pPageDesc, pPageDesc1, nCorrIhdt);
+ SetLeftRight(aNewSection);
+ //END read section values
- static const BYTE aPaperBinIds[17] = {5,2,4,0,3,0,0,0,0,0,0,0,0,0,0,0,1};
- // WW SW
- // ------------------------------
- // 0 == default 5
- // 1 == Upper paper tray 2
- // 2 == Lower paper tray 4
- // 4 == Manual paper feed 3
- // 15 == Automatically select 0
- // 16 == First tray available 1
+ if (!bVer67)
+ aNewSection.SetDirection();
- const BYTE* pSprmSDmBinFirst = pSep->HasSprm( bVer67 ? 140 : 0x5007 );
- const BYTE* pSprmSDmBinOther = pSep->HasSprm( bVer67 ? 141 : 0x5008 );
- if( pSprmSDmBinFirst && (17 > *pSprmSDmBinFirst) )
- {
- SvxPaperBinItem aItem(ITEMID_PAPERBIN, aPaperBinIds[*pSprmSDmBinFirst]);
- pPageDesc->GetMaster().SetAttr( aItem );
- }
- if( pSprmSDmBinOther && (17 > *pSprmSDmBinOther) )
- {
- SvxPaperBinItem aItem(ITEMID_PAPERBIN, aPaperBinIds[*pSprmSDmBinOther]);
- SwFrmFmt &rFmtOther = pPageDesc1 ? pPageDesc1->GetMaster() :
- pPageDesc->GetLeft();
- rFmtOther.SetAttr( aItem );
- }
+ maSegments.push_back(aNewSection);
// Kopf / Fuss - Index Updaten
// Damit der Index auch spaeter noch stimmt
- if( pHdFt )
- pHdFt->UpdateIndex( nCorrIhdt );
+ if (mrReader.pHdFt)
+ mrReader.pHdFt->UpdateIndex(aNewSection.maSep.grpfIhdt);
}
-
-void SwWW8ImplReader::CopyPageDescHdFt( const SwPageDesc* pOrgPageDesc,
- SwPageDesc* pNewPageDesc, BYTE nCode )
+void SwWW8ImplReader::CopyPageDescHdFt(const SwPageDesc* pOrgPageDesc,
+ SwPageDesc* pNewPageDesc, BYTE nCode )
{
// copy first header content section
- if( nCode & WW8_HEADER_FIRST )
+ if (nCode & WW8_HEADER_FIRST)
rDoc.CopyHeader(pOrgPageDesc->GetMaster(), pNewPageDesc->GetMaster());
// copy first footer content section
@@ -1800,30 +1191,28 @@ void SwWW8ImplReader::CopyPageDescHdFt( const SwPageDesc* pOrgPageDesc,
if( nCode & ( WW8_HEADER_ODD | WW8_FOOTER_ODD
| WW8_HEADER_EVEN | WW8_FOOTER_EVEN ) )
{
- // determine PageDesc of follow pages
- const SwPageDesc* pOrgFollowPageDesc = pOrgPageDesc->GetFollow();
// copy odd header content section
if( nCode & WW8_HEADER_ODD )
{
- rDoc.CopyHeader(pOrgFollowPageDesc->GetMaster(),
+ rDoc.CopyHeader(pOrgPageDesc->GetMaster(),
pNewPageDesc->GetMaster() );
}
// copy odd footer content section
if( nCode & WW8_FOOTER_ODD )
{
- rDoc.CopyFooter(pOrgFollowPageDesc->GetMaster(),
+ rDoc.CopyFooter(pOrgPageDesc->GetMaster(),
pNewPageDesc->GetMaster());
}
// copy even header content section
if( nCode & WW8_HEADER_EVEN )
{
- rDoc.CopyHeader(pOrgFollowPageDesc->GetLeft(),
+ rDoc.CopyHeader(pOrgPageDesc->GetLeft(),
pNewPageDesc->GetLeft());
}
// copy even footer content section
if( nCode & WW8_FOOTER_EVEN )
{
- rDoc.CopyFooter(pOrgFollowPageDesc->GetLeft(),
+ rDoc.CopyFooter(pOrgPageDesc->GetLeft(),
pNewPageDesc->GetLeft());
}
}
@@ -2197,19 +1586,24 @@ bool SwWW8ImplReader::SetShadow(SvxShadowItem& rShadow, const SvxBoxItem& rBox,
return bRet;
}
-void SwWW8ImplReader::GetBorderDistance( WW8_BRC* pbrc, Rectangle& rInnerDist )
+void SwWW8ImplReader::GetBorderDistance(const WW8_BRC* pbrc,
+ Rectangle& rInnerDist)
{
// 'dptSpace' is stored in 3 bits of 'Border Code (BRC)'
- if( bVer67 )
+ if (bVer67)
+ {
rInnerDist = Rectangle(((pbrc[ 1 ].aBits1[1] >> 3) & 0x1f) * 20,
((pbrc[ 0 ].aBits1[1] >> 3) & 0x1f) * 20,
((pbrc[ 3 ].aBits1[1] >> 3) & 0x1f) * 20,
((pbrc[ 2 ].aBits1[1] >> 3) & 0x1f) * 20 );
+ }
else
+ {
rInnerDist = Rectangle( (pbrc[ 1 ].aBits2[1] & 0x1f) * 20,
(pbrc[ 0 ].aBits2[1] & 0x1f) * 20,
(pbrc[ 3 ].aBits2[1] & 0x1f) * 20,
(pbrc[ 2 ].aBits2[1] & 0x1f) * 20 );
+ }
}
@@ -2298,37 +1692,37 @@ WW8FlyPara::WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc /* = 0 */)
bVer67 = bIsVer67;
}
-
-// WW8FlyPara::operator == vergleicht alles, was in der Definition vor
-// den Borders steht!
-// dieses wird u.a. fuer TestSameApo benoetigt.
bool WW8FlyPara::operator==(const WW8FlyPara& rSrc) const
{
- ASSERT( ( (BYTE*)rSrc.brc - (BYTE*)&rSrc < sizeof( WW8FlyPara ) ),
- "WW8FlyPara::operator == geht schief" );
- return memcmp(this, &rSrc, (BYTE*)rSrc.brc - (BYTE*)&rSrc) ? false : true;
- // memcmp ist moeglich, da die gesamte Struktur beim Initialisieren
- // incl. Luecken mit 0 gefuellt wird und sich damit durch die
- // Luecken keine falschen Unterschiede ergeben koennen.
- // Ausserdem sind alle Elemente aligned, so dass keine Luecken
- // existieren
+ //Compare the parts that word seems to compare for equivalence
+ return
+ (
+ (nSp26 == rSrc.nSp26) &&
+ (nSp27 == rSrc.nSp27) &&
+ (nSp45 == rSrc.nSp45) &&
+ (nSp28 == rSrc.nSp28) &&
+ (nLeMgn == rSrc.nLeMgn) &&
+ (nRiMgn == rSrc.nRiMgn) &&
+ (nUpMgn == rSrc.nUpMgn) &&
+ (nLoMgn == rSrc.nLoMgn) &&
+ (nSp29 == rSrc.nSp29) &&
+ (nSp37 == rSrc.nSp37)
+ );
}
-
// Read fuer normalen Text
-
void WW8FlyPara::Read(const BYTE* pSprm29, WW8PLCFx_Cp_FKP* pPap)
{
sal_uInt8 nOrigSp29 = nSp29;
if (pSprm29)
nOrigSp29 = *pSprm29; // PPC ( Bindung )
- bool bVertSet=false;
const BYTE* pS = 0;
if( bVer67 )
{
SetValSprm( &nSp26, pPap, 26 ); // X-Position //sprmPDxaAbs
- bVertSet = SetValSprm( &nSp27, pPap, 27 ); // Y-Position //sprmPDyaAbs
+ //set in me or in parent style
+ mbVertSet |= SetValSprm( &nSp27, pPap, 27 ); // Y-Position //sprmPDyaAbs
SetValSprm( &nSp45, pPap, 45 ); // Hoehe //sprmPWHeightAbs
SetValSprm( &nSp28, pPap, 28 ); // Breite //sprmPDxaWidth
SetValSprm( &nLeMgn, pPap, 49 ); // L-Raender //sprmPDxaFromText
@@ -2343,7 +1737,8 @@ void WW8FlyPara::Read(const BYTE* pSprm29, WW8PLCFx_Cp_FKP* pPap)
else
{
SetValSprm( &nSp26, pPap, 0x8418 ); // X-Position
- bVertSet = SetValSprm( &nSp27, pPap, 0x8419 ); // Y-Position
+ //set in me or in parent style
+ mbVertSet |= SetValSprm( &nSp27, pPap, 0x8419 ); // Y-Position
SetValSprm( &nSp45, pPap, 0x442B ); // Hoehe
SetValSprm( &nSp28, pPap, 0x841A ); // Breite
SetValSprm( &nLeMgn, pPap, 0x842F ); // L-Raender
@@ -2366,7 +1761,7 @@ void WW8FlyPara::Read(const BYTE* pSprm29, WW8PLCFx_Cp_FKP* pPap)
from para anchor, so we update the frame to have explicitly this type of
anchoring
*/
- if (!bVertSet)
+ if (!mbVertSet)
nSp29 = (nOrigSp29 & 0xCF) | 0x20;
else
nSp29 = nOrigSp29;
@@ -2440,12 +1835,12 @@ void WW8FlyPara::Read(const BYTE* pSprm29, WW8RStyle* pStyle)
if (pSprm29)
nOrigSp29 = *pSprm29; // PPC ( Bindung )
- bool bVertSet=false;
const BYTE* pS = 0;
if (bVer67)
{
SetValSprm( &nSp26, pStyle, 26 ); // X-Position
- bVertSet = SetValSprm(&nSp27, pStyle, 27); // Y-Position
+ //set in me or in parent style
+ mbVertSet |= SetValSprm(&nSp27, pStyle, 27); // Y-Position
SetValSprm( &nSp45, pStyle, 45 ); // Hoehe
SetValSprm( &nSp28, pStyle, 28 ); // Breite
SetValSprm( &nLeMgn, pStyle, 49 ); // L-Raender
@@ -2460,7 +1855,8 @@ void WW8FlyPara::Read(const BYTE* pSprm29, WW8RStyle* pStyle)
else
{
SetValSprm( &nSp26, pStyle, 0x8418 ); // X-Position
- bVertSet = SetValSprm(&nSp27, pStyle, 0x8419); // Y-Position
+ //set in me or in parent style
+ mbVertSet |= SetValSprm(&nSp27, pStyle, 0x8419); // Y-Position
SetValSprm( &nSp45, pStyle, 0x442B ); // Hoehe
SetValSprm( &nSp28, pStyle, 0x841A ); // Breite
SetValSprm( &nLeMgn, pStyle, 0x842F ); // L-Raender
@@ -2483,7 +1879,7 @@ void WW8FlyPara::Read(const BYTE* pSprm29, WW8RStyle* pStyle)
from para anchor, so we update the frame to have explicitly this type of
anchoring
*/
- if (!bVertSet)
+ if (!mbVertSet)
nSp29 = (nOrigSp29 & 0xCF) | 0x20;
else
nSp29 = nOrigSp29;
@@ -2492,6 +1888,14 @@ void WW8FlyPara::Read(const BYTE* pSprm29, WW8RStyle* pStyle)
bool WW8FlyPara::IsEmpty() const
{
WW8FlyPara aEmpty(bVer67);
+ /*
+ wr of 0 like 2 appears to me to be equivalent for checking here. See
+ #107103# if wrong, so given that the empty is 2, if we are 0 then set
+ empty to 0 to make 0 equiv to 2 for empty checking
+ */
+ ASSERT(aEmpty.nSp37 == 2, "this is not what we expect for nSp37");
+ if (this->nSp37 == 0)
+ aEmpty.nSp37 = 0;
if (aEmpty == *this)
return true;
return false;
@@ -2775,7 +2179,7 @@ WW8FlySet::WW8FlySet( SwWW8ImplReader& rReader, const SwPaM* pPaM,
//The horizontal default is on the baseline, the vertical is centered
//around the character center it appears
- if (rReader.bVerticalEnviron)
+ if (rReader.maSectionManager.CurrentSectionIsVertical())
Put(SwFmtVertOrient(0, VERT_CHAR_CENTER,REL_CHAR));
else
Put(SwFmtVertOrient(0, VERT_TOP, FRAME));
@@ -2935,8 +2339,10 @@ bool SwWW8ImplReader::StartApo(const BYTE* pSprm29,
return false;
}
- pSFlyPara = new WW8SwFlyPara( *pPaM, *this, *pWFlyPara, nPgLeft,
- (nPgWidth - nPgRight - nPgLeft), nIniFlyDx, nIniFlyDy );
+ pSFlyPara = new WW8SwFlyPara( *pPaM, *this, *pWFlyPara,
+ maSectionManager.GetPageLeft(),
+ (maSectionManager.GetPageWidth() - maSectionManager.GetPageRight() -
+ maSectionManager.GetPageLeft()), nIniFlyDx, nIniFlyDy );
if( !pWFlyPara->bGrafApo )
{
@@ -2992,6 +2398,12 @@ bool SwWW8ImplReader::StartApo(const BYTE* pSprm29,
return true;
}
+void wwSectionManager::JoinNode(const SwPosition &rPos, const SwNode &rNode)
+{
+ if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
+ maSegments.back().maStart = SwNodeIndex(rNode);
+}
+
bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
{
bool bRet = false;
@@ -2999,9 +2411,9 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
SwNodeIndex aPref(rPam.GetPoint()->nNode, -1);
- SwTxtNode* pNode = aPref.GetNode().GetTxtNode();
- if (pNode)
+ if (SwTxtNode* pNode = aPref.GetNode().GetTxtNode())
{
+ maSectionManager.JoinNode(*rPam.GetPoint(), aPref.GetNode());
rPam.GetPoint()->nNode = aPref;
rPam.GetPoint()->nContent.Assign(pNode, pNode->GetTxt().Len());
if (bStealAttr)
@@ -4491,7 +3903,7 @@ void SwWW8ImplReader::Read_LineSpace( USHORT, const BYTE* pData, short nLen )
NewAttr( aLSpc );
if( pSFlyPara )
pSFlyPara->nLineSpace = nSpaceTw; // LineSpace fuer Graf-Apos
-
+#if 0
if( ( nWwPre > nSwPre || nWwPost > nSwPost )
&& !( nIniFlags & WW8FL_NO_IMPLPASP ) )
{
@@ -4507,6 +3919,7 @@ void SwWW8ImplReader::Read_LineSpace( USHORT, const BYTE* pData, short nLen )
aUL.SetLower( nDL );
NewAttr( aUL );
}
+#endif
}
void SwWW8ImplReader::Read_ParaAutoBefore(USHORT, const BYTE *pData, short nLen)
@@ -6238,3 +5651,5 @@ short SwWW8ImplReader::ImportSprm(const BYTE* pPos,USHORT nId)
return nL;
}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 293cd02b7a1e..e65418c7ee7d 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8scan.cxx,v $
*
- * $Revision: 1.93 $
+ * $Revision: 1.94 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:18 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifdef PCH
@@ -123,6 +122,7 @@ namespace SL
IMPLCONSTSTRINGARRAY(CheckBox);
IMPLCONSTSTRINGARRAY(TextBox);
IMPLCONSTSTRINGARRAY(TextField);
+ IMPLCONSTSTRINGARRAY(MSMacroCmds);
}
template<class C> bool wwString<C>::TestBeltAndBraces(const SvStream& rStrm)
@@ -3425,125 +3425,7 @@ const BYTE* WW8PLCFx_SEPX::HasSprm( USHORT nId, BYTE n2nd ) const
return 0; // Sprm nicht gefunden
}
-const wwSprmSequence* WW8PLCFx_SEPX::GetWW6IgnoredSprms()
-{
- static sal_uInt16 aSprmIds[] =
- {
- 136, 137, 138, 139, 142, 144, 145, 147, 152, 154, 155,
- 158, 160
- };
-
- static wwSprmSequence aWWSprmIds(aSprmIds,
- sizeof(aSprmIds) / sizeof(aSprmIds[0]));
- return &aWWSprmIds;
-}
-
-const wwSprmSequence* WW8PLCFx_SEPX::GetWW8IgnoredSprms()
-{
- //0x3014 -> #i4813#
- static sal_uInt16 aSprmIds[] =
- {
- 0x3005, 0x3006, 0x3009, 0x300E, 0x3013, 0x3014, 0x3019,
- 0x301A, 0x3228, 0x3229, 0x500B, 0x5015, 0x501B, 0x5026,
- 0x703A, 0x900C, 0x9016, 0x9023, 0x9024, 0xB017, 0xB018,
- 0xF203, 0xF204
- };
-
- static wwSprmSequence aWWSprmIds(aSprmIds,
- sizeof(aSprmIds) / sizeof(aSprmIds[0]));
- return &aWWSprmIds;
-}
-
-bool WW8PLCFx_SEPX::SprmsAreEquivalent(const BYTE* pOtherSprms,
- long nOtherSprmSiz) const
-{
- bool bRes = false;
- const BYTE* pSp = pSprms;
-
- /*
- zu 'sprmSBkc':
- Wir sehen zwei WW-Abschnitte auch dann als gleich an,
- wenn sie sich lediglich im break code unterscheiden.
- Natuerlich muessen die Kopf/Fuss-Bereiche identisch sein.
-
- Ignoriert werden auch die folgenden,
- spaltenbezogene Flags:
- SCcolumns, SDxaColumns, SDxaColWidth,
- SDxaColSpacing, SFEvenlySpaced, SLBetween
- und: SFFacingCol (nur bei Ver8)
-
- We will also ignore a different formatting of the page
- number here.
-
- We will also ignore different line numbering settings here
- since only the very 1st line numbering settings are taken
- into account anyway, see: bNoLnNum
- */
- const wwSprmSequence *pIgnore;
- if (GetVersion() < 8)
- pIgnore = GetWW6IgnoredSprms();
- else
- pIgnore = GetWW8IgnoredSprms();
-
- ASSERT(pIgnore, "Impossible");
-
- if ( maSprmParser.CountSprms(pSp, nSprmSiz, pIgnore) ==
- maSprmParser.CountSprms(pOtherSprms, nOtherSprmSiz, pIgnore) )
- {
- bRes = true;
- USHORT i=0;
- while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
- {
- USHORT nSpId = maSprmParser.GetSprmId(pSp);
-
- if( !nSpId )
- break;
-
- USHORT nSpLen = maSprmParser.GetSprmSize(nSpId, pSp);
-
- if (!pIgnore->search(nSpId))
- {
- const BYTE* pOtherSp =
- HasSprm( nSpId, pOtherSprms, nOtherSprmSiz );
-
- if (!pOtherSp)
- bRes = false;
- else
- {
- const BYTE *pTst = pSp + maSprmParser.DistanceToData(nSpId);
- //Allow a one twip fuzziness for the margins, word is
- //doing something very small but intriguing with its
- //rounding of these margins
- if (nSpId == 0xB021 || nSpId == 0xB022 ||
- nSpId == 0x9023 || nSpId == 0x9024 ||
- nSpId == 0xB017 || nSpId == 0xB018 )
- {
- short nOne = SVBT16ToShort(pTst);
- short nTwo = SVBT16ToShort(pOtherSp);
- if (abs(nOne-nTwo) > 1) //(perhaps ww8par2#nToleranz)
- bRes = false;
- }
- else if (memcmp(pTst, pOtherSp,
- maSprmParser.GetSprmTailLen(nSpId, pSp)))
- {
- bRes = false;
- }
- }
-
- if (!bRes)
- break;
- }
- // increase pointers, so it points to next sprm
- i += nSpLen;
- pSp += nSpLen;
- }
- }
- return bRes; // different Sprms
-}
-
-//-----------------------------------------
//-----------------------------------------
-
WW8PLCFx_SubDoc::WW8PLCFx_SubDoc(SvStream* pSt, BYTE nVersion,
WW8_CP nStartCp, long nFcRef, long nLenRef, long nFcTxt, long nLenTxt,
long nStruct)
@@ -4200,7 +4082,7 @@ void WW8PLCFMan::AdjustEnds( WW8PLCFxDesc& rDesc )
}
}
-void WW8PLCFxDesc::ReduceByOffset(void)
+void WW8PLCFxDesc::ReduceByOffset()
{
ASSERT((LONG_MAX == nStartPos) || (nStartPos <= nEndPos),
"Attr-Anfang und -Ende ueber Kreuz" );
@@ -6817,3 +6699,91 @@ USHORT wwSprmParser::DistanceToData(USHORT nId) const
{
return 1 + mnDelta + SprmDataOfs(nId);
}
+
+#if 0
+ALNV::ANLV()
+ : nfc(0), cbTextBefore(0), cbTextAfter(0), jc(0), fPrev(0), fHang(0),
+ fSetBold(0), fSetItalic(0), fSetSmallCaps(0), fSetCaps(0), fSetStrike(0),
+ fSetKul(0), fPrevSpace(0), fBold(0), fItalic(0), fSmallCaps(0), fCaps(0),
+ fStrike(0), kul(0), ico(0), ftc(0), hps(0), iStartAt(0), dxaIndent(0),
+ dxaSpace(0)
+{}
+
+void ANLV::ReadFromMem(const sal_uInt8 *&pData)
+{
+ nfc = Get_Byte(pData);
+ cbTextBefore = Get_Byte(pData);
+ cbTextAfter = Get_Byte(pData);
+ sal_uInt8 nTemp = Get_Byte(pData);
+ jc = nTemp & 0x03;
+ fPrev = (nTemp & 0x04) >> 2;
+ fHang = (nTemp & 0x08) >> 3;
+ fSetBold = (nTemp & 0x10) >> 4;
+ fSetItalic = (nTemp & 0x20) >> 5;
+ fSetSmallCaps = (nTemp & 0x40) >> 6;
+ fSetCaps = (nTemp & 0x80) >> 7;
+ nTemp = Get_Byte(pData);
+ fSetStrike = nTemp & 0x01;
+ fSetKul = (nTemp & 0x02) >> 1;
+ fPrevSpace = (nTemp & 0x04) >> 2;
+ fBold = (nTemp & 0x08) >> 3;
+ fItalic = (nTemp & 0x10) >> 4;
+ fSmallCaps = (nTemp & 0x20) >> 5;
+ fCaps = (nTemp & 0x40) >> 6;
+ fStrike = (nTemp & 0x80) >> 7;
+ nTemp = Get_Byte(pData);
+ kul = nTemp & 0x07;
+ ico = (nTemp & 0xF1) >> 3;
+ ftc = Get_Short(pData);
+ hps = Get_Short(pData);
+ iStartAt = Get_Short(pData);
+ dxaIndent = Get_Short(pData);
+ dxaSpace = Get_Short(pData);
+}
+
+OLST::OLST() :
+ fRestartHdr(0), fSpareOlst2(0), fSpareOlst3(0), fSpareOlst4(0),
+{
+ memset(rgxch, 0, sizeof(rgxch));
+}
+
+void OLST::ReadFromMem(const sal_uInt8 *&pData, bool bVer67)
+{
+ for (int i = 0;i < 9; ++i)
+ rganlv[i].ReadFromMem(pData);
+ fRestartHdr = Get_Byte(pData);
+ fSpareOlst2 = Get_Byte(pData);
+ fSpareOlst3 = Get_Byte(pData);
+ fSpareOlst4 = Get_Byte(pData);
+ if (bVer67)
+ {
+ for (int j = 0; j < 64; ++j)
+ rgxch[j] = Get_Byte(pData);
+ }
+ else
+ {
+ for (int j = 0; j < 32; ++j)
+ rgxch[j] = Get_Short(pData);
+ }
+}
+#endif
+
+SEPr::SEPr() :
+ bkc(2), fTitlePage(0), fAutoPgn(0), nfcPgn(0), fUnlocked(0), cnsPgn(0),
+ fPgnRestart(0), fEndNote(1), lnc(0), grpfIhdt(0), nLnnMod(0), dxaLnn(0),
+ dxaPgn(720), dyaPgn(720), fLBetween(0), vjc(0), dmBinFirst(0),
+ dmBinOther(0), dmPaperReq(0), fPropRMark(0), ibstPropRMark(0),
+ dttmPropRMark(0), dxtCharSpace(0), dyaLinePitch(0), clm(0), reserved1(0),
+ dmOrientPage(0), iHeadingPgn(0), pgnStart(1), lnnMin(0), wTextFlow(0),
+ reserved2(0), pgbApplyTo(0), pgbPageDepth(0), pgbOffsetFrom(0),
+ xaPage(12240), yaPage(15840), xaPageNUp(12240), yaPageNUp(15840),
+ dxaLeft(1800), dxaRight(1800), dyaTop(1440), dyaBottom(1440), dzaGutter(0),
+ dyaHdrTop(720), dyaHdrBottom(720), ccolM1(0), fEvenlySpaced(1),
+ reserved3(0), fBiDi(0), fFacingCol(0), fRTLGutter(0), fRTLAlignment(0),
+ dxaColumns(720), dxaColumnWidth(0), dmOrientFirst(0), fLayout(0),
+ reserved4(0)
+{
+ memset(rgdxaColumnWidthSpacing, 0, sizeof(rgdxaColumnWidthSpacing));
+}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 445b4a45fa7d..cc0ca0868b2a 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8scan.hxx,v $
*
- * $Revision: 1.57 $
+ * $Revision: 1.58 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:19 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _WW8SCAN_HXX
@@ -113,6 +112,7 @@ namespace SL
DEFCONSTSTRINGARRAY(CheckBox);
DEFCONSTSTRINGARRAY(TextBox);
DEFCONSTSTRINGARRAY(TextField);
+ DEFCONSTSTRINGARRAY(MSMacroCmds);
}
/*
@@ -668,9 +668,6 @@ private:
USHORT nArrMax;
UINT16 nSprmSiz;
- static const wwSprmSequence* GetWW8IgnoredSprms();
- static const wwSprmSequence* GetWW6IgnoredSprms();
-
//no copying
WW8PLCFx_SEPX(const WW8PLCFx_SEPX&);
WW8PLCFx_SEPX& operator=(const WW8PLCFx_SEPX&);
@@ -691,7 +688,6 @@ public:
long nOtherSprmSiz ) const;
bool Find4Sprms(USHORT nId1, USHORT nId2, USHORT nId3, USHORT nId4,
BYTE*& p1, BYTE*& p2, BYTE*& p3, BYTE*& p4 ) const;
- bool SprmsAreEquivalent(const BYTE* pOtherSprms, long nOtherSprmSiz) const;
};
// Iterator fuer Fuss-/Endnoten und Anmerkungen
@@ -1682,3 +1678,5 @@ public:
};
#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx
index 827c1e3f3f27..f173dca7ab5f 100644
--- a/sw/source/filter/ww8/ww8struc.hxx
+++ b/sw/source/filter/ww8/ww8struc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8struc.hxx,v $
*
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
*
- * last change: $Author: cmc $ $Date: 2002-12-10 12:41:19 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
#ifndef _WW8STRUC_HXX
@@ -543,7 +542,6 @@ struct WW8_ANLD
BYTE rgchAnld[32]; // 0x14 characters displayed before/after autonumber
};
-
struct WW8_OLST
{
WW8_ANLV rganlv[9]; // 0 an array of 9 ANLV structures (heading levels)
@@ -555,6 +553,55 @@ struct WW8_OLST
};
// cbOLST is 212(decimal), D4(hex).
+#if 0
+struct ANLV
+{
+ ALNV();
+ void ReadFromMem(const sal_uInt8 *&pData);
+ sal_uInt8 nfc;
+ sal_uInt8 cbTextBefore;
+ sal_uInt8 cbTextAfter;
+ sal_uInt8 jc : 2;
+ sal_uInt8 fPrev : 1;
+ sal_uInt8 fHang : 1;
+ sal_uInt8 fSetBold : 1;
+ sal_uInt8 fSetItalic : 1;
+ sal_uInt8 fSetSmallCaps : 1;
+ sal_uInt8 fSetCaps : 1;
+ sal_uInt8 fSetStrike : 1;
+ sal_uInt8 fSetKul : 1;
+ sal_uInt8 fPrevSpace : 1;
+ sal_uInt8 fBold : 1;
+ sal_uInt8 fItalic : 1;
+ sal_uInt8 fSmallCaps : 1;
+ sal_uInt8 fCaps : 1;
+ sal_uInt8 fStrike : 1;
+ sal_uInt8 kul : 3;
+ sal_uInt8 ico : 5;
+ sal_uInt16 ftc;
+ sal_uInt16 hps;
+ sal_uInt16 iStartAt;
+ sal_uInt16 dxaIndent;
+ sal_uInt16 dxaSpace;
+};
+
+struct OLST
+{
+ OLST();
+ void ReadFromMem(const sal_uInt8 *&pData, bool bVer67)
+ ANLV rganlv[9]; // 0 an array of 9 ANLV structures (heading levels)
+ sal_uInt8 fRestartHdr; // when ==1, restart heading on section break
+ sal_uInt8 fSpareOlst2; // reserved
+ sal_uInt8 fSpareOlst3; // reserved
+ sal_uInt8 fSpareOlst4; // reserved
+ sal_uInt16 rgxch[64]; // array of 64 chars text before/after number
+#if 0
+ sal_uInt16 rgxch[32]; // array of 32 chars text before/after number
+ sal_uInt8 rgch[64]; // array of 64 chars text before/after number
+#endif
+};
+#endif
+
struct WW8_FDOA
{
SVBT32 fc; // 0 FC pointing to drawing object data
@@ -853,6 +900,83 @@ struct WW8_TXBXS
# pragma pack()
#endif
+struct SEPr
+{
+ SEPr();
+ sal_uInt8 bkc;
+ sal_uInt8 fTitlePage;
+ sal_Int8 fAutoPgn;
+ sal_uInt8 nfcPgn;
+ sal_uInt8 fUnlocked;
+ sal_uInt8 cnsPgn;
+ sal_uInt8 fPgnRestart;
+ sal_uInt8 fEndNote;
+ sal_Int8 lnc;
+ sal_Int8 grpfIhdt;
+ sal_uInt16 nLnnMod;
+ sal_Int32 dxaLnn;
+ sal_Int16 dxaPgn;
+ sal_Int16 dyaPgn;
+ sal_Int8 fLBetween;
+ sal_Int8 vjc;
+ sal_uInt16 dmBinFirst;
+ sal_uInt16 dmBinOther;
+ sal_uInt16 dmPaperReq;
+#if 0
+ 28 1C brcTop BRC top page border
+
+ 32 20 brcLeft BRC left page border
+
+ 36 24 brcBottom BRC bottom page border
+
+ 40 28 brcRight BRC right page border
+#endif
+ sal_Int16 fPropRMark;
+ sal_Int16 ibstPropRMark;
+ sal_Int32 dttmPropRMark; //DTTM
+ sal_Int32 dxtCharSpace;
+ sal_Int32 dyaLinePitch;
+ sal_uInt16 clm;
+ sal_Int16 reserved1;
+ sal_uInt8 dmOrientPage;
+ sal_uInt8 iHeadingPgn;
+ sal_uInt16 pgnStart;
+ sal_Int16 lnnMin;
+ sal_uInt16 wTextFlow;
+ sal_Int16 reserved2;
+ sal_uInt16 pgbApplyTo:3;
+ sal_uInt16 pgbPageDepth:2;
+ sal_Int16 pgbOffsetFrom:3;
+ sal_Int16 :8;
+ sal_uInt32 xaPage;
+ sal_uInt32 yaPage;
+ sal_uInt32 xaPageNUp;
+ sal_uInt32 yaPageNUp;
+ sal_uInt32 dxaLeft;
+ sal_uInt32 dxaRight;
+ sal_Int32 dyaTop;
+ sal_Int32 dyaBottom;
+ sal_uInt32 dzaGutter;
+ sal_uInt32 dyaHdrTop;
+ sal_uInt32 dyaHdrBottom;
+ sal_Int16 ccolM1;
+ sal_Int8 fEvenlySpaced;
+ sal_Int8 reserved3;
+ sal_uInt8 fBiDi;
+ sal_uInt8 fFacingCol;
+ sal_uInt8 fRTLGutter;
+ sal_uInt8 fRTLAlignment;
+ sal_Int32 dxaColumns;
+ sal_Int32 rgdxaColumnWidthSpacing[89];
+ sal_Int32 dxaColumnWidth;
+ sal_uInt8 dmOrientFirst;
+ sal_uInt8 fLayout;
+ sal_Int16 reserved4;
+#if 0
+ OLST olstAnm; //currently unused
+#endif
+};
+
namespace wwUtility
{
sal_uInt32 BGRToRGB(sal_uInt32 nColour);
@@ -860,3 +984,5 @@ namespace wwUtility
};
#endif
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index eb3508b20d22..271cdeabfedf 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swxml.cxx,v $
*
- * $Revision: 1.49 $
+ * $Revision: 1.50 $
*
- * last change: $Author: tl $ $Date: 2002-11-20 14:33:04 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,6 +100,9 @@
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
#include <com/sun/star/io/XActiveDataSource.hpp>
#endif
+#ifndef _COM_SUN_STAR_PACKAGES_ZIP_ZIPIOEXCEPTION_HPP_
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#endif
#include <svtools/svstdarr.hxx>
#ifndef _SFXDOCFILE_HXX //autogen wg. SfxMedium
@@ -346,6 +349,15 @@ sal_Int32 ReadThroughComponent(
#endif
return ERR_SWG_READ_ERROR;
}
+ catch( packages::zip::ZipIOException& r )
+ {
+#ifdef DEBUG
+ ByteString aError( "Zip exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
+ return ERRCODE_IO_BROKENPACKAGE;
+ }
catch( io::IOException& r )
{
#ifdef DEBUG
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 863377ff9a86..b7f25f9497ee 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexpit.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dvo $ $Date: 2002-06-19 13:07:54 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -243,8 +243,6 @@ void SvXMLExportItemMapper::exportXML( SvXMLAttributeList& rAttrList,
sal_uInt16 nFlags,
const SfxItemSet *pSet ) const
{
- OUString sCDATA( GetXMLToken(XML_CDATA) );
-
if( 0 != (rEntry.nMemberId & MID_FLAG_SPECIAL_ITEM_EXPORT) )
{
if( rItem.ISA( SvXMLAttrContainerItem ) )
@@ -281,7 +279,7 @@ void SvXMLExportItemMapper::exportXML( SvXMLAttributeList& rAttrList,
sName.append( GetXMLToken(XML_XMLNS) );
sName.append( sal_Unicode(':') );
sName.append( sPrefix );
- rAttrList.AddAttribute( sName.makeStringAndClear(), sCDATA,
+ rAttrList.AddAttribute( sName.makeStringAndClear(),
sNamespace );
}
@@ -290,7 +288,7 @@ void SvXMLExportItemMapper::exportXML( SvXMLAttributeList& rAttrList,
}
sName.append( pUnknown->GetAttrLName( i ) );
- rAttrList.AddAttribute( sName.makeStringAndClear(), sCDATA,
+ rAttrList.AddAttribute( sName.makeStringAndClear(),
pUnknown->GetAttrValue(i) );
}
@@ -311,7 +309,7 @@ void SvXMLExportItemMapper::exportXML( SvXMLAttributeList& rAttrList,
OUString sName(
rNamespaceMap.GetQNameByKey( rEntry.nNameSpace,
GetXMLToken(rEntry.eLocalName)));
- rAttrList.AddAttribute( sName, sCDATA, aValue );
+ rAttrList.AddAttribute( sName, aValue );
}
}
}
diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx
index f3853a9c3a6d..cf806225419e 100644
--- a/sw/source/filter/xml/xmliteme.cxx
+++ b/sw/source/filter/xml/xmliteme.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmliteme.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: dvo $ $Date: 2001-10-26 12:02:47 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,7 +146,6 @@ extern SvXMLItemMapEntry aXMLTableCellItemMap[];
class SwXMLTableItemMapper_Impl: public SvXMLExportItemMapper
{
- const OUString sCDATA;
SwXMLBrushItemExport aBrushItemExport;
protected:
@@ -188,7 +187,6 @@ SwXMLTableItemMapper_Impl::SwXMLTableItemMapper_Impl(
SvXMLItemMapEntriesRef rMapEntries,
SwXMLExport& rExp ) :
SvXMLExportItemMapper( rMapEntries ),
- sCDATA( GetXMLToken( XML_CDATA ) ),
aBrushItemExport( rExp ),
nAbsWidth( USHRT_MAX )
{
@@ -206,7 +204,7 @@ void SwXMLTableItemMapper_Impl::AddAttribute( sal_uInt16 nPrefix,
{
OUString sName( rNamespaceMap.GetQNameByKey( nPrefix,
GetXMLToken(eLName) ) );
- rAttrList.AddAttribute( sName, sCDATA, rValue );
+ rAttrList.AddAttribute( sName, rValue );
}
void SwXMLTableItemMapper_Impl::handleSpecialItem(
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 50df41ee5d32..51a98522f711 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmltbli.cxx,v $
*
- * $Revision: 1.40 $
+ * $Revision: 1.41 $
*
- * last change: $Author: hbrinkm $ $Date: 2002-12-04 16:24:56 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -170,6 +170,10 @@
#include <vos/mutex.hxx>
#endif
+#ifndef _NDTXT_HXX
+#include "ndtxt.hxx"
+#endif
+
using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1738,7 +1742,8 @@ void SwXMLTableContext::InsertRepRows( sal_uInt32 nCount )
{
const SwXMLTableCell_Impl *pSrcCell =
GetCell( nCurRow-1, nCurCol );
- InsertCell( pSrcCell->GetStyleName(), 1U, pSrcCell->GetColSpan(),
+ InsertCell( pSrcCell->GetStyleName(), 1U,
+ pSrcCell->GetColSpan(),
InsertTableSection(), 0, pSrcCell->IsProtected(),
&pSrcCell->GetFormula(),
pSrcCell->HasValue(), pSrcCell->GetValue() );
@@ -2067,19 +2072,76 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
if( pCell->GetStartNode() )
{
- const OUString& rFormula = pCell->GetFormula();
- if (rFormula.getLength() > 0)
+
+ // #104801# try to rescue broken documents with a certain pattern
+ // if: 1) the cell has a default number format (number 0)
+ // 2) the call has no formula
+ // 3) the value is 0.0
+ // 4) the text doesn't look anything like 0.0
+ // [read: length > 10, or length smaller 10 and no 0 in it]
+ // then make it a text cell!
+ bool bSuppressNumericContent = false;
+ if( pCell->HasValue() && (pCell->GetValue() == 0.0) &&
+ (pCell->GetFormula().getLength() == 0) &&
+ (sStyleName.getLength() != 0) )
{
- // formula cell: insert formula if valid
- SwTblBoxFormula aFormulaItem( rFormula );
- pBoxFmt->SetAttr( aFormulaItem );
+ // default num format?
+ const SfxPoolItem* pItem = NULL;
+ if( pBoxFmt->GetItemState( RES_BOXATR_FORMAT, FALSE, &pItem )
+ == SFX_ITEM_SET )
+ {
+ const SwTblBoxNumFormat* pNumFormat =
+ static_cast<const SwTblBoxNumFormat*>( pItem );
+ if( ( pNumFormat != NULL ) && ( pNumFormat->GetValue() == 0 ) )
+ {
+ // only one text node?
+ SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 );
+ if( ( aNodeIndex.GetNode().EndOfSectionIndex() -
+ aNodeIndex.GetNode().StartOfSectionIndex() ) == 2 )
+ {
+ SwTxtNode* pTxtNode= aNodeIndex.GetNode().GetTxtNode();
+ if( pTxtNode != NULL )
+ {
+ // check text: does it look like some form of 0.0?
+ const String& rText = pTxtNode->GetTxt();
+ if( ( rText.Len() > 10 ) ||
+ ( rText.Search( '0' ) == STRING_NOTFOUND ) )
+ {
+ bSuppressNumericContent = true;
+ }
+ }
+ }
+ else
+ bSuppressNumericContent = true; // several nodes
+ }
+ }
}
- // always insert value, even if default
- if( pCell->HasValue() )
+ if( bSuppressNumericContent )
{
- SwTblBoxValue aValueItem( pCell->GetValue() );
- pBoxFmt->SetAttr( aValueItem );
+ // suppress numeric content? Then reset number format!
+ pBoxFmt->ResetAttr( RES_BOXATR_FORMULA );
+ pBoxFmt->ResetAttr( RES_BOXATR_FORMAT );
+ pBoxFmt->ResetAttr( RES_BOXATR_VALUE );
+ }
+ else
+ {
+ // the normal case: set formula and value (if available)
+
+ const OUString& rFormula = pCell->GetFormula();
+ if (rFormula.getLength() > 0)
+ {
+ // formula cell: insert formula if valid
+ SwTblBoxFormula aFormulaItem( rFormula );
+ pBoxFmt->SetAttr( aFormulaItem );
+ }
+
+ // always insert value, even if default
+ if( pCell->HasValue() )
+ {
+ SwTblBoxValue aValueItem( pCell->GetValue() );
+ pBoxFmt->SetAttr( aValueItem );
+ }
}
// update cell content depend on the default language
@@ -2759,11 +2821,16 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
if( !pPrevSttNd )
{
pBox1->pSttNd = pStNd;
- SwTable& rTable = pTableNode->GetTable();
- SwFrmFmt *pTblFmt = rTable.GetFrmFmt();
- Reference < XCell > xCell( SwXCell::CreateXCell( pTblFmt, pBox1, 0, &rTable ) );
- Reference < XText > xText( xCell, UNO_QUERY );
- Reference < XTextCursor > xTextCursor = xText->createTextCursor();
+ SwCntntNode *pCNd = pDoc->GetNodes()[ pStNd->GetIndex() + 1 ]
+ ->GetCntntNode();
+ SwPosition aPos( *pCNd );
+ aPos.nContent.Assign( pCNd, 0U );
+
+ Reference < XTextRange > xTextRange =
+ SwXTextRange::CreateTextRangeFromPosition( pDoc, aPos, 0 );
+ Reference < XText > xText = xTextRange->getText();
+ Reference < XTextCursor > xTextCursor =
+ xText->createTextCursorByRange( xTextRange );
GetImport().GetTextImport()->SetCursor( xTextCursor );
}
}
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index edea7b16d1f2..426c5abf43c5 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmltexte.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: mib $ $Date: 2001-11-26 11:37:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -288,26 +288,6 @@ SwXMLTextParagraphExport::~SwXMLTextParagraphExport()
{
}
-void SwXMLTextParagraphExport::getTextEmbeddedObjectProperties(
- const Reference < XPropertySet >& rPropSet,
- OUString& rURL,
- sal_Bool& rExtern ) const
-{
- SwOLENode *pOLENd = GetNoTxtNode( rPropSet )->GetOLENode();
- SwOLEObj& rOLEObj = pOLENd->GetOLEObj();
-
- rURL = sEmbeddedObjectProtocol;
- rURL += rOLEObj.GetName();
- SvInfoObject *pInfo =
- pOLENd->GetDoc()->GetPersist()->Find( rOLEObj.GetName() );
- DBG_ASSERT( pInfo, "no info object for OLE object found" );
- if( pInfo )
- {
- SvGlobalName aClassName( pInfo->GetClassName() );
- rExtern = aOutplaceClassId == aClassName;
- }
-}
-
void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL(
const Reference < XPropertySet >& rPropSet,
OUString& rURL) const
@@ -360,29 +340,32 @@ void lcl_addOutplaceProperties(
if( pEmbed )
{
const Rectangle& rVisArea = pEmbed->GetVisArea();
- Any aAny;
+ if( !rVisArea.IsEmpty() )
+ {
+ Any aAny;
- aAny <<= (sal_Int32)rVisArea.Left();
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), aAny );
- pStates++;
+ aAny <<= (sal_Int32)rVisArea.Left();
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), aAny );
+ pStates++;
- aAny <<= (sal_Int32)rVisArea.Top();
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), aAny );
- pStates++;
+ aAny <<= (sal_Int32)rVisArea.Top();
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), aAny );
+ pStates++;
- aAny <<= (sal_Int32)rVisArea.GetWidth();
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), aAny );
- pStates++;
+ aAny <<= (sal_Int32)rVisArea.GetWidth();
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), aAny );
+ pStates++;
- aAny <<= (sal_Int32)rVisArea.GetHeight();
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), aAny );
- pStates++;
+ aAny <<= (sal_Int32)rVisArea.GetHeight();
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), aAny );
+ pStates++;
- aAny <<= (sal_Int32)pEmbed->GetViewAspect();
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_DRAW_ASPECT ), aAny );
- pStates++;
+ aAny <<= (sal_Int32)pEmbed->GetViewAspect();
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_DRAW_ASPECT ), aAny );
+ pStates++;
- // TODO: aspect
+ // TODO: aspect
+ }
}
}
@@ -551,7 +534,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded(
if( (rExport.getExportFlags() & EXPORT_EMBEDDED) == 0 )
{
OUString sURL( sEmbeddedObjectProtocol );
- sURL += rOLEObj.GetName();
+ sURL += pInfo->GetStorageName();
sURL = GetExport().AddEmbeddedObject( sURL );
lcl_addURL( rExport, sURL, sal_False );
}
diff --git a/sw/source/filter/xml/xmltexte.hxx b/sw/source/filter/xml/xmltexte.hxx
index a71cf928efc6..0673a237d9cf 100644
--- a/sw/source/filter/xml/xmltexte.hxx
+++ b/sw/source/filter/xml/xmltexte.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmltexte.hxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: mib $ $Date: 2001-03-21 10:19:54 $
+ * last change: $Author: hr $ $Date: 2003-03-27 15:42:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -115,11 +115,6 @@ public:
SvXMLAutoStylePoolP& rAutoStylePool );
~SwXMLTextParagraphExport();
- virtual void getTextEmbeddedObjectProperties(
- const ::com::sun::star::uno::Reference <
- ::com::sun::star::beans::XPropertySet >& rPropSet,
- ::rtl::OUString& rStreamName,
- sal_Bool& rExtern ) const;
virtual void setTextEmbeddedGraphicURL(
const ::com::sun::star::uno::Reference <
::com::sun::star::beans::XPropertySet >& rPropSet,