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 12:00:18 +00:00
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
#include "tp_TitleRotation.hxx"
|
|
|
|
|
|
|
|
#include "ResId.hxx"
|
|
|
|
#include "TabPages.hrc"
|
2007-05-22 16:49:40 +00:00
|
|
|
#include "chartview/ChartSfxItemIds.hxx"
|
2008-11-26 15:19:48 +00:00
|
|
|
#include "HelpIds.hrc"
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
|
|
|
#include <editeng/frmdiritem.hxx>
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
// header for class SfxInt32Item
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/intitem.hxx>
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
|
|
|
|
SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow,
|
2008-11-26 15:19:48 +00:00
|
|
|
const SfxItemSet& rInAttrs, bool bWithRotation) :
|
2004-08-20 07:46:38 +00:00
|
|
|
SfxTabPage(pWindow, SchResId(TP_ALIGNMENT), rInAttrs),
|
2007-04-26 08:38:20 +00:00
|
|
|
aFlAlign ( this, SchResId( FL_ALIGN ) ),
|
|
|
|
aCtrlDial ( this, SchResId( CTR_DIAL ) ),
|
|
|
|
aFtRotate ( this, SchResId( FT_DEGREES ) ),
|
|
|
|
aNfRotate ( this, SchResId( NF_ORIENT ) ),
|
|
|
|
aCbStacked ( this, SchResId( BTN_TXTSTACKED ) ),
|
2008-11-26 15:19:48 +00:00
|
|
|
aOrientHlp ( aCtrlDial, aNfRotate, aCbStacked ),
|
|
|
|
aFtTextDirection( this, SchResId( FT_TEXTDIR ) ),
|
|
|
|
aLbTextDirection( this, SchResId( LB_TEXTDIR ), &aFtTextDirection )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
2004-08-20 07:46:38 +00:00
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
aCbStacked.EnableTriState( sal_False );
|
2004-08-20 07:46:38 +00:00
|
|
|
aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
|
2008-11-26 15:19:48 +00:00
|
|
|
|
|
|
|
if( !bWithRotation )
|
|
|
|
{
|
|
|
|
aOrientHlp.Hide();
|
|
|
|
Point aMove( 0, aCtrlDial.GetPosPixel().Y() - aFtTextDirection.GetPosPixel().Y() );
|
|
|
|
aFtTextDirection.SetPosPixel( aFtTextDirection.GetPosPixel() + aMove );
|
|
|
|
aLbTextDirection.SetPosPixel( aLbTextDirection.GetPosPixel() + aMove );
|
|
|
|
|
|
|
|
aLbTextDirection.SetHelpId( HID_SCH_TEXTDIRECTION_EQUATION );
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SchAlignmentTabPage::~SchAlignmentTabPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-11-26 15:19:48 +00:00
|
|
|
SfxTabPage* SchAlignmentTabPage::Create(Window* pParent,
|
|
|
|
const SfxItemSet& rInAttrs)
|
|
|
|
{
|
|
|
|
return new SchAlignmentTabPage(pParent, rInAttrs);
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent,
|
|
|
|
const SfxItemSet& rInAttrs)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2008-11-26 15:19:48 +00:00
|
|
|
return new SchAlignmentTabPage(pParent, rInAttrs, false);
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
sal_Bool SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2011-01-03 14:04:34 +01:00
|
|
|
//Since 04/1998 text can be rotated by an arbitrary angle: SCHATTR_TEXT_DEGREES
|
2004-08-20 07:46:38 +00:00
|
|
|
bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
|
|
|
|
rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2004-08-20 07:46:38 +00:00
|
|
|
sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
|
|
|
|
rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
|
2008-11-26 15:19:48 +00:00
|
|
|
|
|
|
|
SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() );
|
|
|
|
rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) );
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
return sal_True;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
|
|
|
|
{
|
2007-05-22 16:49:40 +00:00
|
|
|
const SfxPoolItem* pItem = GetItem( rInAttrs, SCHATTR_TEXT_DEGREES );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2004-08-20 07:46:38 +00:00
|
|
|
sal_Int32 nDegrees = pItem ? ((const SfxInt32Item*)pItem)->GetValue() : 0;
|
|
|
|
aCtrlDial.SetRotation( nDegrees );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2004-08-20 07:46:38 +00:00
|
|
|
pItem = GetItem( rInAttrs, SCHATTR_TEXT_STACKED );
|
|
|
|
bool bStacked = pItem && ((const SfxBoolItem*)pItem)->GetValue();
|
|
|
|
aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK );
|
2008-11-26 15:19:48 +00:00
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pItem) == SFX_ITEM_SET)
|
2008-11-26 15:19:48 +00:00
|
|
|
aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} //namespace chart
|
|
|
|
|
2010-10-12 15:59:00 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|