Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "dlg_InsertTrendline.hxx"
22 : #include "dlg_InsertTrendline.hrc"
23 : #include "res_Trendline.hxx"
24 : #include "ResourceIds.hrc"
25 : #include "ResId.hxx"
26 : #include "Strings.hrc"
27 : #include "chartview/ExplicitValueProvider.hxx"
28 : #include "ChartModelHelper.hxx"
29 : #include "ObjectIdentifier.hxx"
30 : #include "DiagramHelper.hxx"
31 : #include "AxisHelper.hxx"
32 : #include "ObjectNameProvider.hxx"
33 : #include <com/sun/star/chart2/XAxis.hpp>
34 : #include <com/sun/star/chart2/XDiagram.hpp>
35 :
36 : #include <svtools/controldims.hrc>
37 :
38 : using namespace ::com::sun::star;
39 : using namespace ::com::sun::star::chart2;
40 :
41 : namespace
42 : {
43 0 : void lcl_SetControlXPos( Control & rControl, long nPosPixel )
44 : {
45 0 : Point aPos( rControl.GetPosPixel());
46 0 : aPos.setX( nPosPixel );
47 0 : rControl.SetPosPixel( aPos );
48 0 : }
49 : } // anonymous namespace
50 :
51 : //.............................................................................
52 : namespace chart
53 : {
54 : //.............................................................................
55 :
56 0 : InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet& rMyAttrs ) :
57 : ModalDialog( pParent, SchResId( DLG_DATA_TRENDLINE )),
58 : rInAttrs( rMyAttrs ),
59 : aBtnOK( this, SchResId( BTN_OK )),
60 : aBtnCancel( this, SchResId( BTN_CANCEL )),
61 : aBtnHelp( this, SchResId( BTN_HELP )),
62 0 : m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true ))
63 : {
64 0 : FreeResource();
65 0 : this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) );
66 0 : }
67 :
68 0 : InsertTrendlineDialog::~InsertTrendlineDialog()
69 : {
70 0 : }
71 :
72 0 : void InsertTrendlineDialog::adjustSize()
73 : {
74 0 : long nControlsRightEdge = m_apTrendlineResources->adjustControlSizes();
75 : long nButtonXPos = nControlsRightEdge +
76 0 : LogicToPixel( Size( RSC_SP_CTRL_X, 10 ), MapMode( MAP_APPFONT )).getWidth();
77 0 : lcl_SetControlXPos( aBtnOK, nButtonXPos );
78 0 : lcl_SetControlXPos( aBtnCancel, nButtonXPos );
79 0 : lcl_SetControlXPos( aBtnHelp, nButtonXPos );
80 :
81 0 : Size aDialogSize( GetSizePixel());
82 : aDialogSize.setWidth(
83 : nControlsRightEdge +
84 : LogicToPixel( Size( RSC_SP_CTRL_X + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT, 0 ),
85 0 : MapMode( MAP_APPFONT )).getWidth());
86 0 : SetSizePixel( aDialogSize );
87 0 : }
88 :
89 0 : void InsertTrendlineDialog::FillItemSet(SfxItemSet& rOutAttrs)
90 : {
91 0 : m_apTrendlineResources->FillItemSet(rOutAttrs);
92 0 : }
93 :
94 0 : void InsertTrendlineDialog::DataChanged( const DataChangedEvent& rDCEvt )
95 : {
96 0 : ModalDialog::DataChanged( rDCEvt );
97 :
98 0 : if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
99 0 : m_apTrendlineResources->FillValueSets();
100 0 : }
101 :
102 : //.............................................................................
103 : } //namespace chart
104 : //.............................................................................
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|