diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-07-27 17:12:01 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-07-27 17:12:01 +0200 |
commit | 386df44d93bcb442a5bf9c9ba1131b09c972eb05 (patch) | |
tree | 52039b356a1274c3bc78cb74aad999ff5c41ebe6 /sw | |
parent | f2562cf3027626b269caf4dd74731b69c207febb (diff) | |
parent | 5c62576e5d8af7379a57b45392d3c51c0bcd0fcc (diff) |
mib17: rebase to DEV300_m84
Diffstat (limited to 'sw')
26 files changed, 1376 insertions, 1162 deletions
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx index b74931d8d9ef..729dc18a780b 100644 --- a/sw/inc/SidebarWin.hxx +++ b/sw/inc/SidebarWin.hxx @@ -170,7 +170,7 @@ class SwSidebarWin : public Window virtual bool IsProtected() {return mbReadonly;}; DECL_LINK( WindowEventListener, VclSimpleEvent* ); - inline const bool IsMouseOverSidebarWin() const { return mbMouseOver; } + inline bool IsMouseOverSidebarWin() const { return mbMouseOver; } void SetLanguage(const SvxLanguageItem aNewItem); diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 16e6cd047fb6..3dd338a5e129 100755 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -29,6 +29,7 @@ #include <rtl/ref.hxx> #include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/uno/Sequence.h> #include <vcl/timer.hxx> #include <sfx2/docfac.hxx> #include <sfx2/objsh.hxx> @@ -302,6 +303,14 @@ public: SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef ); virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const; + + // passwword protection for Writer (derived from SfxObjectShell) + // see also: FN_REDLINE_ON, FN_REDLINE_ON + virtual bool IsChangeRecording() const; + virtual bool HasChangeRecordProtection() const; + virtual void SetChangeRecording( bool bActivate ); + virtual bool SetProtectionPassword( const String &rPassword ); + virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); }; class Graphic; diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 8ad108513297..c8e601143877 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -133,7 +133,7 @@ protected: public: // public Data - used for internal Clipboard / Drag & Drop / XSelection - SwTransferable *pClipboard, *pDragDrop, *pXSelection; + SwTransferable *pDragDrop, *pXSelection; TYPEINFO(); SFX_DECL_INTERFACE(SW_INTERFACE_MODULE) diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx index 76fa7ee3befe..d6ada94d5396 100644 --- a/sw/inc/unotext.hxx +++ b/sw/inc/unotext.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextCopy.hpp> #include <com/sun/star/text/XTextRangeCompare.hpp> #include <com/sun/star/text/XRelativeTextContentInsert.hpp> #include <com/sun/star/text/XRelativeTextContentRemove.hpp> @@ -62,6 +63,7 @@ class SwXText , public ::com::sun::star::lang::XUnoTunnel , public ::com::sun::star::beans::XPropertySet , public ::com::sun::star::text::XTextAppendAndConvert + , public ::com::sun::star::text::XTextCopy , public ::com::sun::star::text::XTextRangeCompare , public ::com::sun::star::text::XRelativeTextContentInsert , public ::com::sun::star::text::XRelativeTextContentRemove @@ -333,6 +335,11 @@ public: throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + // XTextCopy + virtual void SAL_CALL copyText( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextCopy >& xSource ) + throw (::com::sun::star::uno::RuntimeException); }; #endif // SW_UNOTEXT_HXX diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index c27ac20b0013..aae7ec7a019c 100644..100755 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -6623,7 +6623,7 @@ SfxBoolItem ProtectTraceChangeMode FN_REDLINE_PROTECT FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index c2a6d011be85..093d22136d81 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -173,6 +173,17 @@ void SwAccessiblePortionData::Special( sDisplay = aTmpBuffer.makeStringAndClear(); break; } + // --> OD 2010-06-04 #i111768# - apply patch from kstribley: + // Include the control characters. + case POR_CONTROLCHAR: + { + OUStringBuffer aTmpBuffer( rText.Len() + 1 ); + aTmpBuffer.append( rText ); + aTmpBuffer.append( pTxtNode->GetTxt().GetChar(nModelPosition) ); + sDisplay = aTmpBuffer.makeStringAndClear(); + break; + } + // <-- default: sDisplay = rText; break; diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index d60abccddc21..7af292626f06 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -998,7 +998,15 @@ void SwNumRule::SetInvalidRule(BOOL bFlag) for ( aIter = maTxtNodeList.begin(); aIter != maTxtNodeList.end(); ++aIter ) { const SwTxtNode* pTxtNode = *aIter; - aLists.insert( pTxtNode->GetDoc()->getListByName( pTxtNode->GetListId() ) ); + // --> OD 2010-06-04 #i111681# - applying patch from cmc +// aLists.insert( pTxtNode->GetDoc()->getListByName( pTxtNode->GetListId() ) ); + SwList* pList = pTxtNode->GetDoc()->getListByName( pTxtNode->GetListId() ); + ASSERT( pList, "<SwNumRule::SetInvalidRule(..)> - list at which the text node is registered at does not exist. This is a serious issue --> please inform OD."); + if ( pList ) + { + aLists.insert( pList ); + } + // <-- } std::for_each( aLists.begin(), aLists.end(), std::mem_fun( &SwList::InvalidateListTree ) ); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 72976a786fa1..b45f1bcb2ceb 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1385,11 +1385,15 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn ) return pPage; } -// false = right, true = left sw::sidebarwindows::SidebarPosition SwPageFrm::SidebarPosition() const { - if (!GetShell() || GetShell()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)) - return sw::sidebarwindows::SIDEBAR_NONE; + if ( !GetShell() || + GetShell()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) + { + // --> OD 2010-06-03 #i111964# - provide default sidebar position + return sw::sidebarwindows::SIDEBAR_RIGHT; + // <-- + } else { const bool bLTR = GetUpper() ? static_cast<const SwRootFrm*>(GetUpper())->IsLeftToRightViewLayout() : true; diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 1a05aa38098a..59edb6fa59c9 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -416,6 +416,12 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf ) // case CHAR_RLM : // case CHAR_LRM : // <-- + // --> OD 2010-06-03 #i111750# + // - Erasing further control characters from field string in + // to avoid loop. + case CH_TXTATR_BREAKWORD: + case CH_TXTATR_INWORD: + // <-- { aNew.Erase( 0, 1 ); ++nNextOfst; diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index d8682062f039..3ddcfc1d2ed7 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -76,8 +76,6 @@ #include <stdlib.h> #include <iostream> - - using namespace ::com::sun::star; using ::rtl::OUString; @@ -277,6 +275,10 @@ SwXText::queryInterface(const uno::Type& rType) throw (uno::RuntimeException) { aRet <<= uno::Reference< text::XTextContentAppend >(this); } + else if(rType == text::XTextCopy::static_type()) + { + aRet <<= uno::Reference< text::XTextCopy >( this ); + } return aRet; } /* -----------------------------15.03.00 17:42-------------------------------- @@ -1860,6 +1862,32 @@ static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 ) return abs( nPos1 - nPos2 ) < COL_POS_FUZZY; } +void SwXText::copyText( + const uno::Reference< text::XTextCopy >& xSource ) + throw ( uno::RuntimeException ) +{ + uno::Reference< lang::XUnoTunnel > xTTunnel( xSource, uno::UNO_QUERY_THROW ); + SwXText* pText = 0; + pText = reinterpret_cast< SwXText* >( + sal::static_int_cast< sal_IntPtr >( xTTunnel->getSomething( SwXText::getUnoTunnelId()) )); + + uno::Reference< text::XText > xText( xSource, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextCursor > xCursor = xText->createTextCursor( ); + xCursor->gotoEnd( sal_True ); + + uno::Reference< lang::XUnoTunnel > xTunnel( xCursor, uno::UNO_QUERY_THROW ); + + OTextCursorHelper* pCursor = 0; + pCursor = reinterpret_cast< OTextCursorHelper* >( + sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); + if ( pCursor ) + { + SwNodeIndex rNdIndex( *GetStartNode( ), 1 ); + SwPosition rPos( rNdIndex ); + m_pImpl->m_pDoc->CopyRange( *pCursor->GetPaM( ), rPos, false ); + } +} + void SwXText::Impl::ConvertCell( const bool bFirstCell, const uno::Sequence< uno::Reference< text::XTextRange > > & rCell, diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 553554df8f52..6f4cca8993d2 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -1,1031 +1,1037 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" -#define _SVSTDARR_STRINGS - -#include <string.h> -#include <stdio.h> // sscanf -#include <hintids.hxx> -#include <i18npool/lang.h> -#include <i18npool/mslangid.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/parhtml.hxx> -#include <svl/svstdarr.hxx> -#include <sot/storage.hxx> -#include <sot/clsids.hxx> -#include <sfx2/app.hxx> -#include <sfx2/docfilt.hxx> -#include <sfx2/fcontnr.hxx> -#include <sfx2/docfile.hxx> -#include <editeng/lrspitem.hxx> -#include <editeng/tstpitem.hxx> -#include <doc.hxx> -#include <docary.hxx> -#include <pam.hxx> -#include <shellio.hxx> -#include <errhdl.hxx> -#include <docsh.hxx> -#include <wdocsh.hxx> -#include <fltini.hxx> -#include <hints.hxx> -#include <frmatr.hxx> -#include <fmtfsize.hxx> -#include <swtable.hxx> -#include <fmtcntnt.hxx> -#include <editeng/boxitem.hxx> -#include <frmatr.hxx> -#include <frmfmt.hxx> -#include <numrule.hxx> -#include <ndtxt.hxx> -#include <swfltopt.hxx> -#include <swerror.h> -#include <osl/module.hxx> - -using namespace utl; -using rtl::OUString; -using namespace com::sun::star::uno; - -SwRead ReadAscii = 0, /*ReadSwg = 0, ReadSw3 = 0,*/ - ReadHTML = 0, ReadXML = 0; - -Reader* GetRTFReader(); -Reader* GetWW8Reader(); - -// Note: if editing, please don't forget to modify also the enum -// ReaderWriterEnum and aFilterDetect in shellio.hxx -SwReaderWriterEntry aReaderWriter[] = -{ - SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, TRUE ), - SwReaderWriterEntry( 0, &::GetASCWriter, FALSE ), - SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, TRUE ), - 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, TRUE ), - SwReaderWriterEntry( 0, &::GetASCWriter, TRUE ) -}; - -Reader* SwReaderWriterEntry::GetReader() -{ - if ( pReader ) - return pReader; - else if ( fnGetReader ) - { - pReader = (*fnGetReader)(); - return pReader; - } - return NULL; -} - -void SwReaderWriterEntry::GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const -{ - if ( fnGetWriter ) - (*fnGetWriter)( rNm, rBaseURL, xWrt ); - else - xWrt = WriterRef(0); -} - -/*SwRead SwGetReaderSw3() // SW_DLLPUBLIC -{ - return ReadSw3; -} -*/ -SwRead SwGetReaderXML() // SW_DLLPUBLIC -{ - return ReadXML; -} - -bool IsDocShellRegistered() -{ - return 0 != SwDocShell::_GetInterface(); -} - -inline void _SetFltPtr( USHORT rPos, SwRead pReader ) -{ - aReaderWriter[ rPos ].pReader = pReader; -} - -void _InitFilter() -{ - _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) ); - -#ifdef NEW_WW97_EXPORT - aReaderWriter[ READER_WRITER_WW1 ].fnGetWriter = &::GetWW8Writer; - aReaderWriter[ READER_WRITER_WW5 ].fnGetWriter = &::GetWW8Writer; -#endif - - _SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii ); - _SetFltPtr( READER_WRITER_TEXT, ReadAscii ); -} - -void _FinitFilter() -{ - // die Reader vernichten - for( USHORT n = 0; n < MAXFILTER; ++n ) - { - SwReaderWriterEntry& rEntry = aReaderWriter[n]; - if( rEntry.bDelReader && rEntry.pReader ) - delete rEntry.pReader, rEntry.pReader = NULL; - } -} - - -/* */ - -namespace SwReaderWriter { - -Reader* GetReader( ReaderWriterEnum eReader ) -{ - return aReaderWriter[eReader].GetReader(); -} - -void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) -{ - for( USHORT n = 0; n < MAXFILTER; ++n ) - if( aFilterDetect[n].IsFilter( rFltName ) ) - { - aReaderWriter[n].GetWriter( rFltName, rBaseURL, xRet ); - break; - } -} - -SwRead GetReader( const String& rFltName ) -{ - SwRead pRead = 0; - for( USHORT n = 0; n < MAXFILTER; ++n ) - if( aFilterDetect[n].IsFilter( rFltName ) ) - { - pRead = aReaderWriter[n].GetReader(); - // fuer einige Reader noch eine Sonderbehandlung: - if ( pRead ) - pRead->SetFltName( rFltName ); - break; - } - return pRead; -} - -} // namespace SwReaderWriter - -/* */ - -/////////////// die Storage Reader/Writer //////////////////////////////// - -/*void GetSw3Writer( const String&, const String& rBaseURL, WriterRef& xRet ) -{ - DBG_ERROR( "Shouldn't happen!"); - xRet = new Sw3Writer; -} -*/ - -ULONG StgReader::OpenMainStream( SvStorageStreamRef& rRef, USHORT& rBuffSize ) -{ - ULONG nRet = ERR_SWG_READ_ERROR; - ASSERT( pStg, "wo ist mein Storage?" ); - const SfxFilter* pFltr = SwIoSystem::GetFilterOfFormat( aFltName ); - if( pFltr ) - { - rRef = pStg->OpenSotStream( SwIoSystem::GetSubStorageName( *pFltr ), - STREAM_READ | STREAM_SHARE_DENYALL ); - - if( rRef.Is() ) - { - if( SVSTREAM_OK == rRef->GetError() ) - { - USHORT nOld = rRef->GetBufferSize(); - rRef->SetBufferSize( rBuffSize ); - rBuffSize = nOld; - nRet = 0; - } - else - nRet = rRef->GetError(); - } - } - return nRet; -} - -/* */ -/* -ULONG Sw3Reader::Read( SwDoc &rDoc, SwPaM &rPam, const String & ) -{ - ULONG nRet; - if( pStg && pIO ) - { - // TRUE: Vorlagen ueberschreiben - pIO->SetReadOptions( aOpt,TRUE ); - if( !bInsertMode ) - { - // Im Laden-Modus darf der PaM-Content-Teil nicht - // in den Textbereich zeigen (Nodes koennen geloescht werden) - rPam.GetBound( TRUE ).nContent.Assign( 0, 0 ); - rPam.GetBound( FALSE ).nContent.Assign( 0, 0 ); - } - nRet = pIO->Load( pStg, bInsertMode ? &rPam : 0 ); - aOpt.ResetAllFmtsOnly(); - pIO->SetReadOptions( aOpt, TRUE ); - } - else - { - ASSERT( !this, "Sw3-Read ohne Storage und/oder IO-System" ); - nRet = ERR_SWG_READ_ERROR; - } - return nRet; -} - - // read the sections of the document, which is equal to the medium. - // returns the count of it -USHORT Sw3Reader::GetSectionList( SfxMedium& rMedium, - SvStrings& rStrings ) const -{ - SvStorageRef aStg( rMedium.GetStorage() ); - const SfxFilter* pFlt = rMedium.GetFilter(); - ASSERT( pFlt && pFlt->GetVersion(), - "Kein Filter oder Filter ohne FF-Version" ); - if( pFlt && pFlt->GetVersion() ) - aStg->SetVersion( (long)pFlt->GetVersion() ); - - if( pIO ) - pIO->GetSectionList( &aStg, rStrings ); - return rStrings.Count(); - return 0; -} -*/ - -/*ULONG Sw3Writer::WriteStorage() -{ - ULONG nRet; - if( pIO ) - { - // der gleiche Storage -> Save, sonst SaveAs aufrufen - if( !bSaveAs ) - nRet = pIO->Save( pOrigPam, bWriteAll ); - else - nRet = pIO->SaveAs( pStg, pOrigPam, bWriteAll ); - - pIO = 0; // nach dem Schreiben ist der Pointer ungueltig !! - } - else - { - ASSERT( !this, "Sw3-Writer ohne IO-System" ) - nRet = ERR_SWG_WRITE_ERROR; - } - return nRet; -} - -ULONG Sw3Writer::WriteMedium( SfxMedium& ) -{ - DBG_ERROR( "Shouldn't be used currently!"); - return WriteStorage(); -} - -BOOL Sw3Writer::IsSw3Writer() const { return TRUE; } -*/ - -void Writer::SetPasswd( const String& ) {} - - -void Writer::SetVersion( const String&, long ) {} - - -BOOL Writer::IsStgWriter() const { return FALSE; } -//BOOL Writer::IsSw3Writer() const { return FALSE; } - -BOOL StgWriter::IsStgWriter() const { return TRUE; } - -/* */ - - - -BOOL SwReader::NeedsPasswd( const Reader& /*rOptions*/ ) -{ - BOOL bRes = FALSE; - return bRes; -} - - -BOOL SwReader::CheckPasswd( const String& /*rPasswd*/, const Reader& /*rOptions*/ ) -{ - return TRUE; -} - - -/* */ - -//----------------------------------------------------------------------- -// Filter Flags lesen, wird von WW8 / W4W / EXCEL / LOTUS benutzt. -//----------------------------------------------------------------------- - -/* -<FilterFlags> - <Excel_Lotus> - <MinRow cfg:type="long">0</MinRow> - <MaxRow cfg:type="long">0</MaxRow> - <MinCol cfg:type="long">0</MinCol> - <MaxCol cfg:type="long">0</MaxCol> - </Excel_Lotus> - <W4W> - <W4WHD cfg:type="long">0</W4WHD> - <W4WFT cfg:type="long">0</W4WFT> - <W4W000 cfg:type="long">0</W4W000> - </W4W> - <WinWord> - <WW1F cfg:type="long">0</WW1F> - <WW cfg:type="long">0</WW> - <WW8 cfg:type="long">0</WW8> - <WWF cfg:type="long">0</WWF> - <WWFA0 cfg:type="long">0</WWFA0> - <WWFA1 cfg:type="long">0</WWFA1> - <WWFA2 cfg:type="long">0</WWFA2> - <WWFB0 cfg:type="long">0</WWFB0> - <WWFB1 cfg:type="long">0</WWFB1> - <WWFB2 cfg:type="long">0</WWFB2> - <WWFLX cfg:type="long">0</WWFLX> - <WWFLY cfg:type="long">0</WWFLY> - <WWFT cfg:type="long">0</WWFT> - <WWWR cfg:type="long">0</WWWR> - </WinWord> - <Writer> - <SW3Imp cfg:type="long">0</SW3Imp> - </Writer> -</FilterFlags> -*/ - -#define FILTER_OPTION_ROOT String::CreateFromAscii( \ - RTL_CONSTASCII_STRINGPARAM( "Office.Writer/FilterFlags" ) ) - -SwFilterOptions::SwFilterOptions( sal_uInt16 nCnt, const sal_Char** ppNames, - sal_uInt32* pValues ) - : ConfigItem( FILTER_OPTION_ROOT ) -{ - GetValues( nCnt, ppNames, pValues ); -} - -void SwFilterOptions::GetValues( sal_uInt16 nCnt, const sal_Char** ppNames, - sal_uInt32* pValues ) -{ - Sequence<OUString> aNames( nCnt ); - OUString* pNames = aNames.getArray(); - USHORT n; - - for( n = 0; n < nCnt; ++n ) - pNames[ n ] = OUString::createFromAscii( ppNames[ n ] ); - Sequence<Any> aValues = GetProperties( aNames ); - - if( nCnt == aValues.getLength() ) - { - const Any* pAnyValues = aValues.getConstArray(); - for( n = 0; n < nCnt; ++n ) - pValues[ n ] = pAnyValues[ n ].hasValue() - ? *(sal_uInt32*)pAnyValues[ n ].getValue() - : 0; - } - else - for( n = 0; n < nCnt; ++n ) - pValues[ n ] = 0; -} - -void SwFilterOptions::Commit() {} -void SwFilterOptions::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} - -/* */ - - -void StgReader::SetFltName( const String& rFltNm ) -{ - if( SW_STORAGE_READER & GetReaderType() ) - aFltName = rFltNm; -} - - -/* */ - -SwRelNumRuleSpaces::SwRelNumRuleSpaces( SwDoc& rDoc, BOOL bNDoc ) - : bNewDoc( bNDoc ) -{ - pNumRuleTbl = new SwNumRuleTbl( 8, 8 ); - if( !bNDoc ) - pNumRuleTbl->Insert( &rDoc.GetNumRuleTbl(), 0 ); -} - -SwRelNumRuleSpaces::~SwRelNumRuleSpaces() -{ - if( pNumRuleTbl ) - { - pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() ); - delete pNumRuleTbl; - } -} - -void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc ) -{ - const SwNumRuleTbl* pRuleTbl = NULL; - - if( !bNewDoc ) - { - // jetzt alle schon vorhanden NumRules aus dem Array entfernen, - // damit nur die neuen angepasst werden - SwNumRuleTbl aNumRuleTbl; - aNumRuleTbl.Insert( pNumRuleTbl, 0 ); - pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() ); - const SwNumRuleTbl& rRuleTbl = rDoc.GetNumRuleTbl(); - SwNumRule* pRule; - - for( USHORT n = 0; n < rRuleTbl.Count(); ++n ) - if( USHRT_MAX == aNumRuleTbl.GetPos( ( pRule = rRuleTbl[ n ] ))) - // war noch nicht vorhanden, also neu - pNumRuleTbl->Insert( pRule, pNumRuleTbl->Count() ); - - aNumRuleTbl.Remove( 0, aNumRuleTbl.Count() ); - - pRuleTbl = pNumRuleTbl; - } - else - { - pRuleTbl = &rDoc.GetNumRuleTbl(); - } - - if( pRuleTbl ) - { - for( USHORT n = pRuleTbl->Count(); n; ) - { - SwNumRule* pRule = (*pRuleTbl)[ --n ]; - // Rule noch gueltig und am Doc vorhanden? - if( USHRT_MAX != rDoc.GetNumRuleTbl().GetPos( pRule )) - { - // --> OD 2008-02-19 #refactorlists# -// SwNumRuleInfo aUpd( pRule->GetName() ); -// aUpd.MakeList( rDoc ); - -// // bei allen nmumerierten Absaetzen vom linken Rand -// // den absoluten Wert des NumFormates abziehen -// for( ULONG nUpdPos = 0; nUpdPos < aUpd.GetList().Count(); -// ++nUpdPos ) -// { -// SwTxtNode* pNd = aUpd.GetList().GetObject( nUpdPos ); -// SetNumLSpace( *pNd, *pRule ); -// } - SwNumRule::tTxtNodeList aTxtNodeList; - pRule->GetTxtNodeList( aTxtNodeList ); - for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin(); - aIter != aTxtNodeList.end(); ++aIter ) - { - SwTxtNode* pNd = *aIter; - SetNumLSpace( *pNd, *pRule ); - } - // <-- - } - } - } - - if( pNumRuleTbl ) - { - pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() ); - delete pNumRuleTbl, pNumRuleTbl = 0; - } - - if( bNewDoc ) - { - SetOultineRelSpaces( SwNodeIndex( rDoc.GetNodes() ), - SwNodeIndex( rDoc.GetNodes().GetEndOfContent())); - } -} - -void SwRelNumRuleSpaces::SetOultineRelSpaces( const SwNodeIndex& rStt, - const SwNodeIndex& rEnd ) -{ - SwDoc* pDoc = rStt.GetNode().GetDoc(); - const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds(); - if( rOutlNds.Count() ) - { - USHORT nPos; - rOutlNds.Seek_Entry( &rStt.GetNode(), &nPos ); - for( ; nPos < rOutlNds.Count() && - rOutlNds[ nPos ]->GetIndex() < rEnd.GetIndex(); ++nPos ) - { - SwTxtNode* pNd = rOutlNds[ nPos ]->GetTxtNode(); - if( pNd->IsOutline() && !pNd->GetNumRule() ) - SetNumLSpace( *pNd, *pDoc->GetOutlineNumRule() ); - } - } -} - -void SwRelNumRuleSpaces::SetNumLSpace( SwTxtNode& rNd, const SwNumRule& rRule ) -{ - BOOL bOutlineRule = OUTLINE_RULE == rRule.GetRuleType(); - // --> OD 2005-11-18 #128056# - // correction of refactoring done by cws swnumtree: - // - assure a correct level for retrieving numbering format. -// BYTE nLvl = rNd.GetLevel(); - BYTE nLvl = 0; - if ( rNd.GetActualListLevel() >= 0 && rNd.GetActualListLevel() < MAXLEVEL ) - { - nLvl = static_cast< BYTE >(rNd.GetActualListLevel()); - } - // <-- - const SwNumFmt& rFmt = rRule.Get( nLvl ); - const SvxLRSpaceItem& rLR = rNd.GetSwAttrSet().GetLRSpace(); - - SvxLRSpaceItem aLR( rLR ); - aLR.SetTxtFirstLineOfst( 0 ); - - // sagt der Node, das die Numerierung den Wert vorgibt? - if( !bOutlineRule && rNd.IsSetNumLSpace() ) - aLR.SetTxtLeft( 0 ); - else - { - long nLeft = rFmt.GetAbsLSpace(), nParaLeft = rLR.GetTxtLeft(); - if( 0 < rLR.GetTxtFirstLineOfst() ) - nParaLeft += rLR.GetTxtFirstLineOfst(); - else if( nParaLeft >= nLeft ) - // #82963#/#82962#: set correct paragraph indent - nParaLeft -= nLeft; - else - //#83154#, Don't think any of the older #80856# bugfix code is - //relevent anymore. - nParaLeft = rLR.GetTxtLeft()+rLR.GetTxtFirstLineOfst(); - aLR.SetTxtLeft( nParaLeft ); - } - - if( aLR.GetTxtLeft() != rLR.GetTxtLeft() ) - { - //bevor rLR geloescht wird! - long nOffset = rLR.GetTxtLeft() - aLR.GetTxtLeft(); - rNd.SetAttr( aLR ); - - // Tabs anpassen !! - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rNd.GetSwAttrSet().GetItemState( - RES_PARATR_TABSTOP, TRUE, &pItem )) - { - SvxTabStopItem aTStop( *(SvxTabStopItem*)pItem ); - for( USHORT n = 0; n < aTStop.Count(); ++n ) - { - SvxTabStop& rTab = (SvxTabStop&)aTStop[ n ]; - if( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() ) - { - if( !rTab.GetTabPos() ) - { - aTStop.Remove( n ); - --n; - } - else - rTab.GetTabPos() += nOffset; - } - } - rNd.SetAttr( aTStop ); - } - } -} - -/* */ - - -void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, - SwTwips nPageWidth) -{ - const SfxPoolItem* pItem = 0; - if( SFX_ITEM_SET != rFlySet.GetItemState( RES_FRM_SIZE, TRUE, &pItem ) || - MINFLY > ((SwFmtFrmSize*)pItem)->GetWidth() ) - { - SwFmtFrmSize aSz((SwFmtFrmSize&)rFlySet.Get(RES_FRM_SIZE, TRUE)); - if (pItem) - aSz = (SwFmtFrmSize&)(*pItem); - - SwTwips nWidth; - // dann die Breite des Flys selbst bestimmen. Ist eine Tabelle - // defininiert, dann benutze deren Breite, sonst die Breite der - // Seite - const SwTableNode* pTblNd = rAnchor.GetNode().FindTableNode(); - if( pTblNd ) - nWidth = pTblNd->GetTable().GetFrmFmt()->GetFrmSize().GetWidth(); - else - nWidth = nPageWidth; - - const SwNodeIndex* pSttNd = ((SwFmtCntnt&)rFlySet.Get( RES_CNTNT )). - GetCntntIdx(); - if( pSttNd ) - { - BOOL bOnlyOneNode = TRUE; - ULONG nMinFrm = 0; - ULONG nMaxFrm = 0; - SwTxtNode* pFirstTxtNd = 0; - SwNodeIndex aIdx( *pSttNd, 1 ); - SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() ); - while( aIdx < aEnd ) - { - SwTxtNode *pTxtNd = aIdx.GetNode().GetTxtNode(); - if( pTxtNd ) - { - if( !pFirstTxtNd ) - pFirstTxtNd = pTxtNd; - else if( pFirstTxtNd != pTxtNd ) - { - // forget it - bOnlyOneNode = FALSE; - break; - } - - ULONG nAbsMinCnts; - pTxtNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrm, - nMaxFrm, nAbsMinCnts ); - } - aIdx++; - } - - if( bOnlyOneNode ) - { - if( nMinFrm < MINLAY && pFirstTxtNd ) - { - // if the first node dont contained any content, then - // insert one char in it calc again and delete once again - SwIndex aNdIdx( pFirstTxtNd ); - pFirstTxtNd->InsertText( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "MM" )), aNdIdx ); - ULONG nAbsMinCnts; - pFirstTxtNd->GetMinMaxSize( pFirstTxtNd->GetIndex(), - nMinFrm, nMaxFrm, nAbsMinCnts ); - aNdIdx -= 2; - pFirstTxtNd->EraseText( aNdIdx, 2 ); - } - - // Umrandung und Abstand zum Inhalt beachten - const SvxBoxItem& rBoxItem = (SvxBoxItem&)rFlySet.Get( RES_BOX ); - USHORT nLine = BOX_LINE_LEFT; - for( int i = 0; i < 2; ++i ) - { - const SvxBorderLine* pLn = rBoxItem.GetLine( nLine ); - if( pLn ) - { - USHORT nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth(); - nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine ); - nMinFrm += nWidthTmp; - nMaxFrm += nWidthTmp; - } - nLine = BOX_LINE_RIGHT; - } - - // Mindestbreite fuer Inhalt einhalten - if( nMinFrm < MINLAY ) - nMinFrm = MINLAY; - if( nMaxFrm < MINLAY ) - nMaxFrm = MINLAY; - - if( nWidth > (USHORT)nMaxFrm ) - nWidth = nMaxFrm; - else if( nWidth > (USHORT)nMinFrm ) - nWidth = nMinFrm; - } - } - - if( MINFLY > nWidth ) - nWidth = MINFLY; - - aSz.SetWidth( nWidth ); - if( MINFLY > aSz.GetHeight() ) - aSz.SetHeight( MINFLY ); - rFlySet.Put( aSz ); - } - else if( MINFLY > ((SwFmtFrmSize*)pItem)->GetHeight() ) - { - SwFmtFrmSize aSz( *(SwFmtFrmSize*)pItem ); - aSz.SetHeight( MINFLY ); - rFlySet.Put( aSz ); - } -} - -/* */ -struct CharSetNameMap -{ - rtl_TextEncoding eCode; - const sal_Char* pName; -}; - -const CharSetNameMap *GetCharSetNameMap() -{ - static const CharSetNameMap aMapArr[] = - { -# define IMPLENTRY(X) { RTL_TEXTENCODING_##X, "" #X "" } - IMPLENTRY(DONTKNOW), - IMPLENTRY(MS_1252), - IMPLENTRY(APPLE_ROMAN), - IMPLENTRY(IBM_437), - IMPLENTRY(IBM_850), - IMPLENTRY(IBM_860), - IMPLENTRY(IBM_861), - IMPLENTRY(IBM_863), - IMPLENTRY(IBM_865), - IMPLENTRY(SYMBOL), - IMPLENTRY(ASCII_US), - IMPLENTRY(ISO_8859_1), - IMPLENTRY(ISO_8859_2), - IMPLENTRY(ISO_8859_3), - IMPLENTRY(ISO_8859_4), - IMPLENTRY(ISO_8859_5), - IMPLENTRY(ISO_8859_6), - IMPLENTRY(ISO_8859_7), - IMPLENTRY(ISO_8859_8), - IMPLENTRY(ISO_8859_9), - IMPLENTRY(ISO_8859_14), - IMPLENTRY(ISO_8859_15), - IMPLENTRY(IBM_737), - IMPLENTRY(IBM_775), - IMPLENTRY(IBM_852), - IMPLENTRY(IBM_855), - IMPLENTRY(IBM_857), - IMPLENTRY(IBM_862), - IMPLENTRY(IBM_864), - IMPLENTRY(IBM_866), - IMPLENTRY(IBM_869), - IMPLENTRY(MS_874), - IMPLENTRY(MS_1250), - IMPLENTRY(MS_1251), - IMPLENTRY(MS_1253), - IMPLENTRY(MS_1254), - IMPLENTRY(MS_1255), - IMPLENTRY(MS_1256), - IMPLENTRY(MS_1257), - IMPLENTRY(MS_1258), - IMPLENTRY(APPLE_ARABIC), - IMPLENTRY(APPLE_CENTEURO), - IMPLENTRY(APPLE_CROATIAN), - IMPLENTRY(APPLE_CYRILLIC), - IMPLENTRY(APPLE_DEVANAGARI), - IMPLENTRY(APPLE_FARSI), - IMPLENTRY(APPLE_GREEK), - IMPLENTRY(APPLE_GUJARATI), - IMPLENTRY(APPLE_GURMUKHI), - IMPLENTRY(APPLE_HEBREW), - IMPLENTRY(APPLE_ICELAND), - IMPLENTRY(APPLE_ROMANIAN), - IMPLENTRY(APPLE_THAI), - IMPLENTRY(APPLE_TURKISH), - IMPLENTRY(APPLE_UKRAINIAN), - IMPLENTRY(APPLE_CHINSIMP), - IMPLENTRY(APPLE_CHINTRAD), - IMPLENTRY(APPLE_JAPANESE), - IMPLENTRY(APPLE_KOREAN), - IMPLENTRY(MS_932), - IMPLENTRY(MS_936), - IMPLENTRY(MS_949), - IMPLENTRY(MS_950), - IMPLENTRY(SHIFT_JIS), - IMPLENTRY(GB_2312), - IMPLENTRY(GBT_12345), - IMPLENTRY(GBK), - IMPLENTRY(BIG5), - IMPLENTRY(EUC_JP), - IMPLENTRY(EUC_CN), - IMPLENTRY(EUC_TW), - IMPLENTRY(ISO_2022_JP), - IMPLENTRY(ISO_2022_CN), - IMPLENTRY(KOI8_R), - IMPLENTRY(KOI8_U), - IMPLENTRY(UTF7), - IMPLENTRY(UTF8), - IMPLENTRY(ISO_8859_10), - IMPLENTRY(ISO_8859_13), - IMPLENTRY(EUC_KR), - IMPLENTRY(ISO_2022_KR), - IMPLENTRY(JIS_X_0201), - IMPLENTRY(JIS_X_0208), - IMPLENTRY(JIS_X_0212), - IMPLENTRY(MS_1361), - IMPLENTRY(GB_18030), - IMPLENTRY(BIG5_HKSCS), - IMPLENTRY(TIS_620), - IMPLENTRY(PT154), - IMPLENTRY(UCS4), - IMPLENTRY(UCS2), - IMPLENTRY(UNICODE), - {0,0} //Last - }; - return &aMapArr[0]; -} -/* - Get a rtl_TextEncoding from its name - */ -rtl_TextEncoding CharSetFromName(const String& rChrSetStr) -{ - const CharSetNameMap *pStart = GetCharSetNameMap(); - rtl_TextEncoding nRet = pStart->eCode; - - for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap) - { - if(rChrSetStr.EqualsIgnoreCaseAscii(pMap->pName)) - { - nRet = pMap->eCode; - break; - } - } - - ASSERT(nRet != pStart->eCode, "TXT: That was an unknown language!"); - - return nRet; -} - - -/* - Get the String name of an rtl_TextEncoding - */ -String NameFromCharSet(rtl_TextEncoding nChrSet) -{ - const CharSetNameMap *pStart = GetCharSetNameMap(); - const char *pRet = pStart->pName; - - for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap) - { - if (nChrSet == pMap->eCode) - { - pRet = pMap->pName; - break; - } - } - - ASSERT(pRet != pStart->pName, "TXT: That was an unknown language!"); - - return String::CreateFromAscii(pRet); -} - -// for the automatic conversion (mail/news/...) -// The user data contains the options for the ascii import/export filter. -// The format is: -// 1. CharSet - as ascii chars -// 2. LineEnd - as CR/LR/CRLF -// 3. Fontname -// 4. Language -// the delimetercharacter is "," -// - -void SwAsciiOptions::ReadUserData( const String& rStr ) -{ - xub_StrLen nToken = 0; - USHORT nCnt = 0; - String sToken; - do { - if( 0 != (sToken = rStr.GetToken( 0, ',', nToken )).Len() ) - { - switch( nCnt ) - { - case 0: // CharSet - eCharSet = CharSetFromName(sToken); - break; - case 1: // LineEnd - if( sToken.EqualsIgnoreCaseAscii( "CRLF" )) - eCRLF_Flag = LINEEND_CRLF; - else if( sToken.EqualsIgnoreCaseAscii( "LF" )) - eCRLF_Flag = LINEEND_LF; - else - eCRLF_Flag = LINEEND_CR; - break; - case 2: // fontname - sFont = sToken; - break; - case 3: // Language - nLanguage = MsLangId::convertIsoStringToLanguage( sToken ); - break; - } - } - ++nCnt; - } while( STRING_NOTFOUND != nToken ); -} - -void SwAsciiOptions::WriteUserData( String& rStr ) -{ - // 1. charset - rStr = NameFromCharSet(eCharSet); - rStr += ','; - - // 2. LineEnd - switch(eCRLF_Flag) - { - case LINEEND_CRLF: - rStr.AppendAscii( "CRLF" ); - break; - case LINEEND_CR: - rStr.AppendAscii( "CR" ); - break; - case LINEEND_LF: - rStr.AppendAscii( "LF" ); - break; - } - rStr += ','; - - // 3. Fontname - rStr += sFont; - rStr += ','; - - // 4. Language - if (nLanguage) - { - rtl::OUString sTmp = MsLangId::convertLanguageToIsoString( nLanguage ); - rStr += (String)sTmp; - } - rStr += ','; -} - -extern "C" { static void SAL_CALL thisModule() {} } - -static oslGenericFunction GetMswordLibSymbol( const char *pSymbol ) -{ - static ::osl::Module aModule; - if ( aModule.is() || - aModule.loadRelative( &thisModule, - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "msword" ) ) ) ) ) - { - return aModule.getFunctionSymbol( ::rtl::OUString::createFromAscii( pSymbol ) ); - } - - return NULL; -} - -Reader* GetRTFReader() -{ - FnGetReader pFunction = reinterpret_cast<FnGetReader>( GetMswordLibSymbol( "ImportRTF" ) ); - - if ( pFunction ) - return (*pFunction)(); - - return NULL; -} - -void GetRTFWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) -{ - FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( GetMswordLibSymbol( "ExportRTF" ) ); - - if ( pFunction ) - (*pFunction)( rFltName, rBaseURL, xRet ); - else - xRet = WriterRef(0); -} - -Reader* GetWW8Reader() -{ - FnGetReader pFunction = reinterpret_cast<FnGetReader>( GetMswordLibSymbol( "ImportDOC" ) ); - - if ( pFunction ) - return (*pFunction)(); - - return NULL; -} - -void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) -{ - FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( GetMswordLibSymbol( "ExportDOC" ) ); - - if ( pFunction ) - (*pFunction)( rFltName, rBaseURL, xRet ); - else - xRet = WriterRef(0); -} - -typedef ULONG ( __LOADONCALLAPI *SaveOrDel )( SfxObjectShell&, SotStorage&, BOOL, const String& ); -typedef ULONG ( __LOADONCALLAPI *GetSaveWarning )( SfxObjectShell& ); - -ULONG SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, BOOL bSaveInto, const String& rStorageName ) -{ - SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) ); - if( pFunction ) - return pFunction( rDoc, rStor, bSaveInto, rStorageName ); - return ERRCODE_NONE; -} - -ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ) -{ - GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) ); - if( pFunction ) - return pFunction( rDocS ); - return ERRCODE_NONE; -} - - +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#define _SVSTDARR_STRINGS
+
+#include <string.h>
+#include <stdio.h> // sscanf
+#include <hintids.hxx>
+#include <i18npool/lang.h>
+#include <i18npool/mslangid.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/parhtml.hxx>
+#include <svl/svstdarr.hxx>
+#include <sot/storage.hxx>
+#include <sot/clsids.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/docfile.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <pam.hxx>
+#include <shellio.hxx>
+#include <errhdl.hxx>
+#include <docsh.hxx>
+#include <wdocsh.hxx>
+#include <fltini.hxx>
+#include <hints.hxx>
+#include <frmatr.hxx>
+#include <fmtfsize.hxx>
+#include <swtable.hxx>
+#include <fmtcntnt.hxx>
+#include <editeng/boxitem.hxx>
+#include <frmatr.hxx>
+#include <frmfmt.hxx>
+#include <numrule.hxx>
+#include <ndtxt.hxx>
+#include <swfltopt.hxx>
+#include <swerror.h>
+#include <osl/module.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <rtl/uri.hxx>
+#include <tools/svlibrary.hxx>
+
+using namespace utl;
+using rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star;
+
+SwRead ReadAscii = 0, /*ReadSwg = 0, ReadSw3 = 0,*/
+ ReadHTML = 0, ReadXML = 0;
+
+Reader* GetRTFReader();
+Reader* GetWW8Reader();
+
+// Note: if editing, please don't forget to modify also the enum
+// ReaderWriterEnum and aFilterDetect in shellio.hxx
+SwReaderWriterEntry aReaderWriter[] =
+{
+ SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, TRUE ),
+ SwReaderWriterEntry( 0, &::GetASCWriter, FALSE ),
+ SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, TRUE ),
+ 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, TRUE ),
+ SwReaderWriterEntry( 0, &::GetASCWriter, TRUE )
+};
+
+Reader* SwReaderWriterEntry::GetReader()
+{
+ if ( pReader )
+ return pReader;
+ else if ( fnGetReader )
+ {
+ pReader = (*fnGetReader)();
+ return pReader;
+ }
+ return NULL;
+}
+
+void SwReaderWriterEntry::GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const
+{
+ if ( fnGetWriter )
+ (*fnGetWriter)( rNm, rBaseURL, xWrt );
+ else
+ xWrt = WriterRef(0);
+}
+
+/*SwRead SwGetReaderSw3() // SW_DLLPUBLIC
+{
+ return ReadSw3;
+}
+*/
+SwRead SwGetReaderXML() // SW_DLLPUBLIC
+{
+ return ReadXML;
+}
+
+bool IsDocShellRegistered()
+{
+ return 0 != SwDocShell::_GetInterface();
+}
+
+inline void _SetFltPtr( USHORT rPos, SwRead pReader )
+{
+ aReaderWriter[ rPos ].pReader = pReader;
+}
+
+void _InitFilter()
+{
+ _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) );
+
+#ifdef NEW_WW97_EXPORT
+ aReaderWriter[ READER_WRITER_WW1 ].fnGetWriter = &::GetWW8Writer;
+ aReaderWriter[ READER_WRITER_WW5 ].fnGetWriter = &::GetWW8Writer;
+#endif
+
+ _SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii );
+ _SetFltPtr( READER_WRITER_TEXT, ReadAscii );
+}
+
+void _FinitFilter()
+{
+ // die Reader vernichten
+ for( USHORT n = 0; n < MAXFILTER; ++n )
+ {
+ SwReaderWriterEntry& rEntry = aReaderWriter[n];
+ if( rEntry.bDelReader && rEntry.pReader )
+ delete rEntry.pReader, rEntry.pReader = NULL;
+ }
+}
+
+
+/* */
+
+namespace SwReaderWriter {
+
+Reader* GetReader( ReaderWriterEnum eReader )
+{
+ return aReaderWriter[eReader].GetReader();
+}
+
+void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet )
+{
+ for( USHORT n = 0; n < MAXFILTER; ++n )
+ if( aFilterDetect[n].IsFilter( rFltName ) )
+ {
+ aReaderWriter[n].GetWriter( rFltName, rBaseURL, xRet );
+ break;
+ }
+}
+
+SwRead GetReader( const String& rFltName )
+{
+ SwRead pRead = 0;
+ for( USHORT n = 0; n < MAXFILTER; ++n )
+ if( aFilterDetect[n].IsFilter( rFltName ) )
+ {
+ pRead = aReaderWriter[n].GetReader();
+ // fuer einige Reader noch eine Sonderbehandlung:
+ if ( pRead )
+ pRead->SetFltName( rFltName );
+ break;
+ }
+ return pRead;
+}
+
+} // namespace SwReaderWriter
+
+/* */
+
+/////////////// die Storage Reader/Writer ////////////////////////////////
+
+/*void GetSw3Writer( const String&, const String& rBaseURL, WriterRef& xRet )
+{
+ DBG_ERROR( "Shouldn't happen!");
+ xRet = new Sw3Writer;
+}
+*/
+
+ULONG StgReader::OpenMainStream( SvStorageStreamRef& rRef, USHORT& rBuffSize )
+{
+ ULONG nRet = ERR_SWG_READ_ERROR;
+ ASSERT( pStg, "wo ist mein Storage?" );
+ const SfxFilter* pFltr = SwIoSystem::GetFilterOfFormat( aFltName );
+ if( pFltr )
+ {
+ rRef = pStg->OpenSotStream( SwIoSystem::GetSubStorageName( *pFltr ),
+ STREAM_READ | STREAM_SHARE_DENYALL );
+
+ if( rRef.Is() )
+ {
+ if( SVSTREAM_OK == rRef->GetError() )
+ {
+ USHORT nOld = rRef->GetBufferSize();
+ rRef->SetBufferSize( rBuffSize );
+ rBuffSize = nOld;
+ nRet = 0;
+ }
+ else
+ nRet = rRef->GetError();
+ }
+ }
+ return nRet;
+}
+
+/* */
+/*
+ULONG Sw3Reader::Read( SwDoc &rDoc, SwPaM &rPam, const String & )
+{
+ ULONG nRet;
+ if( pStg && pIO )
+ {
+ // TRUE: Vorlagen ueberschreiben
+ pIO->SetReadOptions( aOpt,TRUE );
+ if( !bInsertMode )
+ {
+ // Im Laden-Modus darf der PaM-Content-Teil nicht
+ // in den Textbereich zeigen (Nodes koennen geloescht werden)
+ rPam.GetBound( TRUE ).nContent.Assign( 0, 0 );
+ rPam.GetBound( FALSE ).nContent.Assign( 0, 0 );
+ }
+ nRet = pIO->Load( pStg, bInsertMode ? &rPam : 0 );
+ aOpt.ResetAllFmtsOnly();
+ pIO->SetReadOptions( aOpt, TRUE );
+ }
+ else
+ {
+ ASSERT( !this, "Sw3-Read ohne Storage und/oder IO-System" );
+ nRet = ERR_SWG_READ_ERROR;
+ }
+ return nRet;
+}
+
+ // read the sections of the document, which is equal to the medium.
+ // returns the count of it
+USHORT Sw3Reader::GetSectionList( SfxMedium& rMedium,
+ SvStrings& rStrings ) const
+{
+ SvStorageRef aStg( rMedium.GetStorage() );
+ const SfxFilter* pFlt = rMedium.GetFilter();
+ ASSERT( pFlt && pFlt->GetVersion(),
+ "Kein Filter oder Filter ohne FF-Version" );
+ if( pFlt && pFlt->GetVersion() )
+ aStg->SetVersion( (long)pFlt->GetVersion() );
+
+ if( pIO )
+ pIO->GetSectionList( &aStg, rStrings );
+ return rStrings.Count();
+ return 0;
+}
+*/
+
+/*ULONG Sw3Writer::WriteStorage()
+{
+ ULONG nRet;
+ if( pIO )
+ {
+ // der gleiche Storage -> Save, sonst SaveAs aufrufen
+ if( !bSaveAs )
+ nRet = pIO->Save( pOrigPam, bWriteAll );
+ else
+ nRet = pIO->SaveAs( pStg, pOrigPam, bWriteAll );
+
+ pIO = 0; // nach dem Schreiben ist der Pointer ungueltig !!
+ }
+ else
+ {
+ ASSERT( !this, "Sw3-Writer ohne IO-System" )
+ nRet = ERR_SWG_WRITE_ERROR;
+ }
+ return nRet;
+}
+
+ULONG Sw3Writer::WriteMedium( SfxMedium& )
+{
+ DBG_ERROR( "Shouldn't be used currently!");
+ return WriteStorage();
+}
+
+BOOL Sw3Writer::IsSw3Writer() const { return TRUE; }
+*/
+
+void Writer::SetPasswd( const String& ) {}
+
+
+void Writer::SetVersion( const String&, long ) {}
+
+
+BOOL Writer::IsStgWriter() const { return FALSE; }
+//BOOL Writer::IsSw3Writer() const { return FALSE; }
+
+BOOL StgWriter::IsStgWriter() const { return TRUE; }
+
+/* */
+
+
+
+BOOL SwReader::NeedsPasswd( const Reader& /*rOptions*/ )
+{
+ BOOL bRes = FALSE;
+ return bRes;
+}
+
+
+BOOL SwReader::CheckPasswd( const String& /*rPasswd*/, const Reader& /*rOptions*/ )
+{
+ return TRUE;
+}
+
+
+/* */
+
+//-----------------------------------------------------------------------
+// Filter Flags lesen, wird von WW8 / W4W / EXCEL / LOTUS benutzt.
+//-----------------------------------------------------------------------
+
+/*
+<FilterFlags>
+ <Excel_Lotus>
+ <MinRow cfg:type="long">0</MinRow>
+ <MaxRow cfg:type="long">0</MaxRow>
+ <MinCol cfg:type="long">0</MinCol>
+ <MaxCol cfg:type="long">0</MaxCol>
+ </Excel_Lotus>
+ <W4W>
+ <W4WHD cfg:type="long">0</W4WHD>
+ <W4WFT cfg:type="long">0</W4WFT>
+ <W4W000 cfg:type="long">0</W4W000>
+ </W4W>
+ <WinWord>
+ <WW1F cfg:type="long">0</WW1F>
+ <WW cfg:type="long">0</WW>
+ <WW8 cfg:type="long">0</WW8>
+ <WWF cfg:type="long">0</WWF>
+ <WWFA0 cfg:type="long">0</WWFA0>
+ <WWFA1 cfg:type="long">0</WWFA1>
+ <WWFA2 cfg:type="long">0</WWFA2>
+ <WWFB0 cfg:type="long">0</WWFB0>
+ <WWFB1 cfg:type="long">0</WWFB1>
+ <WWFB2 cfg:type="long">0</WWFB2>
+ <WWFLX cfg:type="long">0</WWFLX>
+ <WWFLY cfg:type="long">0</WWFLY>
+ <WWFT cfg:type="long">0</WWFT>
+ <WWWR cfg:type="long">0</WWWR>
+ </WinWord>
+ <Writer>
+ <SW3Imp cfg:type="long">0</SW3Imp>
+ </Writer>
+</FilterFlags>
+*/
+
+#define FILTER_OPTION_ROOT String::CreateFromAscii( \
+ RTL_CONSTASCII_STRINGPARAM( "Office.Writer/FilterFlags" ) )
+
+SwFilterOptions::SwFilterOptions( sal_uInt16 nCnt, const sal_Char** ppNames,
+ sal_uInt32* pValues )
+ : ConfigItem( FILTER_OPTION_ROOT )
+{
+ GetValues( nCnt, ppNames, pValues );
+}
+
+void SwFilterOptions::GetValues( sal_uInt16 nCnt, const sal_Char** ppNames,
+ sal_uInt32* pValues )
+{
+ Sequence<OUString> aNames( nCnt );
+ OUString* pNames = aNames.getArray();
+ USHORT n;
+
+ for( n = 0; n < nCnt; ++n )
+ pNames[ n ] = OUString::createFromAscii( ppNames[ n ] );
+ Sequence<Any> aValues = GetProperties( aNames );
+
+ if( nCnt == aValues.getLength() )
+ {
+ const Any* pAnyValues = aValues.getConstArray();
+ for( n = 0; n < nCnt; ++n )
+ pValues[ n ] = pAnyValues[ n ].hasValue()
+ ? *(sal_uInt32*)pAnyValues[ n ].getValue()
+ : 0;
+ }
+ else
+ for( n = 0; n < nCnt; ++n )
+ pValues[ n ] = 0;
+}
+
+void SwFilterOptions::Commit() {}
+void SwFilterOptions::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+/* */
+
+
+void StgReader::SetFltName( const String& rFltNm )
+{
+ if( SW_STORAGE_READER & GetReaderType() )
+ aFltName = rFltNm;
+}
+
+
+/* */
+
+SwRelNumRuleSpaces::SwRelNumRuleSpaces( SwDoc& rDoc, BOOL bNDoc )
+ : bNewDoc( bNDoc )
+{
+ pNumRuleTbl = new SwNumRuleTbl( 8, 8 );
+ if( !bNDoc )
+ pNumRuleTbl->Insert( &rDoc.GetNumRuleTbl(), 0 );
+}
+
+SwRelNumRuleSpaces::~SwRelNumRuleSpaces()
+{
+ if( pNumRuleTbl )
+ {
+ pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() );
+ delete pNumRuleTbl;
+ }
+}
+
+void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc )
+{
+ const SwNumRuleTbl* pRuleTbl = NULL;
+
+ if( !bNewDoc )
+ {
+ // jetzt alle schon vorhanden NumRules aus dem Array entfernen,
+ // damit nur die neuen angepasst werden
+ SwNumRuleTbl aNumRuleTbl;
+ aNumRuleTbl.Insert( pNumRuleTbl, 0 );
+ pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() );
+ const SwNumRuleTbl& rRuleTbl = rDoc.GetNumRuleTbl();
+ SwNumRule* pRule;
+
+ for( USHORT n = 0; n < rRuleTbl.Count(); ++n )
+ if( USHRT_MAX == aNumRuleTbl.GetPos( ( pRule = rRuleTbl[ n ] )))
+ // war noch nicht vorhanden, also neu
+ pNumRuleTbl->Insert( pRule, pNumRuleTbl->Count() );
+
+ aNumRuleTbl.Remove( 0, aNumRuleTbl.Count() );
+
+ pRuleTbl = pNumRuleTbl;
+ }
+ else
+ {
+ pRuleTbl = &rDoc.GetNumRuleTbl();
+ }
+
+ if( pRuleTbl )
+ {
+ for( USHORT n = pRuleTbl->Count(); n; )
+ {
+ SwNumRule* pRule = (*pRuleTbl)[ --n ];
+ // Rule noch gueltig und am Doc vorhanden?
+ if( USHRT_MAX != rDoc.GetNumRuleTbl().GetPos( pRule ))
+ {
+ // --> OD 2008-02-19 #refactorlists#
+// SwNumRuleInfo aUpd( pRule->GetName() );
+// aUpd.MakeList( rDoc );
+
+// // bei allen nmumerierten Absaetzen vom linken Rand
+// // den absoluten Wert des NumFormates abziehen
+// for( ULONG nUpdPos = 0; nUpdPos < aUpd.GetList().Count();
+// ++nUpdPos )
+// {
+// SwTxtNode* pNd = aUpd.GetList().GetObject( nUpdPos );
+// SetNumLSpace( *pNd, *pRule );
+// }
+ SwNumRule::tTxtNodeList aTxtNodeList;
+ pRule->GetTxtNodeList( aTxtNodeList );
+ for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
+ aIter != aTxtNodeList.end(); ++aIter )
+ {
+ SwTxtNode* pNd = *aIter;
+ SetNumLSpace( *pNd, *pRule );
+ }
+ // <--
+ }
+ }
+ }
+
+ if( pNumRuleTbl )
+ {
+ pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() );
+ delete pNumRuleTbl, pNumRuleTbl = 0;
+ }
+
+ if( bNewDoc )
+ {
+ SetOultineRelSpaces( SwNodeIndex( rDoc.GetNodes() ),
+ SwNodeIndex( rDoc.GetNodes().GetEndOfContent()));
+ }
+}
+
+void SwRelNumRuleSpaces::SetOultineRelSpaces( const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd )
+{
+ SwDoc* pDoc = rStt.GetNode().GetDoc();
+ const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+ if( rOutlNds.Count() )
+ {
+ USHORT nPos;
+ rOutlNds.Seek_Entry( &rStt.GetNode(), &nPos );
+ for( ; nPos < rOutlNds.Count() &&
+ rOutlNds[ nPos ]->GetIndex() < rEnd.GetIndex(); ++nPos )
+ {
+ SwTxtNode* pNd = rOutlNds[ nPos ]->GetTxtNode();
+ if( pNd->IsOutline() && !pNd->GetNumRule() )
+ SetNumLSpace( *pNd, *pDoc->GetOutlineNumRule() );
+ }
+ }
+}
+
+void SwRelNumRuleSpaces::SetNumLSpace( SwTxtNode& rNd, const SwNumRule& rRule )
+{
+ BOOL bOutlineRule = OUTLINE_RULE == rRule.GetRuleType();
+ // --> OD 2005-11-18 #128056#
+ // correction of refactoring done by cws swnumtree:
+ // - assure a correct level for retrieving numbering format.
+// BYTE nLvl = rNd.GetLevel();
+ BYTE nLvl = 0;
+ if ( rNd.GetActualListLevel() >= 0 && rNd.GetActualListLevel() < MAXLEVEL )
+ {
+ nLvl = static_cast< BYTE >(rNd.GetActualListLevel());
+ }
+ // <--
+ const SwNumFmt& rFmt = rRule.Get( nLvl );
+ const SvxLRSpaceItem& rLR = rNd.GetSwAttrSet().GetLRSpace();
+
+ SvxLRSpaceItem aLR( rLR );
+ aLR.SetTxtFirstLineOfst( 0 );
+
+ // sagt der Node, das die Numerierung den Wert vorgibt?
+ if( !bOutlineRule && rNd.IsSetNumLSpace() )
+ aLR.SetTxtLeft( 0 );
+ else
+ {
+ long nLeft = rFmt.GetAbsLSpace(), nParaLeft = rLR.GetTxtLeft();
+ if( 0 < rLR.GetTxtFirstLineOfst() )
+ nParaLeft += rLR.GetTxtFirstLineOfst();
+ else if( nParaLeft >= nLeft )
+ // #82963#/#82962#: set correct paragraph indent
+ nParaLeft -= nLeft;
+ else
+ //#83154#, Don't think any of the older #80856# bugfix code is
+ //relevent anymore.
+ nParaLeft = rLR.GetTxtLeft()+rLR.GetTxtFirstLineOfst();
+ aLR.SetTxtLeft( nParaLeft );
+ }
+
+ if( aLR.GetTxtLeft() != rLR.GetTxtLeft() )
+ {
+ //bevor rLR geloescht wird!
+ long nOffset = rLR.GetTxtLeft() - aLR.GetTxtLeft();
+ rNd.SetAttr( aLR );
+
+ // Tabs anpassen !!
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rNd.GetSwAttrSet().GetItemState(
+ RES_PARATR_TABSTOP, TRUE, &pItem ))
+ {
+ SvxTabStopItem aTStop( *(SvxTabStopItem*)pItem );
+ for( USHORT n = 0; n < aTStop.Count(); ++n )
+ {
+ SvxTabStop& rTab = (SvxTabStop&)aTStop[ n ];
+ if( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() )
+ {
+ if( !rTab.GetTabPos() )
+ {
+ aTStop.Remove( n );
+ --n;
+ }
+ else
+ rTab.GetTabPos() += nOffset;
+ }
+ }
+ rNd.SetAttr( aTStop );
+ }
+ }
+}
+
+/* */
+
+
+void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
+ SwTwips nPageWidth)
+{
+ const SfxPoolItem* pItem = 0;
+ if( SFX_ITEM_SET != rFlySet.GetItemState( RES_FRM_SIZE, TRUE, &pItem ) ||
+ MINFLY > ((SwFmtFrmSize*)pItem)->GetWidth() )
+ {
+ SwFmtFrmSize aSz((SwFmtFrmSize&)rFlySet.Get(RES_FRM_SIZE, TRUE));
+ if (pItem)
+ aSz = (SwFmtFrmSize&)(*pItem);
+
+ SwTwips nWidth;
+ // dann die Breite des Flys selbst bestimmen. Ist eine Tabelle
+ // defininiert, dann benutze deren Breite, sonst die Breite der
+ // Seite
+ const SwTableNode* pTblNd = rAnchor.GetNode().FindTableNode();
+ if( pTblNd )
+ nWidth = pTblNd->GetTable().GetFrmFmt()->GetFrmSize().GetWidth();
+ else
+ nWidth = nPageWidth;
+
+ const SwNodeIndex* pSttNd = ((SwFmtCntnt&)rFlySet.Get( RES_CNTNT )).
+ GetCntntIdx();
+ if( pSttNd )
+ {
+ BOOL bOnlyOneNode = TRUE;
+ ULONG nMinFrm = 0;
+ ULONG nMaxFrm = 0;
+ SwTxtNode* pFirstTxtNd = 0;
+ SwNodeIndex aIdx( *pSttNd, 1 );
+ SwNodeIndex aEnd( *pSttNd->GetNode().EndOfSectionNode() );
+ while( aIdx < aEnd )
+ {
+ SwTxtNode *pTxtNd = aIdx.GetNode().GetTxtNode();
+ if( pTxtNd )
+ {
+ if( !pFirstTxtNd )
+ pFirstTxtNd = pTxtNd;
+ else if( pFirstTxtNd != pTxtNd )
+ {
+ // forget it
+ bOnlyOneNode = FALSE;
+ break;
+ }
+
+ ULONG nAbsMinCnts;
+ pTxtNd->GetMinMaxSize( aIdx.GetIndex(), nMinFrm,
+ nMaxFrm, nAbsMinCnts );
+ }
+ aIdx++;
+ }
+
+ if( bOnlyOneNode )
+ {
+ if( nMinFrm < MINLAY && pFirstTxtNd )
+ {
+ // if the first node dont contained any content, then
+ // insert one char in it calc again and delete once again
+ SwIndex aNdIdx( pFirstTxtNd );
+ pFirstTxtNd->InsertText( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "MM" )), aNdIdx );
+ ULONG nAbsMinCnts;
+ pFirstTxtNd->GetMinMaxSize( pFirstTxtNd->GetIndex(),
+ nMinFrm, nMaxFrm, nAbsMinCnts );
+ aNdIdx -= 2;
+ pFirstTxtNd->EraseText( aNdIdx, 2 );
+ }
+
+ // Umrandung und Abstand zum Inhalt beachten
+ const SvxBoxItem& rBoxItem = (SvxBoxItem&)rFlySet.Get( RES_BOX );
+ USHORT nLine = BOX_LINE_LEFT;
+ for( int i = 0; i < 2; ++i )
+ {
+ const SvxBorderLine* pLn = rBoxItem.GetLine( nLine );
+ if( pLn )
+ {
+ USHORT nWidthTmp = pLn->GetOutWidth() + pLn->GetInWidth();
+ nWidthTmp = nWidthTmp + rBoxItem.GetDistance( nLine );
+ nMinFrm += nWidthTmp;
+ nMaxFrm += nWidthTmp;
+ }
+ nLine = BOX_LINE_RIGHT;
+ }
+
+ // Mindestbreite fuer Inhalt einhalten
+ if( nMinFrm < MINLAY )
+ nMinFrm = MINLAY;
+ if( nMaxFrm < MINLAY )
+ nMaxFrm = MINLAY;
+
+ if( nWidth > (USHORT)nMaxFrm )
+ nWidth = nMaxFrm;
+ else if( nWidth > (USHORT)nMinFrm )
+ nWidth = nMinFrm;
+ }
+ }
+
+ if( MINFLY > nWidth )
+ nWidth = MINFLY;
+
+ aSz.SetWidth( nWidth );
+ if( MINFLY > aSz.GetHeight() )
+ aSz.SetHeight( MINFLY );
+ rFlySet.Put( aSz );
+ }
+ else if( MINFLY > ((SwFmtFrmSize*)pItem)->GetHeight() )
+ {
+ SwFmtFrmSize aSz( *(SwFmtFrmSize*)pItem );
+ aSz.SetHeight( MINFLY );
+ rFlySet.Put( aSz );
+ }
+}
+
+/* */
+struct CharSetNameMap
+{
+ rtl_TextEncoding eCode;
+ const sal_Char* pName;
+};
+
+const CharSetNameMap *GetCharSetNameMap()
+{
+ static const CharSetNameMap aMapArr[] =
+ {
+# define IMPLENTRY(X) { RTL_TEXTENCODING_##X, "" #X "" }
+ IMPLENTRY(DONTKNOW),
+ IMPLENTRY(MS_1252),
+ IMPLENTRY(APPLE_ROMAN),
+ IMPLENTRY(IBM_437),
+ IMPLENTRY(IBM_850),
+ IMPLENTRY(IBM_860),
+ IMPLENTRY(IBM_861),
+ IMPLENTRY(IBM_863),
+ IMPLENTRY(IBM_865),
+ IMPLENTRY(SYMBOL),
+ IMPLENTRY(ASCII_US),
+ IMPLENTRY(ISO_8859_1),
+ IMPLENTRY(ISO_8859_2),
+ IMPLENTRY(ISO_8859_3),
+ IMPLENTRY(ISO_8859_4),
+ IMPLENTRY(ISO_8859_5),
+ IMPLENTRY(ISO_8859_6),
+ IMPLENTRY(ISO_8859_7),
+ IMPLENTRY(ISO_8859_8),
+ IMPLENTRY(ISO_8859_9),
+ IMPLENTRY(ISO_8859_14),
+ IMPLENTRY(ISO_8859_15),
+ IMPLENTRY(IBM_737),
+ IMPLENTRY(IBM_775),
+ IMPLENTRY(IBM_852),
+ IMPLENTRY(IBM_855),
+ IMPLENTRY(IBM_857),
+ IMPLENTRY(IBM_862),
+ IMPLENTRY(IBM_864),
+ IMPLENTRY(IBM_866),
+ IMPLENTRY(IBM_869),
+ IMPLENTRY(MS_874),
+ IMPLENTRY(MS_1250),
+ IMPLENTRY(MS_1251),
+ IMPLENTRY(MS_1253),
+ IMPLENTRY(MS_1254),
+ IMPLENTRY(MS_1255),
+ IMPLENTRY(MS_1256),
+ IMPLENTRY(MS_1257),
+ IMPLENTRY(MS_1258),
+ IMPLENTRY(APPLE_ARABIC),
+ IMPLENTRY(APPLE_CENTEURO),
+ IMPLENTRY(APPLE_CROATIAN),
+ IMPLENTRY(APPLE_CYRILLIC),
+ IMPLENTRY(APPLE_DEVANAGARI),
+ IMPLENTRY(APPLE_FARSI),
+ IMPLENTRY(APPLE_GREEK),
+ IMPLENTRY(APPLE_GUJARATI),
+ IMPLENTRY(APPLE_GURMUKHI),
+ IMPLENTRY(APPLE_HEBREW),
+ IMPLENTRY(APPLE_ICELAND),
+ IMPLENTRY(APPLE_ROMANIAN),
+ IMPLENTRY(APPLE_THAI),
+ IMPLENTRY(APPLE_TURKISH),
+ IMPLENTRY(APPLE_UKRAINIAN),
+ IMPLENTRY(APPLE_CHINSIMP),
+ IMPLENTRY(APPLE_CHINTRAD),
+ IMPLENTRY(APPLE_JAPANESE),
+ IMPLENTRY(APPLE_KOREAN),
+ IMPLENTRY(MS_932),
+ IMPLENTRY(MS_936),
+ IMPLENTRY(MS_949),
+ IMPLENTRY(MS_950),
+ IMPLENTRY(SHIFT_JIS),
+ IMPLENTRY(GB_2312),
+ IMPLENTRY(GBT_12345),
+ IMPLENTRY(GBK),
+ IMPLENTRY(BIG5),
+ IMPLENTRY(EUC_JP),
+ IMPLENTRY(EUC_CN),
+ IMPLENTRY(EUC_TW),
+ IMPLENTRY(ISO_2022_JP),
+ IMPLENTRY(ISO_2022_CN),
+ IMPLENTRY(KOI8_R),
+ IMPLENTRY(KOI8_U),
+ IMPLENTRY(UTF7),
+ IMPLENTRY(UTF8),
+ IMPLENTRY(ISO_8859_10),
+ IMPLENTRY(ISO_8859_13),
+ IMPLENTRY(EUC_KR),
+ IMPLENTRY(ISO_2022_KR),
+ IMPLENTRY(JIS_X_0201),
+ IMPLENTRY(JIS_X_0208),
+ IMPLENTRY(JIS_X_0212),
+ IMPLENTRY(MS_1361),
+ IMPLENTRY(GB_18030),
+ IMPLENTRY(BIG5_HKSCS),
+ IMPLENTRY(TIS_620),
+ IMPLENTRY(PT154),
+ IMPLENTRY(UCS4),
+ IMPLENTRY(UCS2),
+ IMPLENTRY(UNICODE),
+ {0,0} //Last
+ };
+ return &aMapArr[0];
+}
+/*
+ Get a rtl_TextEncoding from its name
+ */
+rtl_TextEncoding CharSetFromName(const String& rChrSetStr)
+{
+ const CharSetNameMap *pStart = GetCharSetNameMap();
+ rtl_TextEncoding nRet = pStart->eCode;
+
+ for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
+ {
+ if(rChrSetStr.EqualsIgnoreCaseAscii(pMap->pName))
+ {
+ nRet = pMap->eCode;
+ break;
+ }
+ }
+
+ ASSERT(nRet != pStart->eCode, "TXT: That was an unknown language!");
+
+ return nRet;
+}
+
+
+/*
+ Get the String name of an rtl_TextEncoding
+ */
+String NameFromCharSet(rtl_TextEncoding nChrSet)
+{
+ const CharSetNameMap *pStart = GetCharSetNameMap();
+ const char *pRet = pStart->pName;
+
+ for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap)
+ {
+ if (nChrSet == pMap->eCode)
+ {
+ pRet = pMap->pName;
+ break;
+ }
+ }
+
+ ASSERT(pRet != pStart->pName, "TXT: That was an unknown language!");
+
+ return String::CreateFromAscii(pRet);
+}
+
+// for the automatic conversion (mail/news/...)
+// The user data contains the options for the ascii import/export filter.
+// The format is:
+// 1. CharSet - as ascii chars
+// 2. LineEnd - as CR/LR/CRLF
+// 3. Fontname
+// 4. Language
+// the delimetercharacter is ","
+//
+
+void SwAsciiOptions::ReadUserData( const String& rStr )
+{
+ xub_StrLen nToken = 0;
+ USHORT nCnt = 0;
+ String sToken;
+ do {
+ if( 0 != (sToken = rStr.GetToken( 0, ',', nToken )).Len() )
+ {
+ switch( nCnt )
+ {
+ case 0: // CharSet
+ eCharSet = CharSetFromName(sToken);
+ break;
+ case 1: // LineEnd
+ if( sToken.EqualsIgnoreCaseAscii( "CRLF" ))
+ eCRLF_Flag = LINEEND_CRLF;
+ else if( sToken.EqualsIgnoreCaseAscii( "LF" ))
+ eCRLF_Flag = LINEEND_LF;
+ else
+ eCRLF_Flag = LINEEND_CR;
+ break;
+ case 2: // fontname
+ sFont = sToken;
+ break;
+ case 3: // Language
+ nLanguage = MsLangId::convertIsoStringToLanguage( sToken );
+ break;
+ }
+ }
+ ++nCnt;
+ } while( STRING_NOTFOUND != nToken );
+}
+
+void SwAsciiOptions::WriteUserData( String& rStr )
+{
+ // 1. charset
+ rStr = NameFromCharSet(eCharSet);
+ rStr += ',';
+
+ // 2. LineEnd
+ switch(eCRLF_Flag)
+ {
+ case LINEEND_CRLF:
+ rStr.AppendAscii( "CRLF" );
+ break;
+ case LINEEND_CR:
+ rStr.AppendAscii( "CR" );
+ break;
+ case LINEEND_LF:
+ rStr.AppendAscii( "LF" );
+ break;
+ }
+ rStr += ',';
+
+ // 3. Fontname
+ rStr += sFont;
+ rStr += ',';
+
+ // 4. Language
+ if (nLanguage)
+ {
+ rtl::OUString sTmp = MsLangId::convertLanguageToIsoString( nLanguage );
+ rStr += (String)sTmp;
+ }
+ rStr += ',';
+}
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+static oslGenericFunction GetMswordLibSymbol( const char *pSymbol )
+{
+ static ::osl::Module aModule;
+ static sal_Bool bLoaded = sal_False;
+ static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "msword" ) ) );
+ if (!bLoaded)
+ bLoaded = SvLibrary::LoadModule( aModule, aLibName, &thisModule );
+ if (bLoaded)
+ return aModule.getFunctionSymbol( ::rtl::OUString::createFromAscii( pSymbol ) );
+ return NULL;
+}
+
+Reader* GetRTFReader()
+{
+ FnGetReader pFunction = reinterpret_cast<FnGetReader>( GetMswordLibSymbol( "ImportRTF" ) );
+
+ if ( pFunction )
+ return (*pFunction)();
+
+ return NULL;
+}
+
+void GetRTFWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet )
+{
+ FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( GetMswordLibSymbol( "ExportRTF" ) );
+
+ if ( pFunction )
+ (*pFunction)( rFltName, rBaseURL, xRet );
+ else
+ xRet = WriterRef(0);
+}
+
+Reader* GetWW8Reader()
+{
+ FnGetReader pFunction = reinterpret_cast<FnGetReader>( GetMswordLibSymbol( "ImportDOC" ) );
+
+ if ( pFunction )
+ return (*pFunction)();
+
+ return NULL;
+}
+
+void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xRet )
+{
+ FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( GetMswordLibSymbol( "ExportDOC" ) );
+
+ if ( pFunction )
+ (*pFunction)( rFltName, rBaseURL, xRet );
+ else
+ xRet = WriterRef(0);
+}
+
+typedef ULONG ( __LOADONCALLAPI *SaveOrDel )( SfxObjectShell&, SotStorage&, BOOL, const String& );
+typedef ULONG ( __LOADONCALLAPI *GetSaveWarning )( SfxObjectShell& );
+
+ULONG SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, BOOL bSaveInto, const String& rStorageName )
+{
+ SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) );
+ if( pFunction )
+ return pFunction( rDoc, rStor, bSaveInto, rStorageName );
+ return ERRCODE_NONE;
+}
+
+ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS )
+{
+ GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) );
+ if( pFunction )
+ return pFunction( rDocS );
+ return ERRCODE_NONE;
+}
+
+
diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index 507c83c2a204..17050299c84b 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -3776,11 +3776,7 @@ static Writer& OutRTF_SwFmtBox( Writer& rWrt, const SfxPoolItem& rHt ) static USHORT __READONLY_DATA aBorders[] = { BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; -#ifdef __MINGW32__ // for runtime pseudo reloc - static const sal_Char* aBorderNames[] = { -#else static const sal_Char* __READONLY_DATA aBorderNames[] = { -#endif OOO_STRING_SVTOOLS_RTF_BRDRT, OOO_STRING_SVTOOLS_RTF_BRDRL, OOO_STRING_SVTOOLS_RTF_BRDRB, OOO_STRING_SVTOOLS_RTF_BRDRR }; USHORT nDist = rBox.GetDistance(); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 253957dac35b..e22ca1c9b731 100755..100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -257,11 +257,28 @@ static void WriteDop( WW8Export& rWrt ) SwDocShell *pDocShell(rWrt.pDoc->GetDocShell()); DBG_ASSERT(pDocShell, "no SwDocShell"); uno::Reference<document::XDocumentProperties> xDocProps; + uno::Reference<beans::XPropertySet> xProps; if (pDocShell) { + uno::Reference<lang::XComponent> xModelComp(pDocShell->GetModel(), + uno::UNO_QUERY); + xProps = uno::Reference<beans::XPropertySet>(xModelComp, + uno::UNO_QUERY); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - pDocShell->GetModel(), uno::UNO_QUERY_THROW); + xModelComp, uno::UNO_QUERY_THROW); xDocProps = xDPS->getDocumentProperties(); DBG_ASSERT(xDocProps.is(), "DocumentProperties is null"); + + rDop.lKeyProtDoc = pDocShell->GetModifyPasswordHash(); + } + + if ((rWrt.pSepx && rWrt.pSepx->DocumentIsProtected()) || + rDop.lKeyProtDoc != 0) + { + rDop.fProtEnabled = 1; + } + else + { + rDop.fProtEnabled = 0; } if (!xDocProps.is()) { @@ -279,9 +296,8 @@ static void WriteDop( WW8Export& rWrt ) Date aD3(uDT.Day, uDT.Month, uDT.Year); Time aT3(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.HundredthSeconds); rDop.dttmLastPrint = sw::ms::DateTime2DTTM(DateTime(aD3,aT3)); - } - rDop.fProtEnabled = rWrt.pSepx ? rWrt.pSepx->DocumentIsProtected() : 0; + } // auch damit werden die DocStat-Felder in Kopf-/Fusszeilen nicht korrekt // berechnet. @@ -2456,7 +2472,7 @@ typedef ::std::deque<SwNode *> SwNodeDeque; void MSWordExportBase::WriteText() { // whoever has need of the missing function should go and implement it! -// This damned piece of code always breaks builds... +// This piece of code always breaks builds... //#ifdef DEBUG // ::std::clog << "<WriteText>" << ::std::endl; // ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl; @@ -2472,7 +2488,7 @@ void MSWordExportBase::WriteText() SwNode * pNd = pCurPam->GetNode(); // whoever has need of the missing function should go and implement it! -// This damned piece of code always breaks builds... +// This piece of code always breaks builds... #if 0 #ifdef DEBUG if (aNodeSet.find(pNd) == aNodeSet.end()) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 983bc9c73c77..ba932c33c479 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1420,14 +1420,19 @@ void SwWW8ImplReader::ImportDop() uno::Reference<beans::XPropertySetInfo> xInfo = xDocProps->getPropertySetInfo(); sal_Bool bValue = false; - if (xInfo.is() && - xInfo->hasPropertyByName(C2U("ApplyFormDesignMode"))) + if (xInfo.is()) { - xDocProps->setPropertyValue(C2U("ApplyFormDesignMode"), - cppu::bool2any(bValue)); + if (xInfo->hasPropertyByName(C2U("ApplyFormDesignMode"))) + { + xDocProps->setPropertyValue(C2U("ApplyFormDesignMode"), + cppu::bool2any(bValue)); + } } } } + + mpDocShell->SetModifyPasswordHash(pWDop->lKeyProtDoc); + const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); if (bUseEnhFields) { @@ -1852,7 +1857,7 @@ void SwWW8ImplReader::Read_HdFt(bool bIsTitle, int nSect, bool wwSectionManager::SectionIsProtected(const wwSection &rSection) const { - return (mrReader.pWDop->fProtEnabled && !rSection.IsNotProtected()); + return (!rSection.IsNotProtected()); } void wwSectionManager::SetHdFt(wwSection &rSection, int nSect, diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index c3f6585e325e..3c14ed6c46f0 100644..100755 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -39,6 +39,7 @@ #include <svl/zforlist.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> +#include <svl/PasswordHelper.hxx> #include <editeng/adjitem.hxx> #include <basic/sbx.hxx> #include <unotools/moduleoptions.hxx> @@ -1367,3 +1368,79 @@ const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const { return pDoc ? &pDoc->GetXmlIdRegistry() : 0; } + + +bool SwDocShell::IsChangeRecording() const +{ + return (pWrtShell->GetRedlineMode() & nsRedlineMode_t::REDLINE_ON) != 0; +} + + +bool SwDocShell::HasChangeRecordProtection() const +{ + return pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength() > 0; +} + + +void SwDocShell::SetChangeRecording( bool bActivate ) +{ + USHORT nOn = bActivate ? nsRedlineMode_t::REDLINE_ON : 0; + USHORT nMode = pWrtShell->GetRedlineMode(); + pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); +} + + +bool SwDocShell::SetProtectionPassword( const String &rNewPassword ) +{ + const SfxAllItemSet aSet( GetPool() ); + const SfxItemSet* pArgs = &aSet; + const SfxPoolItem* pItem = NULL; + + IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); + Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword(); + if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, FALSE, &pItem ) + && ((SfxBoolItem*)pItem)->GetValue() == aPasswd.getLength() > 0) + return false; + + bool bRes = false; + + if (rNewPassword.Len()) + { + // when password protection is applied change tracking must always be active + SetChangeRecording( true ); + + Sequence< sal_Int8 > aNewPasswd; + SvPasswordHelper::GetHashPassword( aNewPasswd, rNewPassword ); + pIDRA->SetRedlinePassword( aNewPasswd ); + bRes = true; + } + else + { + pIDRA->SetRedlinePassword( Sequence< sal_Int8 >() ); + bRes = true; + } + + return bRes; +} + + +bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ) +{ + bool bRes = false; + + const SfxAllItemSet aSet( GetPool() ); + const SfxItemSet* pArgs = &aSet; + const SfxPoolItem* pItem = NULL; + + IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); + Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() ); + if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, FALSE, &pItem ) + && ((SfxBoolItem*)pItem)->GetValue() == (aPasswdHash.getLength() != 0)) + return false; + rPasswordHash = aPasswdHash; + bRes = true; + + return bRes; +} + + diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx index 4bf8238ade61..3f1c4665c6e3 100644 --- a/sw/source/ui/app/swmodule.cxx +++ b/sw/source/ui/app/swmodule.cxx @@ -207,7 +207,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, pView(0), bAuthorInitialised(sal_False), bEmbeddedLoadSave( sal_False ), - pClipboard( 0 ), pDragDrop( 0 ), pXSelection( 0 ) { diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 704172b21074..8220c7ee2c8d 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -300,9 +300,7 @@ SwTransferable::~SwTransferable() SwModule* pMod = SW_MOD(); if(pMod) { - if ( pMod->pClipboard == this ) - pMod->pClipboard = 0; - else if ( pMod->pDragDrop == this ) + if ( pMod->pDragDrop == this ) pMod->pDragDrop = 0; else if ( pMod->pXSelection == this ) pMod->pXSelection = 0; @@ -338,9 +336,7 @@ static SwDoc * lcl_GetDoc(SwDocFac & rDocFac) void SwTransferable::ObjectReleased() { SwModule *pMod = SW_MOD(); - if( this == pMod->pClipboard ) - pMod->pClipboard = 0; - else if( this == pMod->pDragDrop ) + if( this == pMod->pDragDrop ) pMod->pDragDrop = 0; else if( this == pMod->pXSelection ) pMod->pXSelection = 0; @@ -1013,7 +1009,6 @@ int SwTransferable::Copy( BOOL bIsCut ) int nRet = PrepareForCopy( bIsCut ); if ( nRet ) { - SW_MOD()->pClipboard = this; CopyToClipboard( &pWrtShell->GetView().GetEditWin() ); } return nRet; @@ -1035,7 +1030,6 @@ int SwTransferable::CalculateAndCopy() eBufferType = TRNSFR_DOCUMENT; AddFormat( FORMAT_STRING ); - SW_MOD()->pClipboard = this; CopyToClipboard( &pWrtShell->GetView().GetEditWin() ); return 1; @@ -1086,7 +1080,6 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, PrepareOLE( aObjDesc ); AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); - SW_MOD()->pClipboard = this; CopyToClipboard( &pWrtShell->GetView().GetEditWin() ); return 1; @@ -1104,20 +1097,14 @@ BOOL SwTransferable::IsPaste( const SwWrtShell& rSh, // Check the common case first: We can always paste our own data! // #106503#: If _only_ the internal format can be pasted, this check will // yield 'true', while the one below would give a (wrong) result 'false'. - bool bIsPaste = ( SW_MOD()->pClipboard != NULL ); + + bool bIsPaste = ( GetSwTransferable( rData ) != NULL ); // if it's not our own data, we need to have a closer look: if( ! bIsPaste ) { // determine the proper paste action, and return true if we find one uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() ); - uno::Reference<XUnoTunnel> xTunnel( xTransferable, UNO_QUERY ); - if ( xTunnel.is() ) - { - sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); - if ( nHandle ) - return TRUE; - } USHORT nDestination = SwTransferable::GetSotDestination( rSh ); USHORT nSourceOptions = @@ -1153,36 +1140,27 @@ int SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData ) nDestination = SwTransferable::GetSotDestination( rSh ); ULONG nFormat = 0; - if( SW_MOD()->pClipboard ) + if( GetSwTransferable( rData ) ) + { nAction = EXCHG_OUT_ACTION_INSERT_PRIVATE; + } else { - uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); - if ( xTunnel.is() ) - { - sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); - if ( nHandle ) - nAction = EXCHG_OUT_ACTION_INSERT_PRIVATE; - } - - if ( !nAction ) - { - USHORT nSourceOptions = - (( EXCHG_DEST_DOC_TEXTFRAME == nDestination || - EXCHG_DEST_SWDOC_FREE_AREA == nDestination || - EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination || - EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination ) - ? EXCHG_IN_ACTION_COPY - : EXCHG_IN_ACTION_MOVE); - uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() ); - nAction = SotExchange::GetExchangeAction( - rData.GetDataFlavorExVector(), - nDestination, - nSourceOptions, /* ?? */ - EXCHG_IN_ACTION_DEFAULT, /* ?? */ - nFormat, nEventAction, 0, - lcl_getTransferPointer ( xTransferable ) ); - } + USHORT nSourceOptions = + (( EXCHG_DEST_DOC_TEXTFRAME == nDestination || + EXCHG_DEST_SWDOC_FREE_AREA == nDestination || + EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination || + EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination ) + ? EXCHG_IN_ACTION_COPY + : EXCHG_IN_ACTION_MOVE); + uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() ); + nAction = SotExchange::GetExchangeAction( + rData.GetDataFlavorExVector(), + nDestination, + nSourceOptions, /* ?? */ + EXCHG_IN_ACTION_DEFAULT, /* ?? */ + nFormat, nEventAction, 0, + lcl_getTransferPointer ( xTransferable ) ); } // special case for tables from draw application @@ -1245,7 +1223,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, } } } - else if( ( !pMod->pClipboard || bIsPasteFmt ) && + else if( ( !GetSwTransferable( rData ) || bIsPasteFmt ) && !rSh.IsTableMode() && rSh.HasSelection() ) { // dann die Selektionen loeschen @@ -1273,14 +1251,14 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, // <-- } - SwTransferable *pTrans=0, *pTunneledTrans=0; - uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); - if ( xTunnel.is() ) - { - sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); - if ( nHandle ) - pTunneledTrans = (SwTransferable*) (sal_IntPtr) nHandle; - } + SwTransferable *pTrans=0, *pTunneledTrans=GetSwTransferable( rData ); +// uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); +// if ( xTunnel.is() ) +// { +// sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); +// if ( nHandle ) +// pTunneledTrans = (SwTransferable*) (sal_IntPtr) nHandle; +// } if( pPt && ( bPasteSelection ? 0 != ( pTrans = pMod->pXSelection ) : 0 != ( pTrans = pMod->pDragDrop) )) @@ -1289,7 +1267,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, nRet = pTrans->PrivateDrop( rSh, *pPt, DND_ACTION_MOVE == nDropAction, bPasteSelection ); } - else if( !pPt && ( pTunneledTrans || 0 != ( pTunneledTrans = pMod->pClipboard ) ) && + else if( !pPt && pTunneledTrans && EXCHG_OUT_ACTION_INSERT_PRIVATE == nAction ) { // then internal paste @@ -2816,7 +2794,7 @@ int SwTransferable::PasteFormat( SwWrtShell& rSh, int nRet = 0; ULONG nPrivateFmt = FORMAT_PRIVATE; - SwTransferable *pClipboard = SW_MOD()->pClipboard; + SwTransferable *pClipboard = GetSwTransferable( rData ); if( pClipboard && ((TRNSFR_DOCUMENT|TRNSFR_GRAPHIC|TRNSFR_OLE) & pClipboard->eBufferType )) nPrivateFmt = SOT_FORMATSTR_ID_EMBED_SOURCE; @@ -2912,7 +2890,7 @@ int SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rData USHORT nDest = SwTransferable::GetSotDestination( rSh ); - SwTransferable *pClipboard = SW_MOD()->pClipboard; + SwTransferable *pClipboard = GetSwTransferable( rData ); if( pClipboard ) { aDesc = pClipboard->aObjDesc; @@ -2978,7 +2956,8 @@ void SwTransferable::FillClipFmtItem( const SwWrtShell& rSh, SvxClipboardFmtItem & rToFill ) { USHORT nDest = SwTransferable::GetSotDestination( rSh ); - SwTransferable *pClipboard = SW_MOD()->pClipboard; + + SwTransferable *pClipboard = GetSwTransferable( rData ); if( pClipboard ) { USHORT nResId; @@ -3634,6 +3613,22 @@ sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) throw( return nRet; } +SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& rData ) +{ + SwTransferable* pSwTransferable = NULL; + + uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); + if ( xTunnel.is() ) + { + sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); + if ( nHandle ) + pSwTransferable = (SwTransferable*) (sal_IntPtr) nHandle; + } + + return pSwTransferable; + +} + /* */ // ----------------------------------------------------------------------- diff --git a/sw/source/ui/docvw/AnchorOverlayObject.cxx b/sw/source/ui/docvw/AnchorOverlayObject.cxx index 53afaf625710..5ed5b076a967 100644 --- a/sw/source/ui/docvw/AnchorOverlayObject.cxx +++ b/sw/source/ui/docvw/AnchorOverlayObject.cxx @@ -95,7 +95,7 @@ public: const basegfx::B2DPolygon& getTriangle() const { return maTriangle; } const basegfx::B2DPolygon& getLine() const { return maLine; } const basegfx::B2DPolygon& getLineTop() const { return maLineTop; } - const AnchorState getAnchorState() const { return maAnchorState; } + AnchorState getAnchorState() const { return maAnchorState; } const basegfx::BColor& getColor() const { return maColor; } double getLogicLineWidth() const { return mfLogicLineWidth; } bool getShadow() const { return mbShadow; } diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index 53770059cbcd..645d4773626a 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -1645,28 +1645,36 @@ void SwPostItMgr::CorrectPositions() if (!pFirstPostIt) return; - // yeah, I know, if this is a left page it could be wrong, but finding the page and the note is probably not even faster than just doing it - const long aAnchorX = mpEditWin->LogicToPixel( Point((long)(pFirstPostIt->Anchor()->GetSixthPosition().getX()),0)).X(); - const long aAnchorY = mpEditWin->LogicToPixel( Point(0,(long)(pFirstPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1; - if (Point(aAnchorX,aAnchorY) != pFirstPostIt->GetPosPixel()) - { - long aAnchorPosX = 0; - long aAnchorPosY = 0; - for (unsigned long n=0;n<mPages.size();n++) - { - for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++) - { - if ((*i)->bShow && (*i)->pPostIt) - { + // yeah, I know, if this is a left page it could be wrong, but finding the page and the note is probably not even faster than just doing it + // --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists. + const long aAnchorX = pFirstPostIt->Anchor() + ? mpEditWin->LogicToPixel( Point((long)(pFirstPostIt->Anchor()->GetSixthPosition().getX()),0)).X() + : 0; + const long aAnchorY = pFirstPostIt->Anchor() + ? mpEditWin->LogicToPixel( Point(0,(long)(pFirstPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1 + : 0; + // <-- + if (Point(aAnchorX,aAnchorY) != pFirstPostIt->GetPosPixel()) + { + long aAnchorPosX = 0; + long aAnchorPosY = 0; + for (unsigned long n=0;n<mPages.size();n++) + { + for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++) + { + // --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists. + if ( (*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Anchor() ) + // <-- + { aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT ? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X() : mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X(); aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1; (*i)->pPostIt->SetPosPixel(Point(aAnchorPosX,aAnchorPosY)); } - } - } - } + } + } + } } diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx index cce6db3a891b..dc4f006e2026 100755..100644 --- a/sw/source/ui/docvw/SidebarWin.cxx +++ b/sw/source/ui/docvw/SidebarWin.cxx @@ -334,12 +334,6 @@ void SwSidebarWin::InitControls() mpOutliner->SetUpdateMode( TRUE ); Rescale(); - OutputDevice* pDev = aShell->GetDoc()->getReferenceDevice(TRUE); - if ( pDev ) - { - mpOutliner->SetRefDevice( pDev ); - } - mpOutlinerView = new OutlinerView ( mpOutliner, mpSidebarTxtControl ); mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT); mpOutliner->InsertView(mpOutlinerView ); @@ -560,14 +554,28 @@ void SwSidebarWin::SetPosAndSize() { if (IsFollow() && !HasChildPathFocus()) { - mpAnchor->SetAnchorState(AS_END); + // --> OD 2010-06-03 #i111964# + if ( mpAnchor ) + { + mpAnchor->SetAnchorState(AS_END); + } + // <-- } else { - mpAnchor->SetAnchorState(AS_ALL); + // --> OD 2010-06-03 #i111964# + if ( mpAnchor ) + { + mpAnchor->SetAnchorState(AS_ALL); + } + // <-- SwSidebarWin* pWin = GetTopReplyNote(); - if (pWin) + // --> OD 2010-06-03 #i111964# + if ( pWin && pWin->Anchor() ) + // <-- + { pWin->Anchor()->SetAnchorState(AS_END); + } } } } @@ -1127,8 +1135,12 @@ void SwSidebarWin::SetViewState(ViewState bViewState) { mpAnchor->SetAnchorState(AS_ALL); SwSidebarWin* pWin = GetTopReplyNote(); - if (pWin) + // --> OD 2010-06-03 #i111964# + if ( pWin && pWin->Anchor() ) + // <-- + { pWin->Anchor()->SetAnchorState(AS_END); + } mpAnchor->setLineSolid(true); } if (mpShadow) @@ -1156,17 +1168,24 @@ void SwSidebarWin::SetViewState(ViewState bViewState) SwSidebarWin* pTopWinActive = mrMgr.HasActiveSidebarWin() ? mrMgr.GetActiveSidebarWin()->GetTopReplyNote() : 0; - if (pTopWinSelf && (pTopWinSelf!=pTopWinActive)) + // --> OD 2010-06-03 #i111964# + if ( pTopWinSelf && ( pTopWinSelf != pTopWinActive ) && + pTopWinSelf->Anchor() ) + // <-- { - if (pTopWinSelf!=mrMgr.GetActiveSidebarWin()) + if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() ) + { pTopWinSelf->Anchor()->setLineSolid(false); + } pTopWinSelf->Anchor()->SetAnchorState(AS_ALL); } } mpAnchor->setLineSolid(false); } - if (mpShadow) + if ( mpShadow ) + { mpShadow->SetShadowState(SS_NORMAL); + } break; } } diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index a239f13f1ec2..041b55d9c6db 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -91,6 +91,7 @@ class SwTransferable : public TransferableHelper void DeleteSelection(); // helper methods for the paste + static SwTransferable* GetSwTransferable( const TransferableDataHelper& rData ); static void SetSelInShell( SwWrtShell& , BOOL , const Point* ); static BOOL _CheckForURLOrLNKFile( TransferableDataHelper& rData, String& rFileName, String* pTitle = 0 ); diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index c7c52e3f53ff..801ecba22c73 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -599,15 +599,11 @@ void SwSrcView::GetState(SfxItemSet& rSet) break; case SID_PASTE: { - BOOL bDisable = 0 == SW_MOD()->pClipboard; - if( bDisable ) - { - TransferableDataHelper aDataHelper( - TransferableDataHelper::CreateFromSystemClipboard( - &aEditWin) ); - bDisable = !aDataHelper.GetXTransferable().is() || - 0 == aDataHelper.GetFormatCount(); - } + TransferableDataHelper aDataHelper( + TransferableDataHelper::CreateFromSystemClipboard( + &aEditWin) ); + BOOL bDisable = !aDataHelper.GetXTransferable().is() || + 0 == aDataHelper.GetFormatCount(); if( bDisable ) rSet.DisableItem(nWhich); } diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index e19e06916145..3a7003ff7bca 100644..100755 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -55,6 +55,7 @@ #include <editeng/langitem.hxx> #include <svx/viewlayoutitem.hxx> #include <svx/zoomslideritem.hxx> +#include <svtools/xwindowitem.hxx> #include <svx/htmlmode.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> @@ -538,11 +539,12 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) // xmlsec05: new password dialog Window* pParent; const SfxPoolItem* pParentItem; - if( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_PARENTWINDOW, FALSE, &pParentItem ) ) - pParent = ( Window* ) ( ( const OfaPtrItem* ) pParentItem )->GetValue(); + if( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, FALSE, &pParentItem ) ) + pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr(); else pParent = &GetViewFrame()->GetWindow(); SfxPasswordDialog aPasswdDlg( pParent ); + aPasswdDlg.SetMinLen( 1 ); //#i69751# the result of Execute() can be ignored aPasswdDlg.Execute(); String sNewPasswd( aPasswdDlg.GetPassword() ); @@ -574,11 +576,12 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) // message box for wrong password Window* pParent; const SfxPoolItem* pParentItem; - if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_PARENTWINDOW, FALSE, &pParentItem ) ) - pParent = ( Window* ) ( ( const OfaPtrItem* ) pParentItem )->GetValue(); + if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, FALSE, &pParentItem ) ) + pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr(); else pParent = &GetViewFrame()->GetWindow(); SfxPasswordDialog aPasswdDlg( pParent ); + aPasswdDlg.SetMinLen( 1 ); if(!aPasswd.getLength()) aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); if (aPasswdDlg.Execute()) diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index f23b73f5dfad..b0d5f71744c9 100644..100755 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -269,12 +269,10 @@ void SwView::GetState(SfxItemSet &rSet) } break; case FN_REDLINE_ON: - rSet.Put( SfxBoolItem( nWhich, (pWrtShell->GetRedlineMode() & nsRedlineMode_t::REDLINE_ON) != 0 ) ); - break; + rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) ); + break; case FN_REDLINE_PROTECT : - { - rSet.Put( SfxBoolItem( nWhich, pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength() > 0 ) ); - } + rSet.Put( SfxBoolItem( nWhich, GetDocShell()->HasChangeRecordProtection() ) ); break; case FN_REDLINE_SHOW: { diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index 63a674e0efad..b0ad816df4a1 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -122,8 +122,9 @@ enum SwDocumentSettingsPropertyHandles HANDLE_PROTECT_FORM, HANDLE_TABS_RELATIVE_TO_INDENT, // --> OD 2008-06-05 #i89181# - HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST + HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, // <-- + HANDLE_MODIFYPASSWORDINFO }; MasterPropertySetInfo * lcl_createSettingsInfo() @@ -177,6 +178,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo() { RTL_CONSTASCII_STRINGPARAM("ProtectForm"), HANDLE_PROTECT_FORM, CPPUTYPE_BOOLEAN, 0, 0}, // --> OD 2008-06-05 #i89181# { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, CPPUTYPE_PROPERTYVALUE, 0, 0}, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -671,6 +673,21 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } break; // <-- + case HANDLE_MODIFYPASSWORDINFO: + { + uno::Sequence< beans::PropertyValue > aInfo; + if ( !( rValue >>= aInfo ) ) + throw lang::IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value of type Sequence<PropertyValue> expected!" ) ), + uno::Reference< uno::XInterface >(), + 2 ); + + if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) ) + throw beans::PropertyVetoException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The hash is not allowed to be changed now!" ) ), + uno::Reference< uno::XInterface >() ); + } + break; default: throw UnknownPropertyException(); } @@ -998,6 +1015,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf } break; // <-- + case HANDLE_MODIFYPASSWORDINFO: + { + rValue <<= mpDocSh->GetModifyPasswordInfo(); + } + break; default: throw UnknownPropertyException(); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index c33d7428b630..cbde03479433 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -167,7 +167,7 @@ SwFilterDetect::~SwFilterDetect() lDescriptor[nProperty].Value >>= xInteraction; nIndexOfInteractionHandler = nProperty; } - else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("RapairPackage")) ) + else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")) ) lDescriptor[nProperty].Value >>= bRepairPackage; else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")) ) nIndexOfDocumentTitle = nProperty; |