1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*cde9e8dcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*cde9e8dcSAndrew Rist * distributed with this work for additional information
6*cde9e8dcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*cde9e8dcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist * with the License. You may obtain a copy of the License at
10*cde9e8dcSAndrew Rist *
11*cde9e8dcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist *
13*cde9e8dcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist * KIND, either express or implied. See the License for the
17*cde9e8dcSAndrew Rist * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist * under the License.
19*cde9e8dcSAndrew Rist *
20*cde9e8dcSAndrew Rist *************************************************************/
21*cde9e8dcSAndrew Rist
22*cde9e8dcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "dlg_InsertTrendline.hxx"
28cdf0e10cSrcweir #include "dlg_InsertTrendline.hrc"
29cdf0e10cSrcweir #include "res_Trendline.hxx"
30cdf0e10cSrcweir #include "ResourceIds.hrc"
31cdf0e10cSrcweir #include "ResId.hxx"
32cdf0e10cSrcweir #include "Strings.hrc"
33cdf0e10cSrcweir #include "chartview/ExplicitValueProvider.hxx"
34cdf0e10cSrcweir #include "ChartModelHelper.hxx"
35cdf0e10cSrcweir #include "ObjectIdentifier.hxx"
36cdf0e10cSrcweir #include "DiagramHelper.hxx"
37cdf0e10cSrcweir #include "AxisHelper.hxx"
38cdf0e10cSrcweir #include "ObjectNameProvider.hxx"
39cdf0e10cSrcweir #include <com/sun/star/chart2/XAxis.hpp>
40cdf0e10cSrcweir #include <com/sun/star/chart2/XDiagram.hpp>
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include <svtools/controldims.hrc>
43cdf0e10cSrcweir
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir using namespace ::com::sun::star::chart2;
46cdf0e10cSrcweir
47cdf0e10cSrcweir namespace
48cdf0e10cSrcweir {
lcl_SetControlXPos(Control & rControl,long nPosPixel)49cdf0e10cSrcweir void lcl_SetControlXPos( Control & rControl, long nPosPixel )
50cdf0e10cSrcweir {
51cdf0e10cSrcweir Point aPos( rControl.GetPosPixel());
52cdf0e10cSrcweir aPos.setX( nPosPixel );
53cdf0e10cSrcweir rControl.SetPosPixel( aPos );
54cdf0e10cSrcweir }
55cdf0e10cSrcweir } // anonymous namespace
56cdf0e10cSrcweir
57cdf0e10cSrcweir //.............................................................................
58cdf0e10cSrcweir namespace chart
59cdf0e10cSrcweir {
60cdf0e10cSrcweir //.............................................................................
61cdf0e10cSrcweir
InsertTrendlineDialog(Window * pParent,const SfxItemSet & rMyAttrs)62cdf0e10cSrcweir InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet& rMyAttrs ) :
63cdf0e10cSrcweir ModalDialog( pParent, SchResId( DLG_DATA_TRENDLINE )),
64cdf0e10cSrcweir rInAttrs( rMyAttrs ),
65cdf0e10cSrcweir aBtnOK( this, SchResId( BTN_OK )),
66cdf0e10cSrcweir aBtnCancel( this, SchResId( BTN_CANCEL )),
67cdf0e10cSrcweir aBtnHelp( this, SchResId( BTN_HELP )),
68cdf0e10cSrcweir m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true ))
69cdf0e10cSrcweir {
70cdf0e10cSrcweir FreeResource();
71cdf0e10cSrcweir this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) );
72cdf0e10cSrcweir }
73cdf0e10cSrcweir
~InsertTrendlineDialog()74cdf0e10cSrcweir InsertTrendlineDialog::~InsertTrendlineDialog()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir }
77cdf0e10cSrcweir
adjustSize()78cdf0e10cSrcweir void InsertTrendlineDialog::adjustSize()
79cdf0e10cSrcweir {
80cdf0e10cSrcweir long nControlsRightEdge = m_apTrendlineResources->adjustControlSizes();
81cdf0e10cSrcweir long nButtonXPos = nControlsRightEdge +
82cdf0e10cSrcweir LogicToPixel( Size( RSC_SP_CTRL_X, 10 ), MapMode( MAP_APPFONT )).getWidth();
83cdf0e10cSrcweir lcl_SetControlXPos( aBtnOK, nButtonXPos );
84cdf0e10cSrcweir lcl_SetControlXPos( aBtnCancel, nButtonXPos );
85cdf0e10cSrcweir lcl_SetControlXPos( aBtnHelp, nButtonXPos );
86cdf0e10cSrcweir
87cdf0e10cSrcweir Size aDialogSize( GetSizePixel());
88cdf0e10cSrcweir aDialogSize.setWidth(
89cdf0e10cSrcweir nControlsRightEdge +
90cdf0e10cSrcweir LogicToPixel( Size( RSC_SP_CTRL_X + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT, 0 ),
91cdf0e10cSrcweir MapMode( MAP_APPFONT )).getWidth());
92cdf0e10cSrcweir SetSizePixel( aDialogSize );
93cdf0e10cSrcweir }
94cdf0e10cSrcweir
FillItemSet(SfxItemSet & rOutAttrs)95cdf0e10cSrcweir void InsertTrendlineDialog::FillItemSet(SfxItemSet& rOutAttrs)
96cdf0e10cSrcweir {
97cdf0e10cSrcweir m_apTrendlineResources->FillItemSet(rOutAttrs);
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rDCEvt)100cdf0e10cSrcweir void InsertTrendlineDialog::DataChanged( const DataChangedEvent& rDCEvt )
101cdf0e10cSrcweir {
102cdf0e10cSrcweir ModalDialog::DataChanged( rDCEvt );
103cdf0e10cSrcweir
104cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
105cdf0e10cSrcweir m_apTrendlineResources->FillValueSets();
106cdf0e10cSrcweir }
107cdf0e10cSrcweir
108cdf0e10cSrcweir //.............................................................................
109cdf0e10cSrcweir } //namespace chart
110cdf0e10cSrcweir //.............................................................................
111