diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-16 16:15:54 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-16 16:15:54 +0000 |
commit | ff40d5a47de6525d580ac10d9009f91b358e1705 (patch) | |
tree | 9cf5478720e968e985197de67e9eaa531b63f3c1 | |
parent | 38dddedf06c27bde422e0387047852daa0d06cb7 (diff) |
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.
-rw-r--r-- | comphelper/source/misc/makefile.mk | 1 | ||||
-rw-r--r-- | comphelper/source/streaming/memorystream.cxx | 1 | ||||
-rw-r--r-- | svtools/inc/sfxecode.hxx | 1 | ||||
-rw-r--r-- | svtools/inc/svtools/parhtml.hxx | 30 | ||||
-rw-r--r-- | svtools/inc/svtools/svparser.hxx | 79 | ||||
-rw-r--r-- | svtools/source/control/inettbc.cxx | 4 | ||||
-rw-r--r-- | svtools/source/misc/acceleratorexecute.cxx | 10 | ||||
-rw-r--r-- | svtools/source/misc/documentlockfile.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/errtxt.src | 4 | ||||
-rw-r--r-- | svtools/source/svhtml/makefile.mk | 2 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 250 | ||||
-rw-r--r-- | svtools/source/svrtf/svparser.cxx | 60 | ||||
-rw-r--r-- | svtools/source/uno/unoevent.cxx | 2 |
13 files changed, 441 insertions, 5 deletions
diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index 1d473e6c5365..f50f57c47eb3 100644 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk @@ -58,6 +58,7 @@ SLOFILES= \ $(SLO)$/componentmodule.obj \ $(SLO)$/configurationhelper.obj \ $(SLO)$/documentinfo.obj \ + $(SLO)$/documentiologring.obj \ $(SLO)$/evtlistenerhlp.obj \ $(SLO)$/ihwrapnofilter.obj \ $(SLO)$/instancelocker.obj \ diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index 9e209a01c581..b999c0f8e6af 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -163,6 +163,7 @@ void SAL_CALL UNOMemoryStream::seek( sal_Int64 location ) throw (IllegalArgument if( (location < 0) || (location > SAL_MAX_INT32) ) throw IllegalArgumentException( OUString(RTL_CONSTASCII_USTRINGPARAM("this implementation does not support more than 2GB!")), Reference< XInterface >(static_cast<OWeakObject*>(this)), 0 ); + // seek operation should be able to resize the stream if ( location > static_cast< sal_Int64 >( maData.size() ) ) maData.resize( static_cast< sal_Int32 >( location ) ); diff --git a/svtools/inc/sfxecode.hxx b/svtools/inc/sfxecode.hxx index 100336796ea4..01292f1c87fa 100644 --- a/svtools/inc/sfxecode.hxx +++ b/svtools/inc/sfxecode.hxx @@ -84,6 +84,7 @@ #define ERRCODE_SFX_MACROS_SUPPORT_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51) #define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52) #define ERRCODE_SFX_BROKENSIGNATURE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 53) +#define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54) diff --git a/svtools/inc/svtools/parhtml.hxx b/svtools/inc/svtools/parhtml.hxx index d129a8c14595..f5de6aea358d 100644 --- a/svtools/inc/svtools/parhtml.hxx +++ b/svtools/inc/svtools/parhtml.hxx @@ -37,9 +37,17 @@ #include <svtools/svarray.hxx> #include <svtools/svparser.hxx> + +namespace com { namespace sun { namespace star { + namespace document { + class XDocumentProperties; + } +} } } + class Color; class SvNumberFormatter; class SvULongs; +class SvKeyValueIterator; #define HTMLFONTSZ1_DFLT 7 #define HTMLFONTSZ2_DFLT 10 @@ -224,6 +232,28 @@ public: // virtual void RestoreState(); virtual void Continue( int nToken ); + +protected: + + static rtl_TextEncoding GetEncodingByMIME( const String& rMime ); + + /// template method: called when ParseMetaOptions adds a user-defined meta + virtual void AddMetaUserDefined( ::rtl::OUString const & i_rMetaName ); + +private: + /// parse meta options into XDocumentProperties and encoding + bool ParseMetaOptionsImpl( const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties>&, + SvKeyValueIterator*, + const HTMLOptions*, + rtl_TextEncoding& rEnc ); + +public: + /// overriding method must call this implementation! + virtual bool ParseMetaOptions( const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties>&, + SvKeyValueIterator* ); + // Ist der uebergebene 0-terminierte String (vermutlich) der Anfang // eines HTML-Files? Er sollte mind. 80 Zeichen lang sein. // Mit Ausnahme des Falls, dass SwitchToUCS2==FALSE und diff --git a/svtools/inc/svtools/svparser.hxx b/svtools/inc/svtools/svparser.hxx index d63777d05b1b..96c1aadc6319 100644 --- a/svtools/inc/svtools/svparser.hxx +++ b/svtools/inc/svtools/svparser.hxx @@ -37,6 +37,7 @@ #include <tools/string.hxx> #include <tools/ref.hxx> #include <rtl/textenc.h> +#include <boost/utility.hpp> struct SvParser_Impl; @@ -204,6 +205,84 @@ inline USHORT SvParser::GetCharSize() const { return (RTL_TEXTENCODING_UCS2 == eSrcEnc) ? 2 : 1; } + + +/*======================================================================== + * + * SvKeyValue. + * + *======================================================================*/ + +SV_DECL_REF(SvKeyValueIterator) + +class SvKeyValue +{ + /** Representation. + */ + String m_aKey; + String m_aValue; + +public: + /** Construction. + */ + SvKeyValue (void) + {} + + SvKeyValue (const String &rKey, const String &rValue) + : m_aKey (rKey), m_aValue (rValue) + {} + + SvKeyValue (const SvKeyValue &rOther) + : m_aKey (rOther.m_aKey), m_aValue (rOther.m_aValue) + {} + + /** Assignment. + */ + SvKeyValue& operator= (SvKeyValue &rOther) + { + m_aKey = rOther.m_aKey; + m_aValue = rOther.m_aValue; + return *this; + } + + /** Operation. + */ + const String& GetKey (void) const { return m_aKey; } + const String& GetValue (void) const { return m_aValue; } + + void SetKey (const String &rKey ) { m_aKey = rKey; } + void SetValue (const String &rValue) { m_aValue = rValue; } +}; + +/*======================================================================== + * + * SvKeyValueIterator. + * + *======================================================================*/ +class SvKeyValueList_Impl; +class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase, + private boost::noncopyable +{ + /** Representation. + */ + SvKeyValueList_Impl* m_pList; + USHORT m_nPos; + +public: + /** Construction/Destruction. + */ + SvKeyValueIterator (void); + virtual ~SvKeyValueIterator (void); + + /** Operation. + */ + virtual BOOL GetFirst (SvKeyValue &rKeyVal); + virtual BOOL GetNext (SvKeyValue &rKeyVal); + virtual void Append (const SvKeyValue &rKeyVal); +}; + +SV_IMPL_REF(SvKeyValueIterator); + #endif //_SVPARSER_HXX /* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 4a01a03ad759..3c6522f051fa 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -641,7 +641,11 @@ void SvtMatchContext_Impl::run() // if the user input is a valid URL, go on with it // otherwise it could be parsed smart with a predefined smart protocol // ( or if this is not set with the protocol of a predefined base URL ) +<<<<<<< .working if( eProt == INET_PROT_NOT_VALID || eProt == eSmartProt || (eSmartProt == INET_PROT_NOT_VALID && eProt == eBaseProt) ) +======= + if( eProt == INET_PROT_NOT_VALID || eProt == eSmartProt || (eSmartProt == INET_PROT_NOT_VALID && eProt == eBaseProt) )
+>>>>>>> .merge-right.r272982 { // not stopped yet ? if( schedule() ) diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index 3e2d63e0b622..16bc8339a0d9 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -476,8 +476,14 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule); - css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg (xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg; + try + { + css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule); + xAccCfg = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); + } + catch(const css::container::NoSuchElementException&) + {} return xAccCfg; } diff --git a/svtools/source/misc/documentlockfile.cxx b/svtools/source/misc/documentlockfile.cxx index 71b541cfe894..990f1ba58d73 100644 --- a/svtools/source/misc/documentlockfile.cxx +++ b/svtools/source/misc/documentlockfile.cxx @@ -202,7 +202,7 @@ sal_Bool DocumentLockFile::OverwriteOwnLockFile() WriteEntryToStream( aNewEntry, xOutput ); xOutput->closeOutput(); } - catch( ucb::NameClashException& ) + catch( uno::Exception& ) { return sal_False; } diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index 72b575f96f43..033ecefc10e7 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -503,6 +503,10 @@ Resource RID_ERRHDL { Text [ en-US ] = "Function not possible: write protected." ; }; + String ERRCODE_SFX_SHARED_NOPASSWORDCHANGE + { + Text [ en-US ] = "The password of a shared spreadsheet cannot be set or changed.\nDeactivate sharing mode first."; + }; }; // eof ------------------------------------------------------------------------ diff --git a/svtools/source/svhtml/makefile.mk b/svtools/source/svhtml/makefile.mk index 577cc83e65c7..b597763ac390 100644 --- a/svtools/source/svhtml/makefile.mk +++ b/svtools/source/svhtml/makefile.mk @@ -34,6 +34,8 @@ PRJ=..$/.. PRJNAME=svtools TARGET=svhtml +ENABLE_EXCEPTIONS=TRUE + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 3413cd3e7fb8..215133c8efb4 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -43,10 +43,21 @@ #include <svtools/svstdarr.hxx> #endif +#include <tools/tenccvt.hxx> +#include <tools/datetime.hxx> +#include <svtools/inettype.hxx> +#include <comphelper/string.hxx> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> + #include <svtools/parhtml.hxx> #include "htmltokn.h" #include "htmlkywd.hxx" + +using namespace ::com::sun::star; + + const sal_Int32 MAX_LEN( 1024L ); //static sal_Unicode sTmpBuffer[ MAX_LEN+1 ]; const sal_Int32 MAX_MACRO_LEN( 1024 ); @@ -2080,7 +2091,6 @@ BOOL HTMLParser::InternalImgToPrivateURL( String& rURL ) return bFound; } - #ifdef USED void HTMLParser::SaveState( int nToken ) { @@ -2093,3 +2103,241 @@ void HTMLParser::RestoreState() } #endif + +enum eHtmlMetas { + HTML_META_NONE = 0, + HTML_META_AUTHOR, + HTML_META_DESCRIPTION, + HTML_META_KEYWORDS, + HTML_META_REFRESH, + HTML_META_CLASSIFICATION, + HTML_META_CREATED, + HTML_META_CHANGEDBY, + HTML_META_CHANGED, + HTML_META_GENERATOR, + HTML_META_SDFOOTNOTE, + HTML_META_SDENDNOTE, + HTML_META_CONTENT_TYPE +}; + +// <META NAME=xxx> +#ifdef __MINGW32__ // for runtime pseudo reloc +static HTMLOptionEnum aHTMLMetaNameTable[] = +#else +static HTMLOptionEnum __READONLY_DATA aHTMLMetaNameTable[] = +#endif +{ + { OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR }, + { OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED }, + { OOO_STRING_SVTOOLS_HTML_META_changedby, HTML_META_CHANGEDBY }, + { OOO_STRING_SVTOOLS_HTML_META_classification,HTML_META_CLASSIFICATION}, + { OOO_STRING_SVTOOLS_HTML_META_content_type, HTML_META_CONTENT_TYPE }, + { OOO_STRING_SVTOOLS_HTML_META_created, HTML_META_CREATED }, + { OOO_STRING_SVTOOLS_HTML_META_description, HTML_META_DESCRIPTION }, + { OOO_STRING_SVTOOLS_HTML_META_keywords, HTML_META_KEYWORDS }, + { OOO_STRING_SVTOOLS_HTML_META_generator, HTML_META_GENERATOR }, + { OOO_STRING_SVTOOLS_HTML_META_refresh, HTML_META_REFRESH }, + { OOO_STRING_SVTOOLS_HTML_META_sdendnote, HTML_META_SDENDNOTE }, + { OOO_STRING_SVTOOLS_HTML_META_sdfootnote, HTML_META_SDFOOTNOTE }, + { 0, 0 } +}; + + +void HTMLParser::AddMetaUserDefined( ::rtl::OUString const & ) +{ +} + +bool HTMLParser::ParseMetaOptionsImpl( + const uno::Reference<document::XDocumentProperties> & i_xDocProps, + SvKeyValueIterator *i_pHTTPHeader, + const HTMLOptions *i_pOptions, + rtl_TextEncoding& o_rEnc ) +{ + String aName, aContent; + USHORT nAction = HTML_META_NONE; + bool bHTTPEquiv = false, bChanged = false; + + for ( USHORT i = i_pOptions->Count(); i; ) + { + const HTMLOption *pOption = (*i_pOptions)[ --i ]; + switch ( pOption->GetToken() ) + { + case HTML_O_NAME: + aName = pOption->GetString(); + if ( HTML_META_NONE==nAction ) + { + pOption->GetEnum( nAction, aHTMLMetaNameTable ); + } + break; + case HTML_O_HTTPEQUIV: + aName = pOption->GetString(); + pOption->GetEnum( nAction, aHTMLMetaNameTable ); + bHTTPEquiv = true; + break; + case HTML_O_CONTENT: + aContent = pOption->GetString(); + break; + } + } + + if ( bHTTPEquiv || HTML_META_DESCRIPTION != nAction ) + { + // if it is not a Description, remove CRs and LFs from CONTENT + aContent.EraseAllChars( _CR ); + aContent.EraseAllChars( _LF ); + } + else + { + // convert line endings for Description + aContent.ConvertLineEnd(); + } + + + if ( bHTTPEquiv && i_pHTTPHeader ) + { + // #57232#: Netscape seems to just ignore a closing ", so we do too + if ( aContent.Len() && '"' == aContent.GetChar( aContent.Len()-1 ) ) + { + aContent.Erase( aContent.Len() - 1 ); + } + SvKeyValue aKeyValue( aName, aContent ); + i_pHTTPHeader->Append( aKeyValue ); + } + + switch ( nAction ) + { + case HTML_META_AUTHOR: + if (i_xDocProps.is()) { + i_xDocProps->setAuthor( aContent ); + bChanged = true; + } + break; + case HTML_META_DESCRIPTION: + if (i_xDocProps.is()) { + i_xDocProps->setDescription( aContent ); + bChanged = true; + } + break; + case HTML_META_KEYWORDS: + if (i_xDocProps.is()) { + i_xDocProps->setKeywords( + ::comphelper::string::convertCommaSeparated(aContent)); + bChanged = true; + } + break; + case HTML_META_CLASSIFICATION: + if (i_xDocProps.is()) { + i_xDocProps->setSubject( aContent ); + bChanged = true; + } + break; + + case HTML_META_CHANGEDBY: + if (i_xDocProps.is()) { + i_xDocProps->setModifiedBy( aContent ); + } + break; + + case HTML_META_CREATED: + case HTML_META_CHANGED: + if ( i_xDocProps.is() && aContent.Len() && + aContent.GetTokenCount() == 2 ) + { + Date aDate( (ULONG)aContent.GetToken(0).ToInt32() ); + Time aTime( (ULONG)aContent.GetToken(1).ToInt32() ); + DateTime aDateTime( aDate, aTime ); + ::util::DateTime uDT(aDateTime.Get100Sec(), + aDateTime.GetSec(), aDateTime.GetMin(), + aDateTime.GetHour(), aDateTime.GetDay(), + aDateTime.GetMonth(), aDateTime.GetYear()); + if ( HTML_META_CREATED==nAction ) + i_xDocProps->setCreationDate( uDT ); + else + i_xDocProps->setModificationDate( uDT ); + bChanged = true; + } + break; + + case HTML_META_REFRESH: + DBG_ASSERT( !bHTTPEquiv || i_pHTTPHeader, + "Reload-URL aufgrund unterlassener MUSS-Aenderung verlorengegangen" ); + break; + + case HTML_META_CONTENT_TYPE: + if ( aContent.Len() ) + { + o_rEnc = GetEncodingByMIME( aContent ); + } + break; + + case HTML_META_NONE: + if ( !bHTTPEquiv ) + { + if (i_xDocProps.is()) + { + uno::Reference<beans::XPropertyContainer> xUDProps + = i_xDocProps->getUserDefinedProperties(); + try { + xUDProps->addProperty(aName, + beans::PropertyAttribute::REMOVEABLE, + uno::makeAny(::rtl::OUString(aContent))); + AddMetaUserDefined(aName); + bChanged = true; + } catch (uno::Exception &) { + // ignore + } + } + } + break; + default: + break; + } + + return bChanged; +} + +bool HTMLParser::ParseMetaOptions( + const uno::Reference<document::XDocumentProperties> & i_xDocProps, + SvKeyValueIterator *i_pHeader ) +{ + USHORT nContentOption = HTML_O_CONTENT; + rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW; + + bool bRet = ParseMetaOptionsImpl( i_xDocProps, i_pHeader, + GetOptions(&nContentOption), + eEnc ); + + // If the encoding is set by a META tag, it may only overwrite the + // current encoding if both, the current and the new encoding, are 1-BYTE + // encodings. Everything else cannot lead to reasonable results. + if (RTL_TEXTENCODING_DONTKNOW != eEnc && + rtl_isOctetTextEncoding( eEnc ) && + rtl_isOctetTextEncoding( GetSrcEncoding() ) ) + { + eEnc = GetExtendedCompatibilityTextEncoding( eEnc ); // #89973# + SetSrcEncoding( eEnc ); + } + + return bRet; +} + +rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime ) +{ + ByteString sType; + ByteString sSubType; + INetContentTypeParameterList aParameters; + ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US ); + if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters)) + { + const INetContentTypeParameter * pCharset + = aParameters.find("charset"); + if (pCharset != 0) + { + ByteString sValue( pCharset->m_sValue, RTL_TEXTENCODING_ASCII_US ); + return GetExtendedCompatibilityTextEncoding( + rtl_getTextEncodingFromMimeCharset( sValue.GetBuffer() ) ); + } + } + return RTL_TEXTENCODING_DONTKNOW; +} + diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index f58a5d11a3c6..c7444dd5cbcb 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -666,4 +666,64 @@ IMPL_STATIC_LINK( SvParser, NewDataRead, void*, EMPTYARG ) return 0; } +/*======================================================================== + * + * SvKeyValueIterator. + * + *======================================================================*/ +SV_DECL_PTRARR_DEL(SvKeyValueList_Impl, SvKeyValue*, 0, 4) +SV_IMPL_PTRARR(SvKeyValueList_Impl, SvKeyValue*); + +/* + * SvKeyValueIterator. + */ +SvKeyValueIterator::SvKeyValueIterator (void) + : m_pList (new SvKeyValueList_Impl), + m_nPos (0) +{ +} + +/* + * ~SvKeyValueIterator. + */ +SvKeyValueIterator::~SvKeyValueIterator (void) +{ + delete m_pList; +} + +/* + * GetFirst. + */ +BOOL SvKeyValueIterator::GetFirst (SvKeyValue &rKeyVal) +{ + m_nPos = m_pList->Count(); + return GetNext (rKeyVal); +} + +/* + * GetNext. + */ +BOOL SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal) +{ + if (m_nPos > 0) + { + rKeyVal = *m_pList->GetObject(--m_nPos); + return TRUE; + } + else + { + // Nothing to do. + return FALSE; + } +} + +/* + * Append. + */ +void SvKeyValueIterator::Append (const SvKeyValue &rKeyVal) +{ + SvKeyValue *pKeyVal = new SvKeyValue (rKeyVal); + m_pList->C40_INSERT(SvKeyValue, pKeyVal, m_pList->Count()); +} + /* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 14321ecdd84c..19d40c17ce5c 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -492,7 +492,7 @@ SvDetachedEventDescriptor::~SvDetachedEventDescriptor() delete aMacros[i]; } - delete aMacros; + delete [] aMacros; } sal_Int16 SvDetachedEventDescriptor::getIndex(const sal_uInt16 nID) const |