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 #include "TitleHelper.hxx" 31*cdf0e10cSrcweir #include "ChartModelHelper.hxx" 32*cdf0e10cSrcweir #include "macros.hxx" 33*cdf0e10cSrcweir #include "AxisHelper.hxx" 34*cdf0e10cSrcweir #include "DiagramHelper.hxx" 35*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp> 36*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir //............................................................................. 39*cdf0e10cSrcweir namespace chart 40*cdf0e10cSrcweir { 41*cdf0e10cSrcweir //............................................................................. 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir using namespace ::com::sun::star; 44*cdf0e10cSrcweir using namespace ::com::sun::star::chart2; 45*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir uno::Reference< XTitled > lcl_getTitleParentFromDiagram( 48*cdf0e10cSrcweir TitleHelper::eTitleType nTitleIndex 49*cdf0e10cSrcweir , const uno::Reference< XDiagram >& xDiagram ) 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir uno::Reference< XTitled > xResult; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir if( nTitleIndex == TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION || 54*cdf0e10cSrcweir nTitleIndex == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION ) 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir bool bDummy = false; 57*cdf0e10cSrcweir bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy ); 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir if( nTitleIndex == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION ) 60*cdf0e10cSrcweir nTitleIndex = bIsVertical ? TitleHelper::X_AXIS_TITLE : TitleHelper::Y_AXIS_TITLE; 61*cdf0e10cSrcweir else 62*cdf0e10cSrcweir nTitleIndex = bIsVertical ? TitleHelper::Y_AXIS_TITLE : TitleHelper::X_AXIS_TITLE; 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir switch( nTitleIndex ) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir case TitleHelper::SUB_TITLE: 69*cdf0e10cSrcweir if( xDiagram.is()) 70*cdf0e10cSrcweir xResult.set( xDiagram, uno::UNO_QUERY ); 71*cdf0e10cSrcweir break; 72*cdf0e10cSrcweir case TitleHelper::X_AXIS_TITLE: 73*cdf0e10cSrcweir if( xDiagram.is()) 74*cdf0e10cSrcweir xResult.set( AxisHelper::getAxis( 0, true, xDiagram ), uno::UNO_QUERY ); 75*cdf0e10cSrcweir break; 76*cdf0e10cSrcweir case TitleHelper::Y_AXIS_TITLE: 77*cdf0e10cSrcweir if( xDiagram.is()) 78*cdf0e10cSrcweir xResult.set( AxisHelper::getAxis( 1, true, xDiagram ), uno::UNO_QUERY ); 79*cdf0e10cSrcweir break; 80*cdf0e10cSrcweir case TitleHelper::Z_AXIS_TITLE: 81*cdf0e10cSrcweir if( xDiagram.is()) 82*cdf0e10cSrcweir xResult.set( AxisHelper::getAxis( 2, true, xDiagram ), uno::UNO_QUERY ); 83*cdf0e10cSrcweir break; 84*cdf0e10cSrcweir case TitleHelper::SECONDARY_X_AXIS_TITLE: 85*cdf0e10cSrcweir if( xDiagram.is()) 86*cdf0e10cSrcweir xResult.set( AxisHelper::getAxis( 0, false, xDiagram ), uno::UNO_QUERY ); 87*cdf0e10cSrcweir break; 88*cdf0e10cSrcweir case TitleHelper::SECONDARY_Y_AXIS_TITLE: 89*cdf0e10cSrcweir if( xDiagram.is()) 90*cdf0e10cSrcweir xResult.set( AxisHelper::getAxis( 1, false, xDiagram ), uno::UNO_QUERY ); 91*cdf0e10cSrcweir break; 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir case TitleHelper::MAIN_TITLE: 94*cdf0e10cSrcweir default: 95*cdf0e10cSrcweir OSL_ENSURE( false, "Unsupported Title-Type requested" ); 96*cdf0e10cSrcweir break; 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir return xResult; 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex 103*cdf0e10cSrcweir , const uno::Reference< frame::XModel >& xModel ) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir uno::Reference< XTitled > xResult; 106*cdf0e10cSrcweir uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY ); 107*cdf0e10cSrcweir uno::Reference< XDiagram > xDiagram; 108*cdf0e10cSrcweir if( xChartDoc.is()) 109*cdf0e10cSrcweir xDiagram.set( xChartDoc->getFirstDiagram()); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir switch( nTitleIndex ) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir case TitleHelper::MAIN_TITLE: 114*cdf0e10cSrcweir xResult.set( xModel, uno::UNO_QUERY ); 115*cdf0e10cSrcweir break; 116*cdf0e10cSrcweir case TitleHelper::SUB_TITLE: 117*cdf0e10cSrcweir case TitleHelper::X_AXIS_TITLE: 118*cdf0e10cSrcweir case TitleHelper::Y_AXIS_TITLE: 119*cdf0e10cSrcweir case TitleHelper::Z_AXIS_TITLE: 120*cdf0e10cSrcweir case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION: 121*cdf0e10cSrcweir case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION: 122*cdf0e10cSrcweir case TitleHelper::SECONDARY_X_AXIS_TITLE: 123*cdf0e10cSrcweir case TitleHelper::SECONDARY_Y_AXIS_TITLE: 124*cdf0e10cSrcweir xResult.set( lcl_getTitleParentFromDiagram( nTitleIndex, xDiagram )); 125*cdf0e10cSrcweir break; 126*cdf0e10cSrcweir default: 127*cdf0e10cSrcweir OSL_ENSURE( false, "Unsupported Title-Type requested" ); 128*cdf0e10cSrcweir break; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir return xResult; 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex 135*cdf0e10cSrcweir , const uno::Reference< frame::XModel >& xModel ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) ); 138*cdf0e10cSrcweir if( xTitled.is()) 139*cdf0e10cSrcweir return xTitled->getTitleObject(); 140*cdf0e10cSrcweir return NULL; 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir uno::Reference< XTitle > TitleHelper::createTitle( 144*cdf0e10cSrcweir TitleHelper::eTitleType eTitleType 145*cdf0e10cSrcweir , const rtl::OUString& rTitleText 146*cdf0e10cSrcweir , const uno::Reference< frame::XModel >& xModel 147*cdf0e10cSrcweir , const uno::Reference< uno::XComponentContext > & xContext 148*cdf0e10cSrcweir , ReferenceSizeProvider * pRefSizeProvider ) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir uno::Reference< XTitle > xTitle; 151*cdf0e10cSrcweir uno::Reference< XTitled > xTitled( lcl_getTitleParent( eTitleType, xModel ) ); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir if( !xTitled.is() ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) ); 156*cdf0e10cSrcweir uno::Reference< chart2::XAxis > xAxis; 157*cdf0e10cSrcweir switch( eTitleType ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir case TitleHelper::SECONDARY_X_AXIS_TITLE: 160*cdf0e10cSrcweir xAxis = AxisHelper::createAxis( 0, false, xDiagram, xContext ); 161*cdf0e10cSrcweir break; 162*cdf0e10cSrcweir case TitleHelper::SECONDARY_Y_AXIS_TITLE: 163*cdf0e10cSrcweir xAxis = AxisHelper::createAxis( 1, false, xDiagram, xContext ); 164*cdf0e10cSrcweir break; 165*cdf0e10cSrcweir default: 166*cdf0e10cSrcweir break; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY ); 169*cdf0e10cSrcweir if( xProps.is() ) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir xProps->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_False ) ); 172*cdf0e10cSrcweir xTitled = lcl_getTitleParent( eTitleType, xModel ); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir if(xTitled.is()) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) ); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir xTitle.set( xContext->getServiceManager()->createInstanceWithContext( 181*cdf0e10cSrcweir C2U( "com.sun.star.chart2.Title" ), 182*cdf0e10cSrcweir xContext ), uno::UNO_QUERY ); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir if(xTitle.is()) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir // default char height (main: 13.0 == default) 187*cdf0e10cSrcweir float fDefaultCharHeightSub = 11.0; 188*cdf0e10cSrcweir float fDefaultCharHeightAxis = 9.0; 189*cdf0e10cSrcweir switch( eTitleType ) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir case TitleHelper::SUB_TITLE: 192*cdf0e10cSrcweir TitleHelper::setCompleteString( 193*cdf0e10cSrcweir rTitleText, xTitle, xContext, & fDefaultCharHeightSub ); 194*cdf0e10cSrcweir break; 195*cdf0e10cSrcweir case TitleHelper::X_AXIS_TITLE: 196*cdf0e10cSrcweir case TitleHelper::Y_AXIS_TITLE: 197*cdf0e10cSrcweir case TitleHelper::Z_AXIS_TITLE: 198*cdf0e10cSrcweir case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION: 199*cdf0e10cSrcweir case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION: 200*cdf0e10cSrcweir case TitleHelper::SECONDARY_X_AXIS_TITLE: 201*cdf0e10cSrcweir case TitleHelper::SECONDARY_Y_AXIS_TITLE: 202*cdf0e10cSrcweir TitleHelper::setCompleteString( 203*cdf0e10cSrcweir rTitleText, xTitle, xContext, & fDefaultCharHeightAxis ); 204*cdf0e10cSrcweir break; 205*cdf0e10cSrcweir default: 206*cdf0e10cSrcweir TitleHelper::setCompleteString( rTitleText, xTitle, xContext ); 207*cdf0e10cSrcweir break; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir // set/clear autoscale 211*cdf0e10cSrcweir if( pRefSizeProvider ) 212*cdf0e10cSrcweir pRefSizeProvider->setValuesAtTitle( xTitle ); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir xTitled->setTitleObject( xTitle ); 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir //default rotation 90 degree for y axis title in normal coordinatesystems or for x axis title for swapped coordinatesystems 217*cdf0e10cSrcweir if( eTitleType == TitleHelper::X_AXIS_TITLE || 218*cdf0e10cSrcweir eTitleType == TitleHelper::Y_AXIS_TITLE || 219*cdf0e10cSrcweir eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE || 220*cdf0e10cSrcweir eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE ) 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir try 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir bool bDummy = false; 226*cdf0e10cSrcweir bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy ); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir Reference< beans::XPropertySet > xTitleProps( xTitle, uno::UNO_QUERY ); 229*cdf0e10cSrcweir if( xTitleProps.is() ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir double fNewAngleDegree = 90.0; 232*cdf0e10cSrcweir if( (!bIsVertical && eTitleType == TitleHelper::Y_AXIS_TITLE) 233*cdf0e10cSrcweir || (bIsVertical && eTitleType == TitleHelper::X_AXIS_TITLE) 234*cdf0e10cSrcweir || (!bIsVertical && eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE) 235*cdf0e10cSrcweir || (bIsVertical && eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE) ) 236*cdf0e10cSrcweir xTitleProps->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fNewAngleDegree )); 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir catch( uno::Exception & ex ) 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir return xTitle; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir rtl::OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle ) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir rtl::OUString aRet; 253*cdf0e10cSrcweir if(!xTitle.is()) 254*cdf0e10cSrcweir return aRet; 255*cdf0e10cSrcweir uno::Sequence< uno::Reference< XFormattedString > > aStringList = xTitle->getText(); 256*cdf0e10cSrcweir for( sal_Int32 nN=0; nN<aStringList.getLength();nN++ ) 257*cdf0e10cSrcweir aRet += aStringList[nN]->getString(); 258*cdf0e10cSrcweir return aRet; 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir void TitleHelper::setCompleteString( const rtl::OUString& rNewText 262*cdf0e10cSrcweir , const uno::Reference< XTitle >& xTitle 263*cdf0e10cSrcweir , const uno::Reference< uno::XComponentContext > & xContext 264*cdf0e10cSrcweir , float * pDefaultCharHeight /* = 0 */ ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir //the format of the first old text portion will be maintained if there is any 267*cdf0e10cSrcweir if(!xTitle.is()) 268*cdf0e10cSrcweir return; 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir rtl::OUString aNewText = rNewText; 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir bool bStacked = false; 273*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xTitleProperties( xTitle, uno::UNO_QUERY ); 274*cdf0e10cSrcweir if( xTitleProperties.is() ) 275*cdf0e10cSrcweir xTitleProperties->getPropertyValue( C2U( "StackCharacters" ) ) >>= bStacked; 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir if( bStacked ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir //#i99841# remove linebreaks that were added for vertical stacking 280*cdf0e10cSrcweir rtl::OUStringBuffer aUnstackedStr; 281*cdf0e10cSrcweir rtl::OUStringBuffer aSource(rNewText); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir bool bBreakIgnored = false; 284*cdf0e10cSrcweir sal_Int32 nLen = rNewText.getLength(); 285*cdf0e10cSrcweir for( sal_Int32 nPos = 0; nPos < nLen; ++nPos ) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir sal_Unicode aChar = aSource.charAt( nPos ); 288*cdf0e10cSrcweir if( aChar != '\n' ) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir aUnstackedStr.append( aChar ); 291*cdf0e10cSrcweir bBreakIgnored = false; 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir else if( aChar == '\n' && bBreakIgnored ) 294*cdf0e10cSrcweir aUnstackedStr.append( aChar ); 295*cdf0e10cSrcweir else 296*cdf0e10cSrcweir bBreakIgnored = true; 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir aNewText = aUnstackedStr.makeStringAndClear(); 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir uno::Sequence< uno::Reference< XFormattedString > > aNewStringList(1); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText(); 304*cdf0e10cSrcweir if( aOldStringList.getLength() ) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir aNewStringList[0].set( aOldStringList[0] ); 307*cdf0e10cSrcweir aNewStringList[0]->setString( aNewText ); 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir else 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir uno::Reference< uno::XInterface > xI( 312*cdf0e10cSrcweir xContext->getServiceManager()->createInstanceWithContext( 313*cdf0e10cSrcweir C2U( "com.sun.star.chart2.FormattedString" ), xContext ) ); 314*cdf0e10cSrcweir uno::Reference< XFormattedString > xFormattedString( xI, uno::UNO_QUERY ); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir if(xFormattedString.is()) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir xFormattedString->setString( aNewText ); 319*cdf0e10cSrcweir aNewStringList[0].set( xFormattedString ); 320*cdf0e10cSrcweir if( pDefaultCharHeight != 0 ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir try 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProp( xFormattedString, uno::UNO_QUERY_THROW ); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir uno::Any aFontSize( uno::makeAny( *pDefaultCharHeight )); 327*cdf0e10cSrcweir xProp->setPropertyValue( C2U("CharHeight"), aFontSize ); 328*cdf0e10cSrcweir xProp->setPropertyValue( C2U("CharHeightAsian"), aFontSize ); 329*cdf0e10cSrcweir xProp->setPropertyValue( C2U("CharHeightComplex"), aFontSize ); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir catch( uno::Exception & ex ) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir xTitle->setText( aNewStringList ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex 342*cdf0e10cSrcweir , const ::com::sun::star::uno::Reference< 343*cdf0e10cSrcweir ::com::sun::star::frame::XModel >& xModel ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) ); 346*cdf0e10cSrcweir if( xTitled.is()) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir xTitled->setTitleObject(NULL); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir bool TitleHelper::getTitleType( eTitleType& rType 353*cdf0e10cSrcweir , const ::com::sun::star::uno::Reference< 354*cdf0e10cSrcweir ::com::sun::star::chart2::XTitle >& xTitle 355*cdf0e10cSrcweir , const ::com::sun::star::uno::Reference< 356*cdf0e10cSrcweir ::com::sun::star::frame::XModel >& xModel ) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir if( !xTitle.is() || !xModel.is() ) 359*cdf0e10cSrcweir return false; 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir Reference< chart2::XTitle > xCurrentTitle; 362*cdf0e10cSrcweir for( sal_Int32 nTitleType = TITLE_BEGIN; nTitleType < NORMAL_TITLE_END; nTitleType++ ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), xModel ); 365*cdf0e10cSrcweir if( xCurrentTitle == xTitle ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir rType = static_cast<eTitleType>(nTitleType); 368*cdf0e10cSrcweir return true; 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir return false; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir //............................................................................. 376*cdf0e10cSrcweir } //namespace chart 377*cdf0e10cSrcweir //............................................................................. 378*cdf0e10cSrcweir 379