From fb2ed9464a46f2eaf28c164afaf4e82ad2301fe4 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 16 Jun 2009 16:15:54 +0000 Subject: CWS-TOOLING: integrate CWS fwk103 2009-05-26 12:44:25 +0200 mst r272292 : #i100727# - svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx: + fix warning: rename method to prevent overloading 2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment 2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly 2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly 2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo 2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros 2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros 2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros 2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored 2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored 2009-05-06 17:43:38 +0200 mst r271607 : #i100727# - svtools/source/svhtml/parhtml.cxx: + adapt code to renaming of HTML constants (sb107) 2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning 2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified 2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified 2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47) 2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly 2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx: + fix wrong initialization order in constructor 2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly 2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary 2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash 2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance 2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4 2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4 2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4 2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo 2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727# - svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx, sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}: + move SvKeyValue stuff from sfx2 to svtools - svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx, sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx: + move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2) to HTMLParser (svtools) + make HTMLParser::ParseMetaOptions() a virtual function + HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding() + new template method HTMLParser::AddMetaUserDefined() - svtools/source/svhtml/makefile.mk: + enable exceptions for parhtml.cxx - dbaccess/source/ui/misc/HtmlReader.cxx, sc/source/filter/html/htmlpars.cxx: + remove encoding related code duplication - sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}: + new SwHTMLParser::AddMetaUserDefined() for import of DOCINFO field subtypes INFO[1-4] + do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4] 2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo 2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off 2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off 2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception 2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo 2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button 2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45) 2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well 2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing 2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs 2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document 2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message 2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877# - svtools/source/uno/unoevent.cxx: + use proper operator delete[] 2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL 2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch 2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed. --- starmath/source/document.cxx | 2 +- starmath/source/smdetect.cxx | 2 +- sw/source/filter/html/htmlfld.cxx | 15 +++--------- sw/source/filter/html/htmlform.cxx | 9 +++++++- sw/source/filter/html/swhtml.cxx | 47 ++++++++++++++++++++++++++++++-------- sw/source/filter/html/swhtml.hxx | 10 ++++++++ sw/source/ui/app/docsh.cxx | 12 +++++----- sw/source/ui/app/docsh2.cxx | 2 +- sw/source/ui/app/docshini.cxx | 4 ++-- sw/source/ui/uno/swdetect.cxx | 6 ++--- 10 files changed, 73 insertions(+), 36 deletions(-) diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 125ad39f56..f570fc621b 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -833,7 +833,7 @@ BOOL SmDocShell::Load( SfxMedium& rMedium ) SmXMLImportWrapper aEquation(xModel); ULONG nError = aEquation.Import(rMedium); bRet = 0 == nError; - SetError( nError ); + SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } } diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index bd3f832f2b..df2182fb1e 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -226,7 +226,7 @@ SmFilterDetect::~SmFilterDetect() // error during storage creation means _here_ that the medium // is broken, but we can not handle it in medium since unpossibility // to create a storage does not _always_ means that the medium is broken - aMedium.SetError( aMedium.GetLastStorageCreationState() ); + aMedium.SetError( aMedium.GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); if ( xInteraction.is() ) { OUString empty; diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 37053c1937..2a28f63b67 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -35,8 +35,6 @@ #include #include -#include -#include #include "docsh.hxx" #include @@ -487,16 +485,9 @@ void SwHTMLParser::NewField() if( nSub >= DI_INFO1 && nSub <= DI_INFO4 && aName.Len() == 0 ) { - // backward compatibility: map to names from document info - SfxObjectShell* pShell = pDoc->GetDocShell(); - DBG_ASSERT(pShell, "no object shell"); - if (pShell) { - uno::Reference xDIS( - pShell->GetModel(), uno::UNO_QUERY_THROW); - uno::Reference xDocInfo - = xDIS->getDocumentInfo(); - aName = xDocInfo->getUserFieldName(nSub - DI_INFO1); - } + // backward compatibility for OOo 2: + // map to names stored in AddMetaUserDefined + aName = m_InfoNames[nSub - DI_INFO1]; nSub = DI_CUSTOM; } diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 8648de70a1..7a0449db96 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #ifndef _SFXAPP_HXX #include @@ -724,7 +725,13 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha SwDocShell *pDocSh = pDoc->GetDocShell(); if( pDocSh ) { - + if ( pDocSh->GetMedium() ) + { + // if there is no hidden property in the MediaDescriptor it should be removed after loading + SFX_ITEMSET_ARG( pDocSh->GetMedium()->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); + bRemoveHidden = ( pHiddenItem == NULL || !pHiddenItem->GetValue() ); + } + pTempViewFrame = SfxViewFrame::CreateViewFrame( *pDocSh, 0, sal_True ); CallStartAction(); pDoc->GetEditShell( &pVSh ); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index d7ef5599d2..96791c977c 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -50,9 +50,7 @@ #include #include #include -#ifndef _WRKWIN_HXX //autogen #include -#endif #include #include @@ -99,9 +97,7 @@ #include #include #include // fuer SwBookmark ... -#ifndef _DOCSH_HXX #include -#endif #include // fuer Start/EndAction #include #include @@ -334,6 +330,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, bInFootEndNoteSymbol( FALSE ), // bIgnoreHTMLComments( bNoHTMLComments ) bIgnoreHTMLComments( bNoHTMLComments ), + bRemoveHidden( FALSE ), pTempViewFrame(0) { nEventId = 0; @@ -501,10 +498,17 @@ __EXPORT SwHTMLParser::~SwHTMLParser() { // keiner will mehr das Doc haben, also weg damit delete pDoc; + pDoc = NULL; } if ( pTempViewFrame ) + { pTempViewFrame->DoClose(); + + // the temporary view frame is hidden, so the hidden flag might need to be removed + if ( bRemoveHidden && pDoc && pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() ) + pDoc->GetDocShell()->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN ); + } } IMPL_LINK( SwHTMLParser, AsyncCallback, void*, /*pVoid*/ ) @@ -1341,11 +1345,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) xDocProps = xDPS->getDocumentProperties(); DBG_ASSERT(xDocProps.is(), "DocumentProperties is null"); } - // always call ParseMetaOptions, it sets the encoding (#i96700#) - if (!ParseMetaOptions( xDocProps, pHTTPHeader ) && IsNewDoc()) - { - ParseMoreMetaOptions(); - } + ParseMetaOptions( xDocProps, pHTTPHeader ); } } break; @@ -5501,3 +5501,32 @@ void _HTMLAttr::InsertPrev( _HTMLAttr *pPrv ) pAttr->pPrev = pPrv; } + +bool SwHTMLParser::ParseMetaOptions( + const uno::Reference & i_xDocProps, + SvKeyValueIterator *i_pHeader ) +{ + // always call base ParseMetaOptions, it sets the encoding (#i96700#) + bool ret( HTMLParser::ParseMetaOptions(i_xDocProps, i_pHeader) ); + if (!ret && IsNewDoc()) + { + ParseMoreMetaOptions(); + } + return ret; +} + +// override so we can parse DOCINFO field subtypes INFO[1-4] +void SwHTMLParser::AddMetaUserDefined( ::rtl::OUString const & i_rMetaName ) +{ + // unless we already have 4 names, append the argument to m_InfoNames + ::rtl::OUString* pName // the first empty string in m_InfoNames + (!m_InfoNames[0].getLength() ? &m_InfoNames[0] : + (!m_InfoNames[1].getLength() ? &m_InfoNames[1] : + (!m_InfoNames[2].getLength() ? &m_InfoNames[2] : + (!m_InfoNames[3].getLength() ? &m_InfoNames[3] : 0 )))); + if (pName) + { + (*pName) = i_rMetaName; + } +} + diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index a8d9109c45..2559dfade4 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -499,6 +499,10 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient sal_Bool bInFootEndNoteAnchor : 1; sal_Bool bInFootEndNoteSymbol : 1; sal_Bool bIgnoreHTMLComments : 1; + sal_Bool bRemoveHidden : 1; // the filter implementation might set the hidden flag + + /// the names corresponding to the DOCINFO field subtypes INFO[1-4] + ::rtl::OUString m_InfoNames[4]; SfxViewFrame* pTempViewFrame; @@ -925,6 +929,8 @@ protected: // wird das Dok geloescht, ist auch der Parser zu loeschen virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ); + virtual void AddMetaUserDefined( ::rtl::OUString const & i_rMetaName ); + public: SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, @@ -941,6 +947,10 @@ public: // fuers asynchrone lesen aus dem SvStream virtual void Continue( int nToken ); + + virtual bool ParseMetaOptions( const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties>&, + SvKeyValueIterator* ); }; diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 9eb6511994..64711f3a4c 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -336,7 +336,7 @@ BOOL SwDocShell::ConvertFrom( SfxMedium& rMedium ) SW_MOD()->SetEmbeddedLoadSave( FALSE ); - SetError( nErr ); + SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); BOOL bOk = !IsError( nErr ); // --> OD 2006-11-07 #i59688# @@ -443,7 +443,7 @@ BOOL SwDocShell::Save() } SW_MOD()->SetEmbeddedLoadSave( FALSE ); } - SetError( nErr ? nErr : nVBWarning ); + SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); SfxViewFrame* pFrm = pWrtShell ? pWrtShell->GetView().GetViewFrame() : 0; if( pFrm ) @@ -578,7 +578,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) SW_MOD()->SetEmbeddedLoadSave( FALSE ); } - SetError( nErr ? nErr : nVBWarning ); + SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); return !IsError( nErr ); } @@ -616,7 +616,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) { if(!SwWarnPassword::WarningOnPassword( rMedium )) { - SetError(ERRCODE_ABORT); + SetError(ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); return FALSE; } } @@ -672,7 +672,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) Sequence aModNames = xLib->getElementNames(); if(aModNames.getLength()) { - SetError(WARN_SWG_HTML_NO_MACROS); + SetError(WARN_SWG_HTML_NO_MACROS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); break; } } @@ -844,7 +844,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) } SW_MOD()->SetEmbeddedLoadSave( FALSE ); - SetError( nErrno ? nErrno : nVBWarning ); + SetError( nErrno ? nErrno : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); if( !rMedium.IsStorage() ) rMedium.CloseOutStream(); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 49b1f33d56..36f662d652 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -863,7 +863,7 @@ void SwDocShell::Execute(SfxRequest& rReq) bMerge = 0 != (nFlags&SFX_MERGE_STYLES); aOpt.SetMerge( !bMerge ); - SetError( LoadStylesFromFile( aFileName, aOpt, FALSE )); + SetError( LoadStylesFromFile( aFileName, aOpt, FALSE ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )); if ( !GetError() ) rReq.Done(); } diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 6a17ca046f..5fde691f71 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -668,7 +668,7 @@ sal_Bool SwDocShell::Load( SfxMedium& rMedium ) UpdateFontList(); InitDraw(); - SetError( nErr ); + SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); bRet = !IsError( nErr ); // --> OD 2006-11-07 #i59688# @@ -749,7 +749,7 @@ sal_Bool SwDocShell::LoadFrom( SfxMedium& rMedium ) */ } - SetError( nErr ); + SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); bRet = !IsError( nErr ); } while( sal_False ); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index bfc927e2e0..f20309a4ab 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -223,7 +223,7 @@ SwFilterDetect::~SwFilterDetect() // error during storage creation means _here_ that the medium // is broken, but we can not handle it in medium since impossibility // to create a storage does not _always_ means that the medium is broken - aMedium.SetError( aMedium.GetLastStorageCreationState() ); + aMedium.SetError( aMedium.GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); if ( xInteraction.is() ) { OUString empty; @@ -299,12 +299,12 @@ SwFilterDetect::~SwFilterDetect() if ( nIndexOfInteractionHandler != -1 ) lDescriptor[nIndexOfInteractionHandler].Value <<= uno::Reference< XInteractionHandler >( static_cast< task::XInteractionHandler* >( xHandler.get() ) ); - aMedium.SetError( ERRCODE_ABORT ); + aMedium.SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } } else // no interaction, error handling as usual - aMedium.SetError( ERRCODE_IO_BROKENPACKAGE ); + aMedium.SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); if ( !bRepairAllowed ) { -- cgit v1.2.3