update ooo310-m15
[ooovba.git] / applied_patches / 0178-chart-skip-hidden-cells-chart2.diff
blobcfd4494eb546a4fbd14782dfb9516d111d87ef3d
1 diff --git chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
2 index 439a2b5..c47486c 100644
3 --- chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
4 +++ chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
5 @@ -112,6 +112,7 @@ enum
6 PROP_DIAGRAM_DATAROW_SOURCE,
8 PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
9 + PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
11 PROP_DIAGRAM_SORT_BY_X_VALUES,
13 @@ -233,6 +234,13 @@ void lcl_AddPropertiesToVector(
14 beans::PropertyAttribute::BOUND
15 | beans::PropertyAttribute::MAYBEDEFAULT ));
17 + rOutProperties.push_back(
18 + Property( C2U( "IncludeHiddenCells" ),
19 + PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
20 + ::getBooleanCppuType(),
21 + beans::PropertyAttribute::BOUND
22 + | beans::PropertyAttribute::MAYBEDEFAULT ));
24 //new for XY charts
25 rOutProperties.push_back(
26 Property( C2U( "SortByXValues" ),
27 @@ -1970,6 +1978,44 @@ Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XP
28 //-----------------------------------------------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------------------------------------------
31 +//PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS
32 +class WrappedIncludeHiddenCellsProperty : public WrappedProperty
34 +public:
35 + WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
36 + virtual ~WrappedIncludeHiddenCellsProperty();
38 + virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
39 + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
41 +private: //member
42 + ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
43 +};
45 +WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
46 + : WrappedProperty(C2U("IncludeHiddenCells"),C2U("IncludeHiddenCells"))
47 + , m_spChart2ModelContact( spChart2ModelContact )
51 +WrappedIncludeHiddenCellsProperty::~WrappedIncludeHiddenCellsProperty()
55 +void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
56 + throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
58 + sal_Bool bNewValue = false;
59 + if( ! (rOuterValue >>= bNewValue) )
60 + throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
62 + ChartModelHelper::setIncludeHiddenCells( bNewValue, m_spChart2ModelContact->getChartModel() );
65 +//-----------------------------------------------------------------------------------------------------------------
66 +//-----------------------------------------------------------------------------------------------------------------
67 +//-----------------------------------------------------------------------------------------------------------------
69 // ____ XDiagramProvider ____
70 Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram()
71 throw (uno::RuntimeException)
72 @@ -2025,6 +2071,8 @@ const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
73 aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedBarsConnected" ), C2U( "ConnectBars" ) ) );
74 aWrappedProperties.push_back( new WrappedSolidTypeProperty( m_spChart2ModelContact ) );
75 aWrappedProperties.push_back( new WrappedAutomaticSizeProperty() );
76 + aWrappedProperties.push_back( new WrappedIncludeHiddenCellsProperty( m_spChart2ModelContact ) );
78 return aWrappedProperties;
81 diff --git chart2/source/controller/dialogs/TabPages.hrc chart2/source/controller/dialogs/TabPages.hrc
82 index a9fb1ab..fb58fd4 100644
83 --- chart2/source/controller/dialogs/TabPages.hrc
84 +++ chart2/source/controller/dialogs/TabPages.hrc
85 @@ -83,22 +83,6 @@
86 #define CTL_BITMAP_PREVIEW 6
89 -//#define TP_OPTIONS 908
90 -#define GRP_OPT_AXIS 1
91 -#define RBT_OPT_AXIS_1 2
92 -#define RBT_OPT_AXIS_2 3
93 -#define MT_GAP 4
94 -#define MT_OVERLAP 5
95 -#define FT_GAP 6
96 -#define FT_OVERLAP 7
97 -#define GB_BAR 8
98 -#define CB_CONNECTOR 9
99 -#define CB_BARS_SIDE_BY_SIDE 10
100 -#define FL_PLOT_MISSING_VALUES 11
101 -#define RB_DONT_PAINT 12
102 -#define RB_ASSUME_ZERO 13
103 -#define RB_CONTINUE_LINE 14
105 //------------
106 //from old chart tplabel.hrc
108 diff --git chart2/source/controller/dialogs/tp_PolarOptions.cxx chart2/source/controller/dialogs/tp_PolarOptions.cxx
109 index 30cf24e..bf0c1e6 100644
110 --- chart2/source/controller/dialogs/tp_PolarOptions.cxx
111 +++ chart2/source/controller/dialogs/tp_PolarOptions.cxx
112 @@ -32,7 +32,6 @@
113 #include "tp_PolarOptions.hxx"
114 #include "tp_PolarOptions.hrc"
115 #include "ResId.hxx"
116 -#include "TabPages.hrc"
117 #include "chartview/ChartSfxItemIds.hxx"
118 #include "NoWarningThisInCTOR.hxx"
120 @@ -51,7 +50,9 @@ PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInA
121 m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ),
122 m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ),
123 m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ),
124 - m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) )
125 + m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ),
126 + m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ),
127 + m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) )
129 FreeResource();
131 @@ -78,6 +79,9 @@ BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
132 if( m_aCB_Clockwise.IsVisible() )
133 rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked()));
135 + if (m_aCB_IncludeHiddenCells.IsVisible())
136 + rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
138 return TRUE;
141 @@ -108,6 +112,16 @@ void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
143 m_aCB_Clockwise.Show(FALSE);
145 + if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
147 + bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
148 + m_aCB_IncludeHiddenCells.Check(bVal);
150 + else
152 + m_aCB_IncludeHiddenCells.Show(FALSE);
153 + m_aFL_PlotOptions.Show(FALSE);
157 //.............................................................................
158 diff --git chart2/source/controller/dialogs/tp_PolarOptions.hrc chart2/source/controller/dialogs/tp_PolarOptions.hrc
159 index 722155b..b275a72 100644
160 --- chart2/source/controller/dialogs/tp_PolarOptions.hrc
161 +++ chart2/source/controller/dialogs/tp_PolarOptions.hrc
162 @@ -28,9 +28,13 @@
164 ************************************************************************/
166 +#include "ResourceIds.hrc"
168 #define CB_CLOCKWISE 1
169 +#define CB_INCLUDE_HIDDEN_CELLS_POLAR 2
171 #define FL_STARTING_ANGLE 1
172 +#define FL_PLOT_OPTIONS_POLAR 2
174 #define CT_ANGLE_DIAL 1
176 diff --git chart2/source/controller/dialogs/tp_PolarOptions.hxx chart2/source/controller/dialogs/tp_PolarOptions.hxx
177 index cd1f8e5..77f7a2e 100644
178 --- chart2/source/controller/dialogs/tp_PolarOptions.hxx
179 +++ chart2/source/controller/dialogs/tp_PolarOptions.hxx
180 @@ -58,6 +58,9 @@ private:
181 svx::DialControl m_aAngleDial;
182 FixedText m_aFT_Degrees;
183 NumericField m_aNF_StartingAngle;
185 + FixedLine m_aFL_PlotOptions;
186 + CheckBox m_aCB_IncludeHiddenCells;
189 //.............................................................................
190 diff --git chart2/source/controller/dialogs/tp_PolarOptions.src chart2/source/controller/dialogs/tp_PolarOptions.src
191 index b01ba74..b933c34 100644
192 --- chart2/source/controller/dialogs/tp_PolarOptions.src
193 +++ chart2/source/controller/dialogs/tp_PolarOptions.src
194 @@ -28,7 +28,6 @@
196 ************************************************************************/
198 -#include "TabPages.hrc"
199 #include "tp_PolarOptions.hrc"
200 #include "HelpIds.hrc"
202 @@ -47,8 +46,8 @@ TabPage TP_POLAROPTIONS
204 FixedLine FL_STARTING_ANGLE
206 - Pos = MAP_APPFONT ( 12 , 21 ) ;
207 - Size = MAP_APPFONT ( 242 , 12 ) ;
208 + Pos = MAP_APPFONT ( 6 , 21 ) ;
209 + Size = MAP_APPFONT ( 248 , 12 ) ;
210 Text [ en-US ] = "Starting angle" ;
212 Control CT_ANGLE_DIAL
213 @@ -75,4 +74,17 @@ TabPage TP_POLAROPTIONS
214 Maximum = 359 ;
215 SpinSize = 5 ;
217 + FixedLine FL_PLOT_OPTIONS_POLAR
219 + Pos = MAP_APPFONT ( 6 , 90 ) ;
220 + Size = MAP_APPFONT ( 248 , 8 ) ;
221 + Text [ en-US ] = "Plot options";
222 + };
223 + CheckBox CB_INCLUDE_HIDDEN_CELLS_POLAR
225 + Pos = MAP_APPFONT ( 12 , 104 ) ;
226 + Size = MAP_APPFONT ( 200 , 10 ) ;
227 + TabStop = TRUE ;
228 + Text [ en-US ] = "Include ~values from hidden cells";
229 + };
231 diff --git chart2/source/controller/dialogs/tp_SeriesToAxis.cxx chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
232 index 9b11c6b..8b8a515 100644
233 --- chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
234 +++ chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
235 @@ -31,9 +31,9 @@
236 // MARKER(update_precomp.py): autogen include statement, do not remove
237 #include "precompiled_chart2.hxx"
238 #include "tp_SeriesToAxis.hxx"
239 +#include "tp_SeriesToAxis.hrc"
241 #include "ResId.hxx"
242 -#include "TabPages.hrc"
243 #include "chartview/ChartSfxItemIds.hxx"
244 #include "NoWarningThisInCTOR.hxx"
246 @@ -43,6 +43,8 @@
247 #include <svtools/intitem.hxx>
248 //SfxIntegerListItem
249 #include <svtools/ilstitem.hxx>
250 +#include <svtools/controldims.hrc>
252 #include <com/sun/star/chart/MissingValueTreatment.hpp>
254 //.............................................................................
255 @@ -63,10 +65,12 @@ SchOptionTabPage::SchOptionTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
256 aMTOverlap(this,SchResId(MT_OVERLAP)),
257 aCBConnect(this,SchResId(CB_CONNECTOR)),
258 aCBAxisSideBySide(this,SchResId(CB_BARS_SIDE_BY_SIDE)),
259 - m_aFL_EmptyCells(this,SchResId(FL_PLOT_MISSING_VALUES)),
260 + m_aFL_PlotOptions(this,SchResId(FL_PLOT_OPTIONS)),
261 + m_aFT_MissingValues(this,SchResId(FT_MISSING_VALUES)),
262 m_aRB_DontPaint(this,SchResId(RB_DONT_PAINT)),
263 m_aRB_AssumeZero(this,SchResId(RB_ASSUME_ZERO)),
264 m_aRB_ContinueLine(this,SchResId(RB_CONTINUE_LINE)),
265 + m_aCBIncludeHiddenCells(this,SchResId(CB_INCLUDE_HIDDEN_CELLS)),
266 m_bProvidesSecondaryYAxis(true),
267 m_bProvidesOverlapAndGapWidth(false)
269 @@ -123,6 +127,9 @@ BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
270 else if(m_aRB_ContinueLine.IsChecked())
271 rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::CONTINUE));
273 + if (m_aCBIncludeHiddenCells.IsVisible())
274 + rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCBIncludeHiddenCells.IsChecked()));
276 return TRUE;
279 @@ -212,13 +219,26 @@ void SchOptionTabPage::Reset(const SfxItemSet& rInAttrs)
281 else
283 + m_aFT_MissingValues.Show(FALSE);
284 m_aRB_DontPaint.Show(FALSE);
285 m_aRB_AssumeZero.Show(FALSE);
286 m_aRB_ContinueLine.Show(FALSE);
287 - m_aFL_EmptyCells.Show(FALSE);
291 + // Include hidden cells
292 + if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
294 + bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
295 + m_aCBIncludeHiddenCells.Check(bVal);
297 + else
299 + m_aCBIncludeHiddenCells.Show(FALSE);
300 + if(!m_aFT_MissingValues.IsVisible())
301 + m_aFL_PlotOptions.Show(FALSE);
304 AdaptControlPositionsAndVisibility();
307 @@ -231,6 +251,17 @@ void SchOptionTabPage::Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlap
308 AdaptControlPositionsAndVisibility();
311 +void lcl_offsetControl(Control& rCtrl, long nXOffset, long nYOffset )
313 + Point aPos = rCtrl.GetPosPixel();
314 + rCtrl.SetPosPixel( Point(aPos.getX() + nXOffset, aPos.getY() + nYOffset) );
317 +void lcl_optimzeRadioButtonSize( RadioButton& rCtrl )
319 + rCtrl.SetSizePixel( rCtrl.CalcMinimumSize() );
322 void SchOptionTabPage::AdaptControlPositionsAndVisibility()
324 aRbtAxis1.Show(m_bProvidesSecondaryYAxis);
325 @@ -254,20 +285,30 @@ void SchOptionTabPage::AdaptControlPositionsAndVisibility()
326 else
327 aPos = aGrpBar.GetPosPixel();
329 - long nDiffX = aRbtAxis1.GetPosPixel().getX() - aGrpAxis.GetPosPixel().getX();
330 - long nDiffY = aRbtAxis1.GetPosPixel().getY() - aGrpAxis.GetPosPixel().getY();
331 - long nDiffY1 = aRbtAxis2.GetPosPixel().getY() - aRbtAxis1.GetPosPixel().getY();
333 - m_aFL_EmptyCells.SetPosPixel( aPos );
334 - m_aRB_DontPaint.SetPosPixel( Point( aPos.getX() + nDiffX, aPos.getY() + nDiffY ) );
335 - m_aRB_AssumeZero.SetPosPixel( Point( aPos.getX() + nDiffX, aPos.getY() + nDiffY + nDiffY1 ) );
336 - m_aRB_ContinueLine.SetPosPixel( Point( aPos.getX() + nDiffX, aPos.getY() + nDiffY + nDiffY1 * 2 ) );
337 + long nYOffset = aPos.getY() - m_aFL_PlotOptions.GetPosPixel().getY();
338 + lcl_offsetControl(m_aFL_PlotOptions, 0, nYOffset);
339 + lcl_offsetControl(m_aFT_MissingValues, 0, nYOffset);
340 + lcl_offsetControl(m_aRB_DontPaint, 0, nYOffset);
341 + lcl_offsetControl(m_aRB_AssumeZero, 0, nYOffset);
342 + lcl_offsetControl(m_aRB_ContinueLine, 0, nYOffset);
343 + lcl_offsetControl(m_aCBIncludeHiddenCells, 0, nYOffset);
346 - if( !m_aRB_DontPaint.IsVisible() )
347 + m_aFT_MissingValues.SetSizePixel( m_aFT_MissingValues.CalcMinimumSize() );
348 + lcl_optimzeRadioButtonSize( m_aRB_DontPaint );
349 + lcl_optimzeRadioButtonSize( m_aRB_AssumeZero );
350 + lcl_optimzeRadioButtonSize( m_aRB_ContinueLine );
352 + Size aControlDistance( m_aFT_MissingValues.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
353 + long nXOffset = m_aFT_MissingValues.GetPosPixel().getX() + m_aFT_MissingValues.GetSizePixel().getWidth() + aControlDistance.getWidth() - m_aRB_DontPaint.GetPosPixel().getX();
354 + lcl_offsetControl(m_aRB_DontPaint, nXOffset, 0);
355 + lcl_offsetControl(m_aRB_AssumeZero, nXOffset, 0);
356 + lcl_offsetControl(m_aRB_ContinueLine, nXOffset, 0);
358 + if( !m_aFT_MissingValues.IsVisible() )
360 - m_aRB_ContinueLine.SetPosPixel( m_aRB_AssumeZero.GetPosPixel() );
361 - m_aRB_AssumeZero.SetPosPixel( m_aRB_DontPaint.GetPosPixel() );
362 + //for example for stock charts
363 + m_aCBIncludeHiddenCells.SetPosPixel( m_aFT_MissingValues.GetPosPixel() );
366 //.............................................................................
367 diff --git chart2/source/controller/dialogs/tp_SeriesToAxis.hrc chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
368 new file mode 100644
369 index 0000000..2e96dc7
370 --- /dev/null
371 +++ chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
372 @@ -0,0 +1,48 @@
373 +/*************************************************************************
375 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
376 + *
377 + * Copyright 2008 by Sun Microsystems, Inc.
379 + * OpenOffice.org - a multi-platform office productivity suite
381 + * $RCSfile: ,v $
382 + * $Revision: $
384 + * This file is part of OpenOffice.org.
386 + * OpenOffice.org is free software: you can redistribute it and/or modify
387 + * it under the terms of the GNU Lesser General Public License version 3
388 + * only, as published by the Free Software Foundation.
390 + * OpenOffice.org is distributed in the hope that it will be useful,
391 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
392 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
393 + * GNU Lesser General Public License version 3 for more details
394 + * (a copy is included in the LICENSE file that accompanied this code).
396 + * You should have received a copy of the GNU Lesser General Public License
397 + * version 3 along with OpenOffice.org. If not, see
398 + * <http://www.openoffice.org/license.html>
399 + * for a copy of the LGPLv3 License.
401 + ************************************************************************/
403 +#include "ResourceIds.hrc"
405 +#define GRP_OPT_AXIS 1
406 +#define RBT_OPT_AXIS_1 2
407 +#define RBT_OPT_AXIS_2 3
408 +#define MT_GAP 4
409 +#define MT_OVERLAP 5
410 +#define FT_GAP 6
411 +#define FT_OVERLAP 7
412 +#define GB_BAR 8
413 +#define CB_CONNECTOR 9
414 +#define CB_BARS_SIDE_BY_SIDE 10
415 +#define FL_PLOT_OPTIONS 11
416 +#define FT_MISSING_VALUES 12
417 +#define RB_DONT_PAINT 13
418 +#define RB_ASSUME_ZERO 14
419 +#define RB_CONTINUE_LINE 15
420 +#define CB_INCLUDE_HIDDEN_CELLS 16
421 diff --git chart2/source/controller/dialogs/tp_SeriesToAxis.hxx chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
422 index af1f703..d6516a0 100644
423 --- chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
424 +++ chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
425 @@ -74,11 +74,14 @@ private: //member
426 CheckBox aCBConnect;
427 CheckBox aCBAxisSideBySide;
429 - FixedLine m_aFL_EmptyCells;
430 + FixedLine m_aFL_PlotOptions;
431 + FixedText m_aFT_MissingValues;
432 RadioButton m_aRB_DontPaint;
433 RadioButton m_aRB_AssumeZero;
434 RadioButton m_aRB_ContinueLine;
436 + CheckBox m_aCBIncludeHiddenCells;
438 DECL_LINK(EnableHdl, RadioButton * );
440 sal_Int32 m_nAllSeriesAxisIndex;
441 diff --git chart2/source/controller/dialogs/tp_SeriesToAxis.src chart2/source/controller/dialogs/tp_SeriesToAxis.src
442 index 9729f8a..29161ee 100644
443 --- chart2/source/controller/dialogs/tp_SeriesToAxis.src
444 +++ chart2/source/controller/dialogs/tp_SeriesToAxis.src
445 @@ -28,7 +28,7 @@
447 ************************************************************************/
448 #include "HelpIds.hrc"
449 -#include "TabPages.hrc"
450 +#include "tp_SeriesToAxis.hrc"
452 TabPage TP_OPTIONS
454 @@ -120,7 +120,7 @@ TabPage TP_OPTIONS
455 Pos = MAP_APPFONT ( 12 , 97 ) ;
456 Size = MAP_APPFONT ( 200 , 10 ) ;
457 TabStop = TRUE ;
458 - Text [ en-US ] = "Connection Lines";
459 + Text [ en-US ] = "Connection lines";
462 CheckBox CB_BARS_SIDE_BY_SIDE
463 @@ -131,16 +131,23 @@ TabPage TP_OPTIONS
464 Text [ en-US ] = "Show ~bars side by side";
467 - FixedLine FL_PLOT_MISSING_VALUES
468 + FixedLine FL_PLOT_OPTIONS
470 Pos = MAP_APPFONT ( 6 , 113 ) ;
471 Size = MAP_APPFONT ( 248 , 8 ) ;
472 + Text [ en-US ] = "Plot options";
473 + };
475 + FixedText FT_MISSING_VALUES
477 + Pos = MAP_APPFONT ( 12 , 127 ) ;
478 + Size = MAP_APPFONT ( 80 , 8 ) ;
479 Text [ en-US ] = "Plot missing values";
482 RadioButton RB_DONT_PAINT
484 - Pos = MAP_APPFONT ( 12 , 127 ) ;
485 + Pos = MAP_APPFONT ( 82 , 127 ) ;
486 Size = MAP_APPFONT ( 80 , 10 ) ;
487 TabStop = TRUE ;
488 Text [ en-US ] = "~Leave gap";
489 @@ -148,7 +155,7 @@ TabPage TP_OPTIONS
491 RadioButton RB_ASSUME_ZERO
493 - Pos = MAP_APPFONT ( 12 , 141 ) ;
494 + Pos = MAP_APPFONT ( 82 , 141 ) ;
495 Size = MAP_APPFONT ( 80 , 10 ) ;
496 TabStop = TRUE ;
497 Text [ en-US ] = "~Assume zero";
498 @@ -156,9 +163,17 @@ TabPage TP_OPTIONS
500 RadioButton RB_CONTINUE_LINE
502 - Pos = MAP_APPFONT ( 12 , 155 ) ;
503 + Pos = MAP_APPFONT ( 82 , 155 ) ;
504 Size = MAP_APPFONT ( 80 , 10 ) ;
505 TabStop = TRUE ;
506 Text [ en-US ] = "~Continue line";
507 - };
508 + };
510 + CheckBox CB_INCLUDE_HIDDEN_CELLS
512 + Pos = MAP_APPFONT ( 12 , 172 ) ;
513 + Size = MAP_APPFONT ( 200 , 10 ) ;
514 + TabStop = TRUE ;
515 + Text [ en-US ] = "Include ~values from hidden cells";
516 + };
518 diff --git chart2/source/controller/inc/SeriesOptionsItemConverter.hxx chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
519 index 5966449..1f5ddc3 100644
520 --- chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
521 +++ chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
522 @@ -93,6 +93,9 @@ private:
524 ::com::sun::star::uno::Sequence< sal_Int32 > m_aSupportedMissingValueTreatments;
525 sal_Int32 m_nMissingValueTreatment;
527 + bool m_bSupportingPlottingOfHiddenCells;
528 + bool m_bIncludeHiddenCells;
531 } // namespace wrapper
532 diff --git chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
533 index 9b51d5d..d6215b2 100644
534 --- chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
535 +++ chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
536 @@ -163,7 +163,8 @@ const USHORT nDataPointWhichPairs[] =
537 SCHATTR_STARTING_ANGLE,SCHATTR_STARTING_ANGLE, \
538 SCHATTR_CLOCKWISE,SCHATTR_CLOCKWISE, \
539 SCHATTR_MISSING_VALUE_TREATMENT,SCHATTR_MISSING_VALUE_TREATMENT, \
540 - SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS
541 + SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, \
542 + SCHATTR_INCLUDE_HIDDEN_CELLS,SCHATTR_INCLUDE_HIDDEN_CELLS
544 const USHORT nSeriesOptionsWhichPairs[] =
546 diff --git chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
547 index eae94e8..ad2aca8 100644
548 --- chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
549 +++ chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
550 @@ -93,6 +93,8 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
551 , m_bClockwise(false)
552 , m_aSupportedMissingValueTreatments()
553 , m_nMissingValueTreatment(0)
554 + , m_bSupportingPlottingOfHiddenCells(false)
555 + , m_bIncludeHiddenCells(true)
559 @@ -159,6 +161,23 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
560 m_aSupportedMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType );
561 m_nMissingValueTreatment = DiagramHelper::getCorrectedMissingValueTreatment(
562 ChartModelHelper::findDiagram(m_xChartModel), xChartType );
564 + uno::Reference< XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY );
565 + uno::Reference< beans::XPropertySet > xProp( xChartDoc->getDataProvider(), uno::UNO_QUERY );
566 + if( xProp.is() )
568 + try
570 + //test whether the data provider offers this property
571 + xProp->getPropertyValue(C2U("IncludeHiddenCells"));
572 + //if not exception is thrown the property is offered
573 + m_bSupportingPlottingOfHiddenCells = true;
574 + xDiagramProperties->getPropertyValue( C2U("IncludeHiddenCells") ) >>= m_bIncludeHiddenCells;
576 + catch( const beans::UnknownPropertyException& )
581 catch( uno::Exception ex )
583 @@ -341,6 +360,16 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxIte
586 break;
587 + case SCHATTR_INCLUDE_HIDDEN_CELLS:
589 + if( m_bSupportingPlottingOfHiddenCells )
591 + bool bIncludeHiddenCells = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue();
592 + if (bIncludeHiddenCells != m_bIncludeHiddenCells)
593 + bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, m_xChartModel );
596 + break;
598 return bChanged;
600 @@ -412,6 +441,12 @@ void SeriesOptionsItemConverter::FillSpecialItem(
601 rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) );
602 break;
604 + case SCHATTR_INCLUDE_HIDDEN_CELLS:
606 + if( m_bSupportingPlottingOfHiddenCells )
607 + rOutItemSet.Put( SfxBoolItem(nWhichId, m_bIncludeHiddenCells) );
608 + break;
610 default:
611 break;
613 diff --git chart2/source/inc/CachedDataSequence.hxx chart2/source/inc/CachedDataSequence.hxx
614 index c31fcf2..30c0d07 100644
615 --- chart2/source/inc/CachedDataSequence.hxx
616 +++ chart2/source/inc/CachedDataSequence.hxx
617 @@ -167,8 +167,6 @@ protected:
618 // <properties>
619 sal_Int32 m_nNumberFormatKey;
620 ::rtl::OUString m_sRole;
621 - sal_Bool m_bIsHidden;
622 - ::com::sun::star::uno::Sequence< sal_Int32 > m_aHiddenValues;
623 // </properties>
625 enum DataType
626 diff --git chart2/source/inc/ChartModelHelper.hxx chart2/source/inc/ChartModelHelper.hxx
627 index fa1dbbe..8b49b08 100644
628 --- chart2/source/inc/ChartModelHelper.hxx
629 +++ chart2/source/inc/ChartModelHelper.hxx
630 @@ -87,6 +87,12 @@ public:
632 static void triggerRangeHighlighting( const ::com::sun::star::uno::Reference<
633 ::com::sun::star::frame::XModel >& xModel );
635 + static bool isIncludeHiddenCells( const ::com::sun::star::uno::Reference<
636 + ::com::sun::star::frame::XModel >& xChartModel );
638 + static bool setIncludeHiddenCells( bool bIncludeHiddenCells, const ::com::sun::star::uno::Reference<
639 + ::com::sun::star::frame::XModel >& xChartModel );
642 //.............................................................................
643 diff --git chart2/source/inc/DataSeriesHelper.hxx chart2/source/inc/DataSeriesHelper.hxx
644 index 699c51c..48b520e 100644
645 --- chart2/source/inc/DataSeriesHelper.hxx
646 +++ chart2/source/inc/DataSeriesHelper.hxx
647 @@ -42,6 +42,7 @@
649 #include <vector>
650 #include <functional>
651 +#include <hash_set>
653 namespace chart
655 @@ -180,6 +181,13 @@ OOO_DLLPUBLIC_CHARTTOOLS bool areAllSeriesAttachedToSameAxis(
656 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType,
657 sal_Int32 & rOutAxisIndex );
659 +OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const ::com::sun::star::uno::Reference<
660 + ::com::sun::star::chart2::XDataSeries >& xSeries );
662 +OOO_DLLPUBLIC_CHARTTOOLS
663 +sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const ::com::sun::star::uno::Reference<
664 + ::com::sun::star::chart2::data::XDataSequence >& xDataSequence, bool bTranslate );
666 } // namespace DataSeriesHelper
667 } // namespace chart
669 diff --git chart2/source/inc/RangeHighlighter.hxx chart2/source/inc/RangeHighlighter.hxx
670 index 1f0f08a..c0b5cc9 100644
671 --- chart2/source/inc/RangeHighlighter.hxx
672 +++ chart2/source/inc/RangeHighlighter.hxx
673 @@ -111,6 +111,7 @@ private:
674 ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange >
675 m_aSelectedRanges;
676 sal_Int32 m_nAddedListenerCount;
677 + bool m_bIncludeHiddenCells;
680 } // namespace chart
681 diff --git chart2/source/inc/UncachedDataSequence.hxx chart2/source/inc/UncachedDataSequence.hxx
682 index cf09937..714b04d 100644
683 --- chart2/source/inc/UncachedDataSequence.hxx
684 +++ chart2/source/inc/UncachedDataSequence.hxx
685 @@ -186,8 +186,6 @@ protected:
686 // <properties>
687 sal_Int32 m_nNumberFormatKey;
688 ::rtl::OUString m_sRole;
689 - sal_Bool m_bIsHidden;
690 - ::com::sun::star::uno::Sequence< sal_Int32 > m_aHiddenValues;
691 ::rtl::OUString m_aXMLRange;
692 // </properties>
694 diff --git chart2/source/inc/chartview/ChartSfxItemIds.hxx chart2/source/inc/chartview/ChartSfxItemIds.hxx
695 index 52e47c0..067389e 100644
696 --- chart2/source/inc/chartview/ChartSfxItemIds.hxx
697 +++ chart2/source/inc/chartview/ChartSfxItemIds.hxx
698 @@ -209,8 +209,9 @@
699 #define SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 10)
700 #define SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 11)
701 #define SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 12)
702 +#define SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 13)
704 -#define SCHATTR_CHARTTYPE_END SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS
705 +#define SCHATTR_CHARTTYPE_END SCHATTR_INCLUDE_HIDDEN_CELLS
707 // items for transporting information to dialogs
708 #define SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1)
709 diff --git chart2/source/model/main/ChartModel.cxx chart2/source/model/main/ChartModel.cxx
710 index b190368..31ef4cf 100644
711 --- chart2/source/model/main/ChartModel.cxx
712 +++ chart2/source/model/main/ChartModel.cxx
713 @@ -43,6 +43,8 @@
714 #include "DisposeHelper.hxx"
715 #include "ControllerLockGuard.hxx"
716 #include "ObjectIdentifier.hxx"
717 +#include "ChartModelHelper.hxx"
719 #include <comphelper/InlineContainer.hxx>
720 #include <comphelper/processfactory.hxx>
722 @@ -703,6 +705,19 @@ sal_Bool SAL_CALL ChartModel::hasInternalDataProvider()
724 // /--
725 MutexGuard aGuard( m_aModelMutex );
726 + uno::Reference< beans::XPropertySet > xProp( xProvider, uno::UNO_QUERY );
727 + if( xProp.is() )
729 + try
731 + sal_Bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( Reference< frame::XModel >(this) );
732 + xProp->setPropertyValue(C2U("IncludeHiddenCells"), uno::makeAny(bIncludeHiddenCells));
734 + catch( const beans::UnknownPropertyException& )
739 m_pImplChartModel->SetDataProvider( xProvider );
740 // \--
742 diff --git chart2/source/model/main/ChartModel_Persistence.cxx chart2/source/model/main/ChartModel_Persistence.cxx
743 index 572f737..5b5bb9d 100644
744 --- chart2/source/model/main/ChartModel_Persistence.cxx
745 +++ chart2/source/model/main/ChartModel_Persistence.cxx
746 @@ -37,6 +37,7 @@
747 #include "ChartDebugTrace.hxx"
748 #include "macros.hxx"
749 #include "ChartViewHelper.hxx"
750 +#include "ChartModelHelper.hxx"
751 #include <com/sun/star/container/XNameAccess.hpp>
752 #include <com/sun/star/document/XExporter.hpp>
753 #include <com/sun/star/document/XImporter.hpp>
754 @@ -407,6 +408,7 @@ void SAL_CALL ChartModel::initNew()
757 m_pImplChartModel->CreateDefaultChart();
758 + ChartModelHelper::setIncludeHiddenCells( false, this );
760 catch( uno::Exception & ex )
762 diff --git chart2/source/model/main/Diagram.cxx chart2/source/model/main/Diagram.cxx
763 index 02bf2b7..308ed19 100644
764 --- chart2/source/model/main/Diagram.cxx
765 +++ chart2/source/model/main/Diagram.cxx
766 @@ -78,6 +78,7 @@ enum
767 PROP_DIAGRAM_SORT_BY_X_VALUES,
768 PROP_DIAGRAM_CONNECT_BARS,
769 PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
770 + PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
771 PROP_DIAGRAM_STARTING_ANGLE,
772 PROP_DIAGRAM_RIGHT_ANGLED_AXES,
773 PROP_DIAGRAM_PERSPECTIVE,
774 @@ -125,6 +126,13 @@ void lcl_AddPropertiesToVector(
775 | beans::PropertyAttribute::MAYBEDEFAULT ));
777 rOutProperties.push_back(
778 + Property( C2U("IncludeHiddenCells"),
779 + PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
780 + ::getBooleanCppuType(),
781 + beans::PropertyAttribute::BOUND
782 + | beans::PropertyAttribute::MAYBEDEFAULT ));
784 + rOutProperties.push_back(
785 Property( C2U( "StartingAngle" ),
786 PROP_DIAGRAM_STARTING_ANGLE,
787 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
788 @@ -170,6 +178,7 @@ void lcl_AddDefaultsToMap(
789 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
790 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false );
791 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
792 + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
793 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
794 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
796 diff --git chart2/source/tools/CachedDataSequence.cxx chart2/source/tools/CachedDataSequence.cxx
797 index 2f05ac3..2f34d8f 100644
798 --- chart2/source/tools/CachedDataSequence.cxx
799 +++ chart2/source/tools/CachedDataSequence.cxx
800 @@ -68,9 +68,7 @@ enum
802 // PROP_SOURCE_IDENTIFIER,
803 PROP_NUMBERFORMAT_KEY,
804 - PROP_PROPOSED_ROLE,
805 - PROP_HIDDEN,
806 - PROP_HIDDEN_VALUES
807 + PROP_PROPOSED_ROLE
809 } // anonymous namespace
811 @@ -82,7 +80,6 @@ namespace chart
812 CachedDataSequence::CachedDataSequence()
813 : OPropertyContainer( GetBroadcastHelper()),
814 CachedDataSequence_Base( GetMutex()),
815 - m_bIsHidden( true ),
816 m_eCurrentDataType( NUMERICAL ),
817 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
819 @@ -91,7 +88,6 @@ CachedDataSequence::CachedDataSequence()
820 CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext > & /*xContext*/ )
821 : OPropertyContainer( GetBroadcastHelper()),
822 CachedDataSequence_Base( GetMutex()),
823 - m_bIsHidden( true ),
824 m_eCurrentDataType( MIXED ),
825 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( ))
827 @@ -101,7 +97,6 @@ CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext
828 CachedDataSequence::CachedDataSequence( const ::std::vector< double > & rVector )
829 : OPropertyContainer( GetBroadcastHelper()),
830 CachedDataSequence_Base( GetMutex()),
831 - m_bIsHidden( true ),
832 m_eCurrentDataType( NUMERICAL ),
833 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
835 @@ -112,7 +107,6 @@ CachedDataSequence::CachedDataSequence( const ::std::vector< double > & rVector
836 CachedDataSequence::CachedDataSequence( const ::std::vector< OUString > & rVector )
837 : OPropertyContainer( GetBroadcastHelper()),
838 CachedDataSequence_Base( GetMutex()),
839 - m_bIsHidden( true ),
840 m_eCurrentDataType( TEXTUAL ),
841 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
843 @@ -123,7 +117,6 @@ CachedDataSequence::CachedDataSequence( const ::std::vector< OUString > & rVecto
844 CachedDataSequence::CachedDataSequence( const OUString & rSingleText )
845 : OPropertyContainer( GetBroadcastHelper()),
846 CachedDataSequence_Base( GetMutex()),
847 - m_bIsHidden( true ),
848 m_eCurrentDataType( TEXTUAL ),
849 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
851 @@ -135,7 +128,6 @@ CachedDataSequence::CachedDataSequence( const OUString & rSingleText )
852 CachedDataSequence::CachedDataSequence( const ::std::vector< Any > & rVector )
853 : OPropertyContainer( GetBroadcastHelper()),
854 CachedDataSequence_Base( GetMutex()),
855 - m_bIsHidden( true ),
856 m_eCurrentDataType( MIXED ),
857 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
859 @@ -150,8 +142,6 @@ CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
860 CachedDataSequence_Base( GetMutex()),
861 m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
862 m_sRole( rSource.m_sRole ),
863 - m_bIsHidden( rSource.m_bIsHidden ),
864 - m_aHiddenValues( rSource.m_aHiddenValues ),
865 m_eCurrentDataType( rSource.m_eCurrentDataType ),
866 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
868 @@ -187,18 +177,6 @@ void CachedDataSequence::registerProperties()
869 0, // PropertyAttributes
870 & m_sRole,
871 ::getCppuType( & m_sRole ) );
873 - registerProperty( C2U( "IsHidden" ),
874 - PROP_HIDDEN,
875 - 0, // PropertyAttributes
876 - & m_bIsHidden,
877 - ::getCppuType( & m_bIsHidden ) );
879 - registerProperty( C2U( "HiddenValues" ),
880 - PROP_HIDDEN_VALUES,
881 - 0, // PropertyAttributes
882 - & m_aHiddenValues,
883 - ::getCppuType( & m_aHiddenValues ) );
886 Sequence< double > CachedDataSequence::Impl_getNumericalData() const
887 diff --git chart2/source/tools/ChartModelHelper.cxx chart2/source/tools/ChartModelHelper.cxx
888 index 37e94a6..9919d48 100644
889 --- chart2/source/tools/ChartModelHelper.cxx
890 +++ chart2/source/tools/ChartModelHelper.cxx
891 @@ -33,6 +33,9 @@
892 #include "ChartModelHelper.hxx"
893 #include "macros.hxx"
894 #include "DiagramHelper.hxx"
895 +#include "DataSourceHelper.hxx"
896 +#include "ControllerLockGuard.hxx"
898 #include <com/sun/star/chart2/data/XDataReceiver.hpp>
899 #include <com/sun/star/chart2/XChartDocument.hpp>
900 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
901 @@ -137,6 +140,96 @@ void ChartModelHelper::triggerRangeHighlighting( const uno::Reference< frame::XM
905 +bool ChartModelHelper::isIncludeHiddenCells( const uno::Reference< frame::XModel >& xChartModel )
907 + bool bIncluded = true; // hidden cells are included by default.
909 + uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
910 + if (!xDiagram.is())
911 + return bIncluded;
913 + uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
914 + if (!xProp.is())
915 + return bIncluded;
917 + try
919 + xProp->getPropertyValue(C2U("IncludeHiddenCells")) >>= bIncluded;
921 + catch( const beans::UnknownPropertyException& )
925 + return bIncluded;
928 +bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, const uno::Reference< frame::XModel >& xChartModel )
930 + bool bChanged = false;
931 + try
933 + ControllerLockGuard aLockedControllers( xChartModel );
935 + uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(xChartModel), uno::UNO_QUERY );
936 + if (xDiagramProperties.is())
938 + bool bOldValue = bIncludeHiddenCells;
939 + xDiagramProperties->getPropertyValue( C2U("IncludeHiddenCells") ) >>= bOldValue;
940 + if( bOldValue == bIncludeHiddenCells )
941 + bChanged = true;
943 + //set the property on all instances in all cases to get the different objects in sync!
945 + uno::Any aNewValue = uno::makeAny(bIncludeHiddenCells);
947 + try
949 + uno::Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
950 + if( xChartDoc.is() )
952 + uno::Reference< beans::XPropertySet > xDataProviderProperties( xChartDoc->getDataProvider(), uno::UNO_QUERY );
953 + if( xDataProviderProperties.is() )
954 + xDataProviderProperties->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
957 + catch( const beans::UnknownPropertyException& )
959 + //the property is optional!
962 + try
964 + uno::Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( xChartModel ) );
965 + if( xUsedData.is() )
967 + uno::Reference< beans::XPropertySet > xProp;
968 + uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences());
969 + for( sal_Int32 i=0; i<aData.getLength(); ++i )
971 + xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getValues(), uno::UNO_QUERY ) );
972 + if(xProp.is())
973 + xProp->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
974 + xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getLabel(), uno::UNO_QUERY ) );
975 + if(xProp.is())
976 + xProp->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
980 + catch( const beans::UnknownPropertyException& )
982 + //the property is optional!
985 + xDiagramProperties->setPropertyValue( C2U("IncludeHiddenCells"), aNewValue);
988 + catch (uno::Exception& e)
990 + ASSERT_EXCEPTION(e);
992 + return bChanged;
995 //.............................................................................
996 } //namespace chart
997 //.............................................................................
998 diff --git chart2/source/tools/DataSeriesHelper.cxx chart2/source/tools/DataSeriesHelper.cxx
999 index daba96d..3fe8b66 100644
1000 --- chart2/source/tools/DataSeriesHelper.cxx
1001 +++ chart2/source/tools/DataSeriesHelper.cxx
1002 @@ -644,5 +644,95 @@ bool areAllSeriesAttachedToSameAxis( const uno::Reference< chart2::XChartType >&
1006 +namespace
1009 +bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
1011 + if( !xDataSequence.is() )
1012 + return false;
1013 + uno::Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY );
1014 + if( xProp.is() )
1016 + uno::Sequence< sal_Int32 > aHiddenValues;
1017 + try
1019 + xProp->getPropertyValue( C2U( "HiddenValues" ) ) >>= aHiddenValues;
1020 + if( !aHiddenValues.getLength() )
1021 + return true;
1023 + catch( uno::Exception& e )
1025 + (void)e; // avoid warning
1026 + return true;
1029 + if( xDataSequence->getData().getLength() )
1030 + return true;
1031 + return false;
1036 +bool hasUnhiddenData( const uno::Reference< chart2::XDataSeries >& xSeries )
1038 + uno::Reference< chart2::data::XDataSource > xDataSource =
1039 + uno::Reference< chart2::data::XDataSource >( xSeries, uno::UNO_QUERY );
1041 + uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDataSequences = xDataSource->getDataSequences();
1043 + for(sal_Int32 nN = aDataSequences.getLength();nN--;)
1045 + if( !aDataSequences[nN].is() )
1046 + continue;
1047 + if( lcl_SequenceHasUnhiddenData( aDataSequences[nN]->getValues() ) )
1048 + return true;
1049 + if( lcl_SequenceHasUnhiddenData( aDataSequences[nN]->getLabel() ) )
1050 + return true;
1052 + return false;
1055 +struct lcl_LessIndex
1057 + inline bool operator() ( const sal_Int32& first, const sal_Int32& second )
1059 + return ( first < second );
1063 +sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Reference< chart2::data::XDataSequence >& xDataSequence, bool bTranslate )
1065 + if( !bTranslate )
1066 + return nIndex;
1068 + try
1070 + uno::Reference<beans::XPropertySet> xProp( xDataSequence, uno::UNO_QUERY );
1071 + if( xProp.is())
1073 + Sequence<sal_Int32> aHiddenIndicesSeq;
1074 + xProp->getPropertyValue( C2U("HiddenValues") ) >>= aHiddenIndicesSeq;
1075 + if( aHiddenIndicesSeq.getLength() )
1077 + ::std::vector< sal_Int32 > aHiddenIndices( ContainerHelper::SequenceToVector( aHiddenIndicesSeq ) );
1078 + ::std::sort( aHiddenIndices.begin(), aHiddenIndices.end(), lcl_LessIndex() );
1080 + for( sal_Int32 nN = 0; nN < aHiddenIndices.size(); ++nN)
1082 + if( aHiddenIndices[nN] <= nIndex )
1083 + nIndex += 1;
1084 + else
1085 + break;
1090 + catch (const beans::UnknownPropertyException&)
1093 + return nIndex;
1096 } // namespace DataSeriesHelper
1097 } // namespace chart
1098 diff --git chart2/source/tools/ImplUndoManager.cxx chart2/source/tools/ImplUndoManager.cxx
1099 index d169091..f2309a9 100644
1100 --- chart2/source/tools/ImplUndoManager.cxx
1101 +++ chart2/source/tools/ImplUndoManager.cxx
1102 @@ -37,6 +37,7 @@
1103 #include "ControllerLockGuard.hxx"
1104 #include "PropertyHelper.hxx"
1105 #include "DataSourceHelper.hxx"
1106 +#include "ChartModelHelper.hxx"
1108 #include <com/sun/star/chart/XChartDataArray.hpp>
1109 #include <com/sun/star/chart2/XChartDocument.hpp>
1110 @@ -170,6 +171,9 @@ void UndoElement::applyModelContentToModel(
1111 Reference< chart2::XChartDocument > xSource( xModelToCopyFrom, uno::UNO_QUERY_THROW );
1112 Reference< chart2::XChartDocument > xDestination( xInOutModelToChange, uno::UNO_QUERY_THROW );
1114 + // propagate the correct flag for plotting of hidden values to the data provider and all used sequences
1115 + ChartModelHelper::setIncludeHiddenCells( ChartModelHelper::isIncludeHiddenCells( xModelToCopyFrom ) , xInOutModelToChange );
1117 // diagram
1118 xDestination->setFirstDiagram( xSource->getFirstDiagram());
1120 diff --git chart2/source/tools/RangeHighlighter.cxx chart2/source/tools/RangeHighlighter.cxx
1121 index 50b5316..93227e7 100644
1122 --- chart2/source/tools/RangeHighlighter.cxx
1123 +++ chart2/source/tools/RangeHighlighter.cxx
1124 @@ -38,6 +38,7 @@
1125 #include "ContainerHelper.hxx"
1126 #include "macros.hxx"
1127 #include "ObjectIdentifier.hxx"
1128 +#include "DataSeriesHelper.hxx"
1130 #include <com/sun/star/chart2/XDataSeries.hpp>
1131 #include <com/sun/star/chart/ErrorBarStyle.hpp>
1132 @@ -78,7 +79,8 @@ RangeHighlighter::RangeHighlighter(
1133 const Reference< view::XSelectionSupplier > & xSelectionSupplier ) :
1134 impl::RangeHighlighter_Base( m_aMutex ),
1135 m_xSelectionSupplier( xSelectionSupplier ),
1136 - m_nAddedListenerCount( 0 )
1137 + m_nAddedListenerCount( 0 ),
1138 + m_bIncludeHiddenCells(true)
1142 @@ -104,6 +106,8 @@ void RangeHighlighter::determineRanges()
1143 if( xController.is())
1144 xChartModel.set( xController->getModel());
1146 + m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( xChartModel );
1148 uno::Any aSelection( m_xSelectionSupplier->getSelection());
1149 OUString aCID;
1150 if(( aSelection >>= aCID ) &&
1151 @@ -271,11 +275,13 @@ void RangeHighlighter::fillRangesForDataPoint( const Reference< uno::XInterface
1153 nPreferredColor,
1154 sal_False ));
1156 + sal_Int32 nUnhiddenIndex = DataSeriesHelper::translateIndexFromHiddenToFullSequence( nIndex, xValues, !m_bIncludeHiddenCells );
1157 if( xValues.is())
1158 aHilightedRanges.push_back(
1159 chart2::data::HighlightedRange(
1160 xValues->getSourceRangeRepresentation(),
1161 - nIndex,
1162 + nUnhiddenIndex,
1163 nPreferredColor,
1164 sal_False ));
1166 diff --git chart2/source/tools/UncachedDataSequence.cxx chart2/source/tools/UncachedDataSequence.cxx
1167 index bcf99f7..6a56cd5 100644
1168 --- chart2/source/tools/UncachedDataSequence.cxx
1169 +++ chart2/source/tools/UncachedDataSequence.cxx
1170 @@ -63,8 +63,6 @@ enum
1171 // PROP_SOURCE_IDENTIFIER,
1172 PROP_NUMBERFORMAT_KEY,
1173 PROP_PROPOSED_ROLE,
1174 - PROP_HIDDEN,
1175 - PROP_HIDDEN_VALUES,
1176 PROP_XML_RANGE
1178 } // anonymous namespace
1179 @@ -79,7 +77,6 @@ UncachedDataSequence::UncachedDataSequence(
1180 const OUString & rRangeRepresentation )
1181 : OPropertyContainer( GetBroadcastHelper()),
1182 UncachedDataSequence_Base( GetMutex()),
1183 - m_bIsHidden( true ),
1184 m_xDataProvider( xIntDataProv ),
1185 m_aSourceRepresentation( rRangeRepresentation ),
1186 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
1187 @@ -93,7 +90,6 @@ UncachedDataSequence::UncachedDataSequence(
1188 const OUString & rRole )
1189 : OPropertyContainer( GetBroadcastHelper()),
1190 UncachedDataSequence_Base( GetMutex()),
1191 - m_bIsHidden( true ),
1192 m_xDataProvider( xIntDataProv ),
1193 m_aSourceRepresentation( rRangeRepresentation ),
1194 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
1195 @@ -109,8 +105,6 @@ UncachedDataSequence::UncachedDataSequence( const UncachedDataSequence & rSource
1196 UncachedDataSequence_Base( GetMutex()),
1197 m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
1198 m_sRole( rSource.m_sRole ),
1199 - m_bIsHidden( rSource.m_bIsHidden ),
1200 - m_aHiddenValues( rSource.m_aHiddenValues ),
1201 m_xDataProvider( rSource.m_xDataProvider ),
1202 m_aSourceRepresentation( rSource.m_aSourceRepresentation ),
1203 m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
1204 @@ -135,18 +129,6 @@ void UncachedDataSequence::registerProperties()
1205 & m_sRole,
1206 ::getCppuType( & m_sRole ) );
1208 - registerProperty( C2U( "IsHidden" ),
1209 - PROP_HIDDEN,
1210 - 0, // PropertyAttributes
1211 - & m_bIsHidden,
1212 - ::getCppuType( & m_bIsHidden ) );
1214 - registerProperty( C2U( "HiddenValues" ),
1215 - PROP_HIDDEN_VALUES,
1216 - 0, // PropertyAttributes
1217 - & m_aHiddenValues,
1218 - ::getCppuType( & m_aHiddenValues ) );
1220 registerProperty( C2U( "CachedXMLRange" ),
1221 PROP_XML_RANGE,
1222 0, // PropertyAttributes
1223 diff --git chart2/source/view/axes/ScaleAutomatism.cxx chart2/source/view/axes/ScaleAutomatism.cxx
1224 index 7c58236..3e412c4 100644
1225 --- chart2/source/view/axes/ScaleAutomatism.cxx
1226 +++ chart2/source/view/axes/ScaleAutomatism.cxx
1227 @@ -134,7 +134,7 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
1228 if( m_aSourceScale.AxisType==AxisType::PERCENT )
1229 rExplicitScale.Minimum = 0.0;
1230 else if( ::rtl::math::isNan( m_fValueMinimum ) )
1231 - rExplicitScale.Minimum = 0.0; //@todo get Minimum from scsaling or from plotter????
1232 + rExplicitScale.Minimum = 0.0; //@todo get Minimum from scaling or from plotter????
1233 else
1234 rExplicitScale.Minimum = m_fValueMinimum;
1236 @@ -143,7 +143,7 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
1237 if( bAutoMaximum )
1239 if( m_aSourceScale.AxisType==AxisType::PERCENT )
1240 - rExplicitScale.Minimum = 1.0;
1241 + rExplicitScale.Maximum = 1.0;
1242 else if( ::rtl::math::isNan( m_fValueMaximum ) )
1243 rExplicitScale.Maximum = 10.0; //@todo get Maximum from scaling or from plotter????
1244 else
1245 diff --git chart2/source/view/inc/VDataSeries.hxx chart2/source/view/inc/VDataSeries.hxx
1246 index e41340c..7e11efd 100644
1247 --- chart2/source/view/inc/VDataSeries.hxx
1248 +++ chart2/source/view/inc/VDataSeries.hxx
1249 @@ -59,7 +59,7 @@ class VDataSequence
1251 public:
1252 void init( const ::com::sun::star::uno::Reference<
1253 - ::com::sun::star::chart2::data::XDataSequence >& xModel);
1254 + ::com::sun::star::chart2::data::XDataSequence >& xModel );
1255 bool is() const;
1256 void clear();
1257 double getValue( sal_Int32 index ) const;
1258 diff --git chart2/source/view/main/ChartItemPool.cxx chart2/source/view/main/ChartItemPool.cxx
1259 index 784307a..f8f9b4a 100644
1260 --- chart2/source/view/main/ChartItemPool.cxx
1261 +++ chart2/source/view/main/ChartItemPool.cxx
1262 @@ -184,6 +184,7 @@ ChartItemPool::ChartItemPool():
1263 ppPoolDefaults[SCHATTR_DIAGRAM_STYLE - SCHATTR_START] = new SvxChartStyleItem( CHSTYLE_2D_COLUMN, SCHATTR_DIAGRAM_STYLE );
1264 ppPoolDefaults[SCHATTR_TEXTBREAK - SCHATTR_START] = new SfxBoolItem( SCHATTR_TEXTBREAK, FALSE );
1265 ppPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, FALSE);
1266 + ppPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE);
1267 ppPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SfxInt32Item( SCHATTR_STARTING_ANGLE, 90 );
1268 ppPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, FALSE );
1270 diff --git chart2/source/view/main/ChartView.cxx chart2/source/view/main/ChartView.cxx
1271 index 50afb71..c096326 100644
1272 --- chart2/source/view/main/ChartView.cxx
1273 +++ chart2/source/view/main/ChartView.cxx
1274 @@ -631,6 +631,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
1275 sal_Bool bSortByXValues = sal_False;
1276 sal_Bool bConnectBars = sal_False;
1277 sal_Bool bGroupBarsPerAxis = sal_True;
1278 + sal_Bool bIncludeHiddenCells = sal_True;
1279 sal_Int32 nStartingAngle = 90;
1282 @@ -638,6 +639,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
1283 xDiaProp->getPropertyValue( C2U( "SortByXValues" ) ) >>= bSortByXValues;
1284 xDiaProp->getPropertyValue( C2U( "ConnectBars" ) ) >>= bConnectBars;
1285 xDiaProp->getPropertyValue( C2U( "GroupBarsPerAxis" ) ) >>= bGroupBarsPerAxis;
1286 + xDiaProp->getPropertyValue( C2U( "IncludeHiddenCells" ) ) >>= bIncludeHiddenCells;
1287 xDiaProp->getPropertyValue( C2U( "StartingAngle" ) ) >>= nStartingAngle;
1289 catch( const uno::Exception & ex )
1290 @@ -703,6 +705,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
1291 uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
1292 if(!xDataSeries.is())
1293 continue;
1294 + if( !bIncludeHiddenCells && !DataSeriesHelper::hasUnhiddenData(xDataSeries) )
1295 + continue;
1297 VDataSeries* pSeries = new VDataSeries( xDataSeries );
1299 pSeries->setGlobalSeriesIndex(nGlobalSeriesIndex);
1300 diff --git chart2/source/view/main/VDataSeries.cxx chart2/source/view/main/VDataSeries.cxx
1301 index c3d281d..96345db 100644
1302 --- chart2/source/view/main/VDataSeries.cxx
1303 +++ chart2/source/view/main/VDataSeries.cxx
1304 @@ -37,6 +37,7 @@
1305 #include "LabelPositionHelper.hxx"
1306 #include "ChartTypeHelper.hxx"
1307 #include "ContainerHelper.hxx"
1308 +#include "DataSeriesHelper.hxx"
1309 #include "MeanValueRegressionCurveCalculator.hxx"
1311 #include <com/sun/star/chart/MissingValueTreatment.hpp>
1312 @@ -61,87 +62,10 @@ using namespace ::com::sun::star;
1313 using namespace ::com::sun::star::chart2;
1314 using ::com::sun::star::uno::Reference;
1316 -namespace
1318 - struct lcl_LessIndex
1320 - inline bool operator() ( const sal_Int32& first,
1321 - const sal_Int32& second )
1323 - return ( first < second );
1325 - };
1327 - void lcl_removeIndices( uno::Sequence< double >& rValues, const uno::Sequence< sal_Int32 >& rIndicesToRemove )
1329 - if( !rIndicesToRemove.getLength() )
1330 - return;
1332 - ::std::vector< sal_Int32 > aIndicesToRemove( ContainerHelper::SequenceToVector( rIndicesToRemove) );
1333 - ::std::sort( aIndicesToRemove.begin(), aIndicesToRemove.end(), lcl_LessIndex() );
1335 - sal_Int32 nTarget=0;
1336 - sal_Int32 nR = 0;
1337 - sal_Int32 nRemove = aIndicesToRemove[nR];
1338 - for( sal_Int32 nSource=0; nSource<rValues.getLength(); nSource++ )
1340 - if( nSource<nRemove || nRemove==-1 )
1342 - if( nTarget < nSource )
1343 - rValues[nTarget]=rValues[nSource];
1344 - nTarget++;
1345 - continue;
1347 - if( nSource==nRemove )
1349 - ++nR;
1350 - if( nR<static_cast<sal_Int32>(aIndicesToRemove.size()) )
1351 - nRemove = aIndicesToRemove[nR];
1352 - else
1353 - nRemove = -1;
1357 - if( nTarget>0 )
1358 - rValues.realloc( nTarget );
1359 - else
1360 - rValues.realloc(0);
1364 void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
1366 - bool bDisplayHiddenCells = true; //todo: make this configurable in future
1367 - bool bIsHidden = false;
1368 - uno::Sequence< sal_Int32 > aHiddenValues;
1369 - if( !bDisplayHiddenCells )
1371 - uno::Reference<beans::XPropertySet> xProp(xModel, uno::UNO_QUERY );
1372 - if( xProp.is())
1374 - try
1376 - xProp->getPropertyValue( C2U( "IsHidden" ) ) >>= bIsHidden;
1377 - xProp->getPropertyValue( C2U( "HiddenValues" ) ) >>= aHiddenValues;
1379 - catch( uno::Exception& e )
1381 - ASSERT_EXCEPTION( e );
1386 Model = xModel;
1387 - if( bDisplayHiddenCells || !bIsHidden )
1388 - Doubles = DataSequenceToDoubleSequence( xModel );
1390 - if( !bDisplayHiddenCells )
1392 - if( bIsHidden )
1393 - Doubles.realloc(0);
1394 - else if( aHiddenValues.getLength() )
1395 - lcl_removeIndices( Doubles, aHiddenValues );
1397 + Doubles = DataSequenceToDoubleSequence( xModel );
1400 bool VDataSequence::is() const