diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-24 19:23:00 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-24 19:23:00 +0200 |
commit | 41ce86ad453eefdf1a5f8c5b72f2d0099f3938a7 (patch) | |
tree | b98deba63cc7e874608de37335b533858ad43acc /svtools | |
parent | 182488ef1409a0a524e4a3e72d6098efd7bc8479 (diff) | |
parent | a3a5ec733152f282ba243644bced2c3cdecdcf98 (diff) |
Merge branch 'master' into feature/gnumake4
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/filedlg.hxx | 5 | ||||
-rw-r--r-- | svtools/inc/svtools/optionsdrawinglayer.hxx | 26 | ||||
-rw-r--r-- | svtools/inc/svtools/parhtml.hxx | 110 | ||||
-rw-r--r-- | svtools/inc/svtools/templdlg.hxx | 6 | ||||
-rw-r--r-- | svtools/source/config/optionsdrawinglayer.cxx | 169 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl.hxx | 35 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl1.cxx | 402 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 35 | ||||
-rw-r--r-- | svtools/source/dialogs/filedlg.cxx | 20 | ||||
-rw-r--r-- | svtools/source/filter/wmf/enhwmf.cxx | 51 | ||||
-rw-r--r-- | svtools/source/filter/wmf/winmtf.cxx | 26 | ||||
-rw-r--r-- | svtools/source/filter/wmf/winmtf.hxx | 15 | ||||
-rw-r--r-- | svtools/source/filter/wmf/winwmf.cxx | 25 | ||||
-rw-r--r-- | svtools/source/svhtml/htmlsupp.cxx | 22 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 299 |
15 files changed, 295 insertions, 951 deletions
diff --git a/svtools/inc/svtools/filedlg.hxx b/svtools/inc/svtools/filedlg.hxx index 1e31ddc7a6a6..0390c3bc8f2f 100644 --- a/svtools/inc/svtools/filedlg.hxx +++ b/svtools/inc/svtools/filedlg.hxx @@ -87,8 +87,6 @@ public: void SetDefaultExt( const UniString& rExt ) { aDfltExt = rExt; } const UniString& GetDefaultExt() const { return aDfltExt; } void AddFilter( const UniString& rFilter, const UniString& rType ); - void RemoveFilter( const UniString& rFilter ); - void RemoveAllFilter(); void SetCurFilter( const UniString& rFilter ); UniString GetCurFilter() const; sal_uInt16 GetFilterCount() const; @@ -99,9 +97,6 @@ public: const Link& GetFileSelectHdl() const { return aFileHdlLink; } void SetFilterSelectHdl( const Link& rLink ) { aFilterHdlLink = rLink; } const Link& GetFilterSelectHdl() const { return aFilterHdlLink; } - - void SetOkButtonText( const UniString& rText ); - void SetCancelButtonText( const UniString& rText ); }; #endif // _FILEDLG_HXX diff --git a/svtools/inc/svtools/optionsdrawinglayer.hxx b/svtools/inc/svtools/optionsdrawinglayer.hxx index d788c4d3e340..cb1bfd4279ab 100644 --- a/svtools/inc/svtools/optionsdrawinglayer.hxx +++ b/svtools/inc/svtools/optionsdrawinglayer.hxx @@ -129,27 +129,15 @@ class SVT_DLLPUBLIC SvtOptionsDrawinglayer Color GetStripeColorB() const; sal_uInt16 GetStripeLength() const; - void SetOverlayBuffer( sal_Bool bState ); - void SetPaintBuffer( sal_Bool bState ); - void SetStripeColorA( Color aColor ); - void SetStripeColorB( Color aColor ); - void SetStripeLength( sal_uInt16 nLength ); - // #i73602# sal_Bool IsOverlayBuffer_Calc() const; sal_Bool IsOverlayBuffer_Writer() const; sal_Bool IsOverlayBuffer_DrawImpress() const; - void SetOverlayBuffer_Calc( sal_Bool bState ); - void SetOverlayBuffer_Writer( sal_Bool bState ); - void SetOverlayBuffer_DrawImpress( sal_Bool bState ); // #i74769#, #i75172# sal_Bool IsPaintBuffer_Calc() const; sal_Bool IsPaintBuffer_Writer() const; sal_Bool IsPaintBuffer_DrawImpress() const; - void SetPaintBuffer_Calc( sal_Bool bState ); - void SetPaintBuffer_Writer( sal_Bool bState ); - void SetPaintBuffer_DrawImpress( sal_Bool bState ); // #i4219# sal_uInt32 GetMaximumPaperWidth() const; @@ -159,13 +147,6 @@ class SVT_DLLPUBLIC SvtOptionsDrawinglayer sal_uInt32 GetMaximumPaperTopMargin() const; sal_uInt32 GetMaximumPaperBottomMargin() const; - void SetMaximumPaperWidth(sal_uInt32 nNew); - void SetMaximumPaperHeight(sal_uInt32 nNew); - void SetMaximumPaperLeftMargin(sal_uInt32 nNew); - void SetMaximumPaperRightMargin(sal_uInt32 nNew); - void SetMaximumPaperTopMargin(sal_uInt32 nNew); - void SetMaximumPaperBottomMargin(sal_uInt32 nNew); - // #i95644# helper to check if AA is allowed on this system. Currently, for WIN its disabled // and OutDevSupport_TransparentRect is checked (this hits XRenderExtension, e.g. // currently for SunRay as long as not supported there) @@ -181,12 +162,6 @@ class SVT_DLLPUBLIC SvtOptionsDrawinglayer sal_uInt32 GetQuadraticFormControlRenderLimit() const; void SetAntiAliasing( sal_Bool bState ); - void SetSnapHorVerLinesToDiscrete( sal_Bool bState ); - void SetSolidDragCreate( sal_Bool bState ); - void SetRenderDecoratedTextDirect( sal_Bool bState ); - void SetRenderSimpleTextDirect( sal_Bool bState ); - void SetQuadratic3DRenderLimit(sal_uInt32 nNew); - void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); // #i97672# selection settings sal_Bool IsTransparentSelection() const; @@ -195,7 +170,6 @@ class SVT_DLLPUBLIC SvtOptionsDrawinglayer void SetTransparentSelection( sal_Bool bState ); void SetTransparentSelectionPercent( sal_uInt16 nPercent ); - void SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ); //------------------------------------------------------------------------------------------------------------- // private methods diff --git a/svtools/inc/svtools/parhtml.hxx b/svtools/inc/svtools/parhtml.hxx index 20e15990e538..627e7870e0ff 100644 --- a/svtools/inc/svtools/parhtml.hxx +++ b/svtools/inc/svtools/parhtml.hxx @@ -35,6 +35,7 @@ #include <svl/svarray.hxx> #include <svtools/svparser.hxx> +#include <boost/ptr_container/ptr_vector.hpp> namespace com { namespace sun { namespace star { namespace document { @@ -115,13 +116,13 @@ public: sal_uInt32 GetNumber() const; // ... als Zahl sal_Int32 GetSNumber() const; // ... als Zahl void GetNumbers( SvULongs &rLongs, // ... als Zahlen - sal_Bool bSpaceDelim=sal_False ) const; + bool bSpaceDelim=false ) const; void GetColor( Color& ) const; // ... als Farbe // ... als Enum pOptEnums ist ein HTMLOptionEnum-Array sal_uInt16 GetEnum( const HTMLOptionEnum *pOptEnums, sal_uInt16 nDflt=0 ) const; - sal_Bool GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const; + bool GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const; // ... und als ein par spezielle Enums HTMLInputType GetInputType() const; // <INPUT TYPE=...> @@ -130,29 +131,30 @@ public: //SvxAdjust GetAdjust() const; // <P,TH,TD ALIGN=> }; -typedef HTMLOption* HTMLOptionPtr; -SV_DECL_PTRARR(HTMLOptions,HTMLOptionPtr,16,16) +typedef ::boost::ptr_vector<HTMLOption> HTMLOptions; class SVT_DLLPUBLIC HTMLParser : public SvParser { - sal_Bool bNewDoc : 1; // neues Doc lesen ? - sal_Bool bIsInHeader : 1; // scanne Header-Bereich - sal_Bool bIsInBody : 1; // scanne Body-Bereich - sal_Bool bReadListing : 1; // Lese Listings - sal_Bool bReadXMP : 1; // Lese XMP - sal_Bool bReadPRE : 1; // Lese preformatted Text - sal_Bool bReadTextArea : 1; // Lese TEXTAREA - sal_Bool bReadScript : 1; // Lesen von <SCRIPT> - sal_Bool bReadStyle : 1; // Lesen von <STYLE> - sal_Bool bEndTokenFound : 1; // </SCRIPT> oder </STYLE> gefunden - - sal_Bool bPre_IgnoreNewPara : 1; // Flags fuers lesen von PRE-Absaetzen - sal_Bool bReadNextChar : 1; // sal_True: NextChar nochmals lesen (JavaScript!) - sal_Bool bReadComment : 1; // sal_True: NextChar nochmals lesen (JavaScript!) +private: + mutable HTMLOptions maOptions; // die Optionen des Start-Tags + + bool bNewDoc : 1; // neues Doc lesen ? + bool bIsInHeader : 1; // scanne Header-Bereich + bool bIsInBody : 1; // scanne Body-Bereich + bool bReadListing : 1; // Lese Listings + bool bReadXMP : 1; // Lese XMP + bool bReadPRE : 1; // Lese preformatted Text + bool bReadTextArea : 1; // Lese TEXTAREA + bool bReadScript : 1; // Lesen von <SCRIPT> + bool bReadStyle : 1; // Lesen von <STYLE> + bool bEndTokenFound : 1; // </SCRIPT> oder </STYLE> gefunden + + bool bPre_IgnoreNewPara : 1; // Flags fuers lesen von PRE-Absaetzen + bool bReadNextChar : 1; // true: NextChar nochmals lesen (JavaScript!) + bool bReadComment : 1; // true: NextChar nochmals lesen (JavaScript!) sal_uInt32 nPre_LinePos; // Pos in der Line im PRE-Tag - HTMLOptions *pOptions; // die Optionen des Start-Tags String aEndToken; protected: @@ -167,43 +169,43 @@ protected: virtual ~HTMLParser(); - void FinishHeader( sal_Bool bBody ) { bIsInHeader = sal_False; bIsInBody = bBody; } + void FinishHeader( bool bBody ) { bIsInHeader = false; bIsInBody = bBody; } public: - HTMLParser( SvStream& rIn, int bReadNewDoc = sal_True ); + HTMLParser( SvStream& rIn, bool bReadNewDoc = true ); virtual SvParserState CallParser(); // Aufruf des Parsers - sal_Bool IsNewDoc() const { return bNewDoc; } - sal_Bool IsInHeader() const { return bIsInHeader; } - sal_Bool IsInBody() const { return bIsInBody; } - sal_Bool IsValidSyntax() const { return sal_True; } - sal_Bool IsReadListing() const { return bReadListing; } - sal_Bool IsReadXMP() const { return bReadXMP; } - sal_Bool IsReadPRE() const { return bReadPRE; } - sal_Bool IsReadScript() const { return bReadScript; } - sal_Bool IsReadStyle() const { return bReadStyle; } + bool IsNewDoc() const { return bNewDoc; } + bool IsInHeader() const { return bIsInHeader; } + bool IsInBody() const { return bIsInBody; } + bool IsValidSyntax() const { return true; } + bool IsReadListing() const { return bReadListing; } + bool IsReadXMP() const { return bReadXMP; } + bool IsReadPRE() const { return bReadPRE; } + bool IsReadScript() const { return bReadScript; } + bool IsReadStyle() const { return bReadStyle; } - void SetReadNextChar() { bReadNextChar = sal_True; } + void SetReadNextChar() { bReadNextChar = true; } // PRE-/LISTING oder XMP-Modus starten/beenden oder Tags entsprechend // filtern - inline void StartPRE( sal_Bool bRestart=sal_False ); - void FinishPRE() { bReadPRE = sal_False; } + inline void StartPRE( bool bRestart=false ); + void FinishPRE() { bReadPRE = false; } int FilterPRE( int nToken ); - inline void StartListing( sal_Bool bRestart=sal_False ); - void FinishListing() { bReadListing = sal_False; } + inline void StartListing( bool bRestart=false ); + void FinishListing() { bReadListing = false; } int FilterListing( int nToken ); - inline void StartXMP( sal_Bool bRestart=sal_False ); - void FinishXMP() { bReadXMP = sal_False; } + inline void StartXMP( bool bRestart=false ); + void FinishXMP() { bReadXMP = false; } int FilterXMP( int nToken ); - void FinishTextArea() { bReadTextArea = sal_False; } + void FinishTextArea() { bReadTextArea = false; } // PRE-/LSITING- und XMP-Modus beenden - void FinishPREListingXMP() { bReadPRE = bReadListing = bReadXMP = sal_False; } + void FinishPREListingXMP() { bReadPRE = bReadListing = bReadXMP = false; } // Das aktuelle Token dem aktuellen Modus (PRE, XMP, ...) entsprechend // Filtern und die Flags setzen. Wird von Continue aufgerufen, bevor @@ -213,7 +215,7 @@ public: // Scannen eines Scripts beenden (sollte nur unmittelbar nach dem // Lesen eines <SCRIPT> aufgerufen werden - void EndScanScript() { bReadScript = sal_False; } + void EndScanScript() { bReadScript = false; } void ReadRawData( const sal_Char *pEndToken ) { aEndToken.AssignAscii(pEndToken); } @@ -223,11 +225,9 @@ public: // Ermitteln der Optionen. pNoConvertToken ist das optionale Token // einer Option, fuer die CR/LFs nicht aus dem Wert der Option // geloescht werden. - const HTMLOptions *GetOptions( sal_uInt16 *pNoConvertToken=0 ) const; + const HTMLOptions& GetOptions( sal_uInt16 *pNoConvertToken=0 ) const; // fuers asynchrone lesen aus dem SvStream -// virtual void SaveState( int nToken ); -// virtual void RestoreState(); virtual void Continue( int nToken ); @@ -243,7 +243,7 @@ private: bool ParseMetaOptionsImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties>&, SvKeyValueIterator*, - const HTMLOptions*, + const HTMLOptions&, rtl_TextEncoding& rEnc ); public: @@ -254,14 +254,14 @@ public: // 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==sal_False und + // Mit Ausnahme des Falls, dass SwitchToUCS2==false und // SVPAR_CS_DONTKNOW uebergeben wird muss der String mit zwei(!) // 0-Bytes an einer geraden(!) Position terminiert sein. static bool IsHTMLFormat( const sal_Char* pHeader, - sal_Bool bSwitchToUCS2 = sal_False, + bool bSwitchToUCS2 = false, rtl_TextEncoding eEnc=RTL_TEXTENCODING_DONTKNOW ); - sal_Bool ParseScriptOptions( String& rLangString, const String&, HTMLScriptLanguage& rLang, + bool ParseScriptOptions( String& rLangString, const String&, HTMLScriptLanguage& rLang, String& rSrc, String& rLibrary, String& rModule ); // Einen Kommentar um den Inhalt von <SCRIPT> oder <STYLE> entfernen @@ -269,28 +269,28 @@ public: // entfernt (fuer JavaSript) static void RemoveSGMLComment( String &rString, sal_Bool bFull ); - static sal_Bool InternalImgToPrivateURL( String& rURL ); + static bool InternalImgToPrivateURL( String& rURL ); static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader ); - sal_Bool SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader ); + bool SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader ); }; -inline void HTMLParser::StartPRE( sal_Bool bRestart ) +inline void HTMLParser::StartPRE( bool bRestart ) { - bReadPRE = sal_True; + bReadPRE = true; bPre_IgnoreNewPara = !bRestart; nPre_LinePos = 0UL; } -inline void HTMLParser::StartListing( sal_Bool bRestart ) +inline void HTMLParser::StartListing( bool bRestart ) { - bReadListing = sal_True; + bReadListing = true; bPre_IgnoreNewPara = !bRestart; nPre_LinePos = 0UL; } -inline void HTMLParser::StartXMP( sal_Bool bRestart ) +inline void HTMLParser::StartXMP( bool bRestart ) { - bReadXMP = sal_True; + bReadXMP = true; bPre_IgnoreNewPara = !bRestart; nPre_LinePos = 0UL; } diff --git a/svtools/inc/svtools/templdlg.hxx b/svtools/inc/svtools/templdlg.hxx index ba62c3ec5a89..4765dbb6a643 100644 --- a/svtools/inc/svtools/templdlg.hxx +++ b/svtools/inc/svtools/templdlg.hxx @@ -74,14 +74,8 @@ public: </ul> */ - struct SelectOnly { }; - SvtDocumentTemplateDialog( Window* _pParent, SelectOnly ); - ~SvtDocumentTemplateDialog(); - sal_Bool IsFileSelected( ) const; - String GetSelectedFileURL( ) const; - void SelectTemplateFolder(); private: diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 957792d85166..e691e26ea411 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -1397,126 +1397,6 @@ sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const return m_pDataContainer->GetMaximumPaperBottomMargin(); } -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetOverlayBuffer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetPaintBuffer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetStripeColorA( Color aColor ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetStripeColorA( aColor ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetStripeColorB( Color aColor ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetStripeColorB( aColor ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptionsDrawinglayer::SetStripeLength( sal_uInt16 nLength ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetStripeLength( nLength ); -} - -// #i73602# -void SvtOptionsDrawinglayer::SetOverlayBuffer_Calc( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer_Calc( bState ); -} - -void SvtOptionsDrawinglayer::SetOverlayBuffer_Writer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer_Writer( bState ); -} - -void SvtOptionsDrawinglayer::SetOverlayBuffer_DrawImpress( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOverlayBuffer_DrawImpress( bState ); -} - -// #i74769#, #i75172# -void SvtOptionsDrawinglayer::SetPaintBuffer_Calc( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer_Calc( bState ); -} - -void SvtOptionsDrawinglayer::SetPaintBuffer_Writer( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer_Writer( bState ); -} - -void SvtOptionsDrawinglayer::SetPaintBuffer_DrawImpress( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaintBuffer_DrawImpress( bState ); -} - -// #i4219# -void SvtOptionsDrawinglayer::SetMaximumPaperWidth( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperWidth( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperHeight( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperHeight( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperLeftMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperLeftMargin( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperRightMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperRightMargin( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperTopMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperTopMargin( nNew ); -} - -void SvtOptionsDrawinglayer::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetMaximumPaperBottomMargin( nNew ); -} - // helper sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const { @@ -1572,42 +1452,6 @@ void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState ) m_pDataContainer->SetAntiAliasing( bState ); } -void SvtOptionsDrawinglayer::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetSnapHorVerLinesToDiscrete( bState ); -} - -void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetSolidDragCreate( bState ); -} - -void SvtOptionsDrawinglayer::SetRenderDecoratedTextDirect( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetRenderDecoratedTextDirect( bState ); -} - -void SvtOptionsDrawinglayer::SetRenderSimpleTextDirect( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetRenderSimpleTextDirect( bState ); -} - -void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetQuadratic3DRenderLimit( nNew ); -} - -void SvtOptionsDrawinglayer::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetQuadraticFormControlRenderLimit( nNew ); -} - // #i97672# selection settings sal_Bool SvtOptionsDrawinglayer::IsTransparentSelection() const { @@ -1672,19 +1516,6 @@ sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const return aRetval; } -void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - - // crop to range [0% .. 100%] - if(nPercent > 90) - { - nPercent = 90; - } - - m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent ); -} - namespace { class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{}; diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 18b34b780fde..2d9f04241589 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -219,7 +219,6 @@ class SvxIconChoiceCtrl_Impl LocalFocus aFocus; // Data for focusrect ::svt::AccessibleFactoryAccess aAccFactory; - List* pDraggedSelection; SvxIconChoiceCtrlEntry* pCurEditedEntry; SvxIconChoiceCtrlTextMode eTextMode; SelectionMode eSelectionMode; @@ -228,7 +227,6 @@ class SvxIconChoiceCtrl_Impl sal_Bool bBoundRectsDirty; sal_Bool bUpdateMode; sal_Bool bEntryEditingEnabled; - sal_Bool bInDragDrop; void ShowCursor( sal_Bool bShow ); @@ -313,7 +311,6 @@ class SvxIconChoiceCtrl_Impl sal_Bool bSelect, sal_Bool bSyncPaint ); - void SaveSelection( List** ); void RepaintEntries( sal_uInt16 nEntryFlagsMask ); void SetListPositions(); void SetDefaultTextSize(); @@ -332,7 +329,6 @@ class SvxIconChoiceCtrl_Impl DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* ); void ShowFocus ( Rectangle& rRect ); - void HideFocus (); void DrawFocusRect ( OutputDevice* pOut ); sal_Bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const; @@ -402,7 +398,6 @@ public: ); void InvalidateEntry( SvxIconChoiceCtrlEntry* ); - IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos ); void SetNoSelection(); @@ -444,13 +439,14 @@ public: const Point& rPos, const Size& rBoundingSize ); - // berechnet alle BoundRects neu - void RecalcAllBoundingRects(); // berechnet alle ungueltigen BoundRects neu void RecalcAllBoundingRectsSmart(); const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* ); - void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* ); - void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = sal_True; } + void InvalidateBoundingRect( Rectangle& rRect ) + { + rRect.Right() = LONG_MAX; + bBoundRectsDirty = sal_True; + } sal_Bool IsBoundingRectValid( const Rectangle& rRect ) const { return (sal_Bool)( rRect.Right() != LONG_MAX ); } void PaintEmphasis( @@ -476,28 +472,18 @@ public: // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == sal_True void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); } // berechnet alle invalidierten BoundingRects neu - void UpdateBoundingRects(); void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow ); - void PrepareCommandEvent( const CommandEvent& ); void Command( const CommandEvent& rCEvt ); void ToTop( SvxIconChoiceCtrlEntry* ); sal_uLong GetSelectionCount() const; void SetGrid( const Size& ); Size GetMinGrid() const; - sal_uLong GetGridCount( - const Size& rSize, - sal_Bool bCheckScrBars, - sal_Bool bSmartScrBar ) const; void Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False ); const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const; void HideDDIcon(); void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos ); - void HideShowDDIcon( - SvxIconChoiceCtrlEntry* pRefEntry, - const Point& rPos - ); sal_Bool IsOver( SvPtrarr* pSelectedRectList, @@ -530,14 +516,11 @@ public: SvxIconChoiceCtrlTextMode, SvxIconChoiceCtrlEntry* pEntry = 0 ); - SvxIconChoiceCtrlTextMode GetTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const; - void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry ); void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; } sal_Bool IsEntryEditingEnabled() const { return bEntryEditingEnabled; } sal_Bool IsEntryEditing() const { return (sal_Bool)(pCurEditedEntry!=0); } void EditEntry( SvxIconChoiceCtrlEntry* pEntry ); void StopEntryEditing( sal_Bool bCancel ); - void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock ); size_t GetEntryCount() const { return aEntries.size(); } SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) { @@ -564,18 +547,13 @@ public: nFlags &= ~(F_MOVED_ENTRIES); } sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const; - void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos ); void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; } - void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nFlags ); - SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight ); - SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, sal_Bool bDown ); void InitSettings(); Rectangle GetOutputRect() const; sal_Bool ArePredecessorsSet() const { return (sal_Bool)(pHead != 0); } SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; } void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor); - sal_Bool GetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry** ppPredecessor); // liefert gueltige Ergebnisse nur im AutoArrange-Modus! SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& ); @@ -585,7 +563,6 @@ public: void Flush(); void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& ); const SvxIconChoiceCtrlColumnInfo* GetColumn( sal_uInt16 nIndex ) const; - const SvxIconChoiceCtrlColumnInfo* GetItemColumn( sal_uInt16 nSubItem, long& rLeft ) const; Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); } Rectangle GetVisibleRect() const { return GetOutputRect(); } @@ -601,8 +578,6 @@ public: sal_Bool bHide ); void StopSelectTimer() { aCallSelectHdlTimer.Stop(); } - void Tracking( const TrackingEvent& rTEvt ); - Point GetPopupMenuPosPixel() const; sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 8602fa4cacfd..625b04a0d7a2 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -120,14 +120,12 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( pCurHighlightFrame = 0; pEdit = 0; pAnchor = 0; - pDraggedSelection = 0; pPrevDropTarget = 0; pHdlEntry = 0; pHead = NULL; pCursor = NULL; bUpdateMode = sal_True; bEntryEditingEnabled = sal_False; - bInDragDrop = sal_False; bHighlightFramePressed = sal_False; eSelectionMode = MULTIPLE_SELECTION; pView = pCurView; @@ -186,7 +184,6 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl() delete pDDDev; delete pDDBufDev; delete pDDTempDev; - delete pDraggedSelection; delete pEntryPaintDev; ClearSelectedRectList(); ClearColumnList(); @@ -196,8 +193,6 @@ void SvxIconChoiceCtrl_Impl::Clear( sal_Bool bInCtor ) { StopEntryEditing( sal_True ); nSelectionCount = 0; - DELETEZ(pDraggedSelection); - bInDragDrop = sal_False; pCurHighlightFrame = 0; StopEditTimer(); CancelUserEvents(); @@ -400,12 +395,6 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) if( pEntry == pCurHighlightFrame ) pCurHighlightFrame = 0; - if( bInDragDrop ) - { - DELETEZ(pDraggedSelection); - bInDragDrop = sal_False; - } - if( pEntry->IsSelected() ) CallSelectHandler( 0 ); @@ -867,20 +856,6 @@ void SvxIconChoiceCtrl_Impl::InitScrollBarBox() aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1)); } -IcnViewFieldType SvxIconChoiceCtrl_Impl::GetItem( SvxIconChoiceCtrlEntry* pEntry, - const Point& rAbsPos ) -{ - Rectangle aRect( CalcTextRect( pEntry ) ); - if( aRect.IsInside( rAbsPos ) ) - return IcnViewFieldTypeText; - - aRect = CalcBmpRect( pEntry ); - if( aRect.IsInside( rAbsPos ) ) - return IcnViewFieldTypeImage; - - return IcnViewFieldTypeDontknow; -} - sal_Bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) { sal_Bool bHandled = sal_True; @@ -1102,44 +1077,6 @@ sal_Bool SvxIconChoiceCtrl_Impl::MouseMove( const MouseEvent& rMEvt ) return sal_True; } -void SvxIconChoiceCtrl_Impl::Tracking( const TrackingEvent& rTEvt ) -{ - if ( rTEvt.IsTrackingEnded() ) - { - // Das Rechteck darf nicht "justified" sein, da seine - // TopLeft-Position u.U. zur Berechnung eines Ankers - // benutzt wird. - AddSelectedRect( aCurSelectionRect ); - pView->HideTracking(); - nFlags &= ~(F_ADD_MODE); - if( rTEvt.IsTrackingCanceled() ) - SetNoSelection(); - } - else - { - Point aPosPixel = rTEvt.GetMouseEvent().GetPosPixel(); - Point aDocPos( aPosPixel ); - ToDocPos( aDocPos ); - - long nScrollDX, nScrollDY; - - CalcScrollOffsets( aPosPixel, nScrollDX, nScrollDY, sal_False ); - if( nScrollDX || nScrollDY ) - { - pView->HideTracking(); - pView->Scroll( nScrollDX, nScrollDY ); - } - Rectangle aRect( aCurSelectionRect.TopLeft(), aDocPos ); - if( aRect != aCurSelectionRect ) - { - pView->HideTracking(); - sal_Bool bAdd = (nFlags & F_ADD_MODE) ? sal_True : sal_False; - SelectRect( aRect, bAdd, &aSelectedRectList ); - } - pView->ShowTracking( aRect, SHOWTRACK_SMALL | SHOWTRACK_CLIP ); - } -} - void SvxIconChoiceCtrl_Impl::SetCursor_Impl( SvxIconChoiceCtrlEntry* pOldCursor, SvxIconChoiceCtrlEntry* pNewCursor, sal_Bool bMod1, sal_Bool bShift, sal_Bool bPaintSync ) { @@ -2338,40 +2275,6 @@ Size SvxIconChoiceCtrl_Impl::CalcBoundingSize( SvxIconChoiceCtrlEntry* pEntry ) CalcBoundingHeight( pEntry ) ); } -void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() -{ - nMaxBoundHeight = 0; - pZOrderList->clear(); - size_t nCount = aEntries.size(); - size_t nCur; - SvxIconChoiceCtrlEntry* pEntry; - - if( !IsAutoArrange() || !pHead ) - { - for( nCur = 0; nCur < nCount; nCur++ ) - { - pEntry = aEntries[ nCur ]; - FindBoundingRect( pEntry ); - pZOrderList->push_back( pEntry ); - } - } - else - { - nCur = 0; - pEntry = pHead; - while( nCur != nCount ) - { - DBG_ASSERT(pEntry->pflink&&pEntry->pblink,"SvxIconChoiceCtrl_Impl::RecalcAllBoundingRect > Bad link(s)"); - FindBoundingRect( pEntry ); - pZOrderList->push_back( pEntry ); - pEntry = pEntry->pflink; - nCur++; - } - } - bBoundRectsDirty = sal_False; - AdjustScrollBars(); -} - void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() { nMaxBoundHeight = 0; @@ -2419,16 +2322,6 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() AdjustScrollBars(); } -void SvxIconChoiceCtrl_Impl::UpdateBoundingRects() -{ - const size_t nCount = aEntries.size(); - for( size_t nCur = 0; nCur < nCount; nCur++ ) - { - SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; - GetEntryBoundRect( pEntry ); - } -} - void SvxIconChoiceCtrl_Impl::FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry ) { DBG_ASSERT(!pEntry->IsPosLocked(),"Locked entry pos in FindBoundingRect"); @@ -2572,101 +2465,6 @@ void SvxIconChoiceCtrl_Impl::ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, cons pRefEntry->SetFlags( ICNVIEW_FLAG_SELECTED ); } -void SvxIconChoiceCtrl_Impl::HideShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPosPix ) -{ -/* In Notfaellen folgenden flackernden Code aktivieren: - - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; -*/ - if( !pDDDev ) - { - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - if( pRefEntry != pDDRefEntry ) - { - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - Point aEmptyPoint; - - Point aCurEntryPos( rPosPix ); - ToDocPos( aCurEntryPos ); - - const Rectangle& rRect = GetEntryBoundRect( pRefEntry ); - Size aEntrySize( rRect.GetSize() ); - Rectangle aPrevEntryRect( aDDLastEntryPos, aEntrySize ); - Rectangle aCurEntryRect( aCurEntryPos, aEntrySize ); - - if( !aPrevEntryRect.IsOver( aCurEntryRect ) ) - { - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - // Ueberlappung des neuen und alten D&D-Pointers! - - Rectangle aFullRect( aPrevEntryRect.Union( aCurEntryRect ) ); - if( !pDDTempDev ) - { - pDDTempDev = new VirtualDevice( *pView ); - pDDTempDev->SetFont( pView->GetFont() ); - } - - Size aFullSize( aFullRect.GetSize() ); - Point aFullPos( aFullRect.TopLeft() ); - - pDDTempDev->SetOutputSizePixel( aFullSize ); - - // Hintergrund (mit dem alten D&D-Pointer!) sichern - pDDTempDev->DrawOutDev( aEmptyPoint, aFullSize, aFullPos, aFullSize, *pView ); - // den alten Buffer in den neuen Buffer pasten - aDDLastRectPos = aDDLastRectPos - aFullPos; - - pDDTempDev->DrawOutDev( - aDDLastRectPos, - pDDDev->GetOutputSizePixel(), - aEmptyPoint, - pDDDev->GetOutputSizePixel(), - *pDDDev ); - - // Swap - VirtualDevice* pTemp = pDDDev; - pDDDev = pDDTempDev; - pDDTempDev = pTemp; - - // in den restaurierten Hintergrund den neuen D&D-Pointer zeichnen - pDDTempDev->SetOutputSizePixel( pDDDev->GetOutputSizePixel() ); - pDDTempDev->DrawOutDev( - aEmptyPoint, aFullSize, aEmptyPoint, aFullSize, *pDDDev ); - Point aRelPos = aCurEntryPos - aFullPos; - pRefEntry->SetFlags( ICNVIEW_FLAG_BLOCK_EMPHASIS ); - PaintEntry( pRefEntry, aRelPos, pDDTempDev ); - pRefEntry->ClearFlags( ICNVIEW_FLAG_BLOCK_EMPHASIS ); - - aDDLastRectPos = aFullPos; - aDDLastEntryPos = aCurEntryPos; - - pView->DrawOutDev( - aDDLastRectPos, - pDDDev->GetOutputSizePixel(), - aEmptyPoint, - pDDDev->GetOutputSizePixel(), - *pDDTempDev ); -} - -void SvxIconChoiceCtrl_Impl::InvalidateBoundingRect( SvxIconChoiceCtrlEntry* pEntry ) -{ - InvalidateBoundingRect( pEntry->aRect ); -} - - sal_Bool SvxIconChoiceCtrl_Impl::HandleScrollCommand( const CommandEvent& rCmd ) { Rectangle aDocRect( GetDocumentRect() ); @@ -3393,15 +3191,6 @@ IMPL_LINK(SvxIconChoiceCtrl_Impl, DocRectChangedHdl, void*, EMPTYARG ) return 0; } -void SvxIconChoiceCtrl_Impl::PrepareCommandEvent( const CommandEvent& rCEvt ) -{ - StopEditTimer(); - SvxIconChoiceCtrlEntry* pEntry = pView->GetEntry( rCEvt.GetMousePosPixel() ); - if( (nFlags & F_DOWN_CTRL) && pEntry && !pEntry->IsSelected() ) - SelectEntry( pEntry, sal_True, sal_True ); - nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT); -} - sal_Bool SvxIconChoiceCtrl_Impl::IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos ) { Rectangle aRect( CalcTextRect( pEntry )); @@ -3536,13 +3325,6 @@ void SvxIconChoiceCtrl_Impl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, } } -SvxIconChoiceCtrlTextMode SvxIconChoiceCtrl_Impl::GetTextMode( const SvxIconChoiceCtrlEntry* pEntry ) const -{ - if( !pEntry ) - return eTextMode; - return pEntry->GetTextMode(); -} - SvxIconChoiceCtrlTextMode SvxIconChoiceCtrl_Impl::GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const { DBG_ASSERT(pEntry,"GetEntryTextModeSmart: Entry not set"); @@ -3552,19 +3334,6 @@ SvxIconChoiceCtrlTextMode SvxIconChoiceCtrl_Impl::GetEntryTextModeSmart( const S return eMode; } -void SvxIconChoiceCtrl_Impl::ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry ) -{ - if( !pEntry ) - { - pView->HideFocus(); - } - else - { - Rectangle aRect ( CalcFocusRect( (SvxIconChoiceCtrlEntry*)pEntry ) ); - /*pView->*/ShowFocus( aRect ); - } -} - //////////////////////////////////////////////////////////////////////////////////////////////// // // Draw my own focusrect, because the focusrect of the outputdevice has got the inverted color @@ -3586,11 +3355,6 @@ void SvxIconChoiceCtrl_Impl::ShowFocus ( Rectangle& rRect ) aFocus.aRect = rRect; } -void SvxIconChoiceCtrl_Impl::HideFocus () -{ - aFocus.bOn = sal_False; -} - void SvxIconChoiceCtrl_Impl::DrawFocusRect ( OutputDevice* pOut ) { pOut->SetLineColor( aFocus.aPenColor ); @@ -3739,14 +3503,6 @@ void SvxIconChoiceCtrl_Impl::StopEntryEditing( sal_Bool bCancel ) pEdit->StopEditing( bCancel ); } -void SvxIconChoiceCtrl_Impl::LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock ) -{ - if( bLock ) - pEntry->SetFlags( ICNVIEW_FLAG_POS_LOCKED ); - else - pEntry->ClearFlags( ICNVIEW_FLAG_POS_LOCKED ); -} - SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong& rPos ) const { if( !GetSelectionCount() ) @@ -3843,19 +3599,6 @@ void SvxIconChoiceCtrl_Impl::SelectAll( sal_Bool bSelect, sal_Bool bPaint ) pAnchor = 0; } -void SvxIconChoiceCtrl_Impl::SaveSelection( List** ppList ) -{ - if( !*ppList ) - *ppList = new List; - sal_uLong nPos; - SvxIconChoiceCtrlEntry* pEntry = GetFirstSelectedEntry( nPos ); - while( pEntry && GetSelectionCount() != (*ppList)->Count() ) - { - (*ppList)->Insert( pEntry, LIST_APPEND ); - pEntry = GetNextSelectedEntry( nPos ); - } -} - IcnViewEdit_Impl::IcnViewEdit_Impl( SvtIconChoiceCtrl* pParent, const Point& rPos, const Size& rSize, const XubString& rData, const Link& rNotifyEditEnd ) : MultiLineEdit( pParent, (pParent->GetStyle() & WB_ICON) ? WB_CENTER : WB_LEFT), @@ -3991,49 +3734,6 @@ sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntr return pEntry->nPos; } -void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry, sal_uLong nNewPos ) -{ - size_t nCurPos = GetEntryListPos( pListEntry ); - if( nCurPos == nNewPos ) - return; - aEntries.remove( nCurPos ); - aEntries.insert( nNewPos, pListEntry ); - // Eintragspositionen anpassen - size_t nStart, nEnd; - if( nNewPos < nCurPos ) - { - nStart = nNewPos; - nEnd = nCurPos; - } - else - { - nStart = nCurPos; - nEnd = nNewPos; - } - for( ; nStart <= nEnd; nStart++ ) - { - SvxIconChoiceCtrlEntry* pEntry = aEntries[ nStart ]; - pEntry->nPos = nStart; - } -} - -void SvxIconChoiceCtrl_Impl::SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nEntryFlags ) -{ - pEntry->nFlags = nEntryFlags; - if( nEntryFlags & ICNVIEW_FLAG_POS_MOVED ) - nFlags |= F_MOVED_ENTRIES; -} - -SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GoLeftRight( SvxIconChoiceCtrlEntry* pStart, sal_Bool bRight ) -{ - return pImpCursor->GoLeftRight( pStart, bRight ); -} - -SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pStart, sal_Bool bDown ) -{ - return pImpCursor->GoUpDown( pStart, bDown ); -} - void SvxIconChoiceCtrl_Impl::InitSettings() { const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings(); @@ -4168,26 +3868,8 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod // positionieren wir verschobene Eintraege 'hart' gibts noch Probleme // mit ungewollten Ueberlappungen, da diese Eintrage im Arrange // nicht beruecksichtigt werden. -#if 1 if( aEntries.size() ) aAutoArrangeTimer.Start(); -#else - if( pHead ) - { - // verschobene Eintraege 'hart' auf ihre Position setzen - nCur = nCount; - SvxIconChoiceCtrlEntry* pEntry = pHead; - while( nCur ) - { - SvxIconChoiceCtrlEntry* pPred; - if( GetEntryPredecessor( pEntry, &pPred )) - SetEntryFlags( pEntry, ICNVIEW_FLAG_POS_MOVED ); - pEntry = pEntry->pflink; - nCur--; - } - ClearPredecessors(); - } -#endif return; } @@ -4271,29 +3953,6 @@ void SvxIconChoiceCtrl_Impl::SetEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry aAutoArrangeTimer.Start(); } -sal_Bool SvxIconChoiceCtrl_Impl::GetEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, - SvxIconChoiceCtrlEntry** ppPredecessor ) -{ - *ppPredecessor = 0; - if( !pHead ) - return sal_False; - DBG_ASSERT(pEntry->pblink,"GetEntryPredecessor: Backward link not set"); - DBG_ASSERT(pEntry->pflink,"GetEntryPredecessor: Forward link not set"); - - if( pEntry == pHead ) - { - SvxIconChoiceCtrlEntry* pFirst = aEntries[ 0 ]; - if( pFirst != pEntry ) - return sal_True; - return sal_False; - } - *ppPredecessor = pEntry->pblink; - if( !(pEntry->nFlags & ICNVIEW_FLAG_PRED_SET) && - (GetEntryListPos( *ppPredecessor ) + 1) == GetEntryListPos( pEntry )) - return sal_False; - return sal_True; -} - SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& rPosTopLeft ) { @@ -4446,24 +4105,6 @@ const SvxIconChoiceCtrlColumnInfo* SvxIconChoiceCtrl_Impl::GetColumn( sal_uInt16 return (const SvxIconChoiceCtrlColumnInfo*)pColumns->GetObject( nIndex ); } -const SvxIconChoiceCtrlColumnInfo* SvxIconChoiceCtrl_Impl::GetItemColumn( sal_uInt16 nSubItem, - long& rLeft ) const -{ - rLeft = 0; - if( !pColumns ) - return 0; - const sal_uInt16 nCount = pColumns->Count(); - const SvxIconChoiceCtrlColumnInfo* pCol = 0; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - pCol = (const SvxIconChoiceCtrlColumnInfo*)pColumns->GetObject( nCur ); - if( !pCol || pCol->GetSubItem() == nSubItem ) - return pCol; - rLeft += pCol->GetWidth(); - } - return pCol; -} - void SvxIconChoiceCtrl_Impl::DrawHighlightFrame( OutputDevice* pOut, const Rectangle& rBmpRect, sal_Bool bHide ) { @@ -4548,27 +4189,6 @@ IMPL_LINK( SvxIconChoiceCtrl_Impl, CallSelectHdlHdl, void*, EMPTYARG ) return 0; } -Point SvxIconChoiceCtrl_Impl::GetPopupMenuPosPixel() const -{ - Point aResult; - if( !GetSelectionCount() ) - return aResult; - - SvxIconChoiceCtrlEntry* pEntry = GetCurEntry(); - if( !pEntry || !pEntry->IsSelected() ) - { - sal_uLong nNext; - pEntry = GetFirstSelectedEntry( nNext ); - } - if( pEntry ) - { - Rectangle aRect( ((SvxIconChoiceCtrl_Impl*)this)->CalcBmpRect( pEntry ) ); - aResult = aRect.Center(); - aResult = pView->GetPixelPos( aResult ); - } - return aResult; -} - void SvxIconChoiceCtrl_Impl::SetOrigin( const Point& rPos, sal_Bool bDoNotUpdateWallpaper ) { MapMode aMapMode( pView->GetMapMode() ); @@ -4587,28 +4207,6 @@ void SvxIconChoiceCtrl_Impl::SetOrigin( const Point& rPos, sal_Bool bDoNotUpdate } } -sal_uLong SvxIconChoiceCtrl_Impl::GetGridCount( const Size& rSize, sal_Bool bCheckScrBars, - sal_Bool bSmartScrBar ) const -{ - Size aSize( rSize ); - if( bCheckScrBars && aHorSBar.IsVisible() ) - aSize.Height() -= nHorSBarHeight; - else if( bSmartScrBar && (nWinBits & WB_ALIGN_LEFT) ) - aSize.Height() -= nHorSBarHeight; - - if( bCheckScrBars && aVerSBar.IsVisible() ) - aSize.Width() -= nVerSBarWidth; - else if( bSmartScrBar && (nWinBits & WB_ALIGN_TOP) ) - aSize.Width() -= nVerSBarWidth; - - if( aSize.Width() < 0 ) - aSize.Width() = 0; - if( aSize.Height() < 0 ) - aSize.Height() = 0; - - return IcnGridMap_Impl::GetGridCount( aSize, (sal_uInt16)nGridDX, (sal_uInt16)nGridDY ); -} - sal_Bool SvxIconChoiceCtrl_Impl::HandleShortCutKey( const KeyEvent& rKEvt ) { StopEditTimer(); diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 19dcdb26dd87..7650fa534f77 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -1693,27 +1693,6 @@ uno::Reference< util::XOfficeInstallationDirectories > SvtTmplDlg_Impl::getOffic // class SvtDocumentTemplateDialog --------------------------------------- -SvtDocumentTemplateDialog::SvtDocumentTemplateDialog( Window* _pParent, SelectOnly ) : - ModalDialog( _pParent, SvtResId( DLG_DOCTEMPLATE ) ), - - aMoreTemplatesLink ( this, SvtResId( FT_DOCTEMPLATE_LINK ) ), - aLine ( this, SvtResId( FL_DOCTEMPLATE ) ), - aManageBtn ( this, SvtResId( BTN_DOCTEMPLATE_MANAGE ) ), - aEditBtn ( this, SvtResId( BTN_DOCTEMPLATE_EDIT ) ), - aOKBtn ( this, SvtResId( BTN_DOCTEMPLATE_OPEN ) ), - aCancelBtn ( this, SvtResId( BTN_DOCTEMPLATE_CANCEL ) ), - aHelpBtn ( this, SvtResId( BTN_DOCTEMPLATE_HELP ) ), - pImpl ( NULL ) -{ - FreeResource(); - InitImpl( ); - - // no editing of templates - aEditBtn.Hide(); - - pImpl->bSelectNoOpen = sal_True; -} - // ------------------------------------------------------------------------ SvtDocumentTemplateDialog::SvtDocumentTemplateDialog( Window* pParent ) : @@ -1818,20 +1797,6 @@ SvtDocumentTemplateDialog::~SvtDocumentTemplateDialog() // ------------------------------------------------------------------------ -sal_Bool SvtDocumentTemplateDialog::IsFileSelected( ) const -{ - return pImpl->pWin->IsFileSelected(); -} - -// ------------------------------------------------------------------------ - -String SvtDocumentTemplateDialog::GetSelectedFileURL( ) const -{ - return pImpl->pWin->GetSelectedFile(); -} - -// ------------------------------------------------------------------------ - sal_Bool SvtDocumentTemplateDialog::CanEnableEditBtn() const { sal_Bool bEnable = sal_False; diff --git a/svtools/source/dialogs/filedlg.cxx b/svtools/source/dialogs/filedlg.cxx index e1a7548ba170..a034cdc965cc 100644 --- a/svtools/source/dialogs/filedlg.cxx +++ b/svtools/source/dialogs/filedlg.cxx @@ -93,16 +93,6 @@ void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask ) ((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask ); } -void FileDialog::RemoveFilter( const UniString& rFilter ) -{ - ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveFilter( rFilter ); -} - -void FileDialog::RemoveAllFilter() -{ - ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveAllFilter(); -} - void FileDialog::SetCurFilter( const UniString& rFilter ) { ((ImpFileDialog*)pImpFileDlg->GetDialog())->SetCurFilter( rFilter ); @@ -138,14 +128,4 @@ UniString FileDialog::GetFilterType( sal_uInt16 nPos ) const return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos ); } -void FileDialog::SetOkButtonText( const UniString& rText ) -{ - pImpFileDlg->SetOkButtonText( rText ); -} - -void FileDialog::SetCancelButtonText( const UniString& rText ) -{ - pImpFileDlg->SetCancelButtonText( rText ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index ce7842b0c270..654f8a19a5c0 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -376,8 +376,11 @@ sal_Bool EnhWMFReader::ReadEnhWMF() break; } - if( aBmpSaveList.Count() && ( nRecType != EMR_STRETCHBLT ) && ( nRecType != EMR_STRETCHDIBITS ) ) - pOut->ResolveBitmapActions( aBmpSaveList ); + if( !aBmpSaveList.empty() + && ( nRecType != EMR_STRETCHBLT ) + && ( nRecType != EMR_STRETCHDIBITS ) + ) + pOut->ResolveBitmapActions( aBmpSaveList ); bFlag = sal_False; @@ -1016,7 +1019,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() /* Pseudocomment to add more context so that make patch.unapply * works better. Ha! */ - aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ), LIST_APPEND ); + aBmpSaveList.push_back( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ) ); } } } @@ -1029,8 +1032,20 @@ sal_Bool EnhWMFReader::ReadEnhWMF() sal_uInt32 nStart = pWMF->Tell() - 8; pWMF->SeekRel( 0x10 ); - *pWMF >> xDest >> yDest >> xSrc >> ySrc >> cxSrc >> cySrc >> offBmiSrc >> cbBmiSrc >> offBitsSrc - >> cbBitsSrc >> iUsageSrc >> dwRop >> cxDest >> cyDest; + *pWMF >> xDest + >> yDest + >> xSrc + >> ySrc + >> cxSrc + >> cySrc + >> offBmiSrc + >> cbBmiSrc + >> offBitsSrc + >> cbBitsSrc + >> iUsageSrc + >> dwRop + >> cxDest + >> cyDest; Bitmap aBitmap; Rectangle aRect( Point( xDest, yDest ), Size( cxDest+1, cyDest+1 ) ); @@ -1038,8 +1053,12 @@ sal_Bool EnhWMFReader::ReadEnhWMF() cxDest = abs( (int)cxDest ); // sj: i37894, size can be negative cyDest = abs( (int)cyDest ); // and also 122889 - if ( (cbBitsSrc > (SAL_MAX_UINT32 - 14)) || ((SAL_MAX_UINT32 - 14) - cbBitsSrc < cbBmiSrc) ) + if ( ((SAL_MAX_UINT32 - 14) < cbBitsSrc) + || ((SAL_MAX_UINT32 - 14) - cbBitsSrc < cbBmiSrc ) + ) + { bStatus = sal_False; + } else { sal_uInt32 nSize = cbBmiSrc + cbBitsSrc + 14; @@ -1071,7 +1090,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() aBitmap.Crop( aCropRect ); } /* Another pseudocomment to make make patch.unapply work better */ - aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ), LIST_APPEND ); + aBmpSaveList.push_back( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ) ); } } } @@ -1083,9 +1102,19 @@ sal_Bool EnhWMFReader::ReadEnhWMF() if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 ) { LOGFONTW aLogFont; - *pWMF >> aLogFont.lfHeight >> aLogFont.lfWidth >> aLogFont.lfEscapement >> aLogFont.lfOrientation >> aLogFont.lfWeight >> aLogFont.lfItalic - >> aLogFont.lfUnderline >> aLogFont.lfStrikeOut >> aLogFont.lfCharSet >> aLogFont.lfOutPrecision >> aLogFont.lfClipPrecision - >> aLogFont.lfQuality >> aLogFont.lfPitchAndFamily; + *pWMF >> aLogFont.lfHeight + >> aLogFont.lfWidth + >> aLogFont.lfEscapement + >> aLogFont.lfOrientation + >> aLogFont.lfWeight + >> aLogFont.lfItalic + >> aLogFont.lfUnderline + >> aLogFont.lfStrikeOut + >> aLogFont.lfCharSet + >> aLogFont.lfOutPrecision + >> aLogFont.lfClipPrecision + >> aLogFont.lfQuality + >> aLogFont.lfPitchAndFamily; sal_Unicode lfFaceName[ LF_FACESIZE ]; @@ -1451,7 +1480,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() } pWMF->Seek( nNextPos ); } - if( aBmpSaveList.Count() ) + if( !aBmpSaveList.empty() ) pOut->ResolveBitmapActions( aBmpSaveList ); if ( bStatus ) diff --git a/svtools/source/filter/wmf/winmtf.cxx b/svtools/source/filter/wmf/winmtf.cxx index d2a4b0ec50c2..48acdcb9f52b 100644 --- a/svtools/source/filter/wmf/winmtf.cxx +++ b/svtools/source/filter/wmf/winmtf.cxx @@ -1682,19 +1682,20 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B //----------------------------------------------------------------------------------- -void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) +void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList ) { UpdateClipRegion(); - sal_uInt32 nObjects = rSaveList.Count(); - sal_uInt32 nObjectsLeft = nObjects; + size_t nObjects = rSaveList.size(); + size_t nObjectsLeft = nObjects; while ( nObjectsLeft ) { - sal_uInt32 i, nObjectsOfSameSize = 0; - sal_uInt32 nObjectStartIndex = nObjects - nObjectsLeft; + size_t i; + size_t nObjectsOfSameSize = 0; + size_t nObjectStartIndex = nObjects - nObjectsLeft; - BSaveStruct* pSave = (BSaveStruct*)rSaveList.GetObject( nObjectStartIndex ); + BSaveStruct* pSave = rSaveList[ nObjectStartIndex ]; Rectangle aRect( pSave->aOutRect ); for ( i = nObjectStartIndex; i < nObjects; ) @@ -1702,7 +1703,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) nObjectsOfSameSize++; if ( ++i < nObjects ) { - pSave = (BSaveStruct*)rSaveList.GetObject( i ); + pSave = rSaveList[ i ]; if ( pSave->aOutRect != aRect ) break; } @@ -1712,7 +1713,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) for ( i = nObjectStartIndex; i < ( nObjectStartIndex + nObjectsOfSameSize ); i++ ) { - pSave = (BSaveStruct*)rSaveList.GetObject( i ); + pSave = rSaveList[ i ]; sal_uInt32 nWinRop = pSave->nWinRop; sal_uInt8 nRasterOperation = (sal_uInt8)( nWinRop >> 16 ); @@ -1740,7 +1741,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) { if ( nObjectsOfSameSize == 2 ) { - BSaveStruct* pSave2 = (BSaveStruct*)rSaveList.GetObject( i + 1 ); + BSaveStruct* pSave2 = rSaveList[ i + 1 ]; if ( ( pSave->aBmp.GetPrefSize() == pSave2->aBmp.GetPrefSize() ) && ( pSave->aBmp.GetPrefMapMode() == pSave2->aBmp.GetPrefMapMode() ) ) { @@ -1900,10 +1901,9 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) nObjectsLeft -= nObjectsOfSameSize; } - void* pPtr; - for ( pPtr = rSaveList.First(); pPtr; pPtr = rSaveList.Next() ) - delete (BSaveStruct*)pPtr; - rSaveList.Clear(); + for( size_t i = 0, n = rSaveList.size(); i < n; ++i ) + delete rSaveList[ i ]; + rSaveList.clear(); } //----------------------------------------------------------------------------------- diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index 270af93a4675..cd9e82b832b8 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -537,6 +537,8 @@ struct BSaveStruct {} }; +typedef ::std::vector< BSaveStruct* > BSaveStructList_impl; + // ----------------------------------------------------------------------------- enum GDIObjectType { @@ -754,7 +756,7 @@ public: sal_Bool bRecordPath = sal_False, sal_Int32 nGraphicsMode = GM_COMPATIBLE ); - void ResolveBitmapActions( List& rSaveList ); + void ResolveBitmapActions( BSaveStructList_impl& rSaveList ); void IntersectClipRect( const Rectangle& rRect ); void ExcludeClipRect( const Rectangle& rRect ); @@ -780,11 +782,11 @@ class WinMtf { protected: - WinMtfOutput* pOut; // - SvStream* pWMF; // Die einzulesende WMF/EMF-Datei + WinMtfOutput* pOut; + SvStream* pWMF; // Die einzulesende WMF/EMF-Datei - sal_uInt32 nStartPos, nEndPos; - List aBmpSaveList; + sal_uInt32 nStartPos, nEndPos; + BSaveStructList_impl aBmpSaveList; FilterConfigItem* pFilterConfigItem; @@ -801,9 +803,6 @@ protected: FilterConfigItem* pConfigItem = NULL ); ~WinMtf(); - -public: - }; //============================ EMFReader ================================== diff --git a/svtools/source/filter/wmf/winwmf.cxx b/svtools/source/filter/wmf/winwmf.cxx index a794da5b3274..8ca9c0ac6d19 100644 --- a/svtools/source/filter/wmf/winwmf.cxx +++ b/svtools/source/filter/wmf/winwmf.cxx @@ -571,7 +571,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) aBmp.Crop( aCropRect ); } Rectangle aDestRect( aPoint, Size( nSxe, nSye ) ); - aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ), LIST_APPEND ); + aBmpSaveList.push_back( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ) ); } } } @@ -621,7 +621,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) Rectangle aCropRect( Point( nSx, nSy ), Size( nSxe, nSye ) ); aBmp.Crop( aCropRect ); } - aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ), LIST_APPEND ); + aBmpSaveList.push_back( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ) ); } } } @@ -1121,9 +1121,14 @@ void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader) } *pWMF >> nRecSize >> nFunction; - if( pWMF->GetError() || ( nRecSize < 3 ) || ( nRecSize==3 && nFunction==0 ) || pWMF->IsEof() ) + if( pWMF->GetError() + || ( nRecSize < 3 ) + || ( nRecSize == 3 + && nFunction == 0 + ) + || pWMF->IsEof() + ) { - if( pWMF->IsEof() ) pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR ); @@ -1131,13 +1136,15 @@ void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader) } if ( !bEMFAvailable ) { - if( aBmpSaveList.Count() && - ( nFunction != W_META_STRETCHDIB ) && - ( nFunction != W_META_DIBBITBLT ) && - ( nFunction != W_META_DIBSTRETCHBLT ) ) + if( !aBmpSaveList.empty() + && ( nFunction != W_META_STRETCHDIB ) + && ( nFunction != W_META_DIBBITBLT ) + && ( nFunction != W_META_DIBSTRETCHBLT ) + ) { pOut->ResolveBitmapActions( aBmpSaveList ); } + if ( !nSkipActions ) ReadRecordParams( nFunction ); else @@ -1181,7 +1188,7 @@ void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader) else pWMF->SetError( SVSTREAM_GENERALERROR ); - if( !pWMF->GetError() && aBmpSaveList.Count() ) + if( !pWMF->GetError() && !aBmpSaveList.empty() ) pOut->ResolveBitmapActions( aBmpSaveList ); } if ( pWMF->GetError() ) diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx index 97867c1341bb..187273b434cd 100644 --- a/svtools/source/svhtml/htmlsupp.cxx +++ b/svtools/source/svhtml/htmlsupp.cxx @@ -51,13 +51,13 @@ static HTMLOptionEnum const aScriptLangOptEnums[] = { 0, 0 } }; -sal_Bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBaseURL, +bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBaseURL, HTMLScriptLanguage& rLang, String& rSrc, String& rLibrary, String& rModule ) { - const HTMLOptions *pScriptOptions = GetOptions(); + const HTMLOptions& aScriptOptions = GetOptions(); rLangString.Erase(); rLang = HTML_SL_JAVASCRIPT; @@ -65,16 +65,16 @@ sal_Bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBas rLibrary.Erase(); rModule.Erase(); - for( sal_uInt16 i = pScriptOptions->Count(); i; ) + for( size_t i = aScriptOptions.size(); i; ) { - const HTMLOption *pOption = (*pScriptOptions)[ --i ]; - switch( pOption->GetToken() ) + const HTMLOption& aOption = aScriptOptions[--i]; + switch( aOption.GetToken() ) { case HTML_O_LANGUAGE: { - rLangString = pOption->GetString(); + rLangString = aOption.GetString(); sal_uInt16 nLang; - if( pOption->GetEnum( nLang, aScriptLangOptEnums ) ) + if( aOption.GetEnum( nLang, aScriptLangOptEnums ) ) rLang = (HTMLScriptLanguage)nLang; else rLang = HTML_SL_UNKNOWN; @@ -82,19 +82,19 @@ sal_Bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBas break; case HTML_O_SRC: - rSrc = INetURLObject::GetAbsURL( rBaseURL, pOption->GetString() ); + rSrc = INetURLObject::GetAbsURL( rBaseURL, aOption.GetString() ); break; case HTML_O_SDLIBRARY: - rLibrary = pOption->GetString(); + rLibrary = aOption.GetString(); break; case HTML_O_SDMODULE: - rModule = pOption->GetString(); + rModule = aOption.GetString(); break; } } - return sal_True; + return true; } void HTMLParser::RemoveSGMLComment( String &rString, sal_Bool bFull ) diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index b431d0d931c7..acb8635cb536 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -52,6 +52,7 @@ #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> +#include <memory> using namespace ::com::sun::star; @@ -108,10 +109,6 @@ static HTMLOptionEnum const aTableRulesOptEnums[] = { 0, 0 } }; - -SV_IMPL_PTRARR(HTMLOptions,HTMLOptionPtr) - - sal_uInt16 HTMLOption::GetEnum( const HTMLOptionEnum *pOptEnums, sal_uInt16 nDflt ) const { sal_uInt16 nValue = nDflt; @@ -128,7 +125,7 @@ sal_uInt16 HTMLOption::GetEnum( const HTMLOptionEnum *pOptEnums, sal_uInt16 nDfl return nValue; } -sal_Bool HTMLOption::GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const +bool HTMLOption::GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const { while( pOptEnums->pName ) { @@ -179,7 +176,7 @@ sal_Int32 HTMLOption::GetSNumber() const return aTmp.ToInt32(); } -void HTMLOption::GetNumbers( SvULongs &rLongs, sal_Bool bSpaceDelim ) const +void HTMLOption::GetNumbers( SvULongs &rLongs, bool bSpaceDelim ) const { if( rLongs.Count() ) rLongs.Remove( 0, rLongs.Count() ); @@ -188,7 +185,7 @@ void HTMLOption::GetNumbers( SvULongs &rLongs, sal_Bool bSpaceDelim ) const { // This is a very simplified scanner: it only searches all // numerals in the string. - sal_Bool bInNum = sal_False; + bool bInNum = false; sal_uLong nNum = 0; for( xub_StrLen i=0; i<aValue.Len(); i++ ) { @@ -197,12 +194,12 @@ void HTMLOption::GetNumbers( SvULongs &rLongs, sal_Bool bSpaceDelim ) const { nNum *= 10; nNum += (c - '0'); - bInNum = sal_True; + bInNum = true; } else if( bInNum ) { rLongs.Insert( nNum, rLongs.Count() ); - bInNum = sal_False; + bInNum = false; nNum = 0; } } @@ -307,26 +304,28 @@ HTMLTableRules HTMLOption::GetTableRules() const return (HTMLTableRules)GetEnum( aTableRulesOptEnums, HTML_TR_NONE ); } -HTMLParser::HTMLParser( SvStream& rIn, int bReadNewDoc ) - : SvParser( rIn ) +HTMLParser::HTMLParser( SvStream& rIn, bool bReadNewDoc ) : + SvParser( rIn ), + bNewDoc(bReadNewDoc), + bIsInHeader(true), + bIsInBody(false), + bReadListing(false), + bReadXMP(false), + bReadPRE(false), + bReadTextArea(false), + bReadScript(false), + bReadStyle(false), + bEndTokenFound(false), + bPre_IgnoreNewPara(false), + bReadNextChar(false), + bReadComment(false) { - bNewDoc = bReadNewDoc; - bReadListing = bReadXMP = bReadPRE = bReadTextArea = - bReadScript = bReadStyle = - bEndTokenFound = bIsInBody = bReadNextChar = - bReadComment = sal_False; - bIsInHeader = sal_True; - pOptions = new HTMLOptions; - //#i76649, default to UTF-8 for HTML unless we know differently SetSrcEncoding(RTL_TEXTENCODING_UTF8); } HTMLParser::~HTMLParser() { - if( pOptions && pOptions->Count() ) - pOptions->DeleteAndDestroy( 0, pOptions->Count() ); - delete pOptions; } SvParserState HTMLParser::CallParser() @@ -336,7 +335,7 @@ SvParserState HTMLParser::CallParser() SaveState( 0 ); nPre_LinePos = 0; - bPre_IgnoreNewPara = sal_False; + bPre_IgnoreNewPara = false; AddRef(); Continue( 0 ); @@ -375,24 +374,24 @@ int HTMLParser::FilterToken( int nToken ) break; // don't pass case HTML_HEAD_OFF: - bIsInBody = sal_True; + bIsInBody = true; case HTML_HEAD_ON: bIsInHeader = HTML_HEAD_ON == nToken; break; case HTML_BODY_ON: case HTML_FRAMESET_ON: - bIsInHeader = sal_False; + bIsInHeader = false; bIsInBody = HTML_BODY_ON == nToken; break; case HTML_BODY_OFF: - bIsInBody = bReadPRE = bReadListing = bReadXMP = sal_False; + bIsInBody = bReadPRE = bReadListing = bReadXMP = false; break; case HTML_HTML_OFF: nToken = 0; - bReadPRE = bReadListing = bReadXMP = sal_False; + bReadPRE = bReadListing = bReadXMP = false; break; // HTML_ON hasn't been passed either ! case HTML_PREFORMTXT_ON: @@ -443,17 +442,17 @@ int HTMLParser::FilterToken( int nToken ) int HTMLParser::ScanText( const sal_Unicode cBreak ) { ::rtl::OUStringBuffer sTmpBuffer( MAX_LEN ); - int bContinue = sal_True; - int bEqSignFound = sal_False; + int bContinue = true; + int bEqSignFound = false; sal_Unicode cQuote = 0U; while( bContinue && IsParserWorking() ) { - int bNextCh = sal_True; + int bNextCh = true; switch( nNextCh ) { case '&': - bEqSignFound = sal_False; + bEqSignFound = false; if( bReadXMP ) sTmpBuffer.append( (sal_Unicode)'&' ); else @@ -465,8 +464,8 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( '#' == (nNextCh = GetNextChar()) ) { nNextCh = GetNextChar(); - const sal_Bool bIsHex( 'x' == nNextCh ); - const sal_Bool bIsDecOrHex( bIsHex || HTML_ISDIGIT(nNextCh) ); + const bool bIsHex( 'x' == nNextCh ); + const bool bIsDecOrHex( bIsHex || HTML_ISDIGIT(nNextCh) ); if ( bIsDecOrHex ) { if ( bIsHex ) @@ -639,7 +638,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) else if( IsParserWorking() ) { sTmpBuffer.append( (sal_Unicode)'&' ); - bNextCh = sal_False; + bNextCh = false; break; } @@ -674,15 +673,15 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) rInput.Seek( nStreamPos-(sal_uInt32)GetCharSize() ); nlLinePos = nLinePos-1; ClearTxtConvContext(); - bReadNextChar = sal_True; + bReadNextChar = true; } - bNextCh = sal_False; + bNextCh = false; } } break; case '=': if( '>'==cBreak && !cQuote ) - bEqSignFound = sal_True; + bEqSignFound = true; sTmpBuffer.append( nNextCh ); break; @@ -707,13 +706,13 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) cQuote = 0U; } sTmpBuffer.append( nNextCh ); - bEqSignFound = sal_False; + bEqSignFound = false; break; case sal_Unicode(EOF): if( rInput.IsEof() ) { - bContinue = sal_False; + bContinue = false; } else { @@ -722,11 +721,11 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) break; case '<': - bEqSignFound = sal_False; + bEqSignFound = false; if( '>'==cBreak ) sTmpBuffer.append( nNextCh ); else - bContinue = sal_False; // break, String zusammen + bContinue = false; // break, String zusammen break; case '\f': @@ -738,7 +737,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) else { // otherwise it's a separate token. - bContinue = sal_False; + bContinue = false; } break; @@ -752,7 +751,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) } else if( bReadListing || bReadXMP || bReadPRE || bReadTextArea ) { - bContinue = sal_False; + bContinue = false; break; } // Reduce sequence of CR/LF/BLANK/TAB to a single blank @@ -761,7 +760,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( '\t'==nNextCh && bReadPRE && '>'!=cBreak ) { // In <PRE>: Tabs nach oben durchreichen - bContinue = sal_False; + bContinue = false; break; } // no break @@ -797,15 +796,15 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) } while ( ' ' == nNextCh || '\t' == nNextCh || '\r' == nNextCh || '\n' == nNextCh || '\x0b' == nNextCh ); - bNextCh = sal_False; + bNextCh = false; } break; default: - bEqSignFound = sal_False; + bEqSignFound = false; if( (nNextCh==cBreak && !cQuote) || (sal_uLong(aToken.Len()) + MAX_LEN) > sal_uLong(STRING_MAXLEN & ~1 )) - bContinue = sal_False; + bContinue = false; else { do { @@ -830,7 +829,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) return HTML_TEXTTOKEN; } } while( HTML_ISALPHA( nNextCh ) || HTML_ISDIGIT( nNextCh ) ); - bNextCh = sal_False; + bNextCh = false; } } @@ -855,21 +854,21 @@ int HTMLParser::_GetNextRawToken() { // During the last execution we already found the end token, // thus we don't have to search it again. - bReadScript = sal_False; - bReadStyle = sal_False; + bReadScript = false; + bReadStyle = false; aEndToken.Erase(); - bEndTokenFound = sal_False; + bEndTokenFound = false; return 0; } // Default return value: HTML_RAWDATA - int bContinue = sal_True; + int bContinue = true; int nToken = HTML_RAWDATA; SaveState( 0 ); while( bContinue && IsParserWorking() ) { - int bNextCh = sal_True; + int bNextCh = true; switch( nNextCh ) { case '<': @@ -885,10 +884,10 @@ int HTMLParser::_GetNextRawToken() sal_uLong nLinePos = GetLinePos(); // Start of an end token? - int bOffState = sal_False; + int bOffState = false; if( '/' == (nNextCh = GetNextChar()) ) { - bOffState = sal_True; + bOffState = true; nNextCh = GetNextChar(); } else if( '!' == nNextCh ) @@ -909,7 +908,7 @@ int HTMLParser::_GetNextRawToken() sal::static_int_cast< xub_StrLen >( sTmpBuffer.getLength()) ); aTok.ToUpperAscii(); - sal_Bool bDone = sal_False; + bool bDone = false; if( bReadScript || aEndToken.Len() ) { if( !bReadComment ) @@ -917,7 +916,7 @@ int HTMLParser::_GetNextRawToken() if( aTok.CompareToAscii( OOO_STRING_SVTOOLS_HTML_comment, 3 ) == COMPARE_EQUAL ) { - bReadComment = sal_True; + bReadComment = true; } else { @@ -933,7 +932,7 @@ int HTMLParser::_GetNextRawToken() aTok.Copy( aTok.Len()-2 ).EqualsAscii( "--" ) ) { // End of comment of style <!-----> - bReadComment = sal_False; + bReadComment = false; } } else @@ -954,15 +953,15 @@ int HTMLParser::_GetNextRawToken() // Done! Return the previously read string (if requested) // and continue. - bContinue = sal_False; + bContinue = false; // nToken==0 means, _GetNextToken continues to read if( !aToken.Len() && (bReadStyle || bReadScript) ) { // Immediately close environment (or context?) // and parse the end token - bReadScript = sal_False; - bReadStyle = sal_False; + bReadScript = false; + bReadStyle = false; aEndToken.Erase(); nToken = 0; } @@ -970,7 +969,7 @@ int HTMLParser::_GetNextRawToken() { // Keep bReadScript/bReadStyle alive // and parse end token during next execution - bEndTokenFound = sal_True; + bEndTokenFound = true; } // Move backwards in stream to '<' @@ -990,7 +989,7 @@ int HTMLParser::_GetNextRawToken() if( bOffState ) aToken += (sal_Unicode)'/'; - bNextCh = sal_False; + bNextCh = false; } } break; @@ -998,11 +997,11 @@ int HTMLParser::_GetNextRawToken() sTmpBuffer.append( nNextCh ); if( bReadComment ) { - sal_Bool bTwoMinus = sal_False; + bool bTwoMinus = false; nNextCh = GetNextChar(); while( '-' == nNextCh && IsParserWorking() ) { - bTwoMinus = sal_True; + bTwoMinus = true; if( MAX_LEN == sTmpBuffer.getLength() ) aToken += String(sTmpBuffer.makeStringAndClear()); @@ -1011,9 +1010,9 @@ int HTMLParser::_GetNextRawToken() } if( '>' == nNextCh && IsParserWorking() && bTwoMinus ) - bReadComment = sal_False; + bReadComment = false; - bNextCh = sal_False; + bNextCh = false; } break; @@ -1022,27 +1021,27 @@ int HTMLParser::_GetNextRawToken() nNextCh = GetNextChar(); if( nNextCh=='\n' ) nNextCh = GetNextChar(); - bContinue = sal_False; + bContinue = false; break; case '\n': // \n closes the current text token (even if it's empty) nNextCh = GetNextChar(); - bContinue = sal_False; + bContinue = false; break; case sal_Unicode(EOF): // eof closes the current text token and behaves like having read // an end token if( rInput.IsEof() ) { - bContinue = sal_False; + bContinue = false; if( aToken.Len() || sTmpBuffer.getLength() ) { - bEndTokenFound = sal_True; + bEndTokenFound = true; } else { - bReadScript = sal_False; - bReadStyle = sal_False; + bReadScript = false; + bReadStyle = false; aEndToken.Erase(); nToken = 0; } @@ -1078,13 +1077,13 @@ int HTMLParser::_GetNextToken() sSaveToken.Erase(); // Delete options - if( pOptions->Count() ) - pOptions->DeleteAndDestroy( 0, pOptions->Count() ); + if (!maOptions.empty()) + maOptions.clear(); if( !IsParserWorking() ) // Don't continue if already an error occured return 0; - sal_Bool bReadNextCharSave = bReadNextChar; + bool bReadNextCharSave = bReadNextChar; if( bReadNextChar ) { DBG_ASSERT( !bEndTokenFound, @@ -1092,7 +1091,7 @@ int HTMLParser::_GetNextToken() nNextCh = GetNextChar(); if( !IsParserWorking() ) // Don't continue if already an error occured return 0; - bReadNextChar = sal_False; + bReadNextChar = false; } if( bReadScript || bReadStyle || aEndToken.Len() ) @@ -1103,7 +1102,7 @@ int HTMLParser::_GetNextToken() } do { - int bNextCh = sal_True; + int bNextCh = true; switch( nNextCh ) { case '<': @@ -1112,10 +1111,10 @@ int HTMLParser::_GetNextToken() sal_uLong nLineNr = GetLineNr(); sal_uLong nLinePos = GetLinePos(); - int bOffState = sal_False; + int bOffState = false; if( '/' == (nNextCh = GetNextChar()) ) { - bOffState = sal_True; + bOffState = true; nNextCh = GetNextChar(); } if( HTML_ISALPHA( nNextCh ) || '!'==nNextCh ) @@ -1178,7 +1177,7 @@ int HTMLParser::_GetNextToken() sal_uLong nCLinePos = 0; xub_StrLen nCStrLen = 0; - sal_Bool bDone = sal_False; + bool bDone = false; // Read until closing -->. If not found restart at first > while( !bDone && !rInput.IsEof() && IsParserWorking() ) { @@ -1241,7 +1240,7 @@ int HTMLParser::_GetNextToken() aToken = '<'; nRet = HTML_TEXTTOKEN; nNextCh = GetNextChar(); - bNextCh = sal_False; + bNextCh = false; break; } } @@ -1266,7 +1265,7 @@ int HTMLParser::_GetNextToken() aToken = '<'; nRet = HTML_TEXTTOKEN; nNextCh = GetNextChar(); - bNextCh = sal_False; + bNextCh = false; break; } if( SVPAR_PENDING == eState ) @@ -1280,7 +1279,7 @@ int HTMLParser::_GetNextToken() sal_uLong nCStreamPos = rInput.Tell(); sal_uLong nCLineNr = GetLineNr(), nCLinePos = GetLinePos(); - sal_Bool bDone = sal_False; + bool bDone = false; // Read until closing %>. If not found restart at first >. while( !bDone && !rInput.IsEof() && IsParserWorking() ) { @@ -1312,7 +1311,7 @@ int HTMLParser::_GetNextToken() { aToken = '<'; nRet = HTML_TEXTTOKEN; - bNextCh = sal_False; + bNextCh = false; break; } } @@ -1323,31 +1322,31 @@ int HTMLParser::_GetNextToken() switch( nRet ) { case HTML_TEXTAREA_ON: - bReadTextArea = sal_True; + bReadTextArea = true; break; case HTML_TEXTAREA_OFF: - bReadTextArea = sal_False; + bReadTextArea = false; break; case HTML_SCRIPT_ON: if( !bReadTextArea ) - bReadScript = sal_True; + bReadScript = true; break; case HTML_SCRIPT_OFF: if( !bReadTextArea ) { - bReadScript = sal_False; + bReadScript = false; // JavaScript might modify the stream, // thus the last character has to be read again. - bReadNextChar = sal_True; - bNextCh = sal_False; + bReadNextChar = true; + bNextCh = false; } break; case HTML_STYLE_ON: - bReadStyle = sal_True; + bReadStyle = true; break; case HTML_STYLE_OFF: - bReadStyle = sal_False; + bReadStyle = false; break; } } @@ -1380,7 +1379,7 @@ int HTMLParser::_GetNextToken() if( ( '\n' != nNextCh || '\r' != c ) && ( '\r' != nNextCh || '\n' != c ) ) { - bNextCh = sal_False; + bNextCh = false; nNextCh = c; } nRet = HTML_NEWPARA; @@ -1407,7 +1406,7 @@ scan_text: if( !bNextCh && eState == SVPAR_PENDING ) { eState = SVPAR_WORKING; - bReadNextChar = sal_True; + bReadNextChar = true; } break; @@ -1418,7 +1417,7 @@ scan_text: nNextCh = GetNextChar(); if( SVPAR_PENDING == eState && nRet && HTML_TEXTTOKEN != nRet ) { - bReadNextChar = sal_True; + bReadNextChar = true; eState = SVPAR_WORKING; } } @@ -1435,15 +1434,15 @@ void HTMLParser::UnescapeToken() { xub_StrLen nPos=0; - sal_Bool bEscape = sal_False; + bool bEscape = false; while( nPos < aToken.Len() ) { - sal_Bool bOldEscape = bEscape; - bEscape = sal_False; + bool bOldEscape = bEscape; + bEscape = false; if( '\\'==aToken.GetChar(nPos) && !bOldEscape ) { aToken.Erase( nPos, 1 ); - bEscape = sal_True; + bEscape = true; } else { @@ -1452,12 +1451,12 @@ void HTMLParser::UnescapeToken() } } -const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const +const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const { // If the options for the current token have already been returned, // return them once again. - if( pOptions->Count() ) - return pOptions; + if (!maOptions.empty()) + return maOptions; xub_StrLen nPos = 0; while( nPos < aToken.Len() ) @@ -1486,7 +1485,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const nToken = GetHTMLOption( sNameUpperCase ); // Name is ready DBG_ASSERTWARNING( nToken!=HTML_O_UNKNOWN, "GetOption: unknown HTML option" ); - sal_Bool bStripCRLF = (nToken < HTML_OPTION_SCRIPT_START || + bool bStripCRLF = (nToken < HTML_OPTION_SCRIPT_START || nToken >= HTML_OPTION_SCRIPT_END) && (!pNoConvertToken || nToken != *pNoConvertToken); @@ -1513,12 +1512,12 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const { sal_Unicode cEnd = cChar; nPos++; nStt++; - sal_Bool bDone = sal_False; - sal_Bool bEscape = sal_False; + bool bDone = false; + bool bEscape = false; while( nPos < aToken.Len() && !bDone ) { - sal_Bool bOldEscape = bEscape; - bEscape = sal_False; + bool bOldEscape = bEscape; + bEscape = false; cChar = aToken.GetChar(nPos); switch( cChar ) { @@ -1537,7 +1536,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const else { ((String &)aToken).Erase( nPos, 1 ); - bEscape = sal_True; + bEscape = true; } break; case '"': @@ -1557,12 +1556,12 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const else { // More liberal than the standard: allow all printable characters - sal_Bool bEscape = sal_False; - sal_Bool bDone = sal_False; + bool bEscape = false; + bool bDone = false; while( nPos < aToken.Len() && !bDone ) { - sal_Bool bOldEscape = bEscape; - bEscape = sal_False; + bool bOldEscape = bEscape; + bEscape = false; sal_Unicode c = aToken.GetChar(nPos); switch( c ) { @@ -1575,7 +1574,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const case '\t': case '\r': case '\n': - bDone = sal_True; + bDone = true; break; case '\\': @@ -1586,7 +1585,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const else { ((String &)aToken).Erase( nPos, 1 ); - bEscape = sal_True; + bEscape = true; } break; @@ -1594,7 +1593,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const if( HTML_ISPRINTABLE( c ) ) nPos++, nLen++; else - bDone = sal_True; + bDone = true; break; } } @@ -1606,11 +1605,10 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const } // Token is known and can be saved - HTMLOption *pOption = - new HTMLOption( - sal::static_int_cast< sal_uInt16 >(nToken), sName, aValue ); + std::auto_ptr<HTMLOption> pOption( + new HTMLOption(sal::static_int_cast<sal_uInt16>(nToken), sName, aValue)); - pOptions->Insert( pOption, pOptions->Count() ); + maOptions.push_back(pOption); } else @@ -1618,7 +1616,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const nPos++; } - return pOptions; + return maOptions; } int HTMLParser::FilterPRE( int nToken ) @@ -1799,7 +1797,7 @@ int HTMLParser::FilterPRE( int nToken ) break; } - bPre_IgnoreNewPara = sal_False; + bPre_IgnoreNewPara = false; return nToken; } @@ -1840,7 +1838,7 @@ int HTMLParser::FilterXMP( int nToken ) break; } - bPre_IgnoreNewPara = sal_False; + bPre_IgnoreNewPara = false; return nToken; } @@ -1868,13 +1866,13 @@ int HTMLParser::FilterListing( int nToken ) break; } - bPre_IgnoreNewPara = sal_False; + bPre_IgnoreNewPara = false; return nToken; } bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader, - sal_Bool bSwitchToUCS2, + bool bSwitchToUCS2, rtl_TextEncoding eEnc ) { // If the string matches one of the following regular expressions then @@ -1886,14 +1884,14 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader, // // where the underlined subexpression has to be a HTML token ByteString sCmp; - sal_Bool bUCS2B = sal_False; + bool bUCS2B = false; if( bSwitchToUCS2 ) { if( 0xfeU == (sal_uChar)pHeader[0] && 0xffU == (sal_uChar)pHeader[1] ) { eEnc = RTL_TEXTENCODING_UCS2; - bUCS2B = sal_True; + bUCS2B = true; } else if( 0xffU == (sal_uChar)pHeader[0] && 0xfeU == (sal_uChar)pHeader[1] ) @@ -1911,7 +1909,7 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader, ) { if( 0xfe == (sal_uChar)pHeader[0] ) - bUCS2B = sal_True; + bUCS2B = true; xub_StrLen nLen; for( nLen = 2; @@ -1944,7 +1942,7 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader, // A HTML document must have a '<' in the first line xub_StrLen nStart = sCmp.Search( '<' ); if( STRING_NOTFOUND == nStart ) - return sal_False; + return false; nStart++; // followed by arbitrary characters followed by a blank or '>' @@ -1958,7 +1956,7 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader, // If the document ends after < it's no HTML if( nPos==nStart ) - return sal_False; + return false; // the string following '<' has to be a known HTML token. // <DIR> is not interpreted as HTML. Otherwise the output of the DOS command "DIR" @@ -1966,30 +1964,30 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader, String sTest( sCmp.Copy( nStart, nPos-nStart ), RTL_TEXTENCODING_ASCII_US ); int nTok = GetHTMLToken( sTest ); if( 0 != nTok && HTML_DIRLIST_ON != nTok ) - return sal_True; + return true; // "<!" at the very beginning of the file? if( nStart == 1 && '!' == sCmp.GetChar( 1 ) ) - return sal_True; + return true; // <HTML> somewhere in the first 80 characters of the document nStart = sCmp.Search( OOO_STRING_SVTOOLS_HTML_html ); if( nStart!=STRING_NOTFOUND && nStart>0 && '<'==sCmp.GetChar(nStart-1) && nStart+4 < sCmp.Len() && '>'==sCmp.GetChar(nStart+4) ) - return sal_True; + return true; // Else it's rather not a HTML document - return sal_False; + return false; } -sal_Bool HTMLParser::InternalImgToPrivateURL( String& rURL ) +bool HTMLParser::InternalImgToPrivateURL( String& rURL ) { if( rURL.Len() < 19 || 'i' != rURL.GetChar(0) || rURL.CompareToAscii( OOO_STRING_SVTOOLS_HTML_internal_gopher, 9 ) != COMPARE_EQUAL ) - return sal_False; + return false; - sal_Bool bFound = sal_False; + bool bFound = false; if( rURL.CompareToAscii( OOO_STRING_SVTOOLS_HTML_internal_gopher,16) == COMPARE_EQUAL ) { @@ -2093,32 +2091,32 @@ void HTMLParser::AddMetaUserDefined( ::rtl::OUString const & ) bool HTMLParser::ParseMetaOptionsImpl( const uno::Reference<document::XDocumentProperties> & i_xDocProps, SvKeyValueIterator *i_pHTTPHeader, - const HTMLOptions *i_pOptions, + const HTMLOptions& aOptions, rtl_TextEncoding& o_rEnc ) { String aName, aContent; sal_uInt16 nAction = HTML_META_NONE; bool bHTTPEquiv = false, bChanged = false; - for ( sal_uInt16 i = i_pOptions->Count(); i; ) + for ( size_t i = aOptions.size(); i; ) { - const HTMLOption *pOption = (*i_pOptions)[ --i ]; - switch ( pOption->GetToken() ) + const HTMLOption& aOption = aOptions[--i]; + switch ( aOption.GetToken() ) { case HTML_O_NAME: - aName = pOption->GetString(); + aName = aOption.GetString(); if ( HTML_META_NONE==nAction ) { - pOption->GetEnum( nAction, aHTMLMetaNameTable ); + aOption.GetEnum( nAction, aHTMLMetaNameTable ); } break; case HTML_O_HTTPEQUIV: - aName = pOption->GetString(); - pOption->GetEnum( nAction, aHTMLMetaNameTable ); + aName = aOption.GetString(); + aOption.GetEnum( nAction, aHTMLMetaNameTable ); bHTTPEquiv = true; break; case HTML_O_CONTENT: - aContent = pOption->GetString(); + aContent = aOption.GetString(); break; } } @@ -2289,7 +2287,7 @@ rtl_TextEncoding HTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPH if( pHTTPHeader ) { SvKeyValue aKV; - for( sal_Bool bCont = pHTTPHeader->GetFirst( aKV ); bCont; + for( bool bCont = pHTTPHeader->GetFirst( aKV ); bCont; bCont = pHTTPHeader->GetNext( aKV ) ) { if( aKV.GetKey().EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) ) @@ -2304,15 +2302,14 @@ rtl_TextEncoding HTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPH return eRet; } -sal_Bool HTMLParser::SetEncodingByHTTPHeader( - SvKeyValueIterator *pHTTPHeader ) +bool HTMLParser::SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader ) { - sal_Bool bRet = sal_False; + bool bRet = false; rtl_TextEncoding eEnc = HTMLParser::GetEncodingByHttpHeader( pHTTPHeader ); if(RTL_TEXTENCODING_DONTKNOW != eEnc) { SetSrcEncoding( eEnc ); - bRet = sal_True; + bRet = true; } return bRet; } |