1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlg_InsertTrendline.cxx,v $
10 * $Revision: 1.3.44.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "dlg_InsertTrendline.hxx"
35 #include "dlg_InsertTrendline.hrc"
36 #include "res_Trendline.hxx"
37 #include "ResourceIds.hrc"
39 #include "Strings.hrc"
40 #include "chartview/ExplicitValueProvider.hxx"
41 #include "ChartModelHelper.hxx"
42 #include "ObjectIdentifier.hxx"
43 #include "DiagramHelper.hxx"
44 #include "AxisHelper.hxx"
45 #include <com/sun/star/chart2/XAxis.hpp>
46 #include <com/sun/star/chart2/XDiagram.hpp>
48 #include <svtools/controldims.hrc>
50 using namespace ::com::sun::star
;
51 using namespace ::com::sun::star::chart2
;
55 void lcl_SetControlXPos( Control
& rControl
, long nPosPixel
)
57 Point
aPos( rControl
.GetPosPixel());
58 aPos
.setX( nPosPixel
);
59 rControl
.SetPosPixel( aPos
);
61 } // anonymous namespace
63 //.............................................................................
66 //.............................................................................
68 InsertTrendlineDialog::InsertTrendlineDialog( Window
* pParent
, const SfxItemSet
& rMyAttrs
) :
69 ModalDialog( pParent
, SchResId( DLG_DATA_TRENDLINE
)),
71 aBtnOK( this, SchResId( BTN_OK
)),
72 aBtnCancel( this, SchResId( BTN_CANCEL
)),
73 aBtnHelp( this, SchResId( BTN_HELP
)),
74 m_apTrendlineResources( new TrendlineResources( this, rInAttrs
, true ))
77 this->SetText( String( SchResId( STR_OBJECT_CURVES
)));
80 InsertTrendlineDialog::~InsertTrendlineDialog()
84 void InsertTrendlineDialog::adjustSize()
86 long nControlsRightEdge
= m_apTrendlineResources
->adjustControlSizes();
87 long nButtonXPos
= nControlsRightEdge
+
88 LogicToPixel( Size( RSC_SP_CTRL_X
, 10 ), MapMode( MAP_APPFONT
)).getWidth();
89 lcl_SetControlXPos( aBtnOK
, nButtonXPos
);
90 lcl_SetControlXPos( aBtnCancel
, nButtonXPos
);
91 lcl_SetControlXPos( aBtnHelp
, nButtonXPos
);
93 Size
aDialogSize( GetSizePixel());
96 LogicToPixel( Size( RSC_SP_CTRL_X
+ RSC_CD_PUSHBUTTON_WIDTH
+ RSC_SP_DLG_INNERBORDER_RIGHT
, 0 ),
97 MapMode( MAP_APPFONT
)).getWidth());
98 SetSizePixel( aDialogSize
);
101 void InsertTrendlineDialog::FillItemSet(SfxItemSet
& rOutAttrs
)
103 m_apTrendlineResources
->FillItemSet(rOutAttrs
);
106 void InsertTrendlineDialog::DataChanged( const DataChangedEvent
& rDCEvt
)
108 ModalDialog::DataChanged( rDCEvt
);
110 if ( (rDCEvt
.GetType() == DATACHANGED_SETTINGS
) && (rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
111 m_apTrendlineResources
->FillValueSets();
114 //.............................................................................
116 //.............................................................................