Update ooo320-m1
[ooovba.git] / chart2 / source / controller / dialogs / dlg_InsertTrendline.cxx
blob3e07c27c3afb0756b428fd6741bb632a909625a3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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"
38 #include "ResId.hxx"
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 "ObjectNameProvider.hxx"
46 #include <com/sun/star/chart2/XAxis.hpp>
47 #include <com/sun/star/chart2/XDiagram.hpp>
49 #include <svtools/controldims.hrc>
51 using namespace ::com::sun::star;
52 using namespace ::com::sun::star::chart2;
54 namespace
56 void lcl_SetControlXPos( Control & rControl, long nPosPixel )
58 Point aPos( rControl.GetPosPixel());
59 aPos.setX( nPosPixel );
60 rControl.SetPosPixel( aPos );
62 } // anonymous namespace
64 //.............................................................................
65 namespace chart
67 //.............................................................................
69 InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet& rMyAttrs ) :
70 ModalDialog( pParent, SchResId( DLG_DATA_TRENDLINE )),
71 rInAttrs( rMyAttrs ),
72 aBtnOK( this, SchResId( BTN_OK )),
73 aBtnCancel( this, SchResId( BTN_CANCEL )),
74 aBtnHelp( this, SchResId( BTN_HELP )),
75 m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true ))
77 FreeResource();
78 this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) );
81 InsertTrendlineDialog::~InsertTrendlineDialog()
85 void InsertTrendlineDialog::adjustSize()
87 long nControlsRightEdge = m_apTrendlineResources->adjustControlSizes();
88 long nButtonXPos = nControlsRightEdge +
89 LogicToPixel( Size( RSC_SP_CTRL_X, 10 ), MapMode( MAP_APPFONT )).getWidth();
90 lcl_SetControlXPos( aBtnOK, nButtonXPos );
91 lcl_SetControlXPos( aBtnCancel, nButtonXPos );
92 lcl_SetControlXPos( aBtnHelp, nButtonXPos );
94 Size aDialogSize( GetSizePixel());
95 aDialogSize.setWidth(
96 nControlsRightEdge +
97 LogicToPixel( Size( RSC_SP_CTRL_X + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT, 0 ),
98 MapMode( MAP_APPFONT )).getWidth());
99 SetSizePixel( aDialogSize );
102 void InsertTrendlineDialog::FillItemSet(SfxItemSet& rOutAttrs)
104 m_apTrendlineResources->FillItemSet(rOutAttrs);
107 void InsertTrendlineDialog::DataChanged( const DataChangedEvent& rDCEvt )
109 ModalDialog::DataChanged( rDCEvt );
111 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
112 m_apTrendlineResources->FillValueSets();
115 //.............................................................................
116 } //namespace chart
117 //.............................................................................