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


added the SAL_N_ELEMENTS to construction and destruction, removed unused
code and includes

I removed some commented OSL_TRACE statements... but were they really needed
still?

best wishes
René

On Sat, Oct 16, 2010 at 6:47 PM, René Kjellerup
<rk.katana.steel@gmail.com>wrote:

Wow... a simple symbol mistake of the brain, all the includes seemed to
have hxx extension so....

It complies now pulling a diff together.
 On Oct 16, 2010 3:30 PM, "René Kjellerup" <rk.katana.steel@gmail.com>
wrote:
Okay I've now a beginning of a build of chart2 and I've added:
#include <sal/macros.h>
To the file, but the compilation says that the file is not found,
So where do one add the sal depends to the module? (or simply the
includes)
On Oct 14, 2010 10:11 PM, "Michael Meeks" <michael.meeks@novell.com>
wrote:
Hi Rene,

On Thu, 2010-10-14 at 19:05 +0200, René Kjellerup wrote:
I've looked through the calc's chart2 source and translated and spell
corrected a few comments in the view code

Cool - nice work thanks for that; I pushed it.

in the ChartItemPool I've added the use of SAL_N_ELEMENTS(array) too

Yep; the slight issue here though is that we need to re-arrange the
code a bit. Your changes would work, but only if SCH_ATTR_START == 0 -
since the range is offset otherwise. It would work if we had:

- for( i = SCHATTR_START; i <= SCHATTR_END; i++ )
+ for( i = 0; i <= SAL_N_ELEMENTS(pItemInfos); i++ )
{
- pItemInfos[i - SCHATTR_START]._nSID = 0;
+ pItemInfos[i]._nSID = 0;

etc. ;-) it could perhaps be re-factored like that if you want, but
prolly best to compile/test it.

Anyhow - thanks for your work ! looking forward to what you work on
next - is there any area of LibreOffice you're particularly interested
in contributing to ?

All the best,

Michael.

--
michael.meeks@novell.com <><, Pseudo Engineer, itinerant idiot






-- 
-- as life grows older, I gain experience.
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx 
b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index 86871a5..ec62da1 100644
--- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -29,15 +29,11 @@
 
 #include <sfx2/sfxdefs.hxx>
 
-/*
-// header for SID_OBJ1_START
-#include <sfx2/sfxsids.hrc>
-*/
-
 // ============================================================
 // SCHATTR
 // ============================================================
 
+// can't this be changed to 0?
 #define SCHATTR_START                                          1
 
 #define SCHATTR_DATADESCR_START                                SCHATTR_START
@@ -56,8 +52,7 @@
 #define SCHATTR_LEGEND_END                                     SCHATTR_LEGEND_POS
 
 #define SCHATTR_TEXT_START                                     (SCHATTR_LEGEND_END + 1)
-// #define SCHATTR_TEXT_ORIENT                                 SCHATTR_TEXT_START
-// name changed:
+// name changed, was SCHATTR_TEXT_ORIENT:
 #define SCHATTR_TEXT_STACKED                           SCHATTR_TEXT_START
 #define SCHATTR_TEXT_ORDER                                     (SCHATTR_TEXT_START + 1)
 #define SCHATTR_TEXT_END                                       SCHATTR_TEXT_ORDER
@@ -124,7 +119,7 @@
 
 #define SCHATTR_TEXT2_START                 ( SCHATTR_STAT_END + 1)
 #define SCHATTR_TEXT_DEGREES                ( SCHATTR_TEXT2_START   )
-#define SCHATTR_TEXT_OVERLAP                (SCHATTR_TEXT2_START +1)
+#define SCHATTR_TEXT_OVERLAP                ( SCHATTR_TEXT2_START +1 )
 #define SCHATTR_TEXT2_END                   ( SCHATTR_TEXT_OVERLAP )
 
 // --------------------------------------------------------
@@ -153,7 +148,7 @@
 // --------------------------------------------------------------------------
 
 #define SCHATTR_AXIS                                   (SCHATTR_STYLE_END + 1)// see chtmodel.hxx 
defines CHART_AXIS_PRIMARY_X, etc.
-//Ummappen:
+//Re-mapped:
 #define SCHATTR_AXIS_START                             (SCHATTR_AXIS + 1)
 #define SCHATTR_AXIS_AUTO_MIN                   SCHATTR_AXIS_START
 #define SCHATTR_AXIS_MIN                               (SCHATTR_AXIS_START + 1)
@@ -167,7 +162,7 @@
 #define SCHATTR_AXIS_LOGARITHM                 (SCHATTR_AXIS_START + 8)
 #define SCHATTR_AXIS_AUTO_ORIGIN               (SCHATTR_AXIS_START + 9)
 #define SCHATTR_AXIS_ORIGIN                            (SCHATTR_AXIS_START + 10)
-//Neu:
+//New:
 #define SCHATTR_AXIS_TICKS                             (SCHATTR_AXIS_START + 11)
 #define SCHATTR_AXIS_NUMFMT                            (SCHATTR_AXIS_START + 12)
 #define SCHATTR_AXIS_NUMFMTPERCENT             (SCHATTR_AXIS_START + 13)
@@ -241,8 +236,8 @@
 #define CHART_AXIS_Z    2
 
 // values for SCHATTR_STYLE_SHAPE items
-#define CHART_SHAPE3D_IGNORE  -2 //intern! (GetChartShapeStyle()!)
-#define CHART_SHAPE3D_ANY        -1 //undefinierter Typ (GetChartShapeStyle()!)
+#define CHART_SHAPE3D_IGNORE  -2 //internal! (GetChartShapeStyle()!)
+#define CHART_SHAPE3D_ANY        -1 //undefined type (GetChartShapeStyle()!)
 #define CHART_SHAPE3D_SQUARE   0
 #define CHART_SHAPE3D_CYLINDER 1
 #define CHART_SHAPE3D_CONE     2
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index c9475e9..d3082c9 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -44,6 +44,7 @@
 #include <svl/svstdarr.hxx>
 #include <editeng/editids.hrc>
 #include <svx/svxids.hrc>
+#include <sal/macros.h>
 
 namespace chart
 {
@@ -51,7 +52,6 @@ namespace chart
 ChartItemPool::ChartItemPool():
         SfxItemPool( String( RTL_CONSTASCII_USTRINGPARAM( "ChartItemPool" )), SCHATTR_START, 
SCHATTR_END, NULL, NULL )
 {
-//     OSL_TRACE( "SCH: CTOR: ChartItemPool" );
     /**************************************************************************
     * PoolDefaults
     **************************************************************************/
@@ -68,7 +68,6 @@ ChartItemPool::ChartItemPool():
     ppPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE    - SCHATTR_START] = new 
SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE);
 
     ppPoolDefaults[SCHATTR_LEGEND_POS               - SCHATTR_START] = new SvxChartLegendPosItem( 
CHLEGEND_RIGHT, SCHATTR_LEGEND_POS );
-//  ppPoolDefaults[SCHATTR_TEXT_ORIENT              - SCHATTR_START] = new SvxChartTextOrientItem;
     ppPoolDefaults[SCHATTR_TEXT_STACKED             - SCHATTR_START] = new 
SfxBoolItem(SCHATTR_TEXT_STACKED,FALSE);
     ppPoolDefaults[SCHATTR_TEXT_ORDER               - SCHATTR_START] = new 
SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE, SCHATTR_TEXT_ORDER);
 
@@ -145,7 +144,6 @@ ChartItemPool::ChartItemPool():
     ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new 
SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN);
     ppPoolDefaults[SCHATTR_AXIS_STEP_MAIN              - SCHATTR_START] = new SvxDoubleItem(0.0, 
SCHATTR_AXIS_STEP_MAIN);
     ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new 
SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP);
-//     ppPoolDefaults[SCHATTR_AXIS_STEP_HELP           - SCHATTR_START] = new SvxDoubleItem(0.0, 
SCHATTR_AXIS_STEP_HELP);
     // type changed from double to sal_Int32
     ppPoolDefaults[SCHATTR_AXIS_STEP_HELP              - SCHATTR_START] = new 
SfxInt32Item(SCHATTR_AXIS_STEP_HELP,0);
     ppPoolDefaults[SCHATTR_AXIS_LOGARITHM              - SCHATTR_START] = new 
SfxBoolItem(SCHATTR_AXIS_LOGARITHM);
@@ -201,11 +199,10 @@ ChartItemPool::ChartItemPool():
     **************************************************************************/
     pItemInfos = new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1];
 
-    USHORT i;
-    for( i = SCHATTR_START; i <= SCHATTR_END; i++ )
+    for(USHORT i = 0; i < SAL_N_ELEMENTS(pItemInfos); i++ )
     {
-        pItemInfos[i - SCHATTR_START]._nSID = 0;
-        pItemInfos[i - SCHATTR_START]._nFlags = SFX_ITEM_POOLABLE;
+        pItemInfos[i]._nSID = 0;
+        pItemInfos[i]._nFlags = SFX_ITEM_POOLABLE;
     }
 
     // slot ids differing from which ids
@@ -220,17 +217,15 @@ ChartItemPool::ChartItemPool():
 ChartItemPool::ChartItemPool(const ChartItemPool& rPool):
     SfxItemPool(rPool)
 {
-//     OSL_TRACE( "SCH: CTOR: ChartItemPool" );
 }
 
 ChartItemPool::~ChartItemPool()
 {
-//     OSL_TRACE( "SCH: DTOR: ChartItemPool" );
     Delete();
 
     delete[] pItemInfos;
 
-    const USHORT nMax = SCHATTR_END - SCHATTR_START + 1;
+    const USHORT nMax = SAL_N_ELEMENTS(ppPoolDefaults);
     for( USHORT i=0; i<nMax; ++i )
     {
         SetRefCount(*ppPoolDefaults[i], 0);

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.