diff options
-rw-r--r-- | sw/inc/IDocumentExternalData.hxx | 72 | ||||
-rw-r--r-- | sw/inc/dbgoutsw.hxx | 6 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/dbgoutsw.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8FibData.cxx | 65 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8FibData.hxx | 54 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8Sttbf.cxx | 121 | ||||
-rw-r--r-- | sw/source/filter/ww8/WW8Sttbf.hxx | 148 | ||||
-rw-r--r-- | sw/source/filter/ww8/makefile.mk | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 31 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 30 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 2 |
14 files changed, 567 insertions, 4 deletions
diff --git a/sw/inc/IDocumentExternalData.hxx b/sw/inc/IDocumentExternalData.hxx new file mode 100644 index 0000000000..85f9347050 --- /dev/null +++ b/sw/inc/IDocumentExternalData.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision:$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX +#define INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX + +#include <hash_map> +#include <boost/shared_ptr.hpp> + +namespace sw +{ +enum tExternalDataType { FIB, STTBF_ASSOC }; + +struct ExternalDataTypeHash +{ + size_t operator()(tExternalDataType eType) const { return eType; } +}; + +class ExternalData +{ +public: + ExternalData() {} + virtual ~ExternalData() {} +}; + +typedef ::boost::shared_ptr<ExternalData> tExternalDataPointer; +} + + +class IDocumentExternalData +{ +protected: + typedef ::std::hash_map<sw::tExternalDataType, sw::tExternalDataPointer, sw::ExternalDataTypeHash> + tExternalData; + + tExternalData m_externalData; + + virtual ~IDocumentExternalData() {}; + +public: + virtual void setExternalData(sw::tExternalDataType eType, + sw::tExternalDataPointer pPayload) = 0; + virtual sw::tExternalDataPointer getExternalData(sw::tExternalDataType eType) = 0; +}; + +#endif //INCLUDED_I_DOCUMENT_EXTERNAL_DATA_HXX diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx index cf794340ea..a4803e36a9 100644 --- a/sw/inc/dbgoutsw.hxx +++ b/sw/inc/dbgoutsw.hxx @@ -35,6 +35,11 @@ #include <hash_map> #include <tox.hxx> class String; + +namespace rtl +{ +class OUString; +} class SwNode; class SwTxtAttr; class SwpHints; @@ -69,6 +74,7 @@ extern bool bDbgOutPrintAttrSet; SW_DLLPUBLIC const char * dbg_out(const void * pVoid); SW_DLLPUBLIC const char * dbg_out(const String & aStr); +SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr); SW_DLLPUBLIC const char * dbg_out(const SwRect & rRect); SW_DLLPUBLIC const char * dbg_out(const SwFrmFmt & rFrmFmt); SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 55ab9a57b8..66695efba4 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -58,6 +58,7 @@ #include <IDocumentListsAccess.hxx> class SwList; // <-- +#include <IDocumentExternalData.hxx> #define _SVSTDARR_STRINGSDTOR #include <svtools/svstdarr.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> @@ -271,8 +272,9 @@ class SW_DLLPUBLIC SwDoc : public IDocumentOutlineNodes, // <-- // --> OD 2008-03-12 #refactorlists# - public IDocumentListsAccess + public IDocumentListsAccess, // <-- + public IDocumentExternalData { friend void _InitCore(); @@ -1046,6 +1048,12 @@ public: const String sNewListStyleName ); // <-- + /** IDocumentExternalData */ + virtual void setExternalData(::sw::tExternalDataType eType, + ::sw::tExternalDataPointer pPayload); + virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType); + + /** INextInterface here */ diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index fc9effe7cf..2fb1676d5b 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -111,6 +111,11 @@ SW_DLLPUBLIC const char * dbg_out(const String & aStr) return aDbgOutResult.GetBuffer(); } +SW_DLLPUBLIC const char * dbg_out(const ::rtl::OUString & aStr) +{ + return OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr(); +} + struct CompareUShort { diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 3eb6ffbf62..d5fc2798c6 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -2007,3 +2007,13 @@ void SwDoc::ChkCondColls() } } +void SwDoc::setExternalData(::sw::tExternalDataType eType, + ::sw::tExternalDataPointer pPayload) +{ + m_externalData[eType] = pPayload; +} + +::sw::tExternalDataPointer SwDoc::getExternalData(::sw::tExternalDataType eType) +{ + return m_externalData[eType]; +} diff --git a/sw/source/filter/ww8/WW8FibData.cxx b/sw/source/filter/ww8/WW8FibData.cxx new file mode 100644 index 0000000000..230e65f034 --- /dev/null +++ b/sw/source/filter/ww8/WW8FibData.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile:$ + * $Revision:$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ + +#include "WW8FibData.hxx" + +namespace ww8 +{ +WW8FibData::WW8FibData() + : m_bReadOnlyRecommended(false), + m_bWriteReservation(false) +{ +} + +WW8FibData::~WW8FibData() +{ +} + +void WW8FibData::setReadOnlyRecommended(bool bReadOnlyRecommended) +{ + m_bReadOnlyRecommended = bReadOnlyRecommended; +} + +void WW8FibData::setWriteReservation(bool bWriteReservation) +{ + m_bWriteReservation = bWriteReservation; +} + +bool WW8FibData::getReadOnlyRecommended() const +{ + return m_bReadOnlyRecommended; +} + +bool WW8FibData::getWriteReservation() const +{ + return m_bWriteReservation; +} +} diff --git a/sw/source/filter/ww8/WW8FibData.hxx b/sw/source/filter/ww8/WW8FibData.hxx new file mode 100644 index 0000000000..07bea0b2a1 --- /dev/null +++ b/sw/source/filter/ww8/WW8FibData.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile:$ + * $Revision:$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ +#ifndef INCLUDED_WW8_FIB_DATA_HXX +#define INCLUDED_WW8_FIB_DATA_HXX +#include <IDocumentExternalData.hxx> + +namespace ww8 +{ +class WW8FibData : public ::sw::ExternalData +{ + bool m_bReadOnlyRecommended; + bool m_bWriteReservation; + +public: + WW8FibData(); + virtual ~WW8FibData(); + + void setReadOnlyRecommended(bool bReadOnlyRecommended); + void setWriteReservation(bool bWriteReservation); + + bool getReadOnlyRecommended() const; + bool getWriteReservation() const; +}; +} + +#endif // INCLUDED_WW8_FIB_DATA_HXX diff --git a/sw/source/filter/ww8/WW8Sttbf.cxx b/sw/source/filter/ww8/WW8Sttbf.cxx new file mode 100644 index 0000000000..1d80f201c0 --- /dev/null +++ b/sw/source/filter/ww8/WW8Sttbf.cxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ww8par2.hxx,v $ + * $Revision: 1.47.214.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ + +#include <iostream> +#include <dbgoutsw.hxx> +#include "WW8Sttbf.hxx" + +namespace ww8 +{ + WW8Struct::WW8Struct(SvStream& rSt, sal_uInt32 nPos, sal_uInt32 nSize) + : mn_offset(0), mn_size(nSize) + { + rSt.Seek(nPos); + + mp_data.reset(new BYTE[nSize]); + rSt.Read(mp_data.get(), nSize); + } + + WW8Struct::WW8Struct(WW8Struct * pStruct, sal_uInt32 nPos, sal_uInt32 nSize) + : mp_data(pStruct->mp_data), mn_offset(pStruct->mn_offset + nPos), + mn_size(nSize) + { + } + + WW8Struct::~WW8Struct() + { + } + + sal_uInt8 WW8Struct::getU8(sal_uInt32 nOffset) + { + sal_uInt8 nResult = 0; + + if (nOffset < mn_size) + { + nResult = mp_data[mn_offset + nOffset]; + } + + return nResult; + } + + ::rtl::OUString WW8Struct::getUString(sal_uInt32 nOffset, + sal_uInt32 nCount) + { + ::rtl::OUString aResult; + + if (nCount > 0) + { + rtl_uString * pNew = 0; + rtl_uString_newFromStr_WithLength + (&pNew, reinterpret_cast<const sal_Unicode *>(&mp_data[mn_offset + nOffset]), + nCount); + + aResult = rtl::OUString(pNew); + } + +#ifdef DEBUG + char sBuffer[256]; + snprintf(sBuffer, sizeof(sBuffer), "offset=\"%" SAL_PRIuUINT32 "\" count=\"%" SAL_PRIuUINT32 "\"", + nOffset, nCount); + ::std::clog << "<WW8Struct-getUString" << sBuffer << ">" + << dbg_out(aResult) << "</WW8Struct-getUString>" + << ::std::endl; +#endif + + return aResult; + + } + + ::rtl::OUString WW8Struct::getString(sal_uInt32 nOffset, + sal_uInt32 nCount) + { + ::rtl::OUString aResult; + + if (nCount > 0) + { + ::rtl::OString aOStr(reinterpret_cast<const sal_Char *>(&mp_data[mn_offset + nOffset]), + nCount); + ::rtl::OUString aOUStr(OStringToOUString(aOStr, RTL_TEXTENCODING_ASCII_US)); + aResult = rtl::OUString(aOUStr); + } + +#ifdef DEBUG + char sBuffer[256]; + snprintf(sBuffer, sizeof(sBuffer), "offset=\"%" SAL_PRIuUINT32 "\" count=\"%" SAL_PRIuUINT32 "\"", + nOffset, nCount); + ::std::clog << "<WW8Struct-getString " << sBuffer << ">" + << dbg_out(aResult) << "</WW8Struct-getUString>" + << ::std::endl; +#endif + + return aResult; + } +} diff --git a/sw/source/filter/ww8/WW8Sttbf.hxx b/sw/source/filter/ww8/WW8Sttbf.hxx new file mode 100644 index 0000000000..6e6bc29dc6 --- /dev/null +++ b/sw/source/filter/ww8/WW8Sttbf.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ww8par2.hxx,v $ + * $Revision: 1.47.214.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ + +#include <vector> +#include <boost/shared_ptr.hpp> +#include <boost/shared_array.hpp> +#include <tools/solar.h> +#include <rtl/ustring.hxx> +#include <tools/stream.hxx> +#include <IDocumentExternalData.hxx> + +namespace ww8 +{ + typedef boost::shared_array<BYTE> DataArray_t; + +class WW8Struct : public ::sw::ExternalData + { + DataArray_t mp_data; + sal_uInt32 mn_offset; + sal_uInt32 mn_size; + + public: + WW8Struct(SvStream& rSt, sal_uInt32 nPos, sal_uInt32 nSize); + WW8Struct(WW8Struct * pStruct, sal_uInt32 nPos, sal_uInt32 nSize); + virtual ~WW8Struct(); + + sal_uInt8 getU8(sal_uInt32 nOffset); + + sal_uInt16 getU16(sal_uInt32 nOffset) + { return getU8(nOffset) + (getU8(nOffset + 1) << 8); } + + sal_uInt32 getU32(sal_uInt32 nOffset) + { return getU16(nOffset) + (getU16(nOffset + 1) << 16); } + + ::rtl::OUString getUString(sal_uInt32 nOffset, sal_uInt32 nCount); + + ::rtl::OUString getString(sal_uInt32 nOffset, sal_uInt32 nCount); + }; + +typedef ::std::vector<rtl::OUString> StringVector_t; + template <class T> + class WW8Sttb : public WW8Struct + { + typedef ::boost::shared_ptr< void > ExtraPointer_t; + typedef ::std::vector< ExtraPointer_t > ExtrasVector_t; + bool bDoubleByteCharacters; + StringVector_t m_Strings; + ExtrasVector_t m_Extras; + + public: + WW8Sttb(SvStream& rSt, INT32 nPos, sal_uInt32 nSize); + virtual ~WW8Sttb(); + + sal_uInt32 getCount() const; + ::rtl::OUString getEntry(sal_uInt32 nEntry) const + { + return m_Strings[nEntry]; + } + + StringVector_t & getStrings() + { + return m_Strings; + } + + const T * getExtra(sal_uInt32 nEntry) const + { + return dynamic_cast<const T *> (m_Extras[nEntry].get()); + } + }; + + template <class T> + WW8Sttb<T>::WW8Sttb(SvStream& rSt, INT32 nPos, sal_uInt32 nSize) + : WW8Struct(rSt, nPos, nSize), bDoubleByteCharacters(false) + { + sal_uInt32 nOffset = 0; + + if (getU16(nOffset) == 0xffff) + { + bDoubleByteCharacters = true; + nOffset += 2; + } + + sal_uInt16 nCount = getU16(nOffset); + sal_uInt16 ncbExtra = getU16(nOffset + 2); + + nOffset += 4; + for (sal_uInt16 i = 0; i < nCount; i++) + { + if (bDoubleByteCharacters) + { + sal_uInt16 nStrLen = getU16(nOffset); + + m_Strings.push_back(getUString(nOffset +2, nStrLen)); + + nOffset += 2 + 2 * nStrLen; + } + else + { + sal_uInt8 nStrLen = getU8(nOffset); + + m_Strings.push_back(getUString(nOffset, nStrLen)); + + nOffset += 1 + nStrLen; + } + + if (ncbExtra > 0) + { + ExtraPointer_t pExtra(new T(this, nOffset, ncbExtra)); + m_Extras.push_back(pExtra); + + nOffset += ncbExtra; + } + } + } + + template <class T> + WW8Sttb<T>::~WW8Sttb() + { + } +} diff --git a/sw/source/filter/ww8/makefile.mk b/sw/source/filter/ww8/makefile.mk index 6697ceaec4..164a8fef28 100644 --- a/sw/source/filter/ww8/makefile.mk +++ b/sw/source/filter/ww8/makefile.mk @@ -69,7 +69,9 @@ EXCEPTIONSFILES = \ $(SLO)$/writerwordglue.obj \ $(SLO)$/ww8scan.obj \ $(SLO)$/WW8TableInfo.obj \ - $(SLO)$/WW8FFData.obj + $(SLO)$/WW8FFData.obj \ + $(SLO)$/WW8Sttbf.obj \ + $(SLO)$/WW8FibData.obj SLOFILES = \ @@ -96,7 +98,9 @@ SLOFILES = \ $(SLO)$/writerhelper.obj \ $(SLO)$/writerwordglue.obj \ $(SLO)$/WW8TableInfo.obj \ - $(SLO)$/WW8FFData.obj + $(SLO)$/WW8FFData.obj \ + $(SLO)$/WW8Sttbf.obj \ + $(SLO)$/WW8FibData.obj # --- Tagets ------------------------------------------------------- diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 4d2eb96d35..f945c0ad62 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -117,6 +117,8 @@ #include <svx/mscodec.hxx> #include <osl/time.h> #include <rtl/random.h> +#include "WW8Sttbf.hxx" +#include "WW8FibData.hxx" using namespace sw::util; using namespace sw::types; @@ -2535,6 +2537,8 @@ void WW8Export::WriteMainText() #endif } +typedef ww8::WW8Sttb< ww8::WW8Struct > WW8SttbAssoc; + void WW8Export::WriteFkpPlcUsw() { if( !bWrtWW8 ) @@ -2656,9 +2660,36 @@ void WW8Export::WriteFkpPlcUsw() ExportDopTypography(pDop->doptypography); WriteDop( *this ); // Document-Properties + + // Write SttbfAssoc + WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *> + (pDoc->getExternalData(::sw::STTBF_ASSOC).get()); + ::std::vector<String> aStrings; + + ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); + ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); + for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); + aIt != aItEnd; aIt++) + { + String aStr(aIt->getStr()); + aStrings.push_back(aStr); + } + + WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, + pFib->lcbSttbfAssoc); + } Strm().Seek( 0 ); + // Reclaim stored FIB data from document. + ::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *> + (pDoc->getExternalData(::sw::FIB).get()); + + pFib->fReadOnlyRecommended = + pFibData->getReadOnlyRecommended() ? 1 : 0; + pFib->fWriteReservation = + pFibData->getWriteReservation() ? 1 : 0; + pFib->Write( Strm() ); // FIB } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 070de35a6d..9b5a785220 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -138,6 +138,8 @@ #include <dbgoutsw.hxx> #endif +#include "WW8Sttbf.hxx" +#include "WW8FibData.hxx" #define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm #define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm @@ -3740,6 +3742,34 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) if (mbNewDoc && pStg && !pGloss) ReadDocInfo(); + ::ww8::WW8FibData * pFibData = new ::ww8::WW8FibData(); + + if (pWwFib->fReadOnlyRecommended) + pFibData->setReadOnlyRecommended(true); + else + pFibData->setReadOnlyRecommended(false); + + if (pWwFib->fWriteReservation) + pFibData->setWriteReservation(true); + else + pFibData->setWriteReservation(false); + + ::sw::tExternalDataPointer pExternalFibData(pFibData); + + rDoc.setExternalData(::sw::FIB, pExternalFibData); + + ::sw::tExternalDataPointer pSttbfAsoc + (new ::ww8::WW8Sttb<ww8::WW8Struct>(*pTableStream, pWwFib->fcSttbfAssoc, pWwFib->lcbSttbfAssoc)); + + rDoc.setExternalData(::sw::STTBF_ASSOC, pSttbfAsoc); + + if (pWwFib->fWriteReservation || pWwFib->fReadOnlyRecommended) + { + SwDocShell * pDocShell = rDoc.GetDocShell(); + if (pDocShell) + pDocShell->SetReadOnlyUI(sal_True); + } + pPaM = new SwPaM(rPos); pCtrlStck = new SwWW8FltControlStack( &rDoc, nFieldFlags, *this ); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 3f7bf9e056..d559608d86 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -5488,7 +5488,8 @@ WW8Fib::WW8Fib(SvStream& rSt, BYTE nWantedVersion, UINT32 nOffset) cQuickSaves = ( aBits1 & 0xf0 ) >> 4; fEncrypted = aBits2 & 0x01 ; fWhichTblStm= ( aBits2 & 0x02 ) >> 1; - // dummy = ( aBits2 & 0x0e ) >> 1; + fReadOnlyRecommended = (aBits2 & 0x4) >> 2; + fWriteReservation = (aBits2 & 0x8) >> 3; fExtChar = ( aBits2 & 0x10 ) >> 4; // dummy = ( aBits2 & 0x20 ) >> 5; fFarEast = ( aBits2 & 0x40 ) >> 6; // #i90932# @@ -5661,6 +5662,12 @@ bool WW8Fib::WriteHeader(SvStream& rStrm) nBits16 |= (0xf0 & ( cQuickSaves << 4 )); if( fEncrypted ) nBits16 |= 0x0100; if( fWhichTblStm ) nBits16 |= 0x0200; + + if (fReadOnlyRecommended) + nBits16 |= 0x0400; + if (fWriteReservation) + nBits16 |= 0x0800; + if( fExtChar ) nBits16 |= 0x1000; if( fFarEast ) nBits16 |= 0x4000; // #i90932# if( fObfuscated ) nBits16 |= 0x8000; diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 9ec0fc7b5f..9d3d0af1f6 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1033,6 +1033,8 @@ public: UINT16 cQuickSaves :4; // 00F0 count of times file was quicksaved UINT16 fEncrypted :1; //0100 1 if file is encrypted, 0 if not UINT16 fWhichTblStm :1; //0200 When 0, this fib refers to the table stream + UINT16 fReadOnlyRecommended :1; + UINT16 fWriteReservation :1; // named "0Table", when 1, this fib refers to the // table stream named "1Table". Normally, a file // will have only one table stream, but under unusual |