Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


This patch is bringing up a small question:

I thought we were trying to standardize the code to use sal_* types
everywhere...

Can anyone confirm/deny that?

Regards,

Marc-André Laverdière
Software Security Scientist
Innovation Labs, Tata Consultancy Services
Hyderabad, India

On 07/27/2011 06:54 AM, Kohei Yoshida wrote:
 sw/source/filter/html/parcss1.cxx |    4 ++--
 sw/source/filter/html/parcss1.hxx |    3 +--
 sw/source/filter/html/svxcss1.cxx |   29 +++++++++--------------------
 sw/source/filter/html/svxcss1.hxx |   13 ++++---------
 4 files changed, 16 insertions(+), 33 deletions(-)

New commits:
commit 04113a04a20d758d914833fc22d646831478bf1b
Author: Kohei Yoshida <kyoshida@novell.com>
Date:   Tue Jul 26 21:18:06 2011 -0400

    Replace SV_*_PTRARR with boost::ptr_vector.

diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx
index 5c0955f..3f3ccde 100644
--- a/sw/source/filter/html/parcss1.cxx
+++ b/sw/source/filter/html/parcss1.cxx
@@ -1230,10 +1230,10 @@ sal_Bool CSS1Parser::ParseStyleOption( const String& rIn )
     return sal_True;
 }
 
-sal_Bool CSS1Parser::SelectorParsed( const CSS1Selector * /* pSelector */, sal_Bool /*bFirst*/ )
+bool CSS1Parser::SelectorParsed( CSS1Selector* /* pSelector */, bool /*bFirst*/ )
 {
     // Selektor loeschen
-    return sal_True;
+    return true;
 }
 
 sal_Bool CSS1Parser::DeclarationParsed( const String& /*rProperty*/,
diff --git a/sw/source/filter/html/parcss1.hxx b/sw/source/filter/html/parcss1.hxx
index 3a6fa46..5df550b 100644
--- a/sw/source/filter/html/parcss1.hxx
+++ b/sw/source/filter/html/parcss1.hxx
@@ -270,8 +270,7 @@ protected:
     // Deklaration. Wird sal_True zurueckgegeben, wird der Selektor
     // geloscht, sonst nicht.
     // Die Implementierung dieser Methode gibt nur sal_True zuruck.
-    virtual sal_Bool SelectorParsed( const CSS1Selector *pSelector,
-                                 sal_Bool bFirst );
+    virtual bool SelectorParsed( CSS1Selector* pSelector, bool bFirst );
 
     // Diese Methode wird fuer jede geparsete Property aufgerufen. Wird
     // sal_True zurueckgegeben wird der Selektor geloscht, sonst nicht.
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 2fcf673..93b5fad 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -71,11 +71,6 @@ typedef void (*FnParseCSS1Prop)( const CSS1Expression *pExpr,
                                  SvxCSS1PropertyInfo& rPropInfo,
                                  const SvxCSS1Parser& rParser );
 
-SV_IMPL_PTRARR( CSS1Selectors, CSS1Selector* )
-
-
-/*  */
-
 static CSS1PropertyEnum const aFontSizeTable[] =
 {
     { sCSS1_PV_xx_small,     0                                       },
@@ -720,31 +715,26 @@ sal_Bool SvxCSS1Parser::StyleParsed( const CSS1Selector * /*pSelector*/,
     return sal_True;
 }
 
-sal_Bool SvxCSS1Parser::SelectorParsed( const CSS1Selector *pSelector,
-                                    sal_Bool bFirst )
+bool SvxCSS1Parser::SelectorParsed( CSS1Selector *pSelector, bool bFirst )
 {
     if( bFirst )
     {
         OSL_ENSURE( pSheetItemSet, "Where is the Item-Set for Style-Sheets?" );
 
-        // Dieses ist der erste Selektor einer Rule, also muessen
-        // die bisher geparsten Items auf die Styles verteilt werden
-//           pSheetPropInfo->CreateBoxItem( *pSheetItemSet, GetDfltBorderDist() );
-        for( sal_uInt16 i=0; i<aSelectors.Count(); i++ )
+        for (size_t i = 0; i < aSelectors.size(); ++i)
         {
-            StyleParsed( aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
+            StyleParsed( &aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
         }
         pSheetItemSet->ClearItem();
         pSheetPropInfo->Clear();
 
         // und die naechste Rule vorbereiten
-        if( aSelectors.Count() )
-            aSelectors.DeleteAndDestroy( 0, aSelectors.Count() );
+        aSelectors.clear();
     }
 
-    aSelectors.C40_INSERT( CSS1Selector, pSelector, aSelectors.Count() );
+    aSelectors.push_back(pSelector);
 
-    return sal_False; // den Selektor haben wir gespeichert. Loeschen toedlich!
+    return false; // den Selektor haben wir gespeichert. Loeschen toedlich!
 }
 
 
@@ -840,14 +830,13 @@ sal_Bool SvxCSS1Parser::ParseStyleSheet( const String& rIn )
 
     sal_Bool bSuccess = CSS1Parser::ParseStyleSheet( rIn );
 
-    for( sal_uInt16 i=0; i<aSelectors.Count(); i++ )
+    for (size_t i = 0; i < aSelectors.size(); ++i)
     {
-        StyleParsed( aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
+        StyleParsed( &aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
     }
 
     // und etwas aufrauemen
-    if( aSelectors.Count() )
-        aSelectors.DeleteAndDestroy( 0, aSelectors.Count() );
+    aSelectors.clear();
     pSheetItemSet->ClearItem();
     pSheetPropInfo->Clear();
 
diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx
index 95d682d..b34c0ba 100644
--- a/sw/source/filter/html/svxcss1.hxx
+++ b/sw/source/filter/html/svxcss1.hxx
@@ -39,6 +39,8 @@
 #include <rtl/textenc.h>
 #include "parcss1.hxx"
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 class SfxItemPool;
 class SvxBoxItem;
 class FontList;
@@ -93,21 +95,14 @@ enum SvxCSS1PageBreak
 #define CSS1_SCRIPT_CTL      0x04
 #define CSS1_SCRIPT_ALL              0x07
 
-/*  */
-
 struct CSS1PropertyEnum
 {
     const sal_Char *pName;   // Wert einer Property
     sal_uInt16 nEnum;                        // und der dazugehoerige Wert eines Enums
 };
 
-
-/*  */
-
 namespace editeng { class SvxBorderLine; }
 
-SV_DECL_PTRARR_DEL( CSS1Selectors, CSS1Selector*, 1, 1 )
-
 #define SVX_CSS1_BORDERINFO_WIDTH 1
 #define SVX_CSS1_BORDERINFO_COLOR 2
 #define SVX_CSS1_BORDERINFO_STYLE 4
@@ -227,6 +222,7 @@ inline sal_Bool operator<( const SvxCSS1MapEntry& rE1,    const 
SvxCSS1MapEntry& rE
 
 class SvxCSS1Parser : public CSS1Parser
 {
+    typedef ::boost::ptr_vector<CSS1Selector> CSS1Selectors;
     CSS1Selectors aSelectors;        // Liste der "offenen" Selectoren
 
     SvxCSS1Map aIds;
@@ -277,8 +273,7 @@ protected:
     // zuletzt angelegten Styles kopiert.
     // Diese Methode sollte in abgleiteten Parsern nicht mehr
     // ueberladen werden!
-    virtual sal_Bool SelectorParsed( const CSS1Selector *pSelector,
-                                 sal_Bool bFirst );
+    virtual bool SelectorParsed( CSS1Selector *pSelector, bool bFirst );
 
     // Diese Methode wird fuer jede geparste Property aufgerufen
     // sie fuegt das Item in den ItemSet 'pItemSet' ein
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.