2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-17 12:30:48 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 11:58:36 +00:00
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
#include "tp_AxisLabel.hxx"
|
|
|
|
|
|
|
|
#include "ResId.hxx"
|
|
|
|
#include "TabPages.hrc"
|
2007-05-22 16:43:33 +00:00
|
|
|
#include "chartview/ChartSfxItemIds.hxx"
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
#include <svx/chrtitem.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/intitem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
|
|
|
#include <editeng/frmdiritem.hxx>
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
|
|
|
|
SchAxisLabelTabPage::SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
|
2013-09-04 10:52:43 +03:00
|
|
|
SfxTabPage( pParent, "AxisLabelTabPage","modules/schart/ui/tp_axisLabel.ui", rInAttrs ),
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2004-01-26 08:13:31 +00:00
|
|
|
m_bShowStaggeringControls( true ),
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
m_nInitialDegrees( 0 ),
|
2004-08-20 07:46:38 +00:00
|
|
|
m_bHasInitialDegrees( true ),
|
|
|
|
m_bInitialStacking( false ),
|
2010-11-05 13:25:12 +01:00
|
|
|
m_bHasInitialStacking( true ),
|
|
|
|
m_bComplexCategories( false )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2013-09-04 10:52:43 +03:00
|
|
|
get(m_pCbShowDescription, "showlabelsCB");
|
|
|
|
get(m_pFlOrder, "orderL");
|
|
|
|
get(m_pRbSideBySide, "tile");
|
|
|
|
get(m_pRbUpDown, "odd");
|
|
|
|
get(m_pRbDownUp, "even");
|
|
|
|
get(m_pRbAuto, "auto");
|
|
|
|
get(m_pFlTextFlow, "textflowL");
|
|
|
|
get(m_pCbTextOverlap, "overlapCB");
|
|
|
|
get(m_pCbTextBreak, "breakCB");
|
|
|
|
get(m_pFlOrient, "labelTextOrient");
|
|
|
|
get(m_pCtrlDial,"dialCtrl");
|
|
|
|
get(m_pFtRotate,"degreeL");
|
|
|
|
get(m_pNfRotate,"OrientDegree");
|
|
|
|
get(m_pCbStacked,"stackedCB");
|
|
|
|
get(m_pFtTextDirection,"textdirL");
|
|
|
|
get(m_pLbTextDirection,"textdirLB");
|
|
|
|
get(m_pFtABCD,"labelABCD");
|
|
|
|
m_pCtrlDial->SetText(m_pFtABCD->GetText());
|
|
|
|
m_pOrientHlp = new svx::OrientationHelper(*m_pCtrlDial, *m_pNfRotate, *m_pCbStacked);
|
2014-01-28 20:02:54 +01:00
|
|
|
m_pOrientHlp->Enable( true );
|
2013-09-04 10:52:43 +03:00
|
|
|
|
|
|
|
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pCbStacked->EnableTriState( false );
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pOrientHlp->AddDependentWindow( *m_pFlOrient );
|
2014-02-24 12:25:02 +01:00
|
|
|
m_pOrientHlp->AddDependentWindow( *m_pFtRotate, TRISTATE_TRUE );
|
2013-09-04 10:52:43 +03:00
|
|
|
|
|
|
|
m_pCbShowDescription->SetClickHdl( LINK( this, SchAxisLabelTabPage, ToggleShowLabel ) );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
Construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
SchAxisLabelTabPage::~SchAxisLabelTabPage()
|
2013-09-04 10:52:43 +03:00
|
|
|
{delete m_pOrientHlp;}
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
void SchAxisLabelTabPage::Construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* SchAxisLabelTabPage::Create( Window* pParent, const SfxItemSet& rAttrs )
|
|
|
|
{
|
|
|
|
return new SchAxisLabelTabPage( pParent, rAttrs );
|
|
|
|
}
|
|
|
|
|
2014-03-26 15:34:49 +02:00
|
|
|
bool SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2004-08-20 07:46:38 +00:00
|
|
|
bool bStacked = false;
|
2014-02-24 12:25:02 +01:00
|
|
|
if( m_pOrientHlp->GetStackedState() != TRISTATE_INDET )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2014-02-24 12:25:02 +01:00
|
|
|
bStacked = m_pOrientHlp->GetStackedState() == TRISTATE_TRUE;
|
2004-08-20 07:46:38 +00:00
|
|
|
if( !m_bHasInitialStacking || (bStacked != m_bInitialStacking) )
|
|
|
|
rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2013-09-04 10:52:43 +03:00
|
|
|
if( m_pCtrlDial->HasRotation() )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2013-09-04 10:52:43 +03:00
|
|
|
sal_Int32 nDegrees = bStacked ? 0 : m_pCtrlDial->GetRotation();
|
2004-08-20 07:46:38 +00:00
|
|
|
if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) )
|
|
|
|
rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2004-01-26 08:13:31 +00:00
|
|
|
if( m_bShowStaggeringControls )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-07-25 07:37:32 +00:00
|
|
|
SvxChartTextOrder eOrder = CHTXTORDER_SIDEBYSIDE;
|
2003-10-06 08:58:36 +00:00
|
|
|
bool bRadioButtonChecked = true;
|
|
|
|
|
2013-09-04 10:52:43 +03:00
|
|
|
if( m_pRbUpDown->IsChecked())
|
2003-10-06 08:58:36 +00:00
|
|
|
eOrder = CHTXTORDER_UPDOWN;
|
2013-09-04 10:52:43 +03:00
|
|
|
else if( m_pRbDownUp->IsChecked())
|
2003-10-06 08:58:36 +00:00
|
|
|
eOrder = CHTXTORDER_DOWNUP;
|
2013-09-04 10:52:43 +03:00
|
|
|
else if( m_pRbAuto->IsChecked())
|
2003-10-06 08:58:36 +00:00
|
|
|
eOrder = CHTXTORDER_AUTO;
|
2013-09-04 10:52:43 +03:00
|
|
|
else if( m_pRbSideBySide->IsChecked())
|
2003-10-06 08:58:36 +00:00
|
|
|
eOrder = CHTXTORDER_SIDEBYSIDE;
|
|
|
|
else
|
|
|
|
bRadioButtonChecked = false;
|
|
|
|
|
|
|
|
if( bRadioButtonChecked )
|
2010-11-30 01:45:03 +01:00
|
|
|
rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_AXIS_LABEL_ORDER ));
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2014-02-24 12:25:02 +01:00
|
|
|
if( m_pCbTextOverlap->GetState() != TRISTATE_INDET )
|
2013-09-04 10:52:43 +03:00
|
|
|
rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_OVERLAP, m_pCbTextOverlap->IsChecked() ) );
|
2014-02-24 12:25:02 +01:00
|
|
|
if( m_pCbTextBreak->GetState() != TRISTATE_INDET )
|
2013-09-04 10:52:43 +03:00
|
|
|
rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_BREAK, m_pCbTextBreak->IsChecked() ) );
|
2014-02-24 12:25:02 +01:00
|
|
|
if( m_pCbShowDescription->GetState() != TRISTATE_INDET )
|
2013-09-04 10:52:43 +03:00
|
|
|
rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, m_pCbShowDescription->IsChecked() ) );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2013-09-04 10:52:43 +03:00
|
|
|
if( m_pLbTextDirection->GetSelectEntryCount() > 0 )
|
|
|
|
rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_pLbTextDirection->GetSelectEntryValue() ) );
|
2008-11-26 15:19:48 +00:00
|
|
|
|
2014-03-26 15:34:49 +02:00
|
|
|
return true;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
|
|
|
|
{
|
2013-09-04 10:52:43 +03:00
|
|
|
const SfxPoolItem* pPoolItem = NULL;
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2012-12-15 18:28:02 +01:00
|
|
|
// show description
|
2014-02-19 21:49:02 +01:00
|
|
|
SfxItemState aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, false, &pPoolItem );
|
2003-10-06 08:58:36 +00:00
|
|
|
if( aState == SFX_ITEM_DONTCARE )
|
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pCbShowDescription->EnableTriState( true );
|
2014-02-24 12:25:02 +01:00
|
|
|
m_pCbShowDescription->SetState( TRISTATE_INDET );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pCbShowDescription->EnableTriState( false );
|
2014-04-15 15:17:13 +02:00
|
|
|
bool bCheck = false;
|
2003-10-06 08:58:36 +00:00
|
|
|
if( aState == SFX_ITEM_SET )
|
|
|
|
bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCbShowDescription->Check( bCheck );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCbShowDescription->Hide();
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Rotation as orient item or in degrees ----------
|
|
|
|
|
|
|
|
// check new degree item
|
2004-08-20 07:46:38 +00:00
|
|
|
m_nInitialDegrees = 0;
|
2014-02-19 21:49:02 +01:00
|
|
|
aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, false, &pPoolItem );
|
2004-08-20 07:46:38 +00:00
|
|
|
if( aState == SFX_ITEM_SET )
|
|
|
|
m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2004-08-20 07:46:38 +00:00
|
|
|
m_bHasInitialDegrees = aState != SFX_ITEM_DONTCARE;
|
|
|
|
if( m_bHasInitialDegrees )
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCtrlDial->SetRotation( m_nInitialDegrees );
|
2004-08-20 07:46:38 +00:00
|
|
|
else
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCtrlDial->SetNoRotation();
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2004-08-20 07:46:38 +00:00
|
|
|
// check stacked item
|
|
|
|
m_bInitialStacking = false;
|
2014-02-19 21:49:02 +01:00
|
|
|
aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, false, &pPoolItem );
|
2004-08-20 07:46:38 +00:00
|
|
|
if( aState == SFX_ITEM_SET )
|
|
|
|
m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
|
|
|
|
|
|
|
|
m_bHasInitialStacking = aState != SFX_ITEM_DONTCARE;
|
|
|
|
if( m_bHasInitialDegrees )
|
2014-02-24 12:25:02 +01:00
|
|
|
m_pOrientHlp->SetStackedState( m_bInitialStacking ? TRISTATE_TRUE : TRISTATE_FALSE );
|
2004-08-20 07:46:38 +00:00
|
|
|
else
|
2014-02-24 12:25:02 +01:00
|
|
|
m_pOrientHlp->SetStackedState( TRISTATE_INDET );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2014-02-19 21:49:02 +01:00
|
|
|
if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SFX_ITEM_SET )
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pLbTextDirection->SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
|
2008-11-26 15:19:48 +00:00
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
// Text overlap ----------
|
2014-02-19 21:49:02 +01:00
|
|
|
aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_OVERLAP, false, &pPoolItem );
|
2003-10-06 08:58:36 +00:00
|
|
|
if( aState == SFX_ITEM_DONTCARE )
|
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pCbTextOverlap->EnableTriState( true );
|
2014-02-24 12:25:02 +01:00
|
|
|
m_pCbTextOverlap->SetState( TRISTATE_INDET );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pCbTextOverlap->EnableTriState( false );
|
2014-04-15 15:17:13 +02:00
|
|
|
bool bCheck = false;
|
2003-10-06 08:58:36 +00:00
|
|
|
if( aState == SFX_ITEM_SET )
|
|
|
|
bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCbTextOverlap->Check( bCheck );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCbTextOverlap->Hide();
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// text break ----------
|
2014-02-19 21:49:02 +01:00
|
|
|
aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_BREAK, false, &pPoolItem );
|
2003-10-06 08:58:36 +00:00
|
|
|
if( aState == SFX_ITEM_DONTCARE )
|
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pCbTextBreak->EnableTriState( true );
|
2014-02-24 12:25:02 +01:00
|
|
|
m_pCbTextBreak->SetState( TRISTATE_INDET );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-21 12:53:51 +01:00
|
|
|
m_pCbTextBreak->EnableTriState( false );
|
2014-04-15 15:17:13 +02:00
|
|
|
bool bCheck = false;
|
2003-10-06 08:58:36 +00:00
|
|
|
if( aState == SFX_ITEM_SET )
|
|
|
|
bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCbTextBreak->Check( bCheck );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
|
|
|
|
{
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pCbTextBreak->Hide();
|
|
|
|
if( ! m_pCbTextOverlap->IsVisible() )
|
|
|
|
m_pFlTextFlow->Hide();
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// text order ----------
|
2004-01-26 08:13:31 +00:00
|
|
|
if( m_bShowStaggeringControls )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2014-02-19 21:49:02 +01:00
|
|
|
aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_ORDER, false, &pPoolItem );
|
2003-10-06 08:58:36 +00:00
|
|
|
if( aState == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
SvxChartTextOrder eOrder = static_cast< const SvxChartTextOrderItem * >( pPoolItem )->GetValue();
|
|
|
|
|
|
|
|
switch( eOrder )
|
|
|
|
{
|
|
|
|
case CHTXTORDER_SIDEBYSIDE:
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pRbSideBySide->Check();
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHTXTORDER_UPDOWN:
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pRbUpDown->Check();
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHTXTORDER_DOWNUP:
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pRbDownUp->Check();
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHTXTORDER_AUTO:
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pRbAuto->Check();
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleShowLabel( (void*)0 );
|
|
|
|
}
|
|
|
|
|
2014-04-15 15:17:13 +02:00
|
|
|
void SchAxisLabelTabPage::ShowStaggeringControls( bool bShowStaggeringControls )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2004-01-26 08:13:31 +00:00
|
|
|
m_bShowStaggeringControls = bShowStaggeringControls;
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2004-01-26 08:13:31 +00:00
|
|
|
if( !m_bShowStaggeringControls )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pRbSideBySide->Hide();
|
|
|
|
m_pRbUpDown->Hide();
|
|
|
|
m_pRbDownUp->Hide();
|
|
|
|
m_pRbAuto->Hide();
|
|
|
|
m_pFlOrder->Hide();
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-05 13:25:12 +01:00
|
|
|
void SchAxisLabelTabPage::SetComplexCategories( bool bComplexCategories )
|
|
|
|
{
|
|
|
|
m_bComplexCategories = bComplexCategories;
|
|
|
|
}
|
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
// event handling routines
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(SchAxisLabelTabPage, ToggleShowLabel)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2014-04-15 15:17:13 +02:00
|
|
|
bool bEnable = ( m_pCbShowDescription->GetState() != TRISTATE_FALSE );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pOrientHlp->Enable( bEnable );
|
|
|
|
m_pFlOrder->Enable( bEnable );
|
|
|
|
m_pRbSideBySide->Enable( bEnable );
|
|
|
|
m_pRbUpDown->Enable( bEnable );
|
|
|
|
m_pRbDownUp->Enable( bEnable );
|
|
|
|
m_pRbAuto->Enable( bEnable );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pFlTextFlow->Enable( bEnable );
|
|
|
|
m_pCbTextOverlap->Enable( bEnable && !m_bComplexCategories );
|
|
|
|
m_pCbTextBreak->Enable( bEnable );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2013-09-04 10:52:43 +03:00
|
|
|
m_pFtTextDirection->Enable( bEnable );
|
|
|
|
m_pLbTextDirection->Enable( bEnable );
|
2008-11-26 15:19:48 +00:00
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
return 0L;
|
|
|
|
}
|
|
|
|
} //namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|