[Libreoffice-commits] core.git: 3 commits - bin/findunusedcode filter/source idl/inc idl/source include/rsc include/sfx2 include/svx sc/source sd/source sfx2/source svgio/inc svgio/source svx/source sw/inc sw/Library_sw.mk sw/qa sw/source unusedcode.easy
Caolán McNamara
caolanm at redhat.com
Wed Oct 22 05:12:06 PDT 2014
bin/findunusedcode | 1
dev/null |binary
filter/source/config/fragments/filters/MS_WinWord_5.xcu | 2
filter/source/config/fragments/types/writer_MS_WinWord_5.xcu | 2
idl/inc/basobj.hxx | 1
idl/inc/bastype.hxx | 1
idl/inc/hash.hxx | 2
idl/inc/module.hxx | 1
idl/inc/types.hxx | 3
idl/source/cmptools/hash.cxx | 10
idl/source/objects/basobj.cxx | 21
idl/source/objects/bastype.cxx | 10
idl/source/objects/module.cxx | 6
idl/source/objects/types.cxx | 40
include/rsc/rscsfx.hxx | 2
include/sfx2/app.hxx | 1
include/sfx2/templdlg.hxx | 30
include/svx/dbtoolsclient.hxx | 10
sc/source/ui/view/formatsh.cxx | 4
sd/source/ui/view/drviewsf.cxx | 10
sd/source/ui/view/outlnvsh.cxx | 2
sd/source/ui/view/viewshe3.cxx | 2
sfx2/source/dialog/templdlg.cxx | 167
sfx2/source/inc/templdgi.hxx | 3
svgio/inc/svgio/svgreader/svgdocument.hxx | 1
svgio/source/svgreader/svgdocument.cxx | 8
svx/source/form/dbtoolsclient.cxx | 22
sw/Library_sw.mk | 6
sw/inc/doc.hxx | 3
sw/inc/iodetect.hxx | 4
sw/qa/core/data/ww5/pass/ooo2535-1-WW2.doc |binary
sw/qa/core/data/ww5/pass/ooo40683-1-WW1.doc |binary
sw/source/core/doc/docglos.cxx | 10
sw/source/filter/basflt/fltini.cxx | 2
sw/source/filter/basflt/fltshell.cxx | 2152 +++++++++++
sw/source/filter/basflt/iodetect.cxx | 46
sw/source/filter/inc/fltini.hxx | 5
sw/source/filter/ww1/fltshell.cxx | 2152 -----------
sw/source/filter/ww1/w1class.cxx | 1214 ------
sw/source/filter/ww1/w1class.hxx | 1491 -------
sw/source/filter/ww1/w1filter.cxx | 1988 ----------
sw/source/filter/ww1/w1par.cxx | 105
sw/source/filter/ww1/w1par.hxx | 34
sw/source/filter/ww1/w1sprm.cxx | 632 ---
sw/source/filter/ww1/w1struct.hxx | 837 ----
sw/source/filter/ww8/types.hxx | 2
sw/source/filter/ww8/ww8par.cxx | 5
sw/source/filter/ww8/ww8par2.cxx | 3
sw/source/filter/ww8/ww8scan.cxx | 51
sw/source/ui/uno/swdetect.cxx | 6
sw/source/uibase/app/docsh.cxx | 3
sw/source/uibase/app/docst.cxx | 2
unusedcode.easy | 20
53 files changed, 2254 insertions(+), 8881 deletions(-)
New commits:
commit deb9dd0648abe81cb8c9b0696c71ebd823c0a549
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 22 12:48:46 2014 +0100
remove original and unused word for windows 1 filter
move fltshell.cxx into basflt and fire up the chainsaw for the rest
This filter has never, as far as I know, had a route to actually execute it
since day 0 of OpenOffice.org.
Change-Id: I35a92e2dee60bdc5d2d4e7181074bc4a3635b54c
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index acf947a..4bdae0b 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -497,6 +497,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/filter/ascii/wrtasc \
sw/source/filter/basflt/docfact \
sw/source/filter/basflt/fltini \
+ sw/source/filter/basflt/fltshell \
sw/source/filter/basflt/iodetect \
sw/source/filter/basflt/shellio \
sw/source/filter/html/SwAppletImpl \
@@ -531,11 +532,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/filter/writer/writer \
sw/source/filter/writer/wrt_fn \
sw/source/filter/writer/wrtswtbl \
- sw/source/filter/ww1/fltshell \
- sw/source/filter/ww1/w1class \
- sw/source/filter/ww1/w1filter \
- sw/source/filter/ww1/w1par \
- sw/source/filter/ww1/w1sprm \
sw/source/filter/xml/XMLRedlineImportHelper \
sw/source/filter/xml/swxml \
sw/source/filter/xml/wrtxml \
diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx
index 1197139..ea1faf9 100644
--- a/sw/inc/iodetect.hxx
+++ b/sw/inc/iodetect.hxx
@@ -37,7 +37,6 @@
#define FILTER_XMLV "CXMLV" ///< XML filter
#define FILTER_XMLVW "CXMLVWEB" ///< XML filter
#define sHTML "HTML"
-#define sWW1 "WW1"
#define sWW5 "WW6"
#define sWW6 "CWW6"
@@ -66,7 +65,6 @@ enum ReaderWriterEnum {
READER_WRITER_WW8,
READER_WRITER_RTF_WH,
READER_WRITER_HTML,
- READER_WRITER_WW1,
READER_WRITER_WW5,
READER_WRITER_XML,
READER_WRITER_TEXT_DLG,
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 3433bda..fca7555 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -77,7 +77,6 @@ SwReaderWriterEntry aReaderWriter[] =
SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, true ),
SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, true ),
SwReaderWriterEntry( 0, &::GetHTMLWriter, true ),
- SwReaderWriterEntry( 0, 0, true ),
SwReaderWriterEntry( &::GetWW8Reader, 0, true ),
SwReaderWriterEntry( 0, &::GetXMLWriter, true ),
SwReaderWriterEntry( 0, &::GetASCWriter, false ),
@@ -130,7 +129,6 @@ Filters::Filters()
{
_SetFltPtr( READER_WRITER_BAS, (ReadAscii = new AsciiReader) );
_SetFltPtr( READER_WRITER_HTML, (ReadHTML = new HTMLReader) );
- _SetFltPtr( READER_WRITER_WW1, new WW1Reader );
_SetFltPtr( READER_WRITER_XML, (ReadXML = new XMLReader) );
_SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii );
_SetFltPtr( READER_WRITER_TEXT, ReadAscii );
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
similarity index 100%
rename from sw/source/filter/ww1/fltshell.cxx
rename to sw/source/filter/basflt/fltshell.cxx
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index bd3876f..9fdfe13 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -41,7 +41,6 @@ SwIoDetect aFilterDetect[] =
SwIoDetect( FILTER_WW8 ),
SwIoDetect( sRtfWH ),
SwIoDetect( sHTML ),
- SwIoDetect( sWW1 ),
SwIoDetect( sWW5 ),
SwIoDetect( FILTER_XML ),
SwIoDetect( FILTER_TEXT_DLG ),
diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx
index bc9b3cb..480794b 100644
--- a/sw/source/filter/inc/fltini.hxx
+++ b/sw/source/filter/inc/fltini.hxx
@@ -39,11 +39,6 @@ public:
HTMLReader();
};
-class WW1Reader : public Reader
-{
- virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) SAL_OVERRIDE;
-};
-
class XMLReader : public Reader
{
virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) SAL_OVERRIDE;
diff --git a/sw/source/filter/ww1/w1class.cxx b/sw/source/filter/ww1/w1class.cxx
deleted file mode 100644
index 67629b4..0000000
--- a/sw/source/filter/ww1/w1class.cxx
+++ /dev/null
@@ -1,1214 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <string.h>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustring.hxx>
-#include <tools/stream.hxx>
-#include <w1class.hxx>
-
-#ifdef DUMP
-static const sal_Char* pUnknown = "?";
-#define DUMPNAME(s) s
-#else
-#define DUMPNAME(s) 0
-#endif
-
-Ww1SingleSprm* Ww1Sprm::aTab[ 256 ];
-Ww1SingleSprm* Ww1Sprm::pSingleSprm = 0;
-
-// Fib
-Ww1Fib::Ww1Fib( SvStream& _rStream )
- : rStream(_rStream)
-{
- bOK = 0 == rStream.Seek(0) &&
- rStream.Read( &aFib, sizeof( aFib )) == sizeof( aFib );
-}
-
-// PlainText
-Ww1PlainText::Ww1PlainText(Ww1Fib& rWwFib, sal_uLong nFilePos, sal_uLong nCountBytes)
- : rFib(rWwFib), ulFilePos(nFilePos), ulCountBytes(nCountBytes),
- ulSeek(0), bOK(true)
-{
-}
-
-sal_Unicode Ww1PlainText::operator [] ( sal_uLong ulOffset )
-{
- OSL_ENSURE( ulOffset<Count(), "Ww1PlainText" );
- sal_Unicode cRet;
- sal_Char cRead;
- if( rFib.GetStream().Seek( ulFilePos + ulOffset ) == ulFilePos+ulOffset &&
- rFib.GetStream().Read( &cRead, sizeof( cRead ) ) == sizeof( cRead ) )
- {
- cRet = OUString(&cRead, 1, RTL_TEXTENCODING_MS_1252).toChar();
- }
- else
- cRet = ' ';
- return cRet;
-}
-
-OUString Ww1PlainText::GetText( sal_uLong ulOffset, sal_uLong nLen ) const
-{
- OSL_ENSURE(ulOffset+nLen<Count(), "Ww1PlainText");
-
- sal_Size nPos = ulFilePos+ulOffset;
-
- bool bSeekOk = rFib.GetStream().Seek(nPos) == nPos;
- return bSeekOk ?
- read_uInt8s_ToOUString(rFib.GetStream(), nLen, RTL_TEXTENCODING_MS_1252) :
- OUString();
-}
-
-// Style
-Ww1Style::Ww1Style()
- : pPapx(0), pParent(0), stcBase(0), stcNext(0), bUsed(false)
-{
-}
-
-Ww1Style::~Ww1Style()
-{
- delete pPapx;
-}
-
-void Ww1Style::SetDefaults(sal_uInt8 stc)
-{
- if( 222 == stc )
- {
- stcBase = 222;
- stcNext = 222;
- aChpx.hpsSet(20);
- }
-}
-
-sal_uInt16 Ww1Style::ReadName( sal_uInt8*&p, sal_uInt16& rnCountBytes, sal_uInt16 stc )
-{
- sal_uInt8 nCountBytes = *p;
- p++;
- rnCountBytes--;
- if( !nCountBytes ) // default
- {
- static const sal_Char* const names[] =
- {
- "W1 Null", //222
- "W1 Annotation reference", //223
- "W1 Annotation text", //224
- "W1 Table of contents 8", //225
- "W1 Table of contents 7", //226
- "W1 Table of contents 6", //227
- "W1 Table of contents 5", //228
- "W1 Table of contents 4", //229
- "W1 Table of contents 3", //230
- "W1 Table of contents 2", //231
- "W1 Table of contents 1", //232
- "W1 Index 7", //233
- "W1 Index 6", //234
- "W1 Index 5", //235
- "W1 Index 4", //236
- "W1 Index 3", //237
- "W1 Index 2", //238
- "W1 Index 1", //239
- "W1 Line number", //240
- "W1 Index heading", //241
- "W1 Footer", //242
- "W1 Header", //243
- "W1 Footnote reference", //244
- "W1 Footnote text", //245
- "W1 Heading 9", //246
- "W1 Heading 8", //247
- "W1 Heading 7", //248
- "W1 Heading 6", //249
- "W1 Heading 5", //250
- "W1 Heading 4", //251
- "W1 Heading 3", //252
- "W1 Heading 2", //253
- "W1 Heading 1", //254
- "W1 Normal indent" //255
- };//256
-
- const sal_Char* pStr;
- size_t nSize(stc);
- if (!nSize)
- pStr = "W1 Normal";
- else if (nSize - 222 >= SAL_N_ELEMENTS(names))
- pStr = "?";
- else
- pStr = names[nSize-222];
- SetName(OUString(pStr, strlen(pStr), RTL_TEXTENCODING_MS_1252));
- }
- else if( 255 > nCountBytes ) // unused
- {
- SetName( OUString( (sal_Char*)p, nCountBytes, RTL_TEXTENCODING_MS_1252 ));
- p += nCountBytes;
- OSL_ENSURE(rnCountBytes>=nCountBytes, "Ww1Style");
- rnCountBytes = rnCountBytes - nCountBytes;
- }
- return 0;
-}
-
-sal_uInt16 Ww1Style::ReadChpx( sal_uInt8*&p, sal_uInt16& rnCountBytes )
-{
- sal_uInt16 nCountBytes = *p;
- p++;
- rnCountBytes--;
- if (nCountBytes != 255 // unused
- && nCountBytes != 0) // default
- {
- if (nCountBytes > sizeof(aChpx))
- nCountBytes = sizeof(aChpx);
- memcpy( &aChpx, p, nCountBytes );
- p += nCountBytes;
- OSL_ENSURE(rnCountBytes>=nCountBytes, "Ww1Style");
- rnCountBytes = rnCountBytes - nCountBytes;
- }
- return 0;
-}
-
-sal_uInt16 Ww1Style::ReadPapx(sal_uInt8*&p, sal_uInt16& rnCountBytes)
-{
- sal_uInt16 nCountBytes = *p;
- p++;
- rnCountBytes--;
- if (nCountBytes != 255)
- {
- pPapx = new Ww1SprmPapx(p, nCountBytes);
- p += nCountBytes;
- OSL_ENSURE(rnCountBytes>=nCountBytes, "Ww1Style");
- rnCountBytes = rnCountBytes - nCountBytes;
- }
- else
- pPapx = new Ww1SprmPapx(p, 0);
- return 0;
-}
-
-sal_uInt16 Ww1Style::ReadEstcp(sal_uInt8*&p, sal_uInt16& rnCountBytes)
-{
- stcNext = *p;
- p++;
- rnCountBytes--;
- stcBase = *p;
- p++;
- OSL_ENSURE(rnCountBytes>0, "Ww1Style");
- rnCountBytes--;
- return 0;
-}
-
-// StyleSheet
-Ww1StyleSheet::Ww1StyleSheet(Ww1Fib& _rFib)
- : cstcStd(0),
- rFib(_rFib),
- bOK(false)
-{
- sal_uInt16 cbStshf = rFib.GetFIB().cbStshfGet();
- OSL_ENSURE(cbStshf>=17, "Ww1StyleSheet");
- for (sal_uInt16 stc=0;stc<Count();stc++)
- {
- aStyles[stc].SetParent(this);
- aStyles[stc].SetDefaults((sal_uInt8)stc);
- }
- sal_uInt8* del = NULL;
- if (rFib.GetStream().Seek(rFib.GetFIB().fcStshfGet())
- == (sal_uLong)rFib.GetFIB().fcStshfGet()
- && (del = new sal_uInt8[cbStshf]) != NULL
- && rFib.GetStream().Read(del, cbStshf) == (sal_uLong)cbStshf)
- {
- sal_uInt8* p = del;
- cstcStd = SVBT16ToShort(p);
- p += sizeof(SVBT16);
- cbStshf -= sizeof(SVBT16);
- ReadNames(p, cbStshf);
- ReadChpx(p, cbStshf);
- ReadPapx(p, cbStshf);
- ReadEstcp(p, cbStshf);
- OSL_ENSURE(cbStshf==0, "Ww1StyleSheet");
- bOK = cbStshf == 0;
- }
- delete [] del;
-}
-
-sal_uInt16 Ww1StyleSheet::ReadNames( sal_uInt8*& p, sal_uInt16& rnCountBytes )
-{
- sal_uInt16 nCountBytes = SVBT16ToShort(p);
- p += sizeof(SVBT16);
- OSL_ENSURE(rnCountBytes>=nCountBytes, "Ww1StyleSheet");
- rnCountBytes = rnCountBytes - nCountBytes;
- nCountBytes = nCountBytes - sizeof(SVBT16);
- sal_uInt16 stcp = 0;
- while (nCountBytes > 0)
- {
- sal_uInt16 stc = (stcp - cstcStd) & 255;
- aStyles[stc].ReadName(p, nCountBytes, stc);
- stcp++;
- }
- OSL_ENSURE(nCountBytes==0, "Ww1StyleSheet");
- return 0;
-}
-
-sal_uInt16 Ww1StyleSheet::ReadChpx(sal_uInt8*& p, sal_uInt16& rnCountBytes)
-{
- sal_uInt16 nCountBytes = SVBT16ToShort(p);
- p += sizeof(SVBT16);
- OSL_ENSURE(rnCountBytes>=nCountBytes, "Ww1StyleSheet");
- rnCountBytes = rnCountBytes - nCountBytes;
- nCountBytes = nCountBytes - sizeof(SVBT16);
- sal_uInt16 stcp = 0;
- while (nCountBytes > 0)
- {
- sal_uInt16 stc = (stcp - cstcStd) & 255;
- aStyles[stc].ReadChpx(p, nCountBytes);
- stcp++;
- }
- OSL_ENSURE(nCountBytes == 0, "Ww1StyleSheet");
- return 0;
-}
-
-sal_uInt16 Ww1StyleSheet::ReadPapx(sal_uInt8*& p, sal_uInt16& rnCountBytes)
-{
- sal_uInt16 nCountBytes = SVBT16ToShort(p);
- p += sizeof(SVBT16);
- OSL_ENSURE(rnCountBytes>=nCountBytes, "Ww1StyleSheet");
- rnCountBytes = rnCountBytes - nCountBytes;
- nCountBytes = nCountBytes - sizeof(SVBT16);
- sal_uInt16 stcp = 0;
- while (nCountBytes > 0)
- {
- sal_uInt16 stc = (stcp - cstcStd) & 255;
- aStyles[stc].ReadPapx(p, nCountBytes);
- stcp++;
- }
- OSL_ENSURE(nCountBytes == 0, "Ww1StyleSheet");
- return 0;
-}
-
-sal_uInt16 Ww1StyleSheet::ReadEstcp(sal_uInt8*& p, sal_uInt16& rnCountBytes)
-{
- sal_uInt16 iMac = SVBT16ToShort(p);
- p += sizeof(SVBT16);
- OSL_ENSURE(rnCountBytes>=sizeof(SVBT16), "Ww1StyleSheet");
- rnCountBytes -= sizeof(SVBT16);
- for (sal_uInt16 stcp=0;stcp<iMac;stcp++)
- {
- sal_uInt16 stc = (stcp - cstcStd) & 255;
- aStyles[stc].ReadEstcp(p, rnCountBytes);
- }
- OSL_ENSURE(rnCountBytes==0, "Ww1StyleSheet");
- return 0;
-}
-
-// Fonts
-Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, sal_uLong nFieldFlgs)
- : pFontA(0), rFib(rInFib), nFieldFlags(nFieldFlgs), nMax(0), bOK(false)
-{
- if(rFib.GetFIB().cbSttbfffnGet() > 2 ) // any fonts at all?
- {
- SVBT16 nCountBytes;
- OSL_ENSURE(rFib.GetFIB().cbSttbfffnGet() > sizeof(nCountBytes), "Ww1Fonts");
- if (rFib.GetStream().Seek(rFib.GetFIB().fcSttbfffnGet())
- == (sal_uLong)rFib.GetFIB().fcSttbfffnGet())
- if (rFib.GetStream().Read(nCountBytes, sizeof(nCountBytes))
- == sizeof(nCountBytes)) // length is repeated here
- {
- OSL_ENSURE(SVBT16ToShort(nCountBytes)
- == rFib.GetFIB().cbSttbfffnGet(), "redundant-size missmatch");
- // hopefully they're always equal
- W1_FFN* pA = (W1_FFN*)new char[rFib.GetFIB().cbSttbfffnGet()
- - sizeof(nCountBytes)]; // allocate Font-Array
- //~ Ww1: new-NULL
- if (rFib.GetStream().Read(pA, rFib.GetFIB().cbSttbfffnGet()
- - sizeof(nCountBytes)) == (sal_uLong)rFib.GetFIB().cbSttbfffnGet()
- - sizeof(nCountBytes)) // read all Fonts
- {} // nothing
-
- long nLeft = rFib.GetFIB().cbSttbfffnGet()
- - sizeof(nCountBytes); // count how many contain fonts
- W1_FFN* p = pA;
- while (true)
- {
- sal_uInt16 nNextSiz;
- nNextSiz = p->cbFfnM1Get() + 1;
- if(nNextSiz > nLeft)
- break;
- nMax++;
- nLeft -= nNextSiz;
- if(nLeft < 1) // need to be able to read next length
- break;
- p = (W1_FFN *)(((char*)p) + nNextSiz);
- }
- if (nMax)
- {
- pFontA = new W1_FFN*[nMax]; // allocate Index-Array
- //~ Ww1: new-NULL
- pFontA[0] = pA; // fill Index-Array
- sal_uInt16 i;
- for(i=1, p=pA; i<nMax; i++)
- {
- p = (W1_FFN*)(((char*)p) + p->cbFfnM1Get() + 1);
- pFontA[i] = p;
- }
- }
- else
- pFontA = 0; // no entries -> no Array
- }
- }
- bOK = true;
-}
-
-W1_FFN* Ww1Fonts::GetFFN(sal_uInt16 nNum)
-{
- W1_FFN* pRet = NULL;
- if (pFontA)
- if (nNum < nMax)
- pRet = pFontA[nNum];
- return pRet;
-}
-
-// DOP
-Ww1Dop::Ww1Dop(Ww1Fib& _rFib)
- : rFib(_rFib)
-{
- long nRead;
- memset(&aDop, 0, sizeof(aDop)); // set defaults
- if(rFib.GetFIB().cbDopGet() >= sizeof(aDop))
- nRead = sizeof(aDop);
- else
- nRead = rFib.GetFIB().cbDopGet();
- bOK = rFib.GetStream().Seek(rFib.GetFIB().fcDopGet()) ==
- (sal_uLong)rFib.GetFIB().fcDopGet() &&
- rFib.GetStream().Read(&aDop, nRead) == (sal_uLong)nRead;
-}
-
-// Picture
-Ww1Picture::Ww1Picture(SvStream& rStream, sal_uLong ulFilePos)
- : bOK(false), pPic(0)
-{
- ulFilePos &= 0xffffff; //~ ww1: for some reason the high byte contains 5?!?!
- SVBT32 lcb;
- if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos)
- if (rStream.Read(&lcb, sizeof(lcb)) == (sal_uLong)sizeof(lcb))
- if (sizeof(int)>=4 || SVBT32ToUInt32(lcb) < 0x8000) //~ mdt: 64K & 16bit
- if ((pPic = (W1_PIC*)(new sal_uInt8[SVBT32ToUInt32(lcb)])) != NULL)
- if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos)
- if (rStream.Read(pPic, SVBT32ToUInt32(lcb)) == (sal_uLong)SVBT32ToUInt32(lcb))
- {
- OSL_ENSURE(pPic->cbHeaderGet()==sizeof(*pPic)-sizeof(pPic->rgb), "Ww1Picture");
- bOK = true;
- }
-}
-
-// Sprm
-Ww1Sprm::Ww1Sprm(sal_uInt8* x, sal_uInt16 _nCountBytes)
- : p(NULL),
- nCountBytes(_nCountBytes),
- bOK(false),
- pArr(NULL),
- count(0)
-{
- if (nCountBytes == 0)
- bOK = true;
- else
- if ((p = new sal_uInt8[nCountBytes]) != NULL)
- {
- memcpy(p, x, nCountBytes);
- if (ReCalc())
- bOK = true;
- }
-}
-
-Ww1Sprm::Ww1Sprm(SvStream& rStream, sal_uLong ulFilePos)
- : p(NULL),
- nCountBytes(0),
- bOK(false),
- pArr(NULL),
- count(0)
-{
- sal_uInt8 x = 0;
- if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos)
- if (rStream.Read(&x, sizeof(x)) == (sal_uLong)sizeof(x))
- if ((nCountBytes = x) == 255
- || !nCountBytes
- || (p = new sal_uInt8[nCountBytes]) != NULL)
- if (nCountBytes == 255
- || !nCountBytes
- || rStream.Read(p, nCountBytes) == (sal_uLong)nCountBytes)
- if (ReCalc())
- bOK = true;
-}
-
-Ww1Sprm::~Ww1Sprm()
-{
- delete[] pArr;
- delete[] p;
-}
-
-sal_uInt16 Ww1SingleSprm::Size(sal_uInt8* /*pSprm*/)
-{
- return nCountBytes;
-}
-
-Ww1SingleSprm::~Ww1SingleSprm()
-{
-}
-
-sal_uInt16 Ww1SingleSprmTab::Size(sal_uInt8* pSprm) // Doc 24/25, Fastsave-Sprm
-{
- OSL_ENSURE(nCountBytes==0, "Ww1SingleSprmTab");
- sal_uInt16 nRet = sizeof(sal_uInt8);
- sal_uInt16 nSize = *pSprm;
- if (nSize != 255)
- nRet = nRet + nSize;
- else
- {
- sal_uInt16 nDel = (*(pSprm + 1)) * 4;
- sal_uInt16 nIns = (*(pSprm + 3 + nDel)) * 3;
- nRet += nDel + nIns;
- }
- OSL_ENSURE(nRet <= 354, "Ww1SingleSprmTab");
- if (nRet > 354)
- nRet = 0;
- return nRet;
-}
-
-sal_uInt16 Ww1SingleSprmByteSized::Size(sal_uInt8* pSprm)
-{
- sal_uInt16 nRet = *pSprm + sizeof(sal_uInt8) + nCountBytes;
- return nRet;
-}
-
-sal_uInt16 Ww1SingleSprmWordSized::Size(sal_uInt8* pSprm)
-{
- sal_uInt16 nRet;
- nRet = SVBT16ToShort(pSprm);
- nRet += sizeof(SVBT16); // var. l. word-size
- nRet = nRet + nCountBytes;
- return nRet;
-}
-
-static sal_uInt8 nLast = 0;
-static sal_uInt8 nCurrent = 0;
-sal_uInt16 Ww1Sprm::GetSize(sal_uInt8 nId, sal_uInt8* pSprm)
-{
- sal_uInt16 nL = 0;
- nL = GetTab(nId).Size(pSprm);
- nLast = nCurrent;
- nCurrent = nId;
- return nL;
-}
-
-bool Ww1Sprm::Fill(sal_uInt16 index, sal_uInt8& nId, sal_uInt16& nL, sal_uInt8*& pSprm)
-{
- OSL_ENSURE(index < Count(), "Ww1Sprm");
- pSprm = p + pArr[index];
- nId = *pSprm;
- pSprm++;
- nL = GetTab(nId).Size(pSprm);
- return true;
-}
-
-bool Ww1Sprm::ReCalc()
-{
- bool bRet = true;
- delete[] pArr;
- pArr = NULL;
- count = 0;
- if (nCountBytes != 255) // not unused?
- {
- sal_uInt16 cbsik = nCountBytes;
- sal_uInt8* psik = p;
- while (cbsik > 0)
- {
- sal_uInt16 iLen = GetSizeBrutto(psik);
- OSL_ENSURE(iLen<=cbsik, "Ww1Sprm");
- if (iLen > cbsik)
- cbsik = 0; // ignore the rest: we are wrong...
- else
- {
- psik += iLen;
- cbsik = cbsik - iLen;
- count++;
- }
- }
- if (bRet
- && (pArr = new sal_uInt16[count]) != NULL)
- {
- cbsik = nCountBytes;
- sal_uInt16 offset = 0;
- sal_uInt16 current = 0;
- psik = p;
- while (current<count)
- {
- pArr[current++] = offset;
- sal_uInt16 iLen = GetSizeBrutto(psik);
- psik += iLen;
- if (iLen > cbsik)
- cbsik = 0;
- else
- cbsik = cbsik - iLen;
- offset = offset + iLen;
- }
-
- }
- else
- count = 0;
- }
- return bRet;
-}
-
-void Ww1Sprm::DeinitTab()
-{
- for (size_t i=0; i < SAL_N_ELEMENTS(aTab); ++i)
- delete aTab[i];
- memset(aTab, 0, SAL_N_ELEMENTS(aTab));
- delete pSingleSprm;
-}
-
-void Ww1Sprm::InitTab()
-{
- memset(aTab, 0, SAL_N_ELEMENTS(aTab));
- pSingleSprm = new Ww1SingleSprm( 0, DUMPNAME(pUnknown));
-
- aTab[ 2] = new Ww1SingleSprmByte(DUMPNAME("sprmPStc")); // 2 pap.istd (style code)
- aTab[ 3] = new Ww1SingleSprmByteSized(0, DUMPNAME("sprmPIstdPermute")); // 3 pap.istd permutation
- aTab[ 4] = new Ww1SingleSprmByte(DUMPNAME("sprmPIncLevel")); // 4 pap.istddifference
- aTab[ 5] = new Ww1SingleSprmPJc(DUMPNAME("sprmPJc")); // 5 pap.jc (justification)
- aTab[ 6] = new Ww1SingleSprmBool(DUMPNAME("sprmPFSideBySide")); // 6 pap.fSideBySide
- aTab[ 7] = new Ww1SingleSprmPFKeep(DUMPNAME("sprmPFKeep")); // 7 pap.fKeep
- aTab[ 8] = new Ww1SingleSprmPFKeepFollow(DUMPNAME("sprmPFKeepFollow")); // 8 pap.fKeepFollow
- aTab[ 9] = new Ww1SingleSprmPPageBreakBefore(DUMPNAME("sprmPPageBreakBefore")); // 9 pap.fPageBreakBefore
- aTab[ 10] = new Ww1SingleSprmByte(DUMPNAME("sprmPBrcl")); // 10 pap.brcl
- aTab[ 11] = new Ww1SingleSprmByte(DUMPNAME("sprmPBrcp")); // 11 pap.brcp
- aTab[ 12] = new Ww1SingleSprmByteSized(0, DUMPNAME("sprmPAnld")); // 12 pap.anld (ANLD structure)
- aTab[ 13] = new Ww1SingleSprmByte(DUMPNAME("sprmPNLvlAnm")); // 13 pap.nLvlAnm nn
- aTab[ 14] = new Ww1SingleSprmBool(DUMPNAME("sprmPFNoLineNumb")); // 14 ap.fNoLnn
- aTab[ 15] = new Ww1SingleSprmPChgTabsPapx(DUMPNAME("sprmPChgTabsPapx")); // 15 pap.itbdMac, ...
- aTab[ 16] = new Ww1SingleSprmPDxaRight(DUMPNAME("sprmPDxaRight")); // 16 pap.dxaRight
- aTab[ 17] = new Ww1SingleSprmPDxaLeft(DUMPNAME("sprmPDxaLeft")); // 17 pap.dxaLeft
- aTab[ 18] = new Ww1SingleSprmWord(DUMPNAME("sprmPNest")); // 18 pap.dxaNest
- aTab[ 19] = new Ww1SingleSprmPDxaLeft1(DUMPNAME("sprmPDxaLeft1")); // 19 pap.dxaLeft1
- aTab[ 20] = new Ww1SingleSprmPDyaLine(DUMPNAME("sprmPDyaLine")); // 20 pap.lspd an LSPD
- aTab[ 21] = new Ww1SingleSprmPDyaBefore(DUMPNAME("sprmPDyaBefore")); // 21 pap.dyaBefore
- aTab[ 22] = new Ww1SingleSprmPDyaAfter(DUMPNAME("sprmPDyaAfter")); // 22 pap.dyaAfter
- aTab[ 23] = new Ww1SingleSprmTab(0, DUMPNAME(pUnknown)); // 23 pap.itbdMac, pap.rgdxaTab
- aTab[ 24] = new Ww1SingleSprmPFInTable(DUMPNAME("sprmPFInTable")); // 24 pap.fInTable
- aTab[ 25] = new Ww1SingleSprmPTtp(DUMPNAME("sprmPTtp")); // 25 pap.fTtp
- aTab[ 26] = new Ww1SingleSprmPDxaAbs(DUMPNAME("sprmPDxaAbs")); // 26 pap.dxaAbs
- aTab[ 27] = new Ww1SingleSprmPDyaAbs(DUMPNAME("sprmPDyaAbs")); // 27 pap.dyaAbs
- aTab[ 28] = new Ww1SingleSprmPDxaWidth(DUMPNAME("sprmPDxaWidth")); // 28 pap.dxaWidth
- aTab[ 29] = new Ww1SingleSprmPpc(DUMPNAME("sprmPPc")); // 29 pap.pcHorz, pap.pcVert
- aTab[ 30] = new Ww1SingleSprmPBrc10(BRC_TOP, DUMPNAME("sprmPBrcTop10")); // 30 pap.brcTop BRC10
- aTab[ 31] = new Ww1SingleSprmPBrc10(BRC_LEFT, DUMPNAME("sprmPBrcLeft10")); // 31 pap.brcLeft BRC10
- aTab[ 32] = new Ww1SingleSprmPBrc10(BRC_BOTTOM, DUMPNAME("sprmPBrcBottom10")); // 32 pap.brcBottom BRC10
- aTab[ 33] = new Ww1SingleSprmPBrc10(BRC_RIGHT, DUMPNAME("sprmPBrcRight10")); // 33 pap.brcRight BRC10
- aTab[ 34] = new Ww1SingleSprmWord(DUMPNAME("sprmPBrcBetween10")); // 34 pap.brcBetween BRC10
- aTab[ 35] = new Ww1SingleSprmPBrc10(BRC_LEFT, DUMPNAME("sprmPBrcBar10")); // 35 pap.brcBar BRC10
- aTab[ 36] = new Ww1SingleSprmPFromText(DUMPNAME("sprmPFromText10")); // 36 pap.dxaFromText dxa
- aTab[ 37] = new Ww1SingleSprmByte(DUMPNAME("sprmPWr")); // 37 pap.wr wr
- aTab[ 38] = new Ww1SingleSprmWord(DUMPNAME("sprmPBrcTop")); // 38 pap.brcTop BRC
- aTab[ 39] = new Ww1SingleSprmWord(DUMPNAME("sprmPBrcLeft")); // 39 pap.brcLeft BRC
- aTab[ 40] = new Ww1SingleSprmWord(DUMPNAME("sprmPBrcBottom")); // 40 pap.brcBottom BRC
- aTab[ 41] = new Ww1SingleSprmWord(DUMPNAME("sprmPBrcRight")); // 41 pap.brcRight BRC
- aTab[ 42] = new Ww1SingleSprmWord(DUMPNAME("sprmPBrcBetween")); // 42 pap.brcBetween BRC
- aTab[ 43] = new Ww1SingleSprmWord(DUMPNAME("sprmPBrcBar")); // 43 pap.brcBar BRC word
- aTab[ 44] = new Ww1SingleSprmBool(DUMPNAME("sprmPFNoAutoHyph")); // 44 pap.fNoAutoHyph
- aTab[ 45] = new Ww1SingleSprmWord(DUMPNAME("sprmPWHeightAbs")); // 45 pap.wHeightAbs w
- aTab[ 46] = new Ww1SingleSprmWord(DUMPNAME("sprmPDcs")); // 46 pap.dcs DCS
- aTab[ 47] = new Ww1SingleSprmWord(DUMPNAME("sprmPShd")); // 47 pap.shd SHD
- aTab[ 48] = new Ww1SingleSprmWord(DUMPNAME("sprmPDyaFromText")); // 48 pap.dyaFromText dya
- aTab[ 49] = new Ww1SingleSprmWord(DUMPNAME("sprmPDxaFromText")); // 49 pap.dxaFromText dxa
- aTab[ 50] = new Ww1SingleSprmBool(DUMPNAME("sprmPFLocked")); // 50 pap.fLocked 0 or 1 byte
- aTab[ 51] = new Ww1SingleSprmBool(DUMPNAME("sprmPFWidowControl")); // 51 pap.fWidowControl 0 or 1 byte
-
- aTab[ 57] = new Ww1SingleSprmByteSized(0, DUMPNAME("sprmCDefault")); // 57 whole CHP (see below) none variable length
- aTab[ 58] = new Ww1SingleSprm(0, DUMPNAME("sprmCPlain")); // 58 whole CHP (see below) none 0
-
- aTab[ 60] = new Ww1SingleSprm4State(DUMPNAME("sprmCFBold")); // 60 chp.fBold 0,1, 128, or 129 (see below) byte
- aTab[ 61] = new Ww1SingleSprm4State(DUMPNAME("sprmCFItalic")); // 61 chp.fItalic 0,1, 128, or 129 (see below) byte
- aTab[ 62] = new Ww1SingleSprm4State(DUMPNAME("sprmCFStrike")); // 62 chp.fStrike 0,1, 128, or 129 (see below) byte
- aTab[ 63] = new Ww1SingleSprm4State(DUMPNAME("sprmCFOutline")); // 63 chp.fOutline 0,1, 128, or 129 (see below) byte
- aTab[ 64] = new Ww1SingleSprm4State(DUMPNAME("sprmCFShadow")); // 64 chp.fShadow 0,1, 128, or 129 (see below) byte
- aTab[ 65] = new Ww1SingleSprm4State(DUMPNAME("sprmCFSmallCaps")); // 65 chp.fSmallCaps 0,1, 128, or 129 (see below) byte
- aTab[ 66] = new Ww1SingleSprm4State(DUMPNAME("sprmCFCaps")); // 66 chp.fCaps 0,1, 128, or 129 (see below) byte
- aTab[ 67] = new Ww1SingleSprm4State(DUMPNAME("sprmCFVanish")); // 67 chp.fVanish 0,1, 128, or 129 (see below) byte
- aTab[ 68] = new Ww1SingleSprmWord(DUMPNAME("sprmCFtc")); // 68 chp.ftc ftc word
- aTab[ 69] = new Ww1SingleSprmByte(DUMPNAME("sprmCKul")); // 69 chp.kul kul byte
- aTab[ 70] = new Ww1SingleSprm(3, DUMPNAME("sprmCSizePos")); // 70 chp.hps, chp.hpsPos (see below) 3 bytes
- aTab[ 71] = new Ww1SingleSprmWord(DUMPNAME("sprmCDxaSpace")); // 71 chp.dxaSpace dxa word
- aTab[ 72] = new Ww1SingleSprmWord(DUMPNAME("//")); // 72
- aTab[ 73] = new Ww1SingleSprmByte(DUMPNAME("sprmCIco")); // 73 chp.ico ico byte
- aTab[ 74] = new Ww1SingleSprmByte(DUMPNAME("sprmCHps")); // 74 chp.hps hps !byte!
- aTab[ 75] = new Ww1SingleSprmByte(DUMPNAME("sprmCHpsInc")); // 75 chp.hps (see below) byte
- aTab[ 76] = new Ww1SingleSprmWord(DUMPNAME("sprmCHpsPos")); // 76 chp.hpsPos hps !word!
- aTab[ 77] = new Ww1SingleSprmByte(DUMPNAME("sprmCHpsPosAdj")); // 77 chp.hpsPos hps (see below) byte
- aTab[ 78] = new Ww1SingleSprmByteSized(0, DUMPNAME(pUnknown)); // 78 ?chp.fBold, chp.fItalic, chp.fSmallCaps, ...
-
- aTab[ 94] = new Ww1SingleSprmByte(DUMPNAME("sprmPicBrcl")); // 94 pic.brcl brcl (see PIC structure definition) byte
- aTab[ 95] = new Ww1SingleSprmByteSized(0, DUMPNAME("sprmPicScale")); // 95 pic.mx, pic.my, pic.dxaCropleft,
-
- aTab[117] = new Ww1SingleSprmByte(DUMPNAME("sprmSBkc")); // 117 sep.bkc bkc byte
- aTab[118] = new Ww1SingleSprmBool(DUMPNAME("sprmSFTitlePage")); // 118 sep.fTitlePage 0 or 1 byte
- aTab[119] = new Ww1SingleSprmSColumns(DUMPNAME("sprmSCcolumns")); // 119 sep.ccolM1 # of cols - 1 word
- aTab[120] = new Ww1SingleSprmWord(DUMPNAME("sprmSDxaColumns")); // 120 sep.dxaColumns dxa word
-
- aTab[122] = new Ww1SingleSprmByte(DUMPNAME("sprmSNfcPgn")); // 122 sep.nfcPgn nfc byte
-
- aTab[125] = new Ww1SingleSprmBool(DUMPNAME("sprmSFPgnRestart")); // 125 sep.fPgnRestart 0 or 1 byte
- aTab[126] = new Ww1SingleSprmBool(DUMPNAME("sprmSFEndnote")); // 126 sep.fEndnote 0 or 1 byte
- aTab[127] = new Ww1SingleSprmByte(DUMPNAME("sprmSLnc")); // 127 sep.lnc lnc byte
- aTab[128] = new Ww1SingleSprmSGprfIhdt(DUMPNAME("sprmSGprfIhdt")); // 128 sep.grpfIhdt grpfihdt (see Headers and Footers topic) byte
- aTab[129] = new Ww1SingleSprmWord(DUMPNAME("sprmSNLnnMod")); // 129 sep.nLnnMod non-neg int. word
- aTab[130] = new Ww1SingleSprmWord(DUMPNAME("sprmSDxaLnn")); // 130 sep.dxaLnn dxa word
- aTab[131] = new Ww1SingleSprmWord(DUMPNAME("sprmSDyaHdrTop")); // 131 sep.dyaHdrTop dya word
- aTab[132] = new Ww1SingleSprmWord(DUMPNAME("sprmSDyaHdrBottom")); // 132 sep.dyaHdrBottom dya word
- aTab[133] = new Ww1SingleSprmBool(DUMPNAME("sprmSLBetween")); // 133 sep.fLBetween 0 or 1 byte
- aTab[134] = new Ww1SingleSprmByte(DUMPNAME("sprmSVjc")); // 134 sep.vjc vjc byte
- aTab[135] = new Ww1SingleSprmWord(DUMPNAME("sprmSLnnMin")); // 135 sep.lnnMin lnn word
- aTab[136] = new Ww1SingleSprmWord(DUMPNAME("sprmSPgnStart")); // 136 sep.pgnStart pgn word
-
- aTab[146] = new Ww1SingleSprmWord(DUMPNAME("sprmTJc")); // 146 tap.jc jc word (low order byte is significant)
- aTab[147] = new Ww1SingleSprmWord(DUMPNAME("sprmTDxaLeft")); // 147 tap.rgdxaCenter (see below) dxa word
- aTab[148] = new Ww1SingleSprmWord(DUMPNAME("sprmTDxaGapHalf")); // 148 tap.dxaGapHalf, tap.rgdxaCenter (see below) dxa word
-
- aTab[152] = new Ww1SingleSprmTDefTable10(DUMPNAME("sprmTDefTable10")); // 152 tap.rgdxaCenter, tap.rgtc complex (see below) variable length
- aTab[153] = new Ww1SingleSprmWord(DUMPNAME("sprmTDyaRowHeight")); // 153 tap.dyaRowHeight dya word
-
- aTab[158] = new Ww1SingleSprm(4, DUMPNAME("sprmTInsert")); // 158 tap.rgdxaCenter,tap.rgtc complex (see below) 4 bytes
- aTab[159] = new Ww1SingleSprmWord(DUMPNAME("sprmTDelete")); // 159 tap.rgdxaCenter, tap.rgtc complex (see below) word
- aTab[160] = new Ww1SingleSprm(4, DUMPNAME("sprmTDxaCol")); // 160 tap.rgdxaCenter complex (see below) 4 bytes
- aTab[161] = new Ww1SingleSprmWord(DUMPNAME("sprmTMerge")); // 161 tap.fFirstMerged, tap.fMerged complex (see below) word
- aTab[162] = new Ww1SingleSprmWord(DUMPNAME("sprmTSplit")); // 162 tap.fFirstMerged, tap.fMerged complex (see below) word
- aTab[163] = new Ww1SingleSprm(5, DUMPNAME("sprmTSetBrc10")); // 163 tap.rgtc[].rgbrc complex (see below) 5 bytes
-}
-
-// SprmPapx
-Ww1SprmPapx::Ww1SprmPapx(sal_uInt8* pByte, sal_uInt16 nSize) :
- Ww1Sprm(Sprm(pByte, nSize), SprmSize(pByte, nSize))
-{
- memset(&aPapx, 0, sizeof(aPapx));
- memcpy(&aPapx, pByte, nSize<sizeof(aPapx)?nSize:sizeof(aPapx));
-}
-
-sal_uInt16 Ww1SprmPapx::SprmSize(sal_uInt8*, sal_uInt16 nSize)
-{
- sal_uInt16 nRet = 0;
- if (nSize >= sizeof(W1_PAPX))
- nRet = nSize - ( sizeof(W1_PAPX) - 1 ); // the 1st SprmByte is contained
- // in the W1_PAPX
- return nRet;
-}
-
-sal_uInt8* Ww1SprmPapx::Sprm(sal_uInt8* pByte, sal_uInt16 nSize)
-{
- sal_uInt8* pRet = NULL;
- if (nSize >= sizeof(W1_PAPX))
- pRet = ((W1_PAPX*)(pByte))->grpprlGet();
- return pRet;
-}
-
-// Plc
-Ww1Plc::Ww1Plc(Ww1Fib& rInFib, sal_uLong ulFilePos, sal_uInt16 nInCountBytes,
- sal_uInt16 nInItemSize)
- : p(0), nCountBytes(nInCountBytes), iMac(0), nItemSize(nInItemSize),
- bOK(false), rFib(rInFib)
-{
- if (!nCountBytes)
- bOK = true;
- else
- {
- if (rFib.GetStream().Seek(ulFilePos) == (sal_uLong)ulFilePos)
- {
- if ((p = new sal_uInt8[nCountBytes]) != NULL)
- {
- if (rFib.GetStream().Read(p, nCountBytes) == (sal_uLong)nCountBytes)
- {
- bOK = true;
- iMac = (nCountBytes -
- sizeof(SVBT32)) / (sizeof(SVBT32) + nItemSize);
- OSL_ENSURE(iMac * ((sal_uInt16)sizeof(sal_uLong) + nItemSize) +
- (sal_uInt16)sizeof(SVBT32) == nCountBytes, "Ww1Plc");
- }
- }
- }
- }
-}
-
-Ww1Plc::~Ww1Plc()
-{
- delete p;
-}
-
-void Ww1Plc::Seek(sal_uLong ulSeek, sal_uInt16& nIndex)
-{
- if (iMac)
- for (;nIndex <= iMac && Where(nIndex) < ulSeek;nIndex++)
- ;
-}
-
-sal_uLong Ww1Plc::Where(sal_uInt16 nIndex)
-{
- sal_uLong ulRet = 0xffffffff;
- OSL_ENSURE(nIndex <= iMac, "index out of bounds");
- if (iMac && nIndex <= iMac)
- ulRet = SVBT32ToUInt32(p + sizeof(SVBT32) * nIndex);
- return ulRet;
-}
-
-sal_uInt8* Ww1Plc::GetData(sal_uInt16 nIndex)
-{
- sal_uInt8* pRet = NULL;
- OSL_ENSURE(nIndex < iMac, "index out of bounds");
- if (nIndex < iMac)
- pRet = p + (iMac + 1) * sizeof(SVBT32) +
- nIndex * nItemSize; // Pointer to content array
- return pRet;
-}
-
-// PlcBookmarks
-// class Ww1StringList reads a number of P strings from the stream into memory
-// and patches them into C strings
-// nMax returns the count
-// Index 0 references all strings; index 1 and higher reference individual strings
-Ww1StringList::Ww1StringList( SvStream& rSt, sal_uLong nFc, sal_uInt16 nCb )
- : pIdxA(0), nMax(0)
-{
- if( nCb > 2 ) // any entries at all?
- {
- SVBT16 nCountBytes;
- OSL_ENSURE(nCb > sizeof(nCountBytes), "Ww1StringList");
- if (rSt.Seek(nFc) == (sal_uLong)nFc)
- if (rSt.Read(nCountBytes, sizeof(nCountBytes))
- == sizeof(nCountBytes)) // length again
- {
- OSL_ENSURE(SVBT16ToShort(nCountBytes)
- == nCb, "redundant-size missmatch");
- // let's hope that they are always equal
- sal_Char* pA = new sal_Char[nCb - sizeof(nCountBytes) + 1];
- // allocating PString array
- //~ Ww1: new-NULL
- if (rSt.Read(pA, nCb - sizeof(nCountBytes))
- == (sal_uLong)nCb - sizeof(nCountBytes)) // read all
- {}// do nothing
- // Count number of fonts
- long nLeft = nCb - sizeof(nCountBytes);
- sal_Char* p = pA;
- while (true)
- {
- sal_uInt16 nNextSiz;
- nNextSiz = *p + 1;
- if(nNextSiz > nLeft)
- break;
- nMax++;
- nLeft -= nNextSiz;
- if(nLeft < 1) // need to be able to read next length
- break;
- p = p + nNextSiz;
- }
- if (nMax)
- {
- pIdxA = new sal_Char*[nMax+1]; // allocate index array
- pIdxA[0] = pA; // Index 0 : everything
- // from index 1 C strings
- pIdxA[1] = pA + 1; // fill index array
- sal_uInt16 i = 2;
- p = pA;
- sal_uInt8 nL = *p;
- while(true)
- {
- p += nL + 1; // new length byte
- nL = *p; // remember length
- *p = '\0'; // make C string
- if( i > nMax )
- break;
- pIdxA[i] = p + 1; // Ptr to C string
- i++;
- }
- }
- else
- pIdxA = 0; // No entries -> no array
- }
- }
-}
-
-const OUString Ww1StringList::GetStr( sal_uInt16 nNum ) const
-{
- OUString sRet;
- if( nNum <= nMax )
- sRet = OUString( pIdxA[ nNum+1 ], strlen(pIdxA[ nNum+1 ]), RTL_TEXTENCODING_MS_1252 );
- return sRet;
-}
-
-Ww1Bookmarks::Ww1Bookmarks(Ww1Fib& rInFib)
- : aNames(rInFib), rFib(rInFib), nIsEnd(0)
-{
- pPos[0] = new Ww1PlcBookmarkPos(rFib, rFib.GetFIB().fcPlcfbkfGet(),
- rFib.GetFIB().cbPlcfbkfGet(), false);
- nPlcIdx[0] = 0;
- pPos[1] = new Ww1PlcBookmarkPos(rFib, rFib.GetFIB().fcPlcfbklGet(),
- rFib.GetFIB().cbPlcfbklGet(), true);
- nPlcIdx[1] = 0;
- bOK = !aNames.GetError() && !pPos[0]->GetError() && !pPos[1]->GetError();
-}
-
-// There's one twist to this operator++: in the case of 2 adjacent bookmarks,
-// the end of the first one should be reached first, and then the start of the
-// second one. However, if there are 2 bookmarks of length 0 on top of each
-// other, each bookmarks' respective start *must* be found before its end.
-// The case: ][
-// [...]
-// ][
-// is not solved yet. I'd need to jump back and forth in the start and end
-// indices, using another index or a bitfield or something similar for keeping
-// track of already processed bookmarks.
-void Ww1Bookmarks::operator++()
-{
- if( bOK )
- {
- nPlcIdx[nIsEnd]++;
-
- sal_uLong l0 = pPos[0]->Where(nPlcIdx[0]);
- sal_uLong l1 = pPos[1]->Where(nPlcIdx[1]);
- if( l0 < l1 )
- nIsEnd = 0;
- else if( l1 < l0 )
- nIsEnd = 1;
- else
- nIsEnd = ( nIsEnd ) ? 0 : 1;
- }
-}
-
-long Ww1Bookmarks::GetHandle() const
-{
- if( bOK )
- {
- if( nIsEnd )
- return nPlcIdx[1];
-
- const sal_uInt8* p = pPos[0]->GetData( nPlcIdx[0] );
- if( p )
- return SVBT16ToShort( p );
- }
- return LONG_MAX;
-}
-
-long Ww1Bookmarks::Len() const
-{
- if( nIsEnd )
- {
- OSL_ENSURE( false, "Invalid usage (1) of Ww1Bookmarks::Len()" );
- return 0;
- }
- sal_uInt16 nEndIdx = SVBT16ToShort(pPos[0]->GetData(nPlcIdx[0]));
- return pPos[1]->Where(nEndIdx) - pPos[0]->Where(nPlcIdx[0]);
-}
-
-const OUString Ww1Bookmarks::GetName() const
-{
- if( nIsEnd )
- return OUString("???");
- return aNames.GetStr( nPlcIdx[0] );
-}
-
-// Fkp
-Ww1Fkp::Ww1Fkp(SvStream& rStream, sal_uLong ulFilePos, sal_uInt16 _nItemSize) :
- nItemSize(_nItemSize),
- bOK(false)
-{
- if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos)
- if (rStream.Read(aFkp, sizeof(aFkp)) == sizeof(aFkp))
- bOK = true;
-}
-
-sal_uLong Ww1Fkp::Where(sal_uInt16 nIndex)
-{
- sal_uLong lRet = 0xffffffff;
- OSL_ENSURE(nIndex<=Count(), "index out of bounds");
- if (nIndex<=Count())
- lRet = SVBT32ToUInt32(aFkp+nIndex*sizeof(SVBT32));
- return lRet;
-}
-
-sal_uInt8* Ww1Fkp::GetData(sal_uInt16 nIndex)
-{
- sal_uInt8* pRet = NULL;
- OSL_ENSURE(nIndex<=Count(), "index out of bounds");
- if (nIndex<=Count())
- pRet = aFkp + (Count()+1) * sizeof(SVBT32) +
- nIndex * nItemSize; // start of the structures
- return pRet;
-}
-
-// FkpPap
-bool Ww1FkpPap::Fill(sal_uInt16 nIndex, sal_uInt8*& p, sal_uInt16& rnCountBytes)
-{
- OSL_ENSURE( nIndex < Count(), "Ww1FkpPap::Fill() Index out of Range" );
- sal_uInt16 nOffset = *GetData(nIndex) * 2;
- if (nOffset)
- {
- OSL_ENSURE(nOffset>(sal_uInt16)(Count()*sizeof(SVBT32)), "calc error");
- rnCountBytes = *(aFkp+nOffset) * 2;
- nOffset += sizeof(sal_uInt8);
- if( nOffset + rnCountBytes < 511 ) // SH: Assert triggered 1 too early
- rnCountBytes++; // SH: I'm not entirely sure if the last
- // byte of the PAPX is used, but this way
- // we don't forget any and are on the
- // safe side either way
- OSL_ENSURE(nOffset+rnCountBytes <= 511, "calc error");
- p = aFkp + nOffset;
- }
- else
- {
- p = NULL;
- rnCountBytes = 0;
- }
- return true;
-}
-
-// FkpChp
-bool Ww1FkpChp::Fill(sal_uInt16 nIndex, W1_CHP& aChp)
-{
- OSL_ENSURE( nIndex < Count(), "Ww1FkpChp::Fill() Index out of Range" );
- memset(&aChp, 0, sizeof(aChp));
- sal_uInt16 nOffset = GetData(nIndex)[0] * 2;
- if (nOffset)
- {
- OSL_ENSURE(nOffset>(sal_uInt16)(Count()*sizeof(SVBT32)), "calc error");
- sal_uInt16 nCountBytes = aFkp[nOffset];
- nOffset += sizeof(sal_uInt8);
- OSL_ENSURE(nCountBytes <= 511-nOffset, "calc error");
- OSL_ENSURE(nCountBytes <= sizeof(aChp), "calc error");
- memcpy(&aChp, aFkp+nOffset, nCountBytes);
- }
- return true;
-}
-
-// Assoc
-Ww1Assoc::Ww1Assoc(Ww1Fib& _rFib)
- : rFib(_rFib), pBuffer(NULL), bOK(false)
-{
- sal_uInt16 cb = rFib.GetFIB().cbSttbfAssocGet();
- sal_uInt16 i;
-
- for ( i = 0; i < MaxFields; i++ )
- pStrTbl[i] = NULL;
- if ((pBuffer = new sal_Char[cb]) != NULL
- && rFib.GetStream().Seek(rFib.GetFIB().fcSttbfAssocGet()) ==
- rFib.GetFIB().fcSttbfAssocGet()
- && rFib.GetStream().Read(pBuffer, cb) == cb)
- {
- sal_uInt16 j;
- OSL_ENSURE( cb == SVBT16ToShort( *(SVBT16*)pBuffer ), "size mismatch");
- for (i=0,j=sizeof(SVBT16);j<cb && i<Criteria1;i++)
- {
- pStrTbl[i] = pBuffer+j;
- j += (*pBuffer + j) + 1;
- }
- bOK = true;
- }
-}
-
-OUString Ww1Assoc::GetStr(sal_uInt16 code)
-{
- OStringBuffer sRet;
- OSL_ENSURE(code<MaxFields, "out of range");
- if (pStrTbl[code] != NULL)
- for( sal_uInt16 i=0;i<pStrTbl[code][0];i++ )
- sRet.append(pStrTbl[code][i+1]);
- return OStringToOUString(sRet.makeStringAndClear(),
- RTL_TEXTENCODING_MS_1252);
-}
-
-// Pap
-Ww1Pap::Ww1Pap(Ww1Fib& _rFib)
- : Ww1PlcPap(_rFib), nPlcIndex(0), nPushedPlcIndex(0xffff), nFkpIndex(0),
- nPushedFkpIndex(0xffff), ulOffset(0), pPap(0)
-{
-}
-
-void Ww1Pap::Seek(sal_uLong ulSeek)
-{
- while (ulSeek > Where())
- ++(*this);
-}
-
-// SH: Where has been passed a parameter which determines if the index should be set
-// to 0 upon constructing a new Fkp (must not happen for Push/Pop)
-// Can't think of an elegant way for now
-sal_uLong Ww1Pap::Where( bool bSetIndex )
-{
- sal_uLong ulRet = 0xffffffff;
- if (pPap == NULL)
- if (nPlcIndex < Count())
- {
- pPap = new Ww1FkpPap(rFib.GetStream(),
- SVBT16ToShort(GetData(nPlcIndex)) << 9);
- if( bSetIndex )
- nFkpIndex = 0;
- }
- if (pPap != NULL)
- if (nFkpIndex <= pPap->Count())
- ulRet = pPap->Where(nFkpIndex) - rFib.GetFIB().fcMinGet();
- return ulRet;
-}
-
-void Ww1Pap::operator++()
-{
- if (pPap != NULL)
- if (++nFkpIndex > pPap->Count())
- {
- delete pPap;
- pPap = NULL;
- nPlcIndex++;
- }
-}
-
-// SH: FindSprm looks for Sprm nId in grpprl
-// Return value: pointer or 0
-bool Ww1Pap::FindSprm(sal_uInt16 nId, sal_uInt8* pStart, sal_uInt8* pEnd)
-{
- Ww1Sprm aSprm( pStart, static_cast< sal_uInt16 >(pEnd-pStart) );
- sal_uInt16 nC = aSprm.Count();
- sal_uInt16 i;
- sal_uInt8 nI;
- sal_uInt16 nLen;
- sal_uInt8 *pData;
- for( i = 0; i < nC; i++ ){
- aSprm.Fill( i, nI, nLen, pData );
- if( nI == nId )
- return true;
- }
- return false;
-}
-
-bool Ww1Pap::HasId0(sal_uInt16 nId)
-{
- bool bRet = false;
- UpdateIdx();
-
- if( !pPap ){
- OSL_ENSURE( false, "Ww1Pap::HasId():: cannot create a pPap" );
- return false;
- }
-
- sal_uInt8* pByte;
- sal_uInt16 n;
- if( pPap->Fill(nFkpIndex, pByte, n) ){
- sal_uInt8* p2 = ((W1_PAPX*)(pByte))->grpprlGet(); // SH: Offset was missing
- bRet = FindSprm( nId, p2, pByte + n );
- }
- return bRet;
-}
-
-bool Ww1Pap::HasId(sal_uInt16 nId)
-{
- sal_uInt16 nPushedPlcIndex2 = nPlcIndex;
- sal_uInt16 nPushedFkpIndex2 = nFkpIndex;
- bool bRet = HasId0( nId );
- if (nPlcIndex != nPushedPlcIndex2)
- {
- delete pPap;
- pPap = NULL;
- }
- nPlcIndex = nPushedPlcIndex2;
- nFkpIndex = nPushedFkpIndex2;
- Where( false );
- return bRet;
-}
-
-// Chp
-Ww1Chp::Ww1Chp(Ww1Fib& _rFib)
- : Ww1PlcChp(_rFib), nPlcIndex(0), nPushedPlcIndex(0xffff), nFkpIndex(0),
- nPushedFkpIndex(0xffff), ulOffset(0), pChp(0)
-{
-}
-
-void Ww1Chp::Seek(sal_uLong ulSeek)
-{
- while (ulSeek > Where())
- ++(*this);
-}
-
-// SH: Where has been passed a parameter which determines if the index should be set
-// to 0 upon constructing a new Fkp (must not happen for Push/Pop)
-// Can't think of an elegant way for now
-sal_uLong Ww1Chp::Where( bool bSetIndex )
-{
- sal_uLong ulRet = 0xffffffff;
- if (pChp == NULL)
- if (nPlcIndex < Count())
- {
- pChp = new Ww1FkpChp(rFib.GetStream(),
- SVBT16ToShort(GetData(nPlcIndex)) << 9);
- if( bSetIndex )
- nFkpIndex = 0;
- }
- if (pChp != NULL)
- if (nFkpIndex <= pChp->Count())
- ulRet = pChp->Where(nFkpIndex) -
- rFib.GetFIB().fcMinGet() - ulOffset;
- return ulRet;
-}
-
-void Ww1Chp::operator++()
-{
- if (pChp != NULL)
- if (++nFkpIndex > pChp->Count())
- {
- delete pChp;
- pChp = NULL;
- nPlcIndex++;
- }
-}
-
-// Manager
-Ww1Manager::Ww1Manager(SvStream& rStrm, sal_uLong nFieldFlgs)
- : bOK(false), bInTtp(false), bInStyle(false), bStopAll(false), aFib(rStrm),
- aDop(aFib), aFonts(aFib, nFieldFlgs), aDoc(aFib), pDoc(&aDoc),
- ulDocSeek(0), pSeek(&ulDocSeek), aFld(aFib), pFld(&aFld), aChp(aFib),
- aPap(aFib), aFtn(aFib), aBooks(aFib),
- aSep(aFib, aDop.GetDOP().grpfIhdtGet())
-{
- bOK = !aFib.GetError()
- && !aFib.GetFIB().fComplexGet()
- && !aDoc.GetError()
- && !aSep.GetError()
- && !aPap.GetError()
- && !aChp.GetError()
- && !aFld.GetError()
- && !aFtn.GetError()
- && !aBooks.GetError();
-}
-
-bool Ww1Manager::HasInTable()
-{
- return aPap.HasId(24); // Ww1SingleSprmPFInTable
-}
-
-bool Ww1Manager::HasTtp()
-{
- return aPap.HasId(25); // Ww1SingleSprmPTtp
-}
-
-bool Ww1Manager::HasPPc()
-{
- return aPap.HasId(29); // Ww1SingleSprmPPc
-}
-
-bool Ww1Manager::HasPDxaAbs()
-{
- return aPap.HasId(26); // Ww1SingleSprmPDxaAbs
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww1/w1class.hxx b/sw/source/filter/ww1/w1class.hxx
deleted file mode 100644
index 5c97410..0000000
--- a/sw/source/filter/ww1/w1class.hxx
+++ /dev/null
@@ -1,1491 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SW_SOURCE_FILTER_WW1_W1CLASS_HXX
-#define INCLUDED_SW_SOURCE_FILTER_WW1_W1CLASS_HXX
-
-#include <rtl/ustring.hxx>
-
-// local
-#include <w1struct.hxx>
-
-#ifdef DUMP
-#include <fstream.h>
-#endif
-
-#include <ostream>
-
-namespace editeng { class SvxBorderLine; }
-
-class SvxFontItem;
-class SvxBoxItem;
-class SvStream;
-class SwField;
-class Ww1Annotation;
-class Ww1AtnText;
-class Ww1Chp;
-class Ww1DocText;
-class Ww1Dop;
-class Ww1Fib;
-class Ww1Fkp;
-class Ww1FkpChp;
-class Ww1FkpPap;
-class Ww1Fonts;
-class Ww1Manager;
-class Ww1McrText;
-class Ww1Pap;
-class Ww1PlainText;
-class Ww1Plc;
-class Ww1PlcAnnotationRef;
-class Ww1PlcAnnotationTxt;
-class Ww1PlcChp;
-class Ww1PlcFields;
-class Ww1PlcFootnoteRef;
-class Ww1PlcFootnoteTxt;
-class Ww1PlcGlossary;
-class Ww1PlcHdd;
-class Ww1PlcPap;
-class Ww1PlcSep;
-class Ww1Shell;
-class Ww1Sprm;
-class Ww1SprmPapx;
-class Ww1SprmSep;
-class Ww1Style;
-class Ww1StyleSheet;
-
-// If possible, methods with similar functionality were given similar
-// names in this module. The names were taken from ww filter, if
-// possible.
-// Where() returns an element's position. This can be either a seek
-// position in the stream or a relative offset inside the text, since
-// these are mixed up in Word. The methods' comments indicate which of
-// these options they apply to.
-// Count() returns the number of elements. Be careful with n/n-1
-// fields (Word likes to store structures in double arrays, with the
-// first one containing n elements, and the second one n-1.
-// Fill() fills passed references with data from Word structures.
-// GetData() returns pointers to the data range
-// Start(), Stop(), Out(), op<< see module w1filter
-// Dump() see module w1dump
-
-// file information block: root of the evil: it's at the start of the
-// file (seek(0)) and contains all positions of the structures of the
-// file.
-class Ww1Fib
-{
- W1_FIB aFib;
- bool bOK;
- SvStream& rStream;
-public:
- Ww1Fib(SvStream&);
- friend std::ostream& operator <<(std::ostream&, Ww1Fib&);
- W1_FIB& GetFIB() { return aFib; }
- bool GetError() { return !bOK; }
- SvStream& GetStream() { return rStream; }
-};
-
-// document property: properties of the entire document
-class Ww1Dop
-{
- W1_DOP aDop;
- Ww1Fib& rFib;
- bool bOK;
-public:
- Ww1Dop(Ww1Fib&);
- bool GetError() {
- return !bOK; }
- W1_DOP& GetDOP() {
- return aDop; }
- friend std::ostream& operator <<(std::ostream&, Ww1Dop&);
- void Out(Ww1Shell&);
-};
-
-// ww-files can contain several blocks of text (main-text,
-// footnotes etc). PlainText unifies the overlaps
-class Ww1PlainText
-{
-protected:
- Ww1Fib& rFib;
- sal_uLong ulFilePos;
- sal_uLong ulCountBytes;
- sal_uLong ulSeek;
- bool bOK;
-public:
- Ww1PlainText(Ww1Fib& rWwFib, sal_uLong nFilePos, sal_uLong nCountBytes);
- // within the text
- sal_uLong Where() const { return ulSeek; }
- void Seek( sal_uLong ulNew )
- {
- OSL_ENSURE(ulNew < ulCountBytes, "Ww1PlainText");
- if (ulNew < ulCountBytes)
- ulSeek = ulNew;
- }
-
- sal_uLong Count() const { return ulCountBytes; }
- void SetCount(sal_uLong ulNew)
- {
- ulNew += ulSeek;
- if (ulCountBytes > ulNew)
- ulCountBytes = ulNew;
- }
- void operator++()
- {
- OSL_ENSURE(ulSeek+1<ulCountBytes, "Ww1PlainText");
- ulSeek++;
- }
- bool GetError() { return !bOK; }
- sal_Unicode Out( Ww1Shell&, sal_uLong& );
- sal_Unicode Out( OUString&, sal_uLong=0xffffffff);
- sal_Unicode Out( sal_Unicode& );
- friend std::ostream& operator <<(std::ostream&, Ww1PlainText&);
- OUString& Fill( OUString&, sal_uLong=0, sal_uLong=0xffffffff );
- sal_Unicode operator []( sal_uLong );
- OUString GetText( sal_uLong ulOffset, sal_uLong nLen ) const;
-
- enum Consts { MinChar = 32 };
- static bool IsChar( sal_Unicode c ) { return c >= MinChar; }
-};
-
-class Ww1DocText : public Ww1PlainText
-{
-public:
- Ww1DocText(Ww1Fib& rFibL) :
- Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet(),
- rFibL.GetFIB().ccpTextGet()) {
- }
-};
-
-class Ww1FtnText : public Ww1PlainText
-{
-public:
- sal_uLong Offset(Ww1Fib& rFibL) {
- return rFibL.GetFIB().ccpTextGet(); }
- Ww1FtnText(Ww1Fib& rFibL) :
- Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
- Offset(rFibL), rFibL.GetFIB().ccpFtnGet()) {
- }
-};
-
-class Ww1HddText : public Ww1PlainText
-{
-public:
- sal_uLong Offset(Ww1Fib& rFibL) {
- return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet(); }
- Ww1HddText(Ww1Fib& rFibL) :
- Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
- Offset(rFibL), rFibL.GetFIB().ccpHddGet()) {
- }
-};
-
-class Ww1McrText : public Ww1PlainText
-{
-public:
- sal_uLong Offset(Ww1Fib& rFibL) {
- return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet()
- + rFibL.GetFIB().ccpHddGet(); }
- Ww1McrText(Ww1Fib& rFibL) :
- Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
- Offset(rFibL), rFibL.GetFIB().ccpMcrGet()) {
- }
-};
-
-class Ww1AtnText : public Ww1PlainText
-{
-public:
- sal_uLong Offset(Ww1Fib& rFibL) {
- return rFibL.GetFIB().ccpTextGet() + rFibL.GetFIB().ccpFtnGet()
- + rFibL.GetFIB().ccpHddGet() + rFibL.GetFIB().ccpMcrGet(); }
- Ww1AtnText(Ww1Fib& rFibL) :
- Ww1PlainText(rFibL, rFibL.GetFIB().fcMinGet() +
- Offset(rFibL), rFibL.GetFIB().ccpAtnGet()) {
- }
-};
-
-// a single style or template
-class Ww1Style
-{
- OUString aName;
- W1_CHP aChpx;
- Ww1SprmPapx* pPapx;
- Ww1StyleSheet* pParent;
- sal_uInt8 stcBase;
- sal_uInt8 stcNext;
- bool bUsed;
-public:
- Ww1Style();
- ~Ww1Style();
- bool IsUsed() const { return bUsed; }
- void SetDefaults(sal_uInt8);
- void SetParent(Ww1StyleSheet* newParent) { pParent = newParent; }
- void SetName(const OUString& rName) { bUsed = true; aName = rName; }
- const OUString& GetName() const { return aName; }
- Ww1Style& GetBase();
- sal_uInt16 GetnBase() const { return stcBase; }
- sal_uInt16 GetnNext() const { return stcNext; }
- sal_uInt16 ReadName(sal_uInt8*&, sal_uInt16&, sal_uInt16 stc);
- sal_uInt16 ReadChpx(sal_uInt8*&, sal_uInt16&);
- sal_uInt16 ReadPapx(sal_uInt8*&, sal_uInt16&);
- sal_uInt16 ReadEstcp(sal_uInt8*&, sal_uInt16&);
- friend std::ostream& operator <<(std::ostream&, Ww1Style&);
- void Out(Ww1Shell&, Ww1Manager&);
-};
-
-// collection of all templates (max. 256)
-class Ww1StyleSheet
-{
- Ww1Style aStyles[256];
- sal_uInt16 cstcStd; // count style code standard
- Ww1Fib& rFib;
- bool bOK;
- sal_uInt16 ReadNames(sal_uInt8*&, sal_uInt16&);
- sal_uInt16 ReadChpx(sal_uInt8*&, sal_uInt16&);
- sal_uInt16 ReadPapx(sal_uInt8*&, sal_uInt16&);
- sal_uInt16 ReadEstcp(sal_uInt8*&, sal_uInt16&);
-
- void OutDefaults(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc);
- void OutOne(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc);
- void OutOneWithBase(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc,
- sal_uInt8* pbStopRecur );
-public:
- Ww1StyleSheet(Ww1Fib& rFib);
- Ww1Style& GetStyle(sal_uInt16 stc) {
- return aStyles[stc]; }
- sal_uInt16 Count() {
- return 256; }
- friend std::ostream& operator <<(std::ostream&, Ww1StyleSheet&);
- void Out(Ww1Shell&, Ww1Manager&);
- friend class Ww1Style;
- bool GetError() {
- return !bOK; }
-};
-
-// ww only knows font numbers during formatting. Independently, there
-// is an array of fonts, so that the number can be converted to a
-// specific font.
-class Ww1Fonts
-{
-protected:
- W1_FFN** pFontA; // Array of Pointers to Font Description
- Ww1Fib& rFib;
- sal_uLong nFieldFlags;
- sal_uInt16 nMax; // Array size
- bool bOK;
-public:
- Ww1Fonts(Ww1Fib&, sal_uLong nFieldFlgs);
- ~Ww1Fonts() {
- if (pFontA)
- DELETEZ(pFontA[0]);
- DELETEZ(pFontA); }
- W1_FFN* GetFFN(sal_uInt16 nNum);
- sal_uInt16 Count() {
- return nMax; }
- friend std::ostream& operator <<(std::ostream&, Ww1Fonts&);
- bool GetError() {
- return !bOK; }
- SvxFontItem GetFont(sal_uInt16);
-};
-
-// SingleSprm
-// These classes replace aSprmTab etc. from ww6 filter. The function
-// pointers are virtual methods. There exist derived classes for
-// specific types (byte, word, var-sized etc.). They have methods for
-// determining their sizes, for dumping and outputting the Sprms to
-// the shell.
-// The classes get created with new (in InitTab()) and added to the
-// table according to their code. For activating them the respective
-// method has to be called on an object in the table.
-// Take note: SingleSprms only describe Sprms, they don't carry their
-// content, which must be passed to the individual methods such as
-// Size, Dump and Start/Stop.
-class Ww1SingleSprm
-{
-public:
-#ifdef DUMP
- // The vtab only contains the virtual methods; we hide them
- // depending on what we compile for (dumper or filter). This saves
- // space. Furthermore, these method's implementations live in
- // different modules which only get compiled and linked when
- // required by the respective project. The name string is only
- // required by the dumper -- let's not include it in the filter.
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
- virtual std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
- const sal_Char* sName;
-#else
- virtual void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
- virtual void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&);
- std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
-#endif
- virtual sal_uInt16 Size(sal_uInt8*);
- sal_uInt16 nCountBytes;
-
- Ww1SingleSprm(sal_uInt16 nBytes, const sal_Char* /*pName*/ = 0 )
- : nCountBytes(nBytes)
-#ifdef DUMP
- , sName( pName)
-#endif
- {
- }
- virtual ~Ww1SingleSprm();
-};
-
-class Ww1SingleSprmByteSized : public Ww1SingleSprm {
-public:
- sal_uInt16 Size(sal_uInt8*) SAL_OVERRIDE;
- Ww1SingleSprmByteSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
- Ww1SingleSprm(nBytes, sName) {
- }
-};
-
-class Ww1SingleSprmWordSized : public Ww1SingleSprm {
-public:
- sal_uInt16 Size(sal_uInt8*) SAL_OVERRIDE;
- Ww1SingleSprmWordSized(sal_uInt16 nBytes, sal_Char* sName = 0) :
- Ww1SingleSprm(nBytes, sName) {
- }
-};
-
-class Ww1SingleSprmByte : public Ww1SingleSprm {
-public:
- std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
- Ww1SingleSprmByte(sal_Char* sName = 0) :
- Ww1SingleSprm(1, sName) {
- }
-};
-
-class Ww1SingleSprmBool : public Ww1SingleSprmByte {
-public:
- std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
- Ww1SingleSprmBool(sal_Char* sName = 0) :
- Ww1SingleSprmByte(sName) {
- }
-};
-
-class Ww1SingleSprm4State : public Ww1SingleSprmByte {
-public:
- std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
- Ww1SingleSprm4State(sal_Char* sName = 0) :
- Ww1SingleSprmByte(sName) {
- }
-};
-
-class Ww1SingleSprmWord : public Ww1SingleSprm {
-public:
- std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
- Ww1SingleSprmWord(sal_Char* sName = 0)
- : Ww1SingleSprm(2, sName) {}
-};
-
-class Ww1SingleSprmLong : public Ww1SingleSprm {
-public:
- std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
- Ww1SingleSprmLong(sal_Char* sName = 0) :
- Ww1SingleSprm(4, sName) {
- }
-};
-
-class Ww1SingleSprmTab : public Ww1SingleSprm {
-public:
- std::ostream& Dump(std::ostream&, sal_uInt8*, sal_uInt16);
- sal_uInt16 Size(sal_uInt8*) SAL_OVERRIDE;
- Ww1SingleSprmTab(sal_uInt16 nBytes, sal_Char* sName = 0) :
- Ww1SingleSprm(nBytes, sName) {
- }
-};
-
-class Ww1SingleSprmPJc : public Ww1SingleSprmByte {
-public:
- Ww1SingleSprmPJc(sal_Char* sName) :
- Ww1SingleSprmByte(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDxa : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmPDxa(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDxaRight : public Ww1SingleSprmPDxa {
-public:
- Ww1SingleSprmPDxaRight(sal_Char* sName) :
- Ww1SingleSprmPDxa(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDxaLeft : public Ww1SingleSprmPDxa {
-public:
- Ww1SingleSprmPDxaLeft(sal_Char* sName) :
- Ww1SingleSprmPDxa(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDxaLeft1 : public Ww1SingleSprmPDxa {
-public:
- Ww1SingleSprmPDxaLeft1(sal_Char* sName) :
- Ww1SingleSprmPDxa(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPFKeep : public Ww1SingleSprmBool {
-public:
- Ww1SingleSprmPFKeep(sal_Char* sName) :
- Ww1SingleSprmBool(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPFKeepFollow : public Ww1SingleSprmBool {
-public:
- Ww1SingleSprmPFKeepFollow(sal_Char* sName) :
- Ww1SingleSprmBool(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPPageBreakBefore : public Ww1SingleSprmBool {
-public:
- Ww1SingleSprmPPageBreakBefore(sal_Char* sName) :
- Ww1SingleSprmBool(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPBrc : public Ww1SingleSprmWord {
-protected:
- // specific start routines, supplied with different BoxItems
- // depending on sprm
- void Start(Ww1Shell&, sal_uInt8, W1_BRC10*, sal_uInt16, Ww1Manager&, SvxBoxItem&);
- void Start(Ww1Shell&, sal_uInt8, W1_BRC*, sal_uInt16, Ww1Manager&, SvxBoxItem&);
-
- using Ww1SingleSprm::Start;
-
-public:
- Ww1SingleSprmPBrc(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- // SetBorder() is needed for tables, too. That's why it's public
- static editeng::SvxBorderLine* SetBorder(editeng::SvxBorderLine*, W1_BRC10*);
-};
-
-#define BRC_TOP ((sal_uInt16)0)
-#define BRC_LEFT ((sal_uInt16)1)
-#define BRC_BOTTOM ((sal_uInt16)2)
-#define BRC_RIGHT ((sal_uInt16)3)
-#define BRC_ANZ ((sal_uInt16)BRC_RIGHT-BRC_TOP+1)
-
-// The BRC structure for 1.0 versions of Word differ from the ones in
-// later versions. Luckily, they will be queried by other sprms.
-// SH: From now on, all 4 borders handled by a single class.
-class Ww1SingleSprmPBrc10 : public Ww1SingleSprmPBrc
-{
- sal_uInt16 nLine; // BRC_TOP, BRC_LEFT, ...
-
- using Ww1SingleSprmPBrc::Start;
-
-public:
- Ww1SingleSprmPBrc10(sal_uInt16 nL, sal_Char* sName)
- : Ww1SingleSprmPBrc(sName), nLine(nL) {}
-
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmParaSpace : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmParaSpace(sal_Char* sName)
- : Ww1SingleSprmWord(sName) {}
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDyaBefore : public Ww1SingleSprmParaSpace {
-public:
- Ww1SingleSprmPDyaBefore(sal_Char* sName)
- : Ww1SingleSprmParaSpace(sName) {}
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDyaAfter : public Ww1SingleSprmParaSpace {
-public:
- Ww1SingleSprmPDyaAfter(sal_Char* sName) :
- Ww1SingleSprmParaSpace(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDyaLine : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmPDyaLine(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPChgTabsPapx : public Ww1SingleSprmByteSized {
-public:
- Ww1SingleSprmPChgTabsPapx(sal_Char* sName) :
- Ww1SingleSprmByteSized(0, sName) {
- }
- // Size() is not yet activated!
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmSGprfIhdt : public Ww1SingleSprmByte {
-public:
- Ww1SingleSprmSGprfIhdt(sal_Char* sName) :
- Ww1SingleSprmByte(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmSColumns : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmSColumns(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPFInTable : public Ww1SingleSprmBool {
-public:
- Ww1SingleSprmPFInTable(sal_Char* sName) :
- Ww1SingleSprmBool(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPTtp : public Ww1SingleSprmBool {
-public:
- Ww1SingleSprmPTtp(sal_Char* sName) :
- Ww1SingleSprmBool(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
- void Stop(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmTJc : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmTJc(sal_Char* sName)
- : Ww1SingleSprmWord(sName) {}
-};
-
-class Ww1SingleSprmTDxaGapHalf : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmTDxaGapHalf(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmTDefTable10 : public Ww1SingleSprmWordSized {
-public:
- Ww1SingleSprmTDefTable10(sal_Char* sName) :
- Ww1SingleSprmWordSized(0, sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmTDyaRowHeight : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmTDyaRowHeight(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-// Class definitions for table fastsave attributes
-// Because we don't support fastsave, we don't need it
-
-// Class definitions for Apos ( == Flys )
-
-class Ww1SingleSprmPpc : public Ww1SingleSprmByte {
-public:
- Ww1SingleSprmPpc(sal_Char* sName) :
- Ww1SingleSprmByte(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDxaAbs : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmPDxaAbs(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDyaAbs : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmPDyaAbs(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPDxaWidth : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmPDxaWidth(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-class Ww1SingleSprmPFromText : public Ww1SingleSprmWord {
-public:
- Ww1SingleSprmPFromText(sal_Char* sName) :
- Ww1SingleSprmWord(sName) {
- }
- void Start(Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) SAL_OVERRIDE;
-};
-
-// The data type Sprm actually appearing in the file
-class Ww1Sprm
-{
- bool ReCalc();
- static Ww1SingleSprm* aTab[256];
- static Ww1SingleSprm* pSingleSprm;
-protected:
- static void InitTab();
- Ww1SingleSprm& GetTab(sal_uInt16 nId)
- {
- if( !pSingleSprm )
- InitTab();
- return aTab[ nId ] ? *aTab[nId] : *pSingleSprm;
- }
-
- sal_uInt8* p;
- sal_uInt16 nCountBytes;
- bool bOK;
- sal_uInt16* pArr;
- sal_uInt16 count;
- // without token, with length byte/word
- sal_uInt16 GetSize(sal_uInt8 nId, sal_uInt8* pSprm);
- // with token and length byte
- sal_uInt16 GetSizeBrutto(sal_uInt8* pSprm) {
- sal_uInt8 nId = *pSprm++;
- return GetSize(nId, pSprm) + 1; }
- // returns for the n-th element id, size & pointer to data:
- // sal_Bool Fill(sal_uInt16, sal_uInt8&, sal_uInt16&, sal_uInt8*&);
-public:
- // SH: I need it to be public
- // returns for the n-th element id, size & pointer to data:
- bool Fill(sal_uInt16, sal_uInt8&, sal_uInt16&, sal_uInt8*&);
-
- Ww1Sprm(sal_uInt8*, sal_uInt16);
- Ww1Sprm(SvStream&, sal_uLong);
- ~Ww1Sprm();
- friend std::ostream& operator <<(std::ostream&, Ww1Sprm&);
- void Start(Ww1Shell&, Ww1Manager&);
- void Start(Ww1Shell&, Ww1Manager&, sal_uInt16);
- void Stop(Ww1Shell&, Ww1Manager&);
- bool IsUsed() {
- return nCountBytes != 255; }
- sal_uInt16 Count() {
- return count; }
- bool GetError() {
- return !bOK; }
- static void DeinitTab();
-};
-
-// the wrapper around the type PIC, a structure, which stands at the beginning
-// of a picture filename or an embedded picture
-class Ww1Picture
-{
- bool bOK;
- W1_PIC* pPic;
-public:
- Ww1Picture(SvStream&, sal_uLong);
- ~Ww1Picture() {
- }
- bool GetError() {
- return !bOK; }
- friend std::ostream& operator <<(std::ostream&, Ww1Picture&);
- void Out(Ww1Shell&, Ww1Manager&);
- void WriteBmp(SvStream&);
-};
-
-// One of the important array structures in ww files. They contain n+1
-// file positions and n attributes applying in between them.
-class Ww1Plc
-{
- sal_uInt8* p;
- sal_uInt16 nCountBytes;
- sal_uInt16 iMac;
- sal_uInt16 nItemSize;
- bool bOK;
-protected:
- Ww1Fib& rFib;
- sal_uInt8* GetData(sal_uInt16);
-public:
- Ww1Plc(Ww1Fib&, sal_uLong, sal_uInt16, sal_uInt16);
- ~Ww1Plc();
- friend std::ostream& operator <<(std::ostream&, Ww1Plc&);
- sal_uLong Where(sal_uInt16); // like in each plc
- void Seek(sal_uLong, sal_uInt16&);
- void Fill(sal_uInt16 nIndex, sal_uLong& begin, sal_uLong& end) {
- begin = Where(nIndex);
- end = Where(nIndex+1); }
- sal_uInt16 Count() {
- return iMac; }
- bool GetError() {
- return !bOK; }
-};
-
-// Size Tabs from Sven:
-// CHP, PAP, SEP, HED, FNR, FNT
-//Plc 2, 2, 6, 0, 2, 0
-//Fkp 1, 1, 0, 0, 0, 0
-
-class Ww1PlcGlossary : public Ww1Plc
-{
-public:
- Ww1PlcGlossary(Ww1Fib& rFibL) :
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfglsyGet(),
- rFibL.GetFIB().cbPlcfglsyGet(), 0) {
- }
-};
-
-class Ww1PlcAnnotationRef : public Ww1Plc
-{
-public:
- Ww1PlcAnnotationRef(Ww1Fib& rFibL) :
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandRefGet(),
- rFibL.GetFIB().cbPlcfandRefGet(), 0) {
- }
-};
-
-class Ww1PlcAnnotationTxt : public Ww1Plc
-{
-public:
- Ww1PlcAnnotationTxt(Ww1Fib& rFibL) :
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfandTxtGet(),
- rFibL.GetFIB().cbPlcfandTxtGet(), 0) {
- }
-};
-
-// PlcAnnotation
-class Ww1Annotation {
- Ww1PlcAnnotationRef aRef;
- Ww1PlcAnnotationTxt aTxt;
-public:
- Ww1Annotation(Ww1Fib& rFib) :
- aRef(rFib),
- aTxt(rFib) {
- }
- friend std::ostream& operator <<(std::ostream&, Ww1Annotation&);
-};
-
-class Ww1PlcSep : public Ww1Plc
-{
-public:
- Ww1PlcSep(Ww1Fib& rFibL):
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfsedGet(),
- rFibL.GetFIB().cbPlcfsedGet(), 6) {
- }
- friend std::ostream& operator <<(std::ostream&, Ww1PlcSep&);
-};
-
-class Ww1PlcChp : public Ww1Plc
-{
-public:
- Ww1PlcChp(Ww1Fib& rFibL) :
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbteChpxGet(),
- rFibL.GetFIB().cbPlcfbteChpxGet(), 2) {
- }
- friend std::ostream& operator <<(std::ostream&, Ww1PlcChp&);
-};
-
-class Ww1PlcPap : public Ww1Plc
-{
-public:
- Ww1PlcPap(Ww1Fib& rFibL) :
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfbtePapxGet(),
- rFibL.GetFIB().cbPlcfbtePapxGet(), 2) {
- }
- friend std::ostream& operator <<(std::ostream&, Ww1PlcPap&);
-};
-
-class Ww1PlcFootnoteRef : public Ww1Plc
-{
-public:
- Ww1PlcFootnoteRef(Ww1Fib& rFibL) :
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndRefGet(),
- rFibL.GetFIB().cbPlcffndRefGet(), 2) {
- }
- friend std::ostream& operator <<(std::ostream&, Ww1PlcFootnoteRef&);
-};
-
-class Ww1PlcFootnoteTxt : public Ww1Plc
-{
-public:
- Ww1PlcFootnoteTxt(Ww1Fib& rFibL) :
- Ww1Plc(rFibL, rFibL.GetFIB().fcPlcffndTxtGet(),
- rFibL.GetFIB().cbPlcffndTxtGet(), 0) {
- }
- friend std::ostream& operator <<(std::ostream&, Ww1PlcFootnoteTxt&);
-};
-
-class Ww1PlcFields : public Ww1Plc
-{
-public:
- Ww1PlcFields(Ww1Fib& rFibL, sal_uLong start, sal_uInt16 nBytes)
- : Ww1Plc(rFibL, start, nBytes, 2)
- {}
- W1_FLD* GetData(sal_uInt16 nIndex)
- { return (W1_FLD*)Ww1Plc::GetData(nIndex); }
- sal_uLong Where(sal_uInt16 nIndex) // absolute within the file
- { return Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet(); }
- friend std::ostream& operator <<(std::ostream&, Ww1PlcFields&);
-};
-
-// PlcBookmarks
-class Ww1StringList
-{
- sal_Char** pIdxA;
- sal_uInt16 nMax;
-public:
- Ww1StringList( SvStream& rSt, sal_uLong nFc, sal_uInt16 nCb );
- ~Ww1StringList()
- { if( pIdxA ) { delete pIdxA[0]; delete pIdxA; } }
- const OUString GetStr( sal_uInt16 nNum ) const;
- sal_uInt16 Count() const { return nMax; }
- bool GetError() const { return (nMax != 0) && !pIdxA; }
-};
-
-class Ww1PlcBookmarkTxt: public Ww1StringList
-{
-public:
- Ww1PlcBookmarkTxt(Ww1Fib& rFib) :
- Ww1StringList( rFib.GetStream(), rFib.GetFIB().fcSttbfbkmkGet(),
- rFib.GetFIB().cbSttbfbkmkGet() )
- {}
-};
-
-class Ww1PlcBookmarkPos : public Ww1Plc
-{
-public:
- Ww1PlcBookmarkPos(Ww1Fib& _rFib, sal_uLong start, sal_uInt16 nBytes, bool bEnd)
- : Ww1Plc(_rFib, start, nBytes, (bEnd) ? 0 : 2)
- {}
-
- sal_uInt8* GetData(sal_uInt16 nIndex) { return Ww1Plc::GetData(nIndex); }
- // Position as CP
- sal_uLong WhereCP(sal_uInt16 nIndex) { return Ww1Plc::Where(nIndex); }
- // absolute within the file
- sal_uLong Where(sal_uInt16 nIndex)
- {
- return ( nIndex < Count() )
- ? Ww1Plc::Where(nIndex) + rFib.GetFIB().fcMinGet()
- : 0xffffffff;
- }
-};
-
-class Ww1PlcHdd : public Ww1Plc
-{
-public:
- Ww1PlcHdd(Ww1Fib& rFibL)
- : Ww1Plc(rFibL, rFibL.GetFIB().fcPlcfhddGet(),
- rFibL.GetFIB().cbPlcfhddGet(), 0)
- {}
-};
-
-// Arrays very similar to the plcs; limited to a size of 512 bytes
-class Ww1Fkp
-{
-protected:
- sal_uInt8 aFkp[512];
- sal_uInt16 nItemSize;
- bool bOK;
- sal_uInt8* GetData(sal_uInt16);
-public:
- Ww1Fkp(SvStream&, sal_uLong, sal_uInt16);
- friend std::ostream& operator <<(std::ostream&, Ww1Fkp&);
- sal_uInt16 Count() const { return *(aFkp+511); }
- sal_uLong Where(sal_uInt16); // like in the corresponding fkp
-};
-
-class Ww1FkpPap : public Ww1Fkp
-{
-public:
- Ww1FkpPap(SvStream& rStream, sal_uLong ulFilePos)
- : Ww1Fkp(rStream, ulFilePos, 1)
- {}
- friend std::ostream& operator <<(std::ostream&, Ww1FkpPap&);
- bool Fill(sal_uInt16, sal_uInt8*&, sal_uInt16&);
-};
-
-class Ww1FkpChp : public Ww1Fkp
-{
-#ifdef DUMP
- SvStream& rStream;
- SvStream& GetStream() { return rStream; }
-#endif
-public:
- Ww1FkpChp(SvStream& rStream, sal_uLong ulFilePos)
- : Ww1Fkp(rStream, ulFilePos, 1)
-#ifdef DUMP
- , rStream(rStream)
-#endif
- {}
-
- friend std::ostream& operator <<(std::ostream&, Ww1FkpChp&);
- bool Fill(sal_uInt16, W1_CHP&);
-};
-
-class Ww1SprmPapx : public Ww1Sprm
-{
- W1_PAPX aPapx;
- sal_uInt8* Sprm(sal_uInt8* p, sal_uInt16 nSize);
- sal_uInt16 SprmSize(sal_uInt8* p, sal_uInt16 nSize);
-public:
- Ww1SprmPapx(sal_uInt8* p, sal_uInt16 nSize);
- friend std::ostream& operator <<(std::ostream&, Ww1SprmPapx&);
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell&, Ww1Manager&);
-};
-
-class Ww1SprmSep : public Ww1Sprm
-{
-public:
- Ww1SprmSep(Ww1Fib& rFib, sal_uLong ulFilePos)
- : Ww1Sprm(rFib.GetStream(), ulFilePos)
- {}
- friend std::ostream& operator <<(std::ostream&, Ww1SprmSep&);
-};
-
-class Ww1Assoc
-{
- enum fields { FileNext, Dot, Title, Subject, KeyWords, Comments,
- Author, LastRevBy, DataDoc, HeaderDoc, Criteria1, Criteria2,
- Criteria3, Criteria4, Criteria5, Criteria6, Criteria7, MaxFields };
-
- Ww1Fib& rFib;
- sal_Char* pBuffer;
- sal_Char* pStrTbl[ MaxFields ];
- bool bOK;
-
- OUString GetStr(sal_uInt16);
-
-public:
- Ww1Assoc(Ww1Fib&);
- ~Ww1Assoc() { delete pBuffer; }
- bool GetError() const { return !bOK; }
- friend std::ostream& operator <<(std::ostream&, Ww1Assoc&);
- void Out(Ww1Shell&);
-};
-
-// Header/footer/footnote separators are stored in a separate text one
-// after the other. A plc partitions these texts into several
-// parts. They are numbered as ihdd. There are 9 different functions
-// for these texts. When one of them is requested, it applies to the
-// first ihdd, the next time to the second and so on. Which type a
-// given text part will be treated as can only be determined by
-// reading the file sequentially. The 9 types are: footnote separator,
-// footnote continuation separator, footnote continuation note, even
-// page header, odd page header, even page footer, odd page footer,
-// header and footer for the first page. HeaderFooter remembers the
-// current setting for each of these (but not the previous one) and
-// the following ihdd. A part of type 0xffff denotes a non-existing
-// part.
-class Ww1HeaderFooter : public Ww1PlcHdd
-{
- sal_uInt16 nextIhdd; // next text part in HddText
- sal_uInt16 nFtnSep; // footnote separator
- sal_uInt16 nFtnFollowSep; // footnote continuation separator
- sal_uInt16 nFtnNote; // footnote continuation note
- sal_uInt16 nEvenHeadL;
- sal_uInt16 nOddHeadL;
- sal_uInt16 nEvenFootL;
- sal_uInt16 nOddFootL;
- sal_uInt16 nFirstHeadL;
- sal_uInt16 nFirstFootL;
- enum HeaderFooterMode {
- None, FtnSep, FtnFollowSep, FtnNote, EvenHeadL, OddHeadL,
- EvenFootL, OddFootL, FirstHeadL, MaxHeaderFooterMode
- } eHeaderFooterMode;
-
-public:
- Ww1HeaderFooter(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
- : Ww1PlcHdd(rFibL),
- nextIhdd(0),
- nFtnSep(0xffff),
- nFtnFollowSep(0xffff),
- nFtnNote(0xffff),
- nEvenHeadL(0xffff),
- nOddHeadL(0xffff),
- nEvenFootL(0xffff),
- nOddFootL(0xffff),
- nFirstHeadL(0xffff),
- nFirstFootL(0xffff),
- eHeaderFooterMode(None)
- {
- if (grpfIhdt & 0x0001) nFtnSep = nextIhdd++;
- if (grpfIhdt & 0x0002) nFtnFollowSep = nextIhdd++;
- if (grpfIhdt & 0x0004) nFtnNote = nextIhdd++;
- }
- void SetGrpfIhdt(sal_uInt16 grpfIhdt)
- {
- if (grpfIhdt & 0x0001) nEvenHeadL = nextIhdd++;
- if (grpfIhdt & 0x0002) nOddHeadL = nextIhdd++;
- if (grpfIhdt & 0x0004) nEvenFootL = nextIhdd++;
- if (grpfIhdt & 0x0008) nOddFootL = nextIhdd++;
- if (grpfIhdt & 0x0010) nFirstHeadL = nextIhdd++;
- if (grpfIhdt & 0x0020) nFirstFootL = nextIhdd++;
- OSL_ENSURE(nextIhdd<=Count(), "Ww1HeaderFooter");
- }
- bool operator++()
- {
- bool bRet = true;
- eHeaderFooterMode = (HeaderFooterMode)((short)eHeaderFooterMode + 1);
- if( eHeaderFooterMode == MaxHeaderFooterMode)
- {
- eHeaderFooterMode = None;
- bRet = false;
- }
- return bRet;
- }
- bool FillFtnSep(sal_uLong& begin, sal_uLong& end)
- {
- if (nFtnSep == 0xffff)
- return false;
- Fill(nFtnSep, begin, end);
- return true;
- }
- bool FillFtnFollowSep(sal_uLong& begin, sal_uLong& end)
- {
- if (nFtnFollowSep == 0xffff)
- return false;
- Fill(nFtnFollowSep, begin, end);
- return true;
- }
- bool FillFtnNote(sal_uLong& begin, sal_uLong& end)
- {
- if (nFtnNote == 0xffff)
- return false;
- Fill(nFtnNote, begin, end);
- return true;
- }
- bool FillEvenHeadL(sal_uLong& begin, sal_uLong& end)
- {
- if (nEvenHeadL == 0xffff)
- return false;
- Fill(nEvenHeadL, begin, end);
- return true;
- }
- bool FillOddHeadL(sal_uLong& begin, sal_uLong& end)
- {
- if (nOddHeadL == 0xffff)
- return false;
- Fill(nOddHeadL, begin, end);
- return true;
- }
- bool FillEvenFootL(sal_uLong& begin, sal_uLong& end)
- {
- if (nEvenFootL == 0xffff)
- return false;
- Fill(nEvenFootL, begin, end);
- return true;
- }
- bool FillOddFootL(sal_uLong& begin, sal_uLong& end)
- {
- if (nOddFootL == 0xffff)
- return false;
- Fill(nOddFootL, begin, end);
- return true;
- }
- bool FillFirstHeadL(sal_uLong& begin, sal_uLong& end)
- {
- if (nFirstHeadL == 0xffff)
- return false;
- Fill(nFirstHeadL, begin, end);
- return true;
- }
- bool FillFirstFootL(sal_uLong& begin, sal_uLong& end)
- {
- if (nFirstFootL == 0xffff)
- return false;
- Fill(nFirstFootL, begin, end);
- return true;
- }
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
-};
-
-class Ww1Fields : public Ww1PlcFields
-{
- sal_uInt16 nPlcIndex;
- OUString sResult; // Calculated by Word
- SwField* pField;
- sal_uLong Where(sal_uInt16 nIndex) // within the text
- { return Ww1PlcFields::Where(nIndex) - rFib.GetFIB().fcMinGet(); }
-
-public:
- Ww1Fields(Ww1Fib& rFibL, sal_uLong ulFilePos, sal_uInt16 nBytes)
- : Ww1PlcFields(rFibL, ulFilePos, nBytes), nPlcIndex(0), pField(0)
- {}
- // within the text
- sal_uLong Where() { return Where(nPlcIndex); }
- void operator++()
- {
- OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Fields");
- nPlcIndex++;
- }
- void Seek(sal_uLong ulNew) { Ww1PlcFields::Seek(ulNew, nPlcIndex); }
- W1_FLD* GetData()
- {
- OSL_ENSURE(nPlcIndex < Count(), "Ww1Fields");
- return Ww1PlcFields::GetData(nPlcIndex);
- }
- sal_uLong GetLength();
- friend std::ostream& operator <<(std::ostream&, Ww1Manager&);
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
- void Out(Ww1Shell&, Ww1Manager&, sal_uInt16=0);
-};
-
-class Ww1TextFields : public Ww1Fields
-{
-public:
- Ww1TextFields(Ww1Fib& rFibL)
- : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMomGet(),
- rFibL.GetFIB().cbPlcffldMomGet())
- {}
-};
-
-class Ww1FootnoteFields : public Ww1Fields
-{
-public:
- Ww1FootnoteFields(Ww1Fib& rFibL)
- : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldFtnGet(),
- rFibL.GetFIB().cbPlcffldFtnGet())
- {}
-};
-
-class Ww1HeaderFooterFields : public Ww1Fields
-{
-public:
- Ww1HeaderFooterFields(Ww1Fib& rFibL)
- : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldHdrGet(),
- rFibL.GetFIB().cbPlcffldHdrGet())
- {}
-};
-
-class Ww1MacroFields : public Ww1Fields
-{
-public:
- Ww1MacroFields(Ww1Fib& rFibL)
- : Ww1Fields(rFibL, rFibL.GetFIB().fcPlcffldMcrGet(),
- rFibL.GetFIB().cbPlcffldMcrGet())
- {}
-};
-
-class Ww1Bookmarks
-{
- Ww1PlcBookmarkTxt aNames;
- Ww1PlcBookmarkPos* pPos[2];
- Ww1Fib& rFib;
-
- sal_uInt16 nPlcIdx[2];
- sal_uInt16 nIsEnd;
- bool bOK;
-public:
- Ww1Bookmarks(Ww1Fib& rFib);
- ~Ww1Bookmarks()
- {
- delete pPos[1];
- delete pPos[0];
- }
- sal_uLong Where() const { return pPos[nIsEnd]->WhereCP(nPlcIdx[nIsEnd]); }
- void operator++();
- bool GetError() const { return !bOK; }
- long GetHandle() const;
- bool GetIsEnd() const { return ( nIsEnd ) ? sal_True : sal_False; }
- const OUString GetName() const;
- long Len() const;
- friend std::ostream& operator <<(std::ostream&, Ww1Bookmarks&);
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
- void Out(Ww1Shell&, Ww1Manager&, sal_uInt16=0);
-};
-
-class Ww1Footnotes : public Ww1PlcFootnoteRef
-{
- sal_uInt16 nPlcIndex;
- Ww1PlcFootnoteTxt aText;
- bool bStarted;
-public:
- Ww1Footnotes(Ww1Fib& rFibL)
- : Ww1PlcFootnoteRef(rFibL), nPlcIndex(0), aText(rFibL), bStarted(false)
- {}
- // within the text
- sal_uLong Where()
- {
- sal_uLong ulRet = 0xffffffff;
- if (Count())
- ulRet = Ww1PlcFootnoteRef::Where(nPlcIndex);
- return ulRet;
- }
- void operator++()
- {
- OSL_ENSURE(nPlcIndex+1 <= Count(), "Ww1Footnotes");
- nPlcIndex++;
- }
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
-};
-
-class Ww1Sep : public Ww1PlcSep
-{
- Ww1HeaderFooter aHdd;
- sal_uInt16 nPlcIndex;
-public:
- Ww1Sep(Ww1Fib& rFibL, sal_uInt16 grpfIhdt)
- : Ww1PlcSep(rFibL), aHdd(rFibL, grpfIhdt), nPlcIndex(0) {}
-
- Ww1HeaderFooter& GetHdd() { return aHdd; }
- void operator++() { nPlcIndex++; }
- sal_uInt8* GetData() { return Ww1PlcSep::GetData(nPlcIndex); }
- // within the text
- sal_uLong Where() { return Ww1PlcSep::Where(nPlcIndex); }
- void SetGrpfIhdt(sal_uInt8 grpfIhdt)
- {
- GetHdd().SetGrpfIhdt(grpfIhdt);
- }
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode& c)
- { aHdd.Stop(rOut, rMan, c); }
-};
-
-class Ww1Pap : public Ww1PlcPap
-{
- sal_uInt16 nPlcIndex;
- sal_uInt16 nPushedPlcIndex;
- sal_uInt16 nFkpIndex;
- sal_uInt16 nPushedFkpIndex;
- sal_uLong ulOffset;
- Ww1FkpPap* pPap;
-
- bool FindSprm(sal_uInt16 nId, sal_uInt8* pStart, sal_uInt8* pEnd);
- void UpdateIdx()
- {
- if (pPap && nFkpIndex >= pPap->Count() )
- {
- delete pPap;
- pPap = NULL;
- nPlcIndex++;
- }
- if( !pPap )
- Where();
- }
- bool HasId0(sal_uInt16 nId);
-
-public:
- Ww1Pap(Ww1Fib& rFib);
- ~Ww1Pap() { delete pPap; }
- sal_uLong Where( bool bSetIndex = true ); // within the text
- void operator++();
- bool FillStart(sal_uInt8*& pB, sal_uInt16& nSize)
- {
- UpdateIdx();
- return pPap->Fill(nFkpIndex, pB, nSize);
- }
- bool FillStop(sal_uInt8*& pB, sal_uInt16& nSize)
- {
- return nFkpIndex ? pPap->Fill(nFkpIndex-1, pB, nSize) : sal_False;
- }
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
- void Seek(sal_uLong);
- void Push(sal_uLong ulOffsetTmp = 0)
- {
- OSL_ENSURE(!Pushed(), "Ww1Pap");
- nPushedPlcIndex = nPlcIndex;
- nPushedFkpIndex = nFkpIndex;
- Seek(ulOffsetTmp);
- ulOffset = ulOffsetTmp;
- delete pPap;
- pPap = NULL;
- }
- bool Pushed()
- {
- return nPushedPlcIndex != 0xffff;
- }
- void Pop()
- {
- OSL_ENSURE(Pushed(), "Ww1Pap");
- ulOffset = 0;
- nPlcIndex = nPushedPlcIndex;
- nFkpIndex = nPushedFkpIndex;
- nPushedPlcIndex = 0xffff;
- nPushedFkpIndex = 0xffff;
- delete pPap;
- pPap = NULL;
- Where( false );
- }
- bool HasId(sal_uInt16 nId);
-};
-
-class Ww1Chp : public Ww1PlcChp
-{
- sal_uInt16 nPlcIndex;
- sal_uInt16 nPushedPlcIndex;
- sal_uInt16 nFkpIndex;
- sal_uInt16 nPushedFkpIndex;
- sal_uLong ulOffset;
- Ww1FkpChp* pChp;
- void UpdateIdx()
- {
- if (pChp && nFkpIndex >= pChp->Count() )
- {
- delete pChp;
- pChp = NULL;
- nPlcIndex++;
- }
- if( !pChp )
- Where();
- }
-
-public:
- Ww1Chp( Ww1Fib& rFib );
- ~Ww1Chp() { delete pChp; }
- sal_uLong Where( bool bSetIndex = true ); // within the text
- void operator++();
- bool FillStart(W1_CHP& rChp)
- {
- UpdateIdx();
- return pChp->Fill(nFkpIndex, rChp);
- }
- bool FillStop(W1_CHP& rChp)
- { return nFkpIndex ? pChp->Fill(nFkpIndex-1, rChp) : sal_False; }
- void Start(Ww1Shell&, Ww1Manager&);
- void Stop(Ww1Shell&, Ww1Manager&, sal_Unicode&);
- void Seek(sal_uLong);
- void Push(sal_uLong ulOffsetTmp = 0)
- {
- OSL_ENSURE(!Pushed(), "Ww1Chp");
- nPushedPlcIndex = nPlcIndex;
- nPushedFkpIndex = nFkpIndex;
- Seek(ulOffsetTmp);
- ulOffset = ulOffsetTmp;
- delete pChp;
- pChp = NULL;
- }
- bool Pushed() { return nPushedPlcIndex != 0xffff; }
- void Pop()
- {
- OSL_ENSURE(Pushed(), "Ww1Chp");
- ulOffset = 0;
- nPlcIndex = nPushedPlcIndex;
- nFkpIndex = nPushedFkpIndex;
- nPushedPlcIndex = 0xffff;
- nPushedFkpIndex = 0xffff;
- delete pChp;
- pChp = NULL;
- Where( false );
- }
-};
-
-// Central point of access for the ww side of the filter, constructed
-// from the input stream (ww file). It contains everything necessary
-// for being piped into the shell (pm side).
-class Ww1Manager
-{
- bool bOK;
- bool bInTtp;
- bool bInStyle;
- bool bStopAll;
- Ww1Fib aFib;
- Ww1Dop aDop;
- Ww1Fonts aFonts;
- // from now on, everything in pairs, for 'pushed':
- Ww1DocText aDoc;
- Ww1PlainText* pDoc;
- sal_uLong ulDocSeek;
- sal_uLong* pSeek;
- Ww1TextFields aFld;
- Ww1Fields* pFld;
- // 'push'able itself:
- Ww1Chp aChp;
- Ww1Pap aPap;
- // not present in text ranges if 'pushed'
- Ww1Footnotes aFtn;
- Ww1Bookmarks aBooks;
- Ww1Sep aSep;
-
- void OutStop( Ww1Shell&, sal_Unicode );
- void OutStart( Ww1Shell& );
- void Out(Ww1Shell&, sal_Unicode );
-
-public:
- Ww1Manager(SvStream& rStrm, sal_uLong nFieldFlgs);
- bool GetError() const { return !bOK; }
-
- // for tables
- void SetInTtp(bool bSet = true) { bInTtp = bSet; }
- bool IsInTtp() const { return bInTtp; }
- void SetInStyle(bool bSet = true) { bInStyle = bSet; }
- bool IsInStyle() const { return bInStyle; }
- void SetStopAll(bool bSet = true) { bStopAll = bSet; }
- bool IsStopAll() const { return bStopAll; }
- bool HasInTable();
- bool HasTtp();
- bool LastHasTtp();
-
- // for flys
- bool HasPPc();
- bool HasPDxaAbs();
-
- Ww1Fib& GetFib() { return aFib; }
- Ww1PlainText& GetText() { return *pDoc; }
- Ww1Dop& GetDop() { return aDop; }
- Ww1Sep& GetSep() { return aSep; }
- // within the text
- sal_uLong Where() { return pDoc->Where(); }
- void Fill( sal_Unicode& rChr ) { pDoc->Out( rChr ); }
- sal_uInt8 Fill( OUString& rStr, sal_uLong ulLen)
- {
- ulLen += pDoc->Where();
- return sal::static_int_cast< sal_uInt8 >(pDoc->Out(rStr, ulLen));
- }
- SvxFontItem GetFont(sal_uInt16 nFCode);
- friend Ww1Shell& operator <<(Ww1Shell&, Ww1Manager&);
- friend std::ostream& operator <<(std::ostream&, Ww1Manager&);
- bool Pushed() { return pDoc != &aDoc; }
- void Pop();
- void Push0(Ww1PlainText* pDoc, sal_uLong, Ww1Fields* = 0);
- void Push1(Ww1PlainText* pDoc, sal_uLong ulSeek, sal_uLong ulSeek2 = 0,
- Ww1Fields* = 0);
-};
-
-#endif // INCLUDED_SW_SOURCE_FILTER_WW1_W1CLASS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww1/w1filter.cxx b/sw/source/filter/ww1/w1filter.cxx
deleted file mode 100644
index 1e2e289..0000000
--- a/sw/source/filter/ww1/w1filter.cxx
+++ /dev/null
@@ -1,1988 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <sw3convert.hxx>
-#include <tools/solar.h>
-#include <comphelper/string.hxx>
-#include <editeng/paperinf.hxx>
-#include <vcl/graphicfilter.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/wmf.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/crossedoutitem.hxx>
-#include <editeng/contouritem.hxx>
-#include <editeng/cmapitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/escapementitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <svl/urihelper.hxx>
-#include <fmtfsize.hxx>
-#include <doc.hxx>
-#include <IDocumentFieldsAccess.hxx>
-#include <pam.hxx>
-#include <ndtxt.hxx>
-#include <pagedesc.hxx>
-#include <flddat.hxx>
-#include <reffld.hxx>
-#include <expfld.hxx>
-#include <docufld.hxx>
-#include <ftninfo.hxx>
-#include <section.hxx>
-#include <fltini.hxx>
-#include <w1par.hxx>
-#include <docsh.hxx>
-#include <swerror.h>
-#include <mdiexp.hxx>
-#include <statstr.hrc>
-#include <stdio.h>
-#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-#include <com/sun/star/document/XDocumentProperties.hpp>
-#include <vcl/dibtools.hxx>
-
-#define MAX_FIELDLEN 64000
-
-using namespace css;
-using namespace nsSwDocInfoSubType;
-
-// The methods operator<<, Out, Start and Stop are to be used like
-// this: If possible, information from the document is transferred to
-// the shell with
-// operator<<()
-// If additional parameters are required, the method
-// Out()
-// needs to be used. The methods for marking a range (attribute range,
-// for example), are
-// Start(), Stop()
-// This module contains all of these methods. It is necessary for the
-// filter, but not for the dumper, with one exception though: the
-// module also contains methods, which are useless for the dumper, for
-// example because they operate on sv structures like GetFont() does on
-// SvxFontItem.
-
-// Manager
-Ww1Shell& operator <<(Ww1Shell& rOut, Ww1Manager& This)
-{
- // prohibit action in case of recursive call
- if (!This.Pushed())
- {
- {
- // is only needed temporarily
- This.SetInStyle( true );
- Ww1StyleSheet(This.aFib).Out(rOut, This);
- This.SetInStyle( false );
- }
- {
- // this one, too
- Ww1Assoc(This.aFib).Out(rOut);
- }
- This.aDop.Out(rOut);
- // Decide now how page templates will be created
- if (This.GetSep().Count() <= 1)
- rOut.SetUseStdPageDesc();
- }
- // and now the actual dok
- sal_Unicode cUnknown = ' ';
- while (*This.pSeek < This.pDoc->Count())
- {
- // output the ProgressState only for main text, because we
- // cannot determine the correct value otherwise
- if (!This.Pushed())
- ::SetProgressState(This.Where() * 100 / This.pDoc->Count(),
- rOut.GetDoc().GetDocShell());
- // Here, attributes and characters get pumped into the shell
- // alternatingly. The positions get incremented by reading
- // chars from the manager. First, the attributes:
- This.Out(rOut, cUnknown);
- // The text document pDoc is a Ww1PlainText, whose Out()
- // method outputs until the next special character or the
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list