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