diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-04-16 12:37:03 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-04-16 12:38:23 +0200 |
commit | 0fcab91da2ea6531289aaf01c8c061249f9d6a50 (patch) | |
tree | 5f9389bedbba9d142d548c5f6950a38eed13e6af /sd | |
parent | Updated core (diff) | |
download | core-0fcab91da2ea6531289aaf01c8c061249f9d6a50.tar.gz core-0fcab91da2ea6531289aaf01c8c061249f9d6a50.zip |
Counting is hard (thanks to -fsanitize=address for pointing it out)
Change-Id: I665125d61c4bae5cb52b29cfa3af1e3c4b6d4333
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/app/optsitem.cxx | 211 |
1 files changed, 107 insertions, 104 deletions
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx index a624ac8f1438..f6277e0fc818 100644 --- a/sd/source/ui/app/optsitem.cxx +++ b/sd/source/ui/app/optsitem.cxx @@ -232,34 +232,36 @@ sal_Bool SdOptionsLayout::operator==( const SdOptionsLayout& rOpt ) const void SdOptionsLayout::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const { - static const char* aPropNamesMetric[] = - { - "Display/Ruler", - "Display/Bezier", - "Display/Contour", - "Display/Guide", - "Display/Helpline", - "Other/MeasureUnit/Metric", - "Other/TabStop/Metric" - }; - - static const char* aPropNamesNonMetric[] = - { - "Display/Ruler", - "Display/Bezier", - "Display/Contour", - "Display/Guide", - "Display/Helpline", - "Other/MeasureUnit/NonMetric", - "Other/TabStop/NonMetric" - }; - - rCount = 7; - if( isMetricSystem() ) + { + static const char* aPropNamesMetric[] = + { + "Display/Ruler", + "Display/Bezier", + "Display/Contour", + "Display/Guide", + "Display/Helpline", + "Other/MeasureUnit/Metric", + "Other/TabStop/Metric" + }; ppNames = aPropNamesMetric; + rCount = SAL_N_ELEMENTS(aPropNamesMetric); + } else + { + static const char* aPropNamesNonMetric[] = + { + "Display/Ruler", + "Display/Bezier", + "Display/Contour", + "Display/Guide", + "Display/Helpline", + "Other/MeasureUnit/NonMetric", + "Other/TabStop/NonMetric" + }; ppNames = aPropNamesNonMetric; + rCount = SAL_N_ELEMENTS(aPropNamesNonMetric); + } } @@ -402,7 +404,7 @@ void SdOptionsContents::GetPropNameArray( const char**& ppNames, sal_uLong& rCou "Display/TextPlaceholder" }; - rCount = 4; + rCount = SAL_N_ELEMENTS(aPropNames); ppNames = aPropNames; } @@ -580,7 +582,7 @@ void SdOptionsMisc::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) "Start/EnablePresenterScreen" }; - rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 27 : 14 ); + rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? SAL_N_ELEMENTS(aPropNames) : 14 ); ppNames = aPropNames; } @@ -874,7 +876,7 @@ void SdOptionsSnap::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) "Position/PointReduction" }; - rCount = 10; + rCount = SAL_N_ELEMENTS(aPropNames); ppNames = aPropNames; } @@ -1036,7 +1038,7 @@ void SdOptionsZoom::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) "ScaleY" }; - rCount = ( GetConfigId() == SDCFG_DRAW ) ? 2 : 0; + rCount = ( GetConfigId() == SDCFG_DRAW ) ? SAL_N_ELEMENTS(aPropNames) : 0; ppNames = aPropNames; } @@ -1130,40 +1132,42 @@ sal_Bool SdOptionsGrid::operator==( const SdOptionsGrid& rOpt ) const void SdOptionsGrid::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const { - static const char* aPropNamesMetric[] = - { - "Resolution/XAxis/Metric", - "Resolution/YAxis/Metric", - "Subdivision/XAxis", - "Subdivision/YAxis", - "SnapGrid/XAxis/Metric", - "SnapGrid/YAxis/Metric", - "Option/SnapToGrid", - "Option/Synchronize", - "Option/VisibleGrid", - "SnapGrid/Size" - }; - - static const char* aPropNamesNonMetric[] = - { - "Resolution/XAxis/NonMetric", - "Resolution/YAxis/NonMetric", - "Subdivision/XAxis", - "Subdivision/YAxis", - "SnapGrid/XAxis/NonMetric", - "SnapGrid/YAxis/NonMetric", - "Option/SnapToGrid", - "Option/Synchronize", - "Option/VisibleGrid", - "SnapGrid/Size" - }; - - rCount = 10; - if( isMetricSystem() ) + { + static const char* aPropNamesMetric[] = + { + "Resolution/XAxis/Metric", + "Resolution/YAxis/Metric", + "Subdivision/XAxis", + "Subdivision/YAxis", + "SnapGrid/XAxis/Metric", + "SnapGrid/YAxis/Metric", + "Option/SnapToGrid", + "Option/Synchronize", + "Option/VisibleGrid", + "SnapGrid/Size" + }; ppNames = aPropNamesMetric; + rCount = SAL_N_ELEMENTS(aPropNamesMetric); + } else + { + static const char* aPropNamesNonMetric[] = + { + "Resolution/XAxis/NonMetric", + "Resolution/YAxis/NonMetric", + "Subdivision/XAxis", + "Subdivision/YAxis", + "SnapGrid/XAxis/NonMetric", + "SnapGrid/YAxis/NonMetric", + "Option/SnapToGrid", + "Option/Synchronize", + "Option/VisibleGrid", + "SnapGrid/Size" + }; ppNames = aPropNamesNonMetric; + rCount = SAL_N_ELEMENTS(aPropNamesNonMetric); + } } @@ -1333,58 +1337,57 @@ sal_Bool SdOptionsPrint::operator==( const SdOptionsPrint& rOpt ) const void SdOptionsPrint::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const { - static const char* aDrawPropNames[] = - { - "Other/Date", - "Other/Time", - "Other/PageName", - "Other/HiddenPage", - "Page/PageSize", - "Page/PageTile", - // bWarningPrinter - // bWarningSize - // bWarningOrientation - "Page/Booklet", - "Page/BookletFront", - "Page/BookletBack", - // bCutPage - "Other/FromPrinterSetup", - "Other/Quality", - "Content/Drawing", - }; - static const char* aImpressPropNames[] = - { - "Other/Date", - "Other/Time", - "Other/PageName", - "Other/HiddenPage", - "Page/PageSize", - "Page/PageTile", - // bWarningPrinter - // bWarningSize - // bWarningOrientation - "Page/Booklet", - "Page/BookletFront", - "Page/BookletBack", - // bCutPage - "Other/FromPrinterSetup", - "Other/Quality", - "Content/Presentation", - "Content/Note", - "Content/Handout", - "Content/Outline", - "Other/HandoutHorizontal", - "Other/PagesPerHandout" - }; - if( GetConfigId() == SDCFG_IMPRESS ) { - rCount = 17; + static const char* aImpressPropNames[] = + { + "Other/Date", + "Other/Time", + "Other/PageName", + "Other/HiddenPage", + "Page/PageSize", + "Page/PageTile", + // bWarningPrinter + // bWarningSize + // bWarningOrientation + "Page/Booklet", + "Page/BookletFront", + "Page/BookletBack", + // bCutPage + "Other/FromPrinterSetup", + "Other/Quality", + "Content/Presentation", + "Content/Note", + "Content/Handout", + "Content/Outline", + "Other/HandoutHorizontal", + "Other/PagesPerHandout" + }; + rCount = SAL_N_ELEMENTS(aImpressPropNames); ppNames = aImpressPropNames; } else { - rCount = 12; + static const char* aDrawPropNames[] = + { + "Other/Date", + "Other/Time", + "Other/PageName", + "Other/HiddenPage", + "Page/PageSize", + "Page/PageTile", + // bWarningPrinter + // bWarningSize + // bWarningOrientation + "Page/Booklet", + "Page/BookletFront", + "Page/BookletBack", + // bCutPage + "Other/FromPrinterSetup", + "Other/Quality", + "Content/Drawing", + }; + rCount = SAL_N_ELEMENTS(aDrawPropNames); ppNames = aDrawPropNames; } } |