1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_chart2.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "res_Titles.hxx" 32*cdf0e10cSrcweir #include "res_Titles.hrc" 33*cdf0e10cSrcweir #include "ResId.hxx" 34*cdf0e10cSrcweir #include "TitleDialogData.hxx" 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #ifndef _SVT_CONTROLDIMS_HRC_ 37*cdf0e10cSrcweir #include <svtools/controldims.hrc> 38*cdf0e10cSrcweir #endif 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir //............................................................................. 41*cdf0e10cSrcweir namespace chart 42*cdf0e10cSrcweir { 43*cdf0e10cSrcweir //............................................................................. 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir TitleResources::TitleResources( Window* pWindow, bool bShowSecondaryAxesTitle ) 46*cdf0e10cSrcweir : m_aFT_Main(pWindow, SchResId(FT_MAINTITLE)) 47*cdf0e10cSrcweir , m_aEd_Main(pWindow, SchResId(ED_MAINTITLE)) 48*cdf0e10cSrcweir , m_aFT_Sub(pWindow, SchResId(FT_SUBTITLE)) 49*cdf0e10cSrcweir , m_aEd_Sub(pWindow, SchResId(ED_SUBTITLE)) 50*cdf0e10cSrcweir , m_aFL_Axes(pWindow, SchResId(FL_AXES)) 51*cdf0e10cSrcweir , m_aFT_XAxis(pWindow, SchResId(FT_TITLE_X_AXIS)) 52*cdf0e10cSrcweir , m_aEd_XAxis(pWindow, SchResId(ED_X_AXIS)) 53*cdf0e10cSrcweir , m_aFT_YAxis(pWindow, SchResId(FT_TITLE_Y_AXIS)) 54*cdf0e10cSrcweir , m_aEd_YAxis(pWindow, SchResId(ED_Y_AXIS)) 55*cdf0e10cSrcweir , m_aFT_ZAxis(pWindow, SchResId(FT_TITLE_Z_AXIS)) 56*cdf0e10cSrcweir , m_aEd_ZAxis(pWindow, SchResId(ED_Z_AXIS)) 57*cdf0e10cSrcweir , m_aFL_SecondaryAxes(pWindow, SchResId(FL_SECONDARY_AXES)) 58*cdf0e10cSrcweir , m_aFT_SecondaryXAxis(pWindow, SchResId(FT_TITLE_SECONDARY_X_AXIS)) 59*cdf0e10cSrcweir , m_aEd_SecondaryXAxis(pWindow, SchResId(ED_SECONDARY_X_AXIS)) 60*cdf0e10cSrcweir , m_aFT_SecondaryYAxis(pWindow, SchResId(FT_TITLE_SECONDARY_Y_AXIS)) 61*cdf0e10cSrcweir , m_aEd_SecondaryYAxis(pWindow, SchResId(ED_SECONDARY_Y_AXIS)) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir long nMaxTextWidth = ::std::max( m_aFT_Main.CalcMinimumSize().Width(),m_aFT_Sub.CalcMinimumSize().Width() ) ; 64*cdf0e10cSrcweir nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_XAxis.CalcMinimumSize().Width() ) ; 65*cdf0e10cSrcweir nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_YAxis.CalcMinimumSize().Width() ) ; 66*cdf0e10cSrcweir nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_ZAxis.CalcMinimumSize().Width() ) ; 67*cdf0e10cSrcweir if( bShowSecondaryAxesTitle ) 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_SecondaryXAxis.CalcMinimumSize().Width() ) ; 70*cdf0e10cSrcweir nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_SecondaryYAxis.CalcMinimumSize().Width() ) ; 71*cdf0e10cSrcweir } 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir Size aControlDistance( m_aFT_Main.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) ); 74*cdf0e10cSrcweir long nEditFieldXPos = m_aFT_Main.GetPosPixel().X() + nMaxTextWidth + aControlDistance.Width(); 75*cdf0e10cSrcweir long nEditFieldWidth = m_aEd_Main.GetPosPixel().X() + m_aEd_Main.GetSizePixel().Width() - nEditFieldXPos; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir if( nEditFieldWidth > 10 ) 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir Size aFTSize( m_aFT_Main.GetSizePixel() ); 80*cdf0e10cSrcweir aFTSize.Width() = nMaxTextWidth; 81*cdf0e10cSrcweir m_aFT_Main.SetSizePixel(aFTSize); 82*cdf0e10cSrcweir m_aFT_Sub.SetSizePixel(aFTSize); 83*cdf0e10cSrcweir m_aFT_XAxis.SetSizePixel(aFTSize); 84*cdf0e10cSrcweir m_aFT_YAxis.SetSizePixel(aFTSize); 85*cdf0e10cSrcweir m_aFT_ZAxis.SetSizePixel(aFTSize); 86*cdf0e10cSrcweir if( bShowSecondaryAxesTitle ) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir m_aFT_SecondaryXAxis.SetSizePixel(aFTSize); 89*cdf0e10cSrcweir m_aFT_SecondaryYAxis.SetSizePixel(aFTSize); 90*cdf0e10cSrcweir } 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir m_aEd_Main.SetPosPixel( Point( nEditFieldXPos, m_aEd_Main.GetPosPixel().Y() ) ); 93*cdf0e10cSrcweir m_aEd_Sub.SetPosPixel( Point( nEditFieldXPos, m_aEd_Sub.GetPosPixel().Y() ) ); 94*cdf0e10cSrcweir m_aEd_XAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_XAxis.GetPosPixel().Y() ) ); 95*cdf0e10cSrcweir m_aEd_YAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_YAxis.GetPosPixel().Y() ) ); 96*cdf0e10cSrcweir m_aEd_ZAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_ZAxis.GetPosPixel().Y() ) ); 97*cdf0e10cSrcweir if(bShowSecondaryAxesTitle) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir m_aEd_SecondaryXAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_SecondaryXAxis.GetPosPixel().Y() ) ); 100*cdf0e10cSrcweir m_aEd_SecondaryYAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_SecondaryYAxis.GetPosPixel().Y() ) ); 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir Size aEditSize( m_aEd_Main.GetSizePixel() ); 104*cdf0e10cSrcweir aEditSize.Width() = nEditFieldWidth; 105*cdf0e10cSrcweir m_aEd_Main.SetSizePixel( aEditSize ); 106*cdf0e10cSrcweir m_aEd_Sub.SetSizePixel( aEditSize ); 107*cdf0e10cSrcweir m_aEd_XAxis.SetSizePixel( aEditSize ); 108*cdf0e10cSrcweir m_aEd_YAxis.SetSizePixel( aEditSize ); 109*cdf0e10cSrcweir m_aEd_ZAxis.SetSizePixel( aEditSize ); 110*cdf0e10cSrcweir if(bShowSecondaryAxesTitle) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir m_aEd_SecondaryXAxis.SetSizePixel( aEditSize ); 113*cdf0e10cSrcweir m_aEd_SecondaryYAxis.SetSizePixel( aEditSize ); 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir m_aFT_SecondaryXAxis.Show( bShowSecondaryAxesTitle ); 118*cdf0e10cSrcweir m_aEd_SecondaryXAxis.Show( bShowSecondaryAxesTitle ); 119*cdf0e10cSrcweir m_aFT_SecondaryYAxis.Show( bShowSecondaryAxesTitle ); 120*cdf0e10cSrcweir m_aEd_SecondaryYAxis.Show( bShowSecondaryAxesTitle ); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir TitleResources::~TitleResources() 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir void TitleResources::SetUpdateDataHdl( const Link& rLink ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir sal_uLong nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT; 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir m_aEd_Main.EnableUpdateData( nTimeout ); 132*cdf0e10cSrcweir m_aEd_Main.SetUpdateDataHdl( rLink ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir m_aEd_Sub.EnableUpdateData( nTimeout ); 135*cdf0e10cSrcweir m_aEd_Sub.SetUpdateDataHdl( rLink ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir m_aEd_XAxis.EnableUpdateData( nTimeout ); 138*cdf0e10cSrcweir m_aEd_XAxis.SetUpdateDataHdl( rLink ); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir m_aEd_YAxis.EnableUpdateData( nTimeout ); 141*cdf0e10cSrcweir m_aEd_YAxis.SetUpdateDataHdl( rLink ); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir m_aEd_ZAxis.EnableUpdateData( nTimeout ); 144*cdf0e10cSrcweir m_aEd_ZAxis.SetUpdateDataHdl( rLink ); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir m_aEd_SecondaryXAxis.EnableUpdateData( nTimeout ); 147*cdf0e10cSrcweir m_aEd_SecondaryXAxis.SetUpdateDataHdl( rLink ); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir m_aEd_SecondaryYAxis.EnableUpdateData( nTimeout ); 150*cdf0e10cSrcweir m_aEd_SecondaryYAxis.SetUpdateDataHdl( rLink ); 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir bool TitleResources::IsModified() 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir return m_aEd_Main.IsModified() 156*cdf0e10cSrcweir || m_aEd_Sub.IsModified() 157*cdf0e10cSrcweir || m_aEd_XAxis.IsModified() 158*cdf0e10cSrcweir || m_aEd_YAxis.IsModified() 159*cdf0e10cSrcweir || m_aEd_ZAxis.IsModified() 160*cdf0e10cSrcweir || m_aEd_SecondaryXAxis.IsModified() 161*cdf0e10cSrcweir || m_aEd_SecondaryYAxis.IsModified(); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir void TitleResources::ClearModifyFlag() 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir m_aEd_Main.ClearModifyFlag(); 167*cdf0e10cSrcweir m_aEd_Sub.ClearModifyFlag(); 168*cdf0e10cSrcweir m_aEd_XAxis.ClearModifyFlag(); 169*cdf0e10cSrcweir m_aEd_YAxis.ClearModifyFlag(); 170*cdf0e10cSrcweir m_aEd_ZAxis.ClearModifyFlag(); 171*cdf0e10cSrcweir m_aEd_SecondaryXAxis.ClearModifyFlag(); 172*cdf0e10cSrcweir m_aEd_SecondaryYAxis.ClearModifyFlag(); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir void TitleResources::writeToResources( const TitleDialogData& rInput ) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir m_aFT_Main.Enable( rInput.aPossibilityList[0] ); 178*cdf0e10cSrcweir m_aFT_Sub.Enable( rInput.aPossibilityList[1] ); 179*cdf0e10cSrcweir m_aFT_XAxis.Enable( rInput.aPossibilityList[2] ); 180*cdf0e10cSrcweir m_aFT_YAxis.Enable( rInput.aPossibilityList[3] ); 181*cdf0e10cSrcweir m_aFT_ZAxis.Enable( rInput.aPossibilityList[4] ); 182*cdf0e10cSrcweir m_aFT_SecondaryXAxis.Enable( rInput.aPossibilityList[5] ); 183*cdf0e10cSrcweir m_aFT_SecondaryYAxis.Enable( rInput.aPossibilityList[6] ); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir m_aEd_Main.Enable( rInput.aPossibilityList[0] ); 186*cdf0e10cSrcweir m_aEd_Sub.Enable( rInput.aPossibilityList[1] ); 187*cdf0e10cSrcweir m_aEd_XAxis.Enable( rInput.aPossibilityList[2] ); 188*cdf0e10cSrcweir m_aEd_YAxis.Enable( rInput.aPossibilityList[3] ); 189*cdf0e10cSrcweir m_aEd_ZAxis.Enable( rInput.aPossibilityList[4] ); 190*cdf0e10cSrcweir m_aEd_SecondaryXAxis.Enable( rInput.aPossibilityList[5] ); 191*cdf0e10cSrcweir m_aEd_SecondaryYAxis.Enable( rInput.aPossibilityList[6] ); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir m_aEd_Main.SetText(rInput.aTextList[0]); 194*cdf0e10cSrcweir m_aEd_Sub.SetText(rInput.aTextList[1]); 195*cdf0e10cSrcweir m_aEd_XAxis.SetText(rInput.aTextList[2]); 196*cdf0e10cSrcweir m_aEd_YAxis.SetText(rInput.aTextList[3]); 197*cdf0e10cSrcweir m_aEd_ZAxis.SetText(rInput.aTextList[4]); 198*cdf0e10cSrcweir m_aEd_SecondaryXAxis.SetText(rInput.aTextList[5]); 199*cdf0e10cSrcweir m_aEd_SecondaryYAxis.SetText(rInput.aTextList[6]); 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir void TitleResources::readFromResources( TitleDialogData& rOutput ) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir rOutput.aExistenceList[0] = static_cast<sal_Bool>(m_aEd_Main.GetText().Len()!=0); 205*cdf0e10cSrcweir rOutput.aExistenceList[1] = static_cast<sal_Bool>(m_aEd_Sub.GetText().Len()!=0); 206*cdf0e10cSrcweir rOutput.aExistenceList[2] = static_cast<sal_Bool>(m_aEd_XAxis.GetText().Len()!=0); 207*cdf0e10cSrcweir rOutput.aExistenceList[3] = static_cast<sal_Bool>(m_aEd_YAxis.GetText().Len()!=0); 208*cdf0e10cSrcweir rOutput.aExistenceList[4] = static_cast<sal_Bool>(m_aEd_ZAxis.GetText().Len()!=0); 209*cdf0e10cSrcweir rOutput.aExistenceList[5] = static_cast<sal_Bool>(m_aEd_SecondaryXAxis.GetText().Len()!=0); 210*cdf0e10cSrcweir rOutput.aExistenceList[6] = static_cast<sal_Bool>(m_aEd_SecondaryYAxis.GetText().Len()!=0); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir rOutput.aTextList[0] = m_aEd_Main.GetText(); 213*cdf0e10cSrcweir rOutput.aTextList[1] = m_aEd_Sub.GetText(); 214*cdf0e10cSrcweir rOutput.aTextList[2] = m_aEd_XAxis.GetText(); 215*cdf0e10cSrcweir rOutput.aTextList[3] = m_aEd_YAxis.GetText(); 216*cdf0e10cSrcweir rOutput.aTextList[4] = m_aEd_ZAxis.GetText(); 217*cdf0e10cSrcweir rOutput.aTextList[5] = m_aEd_SecondaryXAxis.GetText(); 218*cdf0e10cSrcweir rOutput.aTextList[6] = m_aEd_SecondaryYAxis.GetText(); 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir //............................................................................. 222*cdf0e10cSrcweir } //namespace chart 223*cdf0e10cSrcweir //............................................................................. 224*cdf0e10cSrcweir 225