Bump for 3.6-28
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_InsertTrendline.cxx
blob6d12b4755ba7a0951313fcecf638a0939b1524a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "dlg_InsertTrendline.hxx"
31 #include "dlg_InsertTrendline.hrc"
32 #include "res_Trendline.hxx"
33 #include "ResourceIds.hrc"
34 #include "ResId.hxx"
35 #include "Strings.hrc"
36 #include "chartview/ExplicitValueProvider.hxx"
37 #include "ChartModelHelper.hxx"
38 #include "ObjectIdentifier.hxx"
39 #include "DiagramHelper.hxx"
40 #include "AxisHelper.hxx"
41 #include "ObjectNameProvider.hxx"
42 #include <com/sun/star/chart2/XAxis.hpp>
43 #include <com/sun/star/chart2/XDiagram.hpp>
45 #include <svtools/controldims.hrc>
47 using namespace ::com::sun::star;
48 using namespace ::com::sun::star::chart2;
50 namespace
52 void lcl_SetControlXPos( Control & rControl, long nPosPixel )
54 Point aPos( rControl.GetPosPixel());
55 aPos.setX( nPosPixel );
56 rControl.SetPosPixel( aPos );
58 } // anonymous namespace
60 //.............................................................................
61 namespace chart
63 //.............................................................................
65 InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet& rMyAttrs ) :
66 ModalDialog( pParent, SchResId( DLG_DATA_TRENDLINE )),
67 rInAttrs( rMyAttrs ),
68 aBtnOK( this, SchResId( BTN_OK )),
69 aBtnCancel( this, SchResId( BTN_CANCEL )),
70 aBtnHelp( this, SchResId( BTN_HELP )),
71 m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true ))
73 FreeResource();
74 this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) );
77 InsertTrendlineDialog::~InsertTrendlineDialog()
81 void InsertTrendlineDialog::adjustSize()
83 long nControlsRightEdge = m_apTrendlineResources->adjustControlSizes();
84 long nButtonXPos = nControlsRightEdge +
85 LogicToPixel( Size( RSC_SP_CTRL_X, 10 ), MapMode( MAP_APPFONT )).getWidth();
86 lcl_SetControlXPos( aBtnOK, nButtonXPos );
87 lcl_SetControlXPos( aBtnCancel, nButtonXPos );
88 lcl_SetControlXPos( aBtnHelp, nButtonXPos );
90 Size aDialogSize( GetSizePixel());
91 aDialogSize.setWidth(
92 nControlsRightEdge +
93 LogicToPixel( Size( RSC_SP_CTRL_X + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT, 0 ),
94 MapMode( MAP_APPFONT )).getWidth());
95 SetSizePixel( aDialogSize );
98 void InsertTrendlineDialog::FillItemSet(SfxItemSet& rOutAttrs)
100 m_apTrendlineResources->FillItemSet(rOutAttrs);
103 void InsertTrendlineDialog::DataChanged( const DataChangedEvent& rDCEvt )
105 ModalDialog::DataChanged( rDCEvt );
107 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
108 m_apTrendlineResources->FillValueSets();
111 //.............................................................................
112 } //namespace chart
113 //.............................................................................
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */