diff options
author | Ingrid Halama <iha@openoffice.org> | 2010-05-05 18:16:33 +0200 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2010-05-05 18:16:33 +0200 |
commit | 0581e072a69d06abd1bdcc8b5cc14771b110e6f9 (patch) | |
tree | 6834bff2bc375b855958e1fb6708a1365b86eece /chart2 | |
parent | 6444c49b780c1683e85af3f3802471c85aa8e5f4 (diff) |
chartpositioning: #i100778# simplify user interface: reduce sizing options to new excluding mode only
Diffstat (limited to 'chart2')
22 files changed, 51 insertions, 1620 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 61b258e2eb22..e05279b15aae 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -745,6 +745,7 @@ awt::Point SAL_CALL DiagramWrapper::getPosition() void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); if( xProp.is() ) { @@ -778,6 +779,7 @@ void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); if( xProp.is() ) { @@ -811,6 +813,7 @@ OUString SAL_CALL DiagramWrapper::getShapeType() void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); if( xDiaProps.is() ) { @@ -832,6 +835,7 @@ void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::Runti } void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); if( xDiaProps.is() ) @@ -859,6 +863,7 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes( } void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); if( xDiaProps.is() ) @@ -870,6 +875,7 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes( } void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) { + ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) ); DiagramWrapper::setDiagramPositionIncludingAxes( aRect ); } diff --git a/chart2/source/controller/dialogs/ResourceIds.hrc b/chart2/source/controller/dialogs/ResourceIds.hrc index 5fd05388bfc3..2ab544c77ab1 100644 --- a/chart2/source/controller/dialogs/ResourceIds.hrc +++ b/chart2/source/controller/dialogs/ResourceIds.hrc @@ -63,7 +63,6 @@ #define TP_AXIS_LABEL 920 #define TP_SCALE 903 #define TP_AXIS_POSITIONS 904 -#define TP_DIAGRAM_POSITION 905 #define TP_CHARTTYPE 910 #define TP_RANGECHOOSER 911 #define TP_WIZARD_TITLEANDOBJECTS 912 diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index e4792361b5ab..4b4cec65426e 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -121,11 +121,6 @@ String STR_PAGE_POSITIONING Text [ en-US ] = "Positioning" ; }; -String STR_PAGE_POSITIONANDSIZE -{ - Text [ en-US ] = "Position and Size" ; -}; - // String STR_PAGE_STATISTICS // { // Text [ en-US ] = "Statistics" ; diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index b2287437c377..2a41d35313e8 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -49,7 +49,6 @@ #include "tp_SeriesToAxis.hxx" #include "tp_TitleRotation.hxx" #include "tp_PolarOptions.hxx" -#include "tp_DiagramPosition.hxx" #include "ResId.hxx" #include "ViewElementListProvider.hxx" #include "macros.hxx" @@ -247,9 +246,6 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel else m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument ); break; - case OBJECTTYPE_DIAGRAM: - m_aLocalizedName = String(SchResId(STR_PAGE_POSITIONANDSIZE)); - break; default: m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects); break; @@ -463,14 +459,12 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE))); break; - case OBJECTTYPE_DIAGRAM: - AddTabPage(TP_DIAGRAM_POSITION, String(SchResId(STR_PAGE_POSITIONANDSIZE)), DiagramPositionTabPage::Create, NULL); - break; - case OBJECTTYPE_DIAGRAM_WALL: case OBJECTTYPE_DATA_STOCK_LOSS: case OBJECTTYPE_DATA_STOCK_GAIN: case OBJECTTYPE_PAGE: case OBJECTTYPE_DIAGRAM_FLOOR: + case OBJECTTYPE_DIAGRAM_WALL: + case OBJECTTYPE_DIAGRAM: AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER))); AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA))); AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY))); diff --git a/chart2/source/controller/dialogs/makefile.mk b/chart2/source/controller/dialogs/makefile.mk index 3121c2e3dfdd..d22f5c83b081 100644 --- a/chart2/source/controller/dialogs/makefile.mk +++ b/chart2/source/controller/dialogs/makefile.mk @@ -67,7 +67,6 @@ SLOFILES= \ $(SLO)$/tp_RangeChooser.obj \ $(SLO)$/tp_Wizard_TitlesAndObjects.obj \ $(SLO)$/tp_Location.obj \ - $(SLO)$/tp_DiagramPosition.obj \ $(SLO)$/tp_AxisLabel.obj \ $(SLO)$/tp_AxisPositions.obj \ $(SLO)$/tp_DataLabel.obj \ @@ -120,7 +119,6 @@ SRC1FILES= \ tp_RangeChooser.src \ tp_Wizard_TitlesAndObjects.src \ tp_Location.src \ - tp_DiagramPosition.src \ tp_AxisLabel.src \ tp_AxisPositions.src \ tp_DataLabel.src \ diff --git a/chart2/source/controller/dialogs/tp_DiagramPosition.cxx b/chart2/source/controller/dialogs/tp_DiagramPosition.cxx deleted file mode 100644 index b8d0df131f63..000000000000 --- a/chart2/source/controller/dialogs/tp_DiagramPosition.cxx +++ /dev/null @@ -1,786 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_chart2.hxx" -#include "tp_DiagramPosition.hxx" -#include "tp_DiagramPosition.hrc" - -#include "ConfigurationAccess.hxx" -#include "DiagramHelper.hxx" -#include "ResId.hxx" -#include "chartview/ChartSfxItemIds.hxx" - -#include <svx/svxids.hrc> -#include <svx/svdview.hxx> -#include <svx/dlgutil.hxx> -#include <svl/rectitem.hxx> -#include <svl/aeitem.hxx> -// header for class SvxDoubleItem -#include <svx/chrtitem.hxx> - -using namespace ::com::sun::star; - -//............................................................................. -namespace chart -{ -//............................................................................. - -void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit) -{ - const basegfx::B2DPoint aTopLeft( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)); - const basegfx::B2DPoint aBottomRight( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)); - - rRange = basegfx::B2DRange(aTopLeft, aBottomRight); -} - -void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale) -{ - const double fFactor(1.0 / double(aUIScale)); - rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor); -} - -DiagramPositionTabPage::DiagramPositionTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - SvxTabPage ( pParent, SchResId( TP_DIAGRAM_POSITION ), rInAttrs ), - - m_aFlPosMode( this, SchResId( FL_POSITIONING_MODE ) ), - - m_aRbPosMode_Auto( this, SchResId( RB_POSITIONING_MODE_AUTOMATIC ) ), - m_aRbPosMode_Excluding( this, SchResId( RB_POSITIONING_MODE_EXCLUDING ) ), - m_aRbPosMode_Including( this, SchResId( RB_POSITIONING_MODE_INCLUDING ) ), - - maFlPosition ( this, SchResId( FL_POSITION ) ), - maFtPosX ( this, SchResId( FT_POS_X ) ), - maMtrPosX ( this, SchResId( MTR_FLD_POS_X ) ), - maFtPosY ( this, SchResId( FT_POS_Y ) ), - maMtrPosY ( this, SchResId( MTR_FLD_POS_Y ) ), - maFtPosReference ( this, SchResId( FT_POSREFERENCE ) ), - maCtlPos ( this, SchResId( CTL_POSRECT ), RP_LT ), - - maFlSize ( this, SchResId( FL_SIZE ) ), - maFtWidth ( this, SchResId( FT_WIDTH ) ), - maMtrWidth ( this, SchResId( MTR_FLD_WIDTH ) ), - maFtHeight ( this, SchResId( FT_HEIGHT ) ), - maMtrHeight ( this, SchResId( MTR_FLD_HEIGHT ) ), - maCbxScale ( this, SchResId( CBX_SCALE ) ), - maFtSizeReference ( this, SchResId( FT_SIZEREFERENCE) ), - maCtlSize ( this, SchResId( CTL_SIZERECT ), RP_LT ), - m_aExcludingRect(1,2,3,4), - m_aIncludingRect(1,2,3,4), - m_aMaxRect(1,2,3,4), - m_fUIScale( 1.0 ), - m_aCurrentRect(1,2,3,4), - m_bRectChangedByUser( false ) -{ - FreeResource(); - - // this pege needs ExchangeSupport - // SetExchangeSupport(); - - // evaluate PoolUnit - SfxItemPool* pPool = rInAttrs.GetPool(); - DBG_ASSERT( pPool, "no pool (!)" ); - mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); - - Construct(); - - m_aRbPosMode_Auto.SetClickHdl( LINK( this, DiagramPositionTabPage, ChangeModeHdl ) ); - m_aRbPosMode_Excluding.SetClickHdl( LINK( this, DiagramPositionTabPage, ChangeModeHdl ) ); - m_aRbPosMode_Including.SetClickHdl( LINK( this, DiagramPositionTabPage, ChangeModeHdl ) ); - - maMtrPosX.SetModifyHdl( LINK( this, DiagramPositionTabPage, ChangePosXHdl ) ); - maMtrPosY.SetModifyHdl( LINK( this, DiagramPositionTabPage, ChangePosYHdl ) ); - - maMtrWidth.SetModifyHdl( LINK( this, DiagramPositionTabPage, ChangeWidthHdl ) ); - maMtrHeight.SetModifyHdl( LINK( this, DiagramPositionTabPage, ChangeHeightHdl ) ); - maCbxScale.SetClickHdl( LINK( this, DiagramPositionTabPage, ClickScaleHdl ) ); -} - -// ----------------------------------------------------------------------- - -void DiagramPositionTabPage::Construct() -{ - // get range and work area - meDlgUnit = ConfigurationAccess::getFieldUnit(); - SetFieldUnit( maMtrPosX, meDlgUnit, TRUE ); - SetFieldUnit( maMtrPosY, meDlgUnit, TRUE ); - SetFieldUnit( maMtrWidth, meDlgUnit, TRUE ); - SetFieldUnit( maMtrHeight, meDlgUnit, TRUE ); - - if(FUNIT_MILE == meDlgUnit || FUNIT_KM == meDlgUnit) - { - maMtrPosX.SetDecimalDigits( 3 ); - maMtrPosY.SetDecimalDigits( 3 ); - maMtrWidth.SetDecimalDigits( 3 ); - maMtrHeight.SetDecimalDigits( 3 ); - } -} - -// ----------------------------------------------------------------------- - -void DiagramPositionTabPage::Reset( const SfxItemSet& rInAttrs ) -{ - //positioning mode - DiagramPositioningMode ePos = DiagramPositioningMode_AUTO; - const SfxPoolItem* pItem = NULL; - if( rInAttrs.GetItemState( SCHATTR_DIAGRAM_POS_MODE, TRUE, &pItem ) == SFX_ITEM_SET ) - ePos = DiagramPositioningMode(((const SfxInt32Item*)pItem)->GetValue()); - if( ePos == DiagramPositioningMode_AUTO ) - m_aRbPosMode_Auto.Check(); - else if( ePos == DiagramPositioningMode_EXCLUDING ) - m_aRbPosMode_Excluding.Check(); - else if( ePos == DiagramPositioningMode_INCLUDING ) - m_aRbPosMode_Including.Check(); - - ReleaseBorders(); - maCtlPos.Reset(); - maCtlSize.Reset(); - - //rectangles - if( rInAttrs.GetItemState( SCHATTR_DIAGRAM_RECT_MAX, TRUE, &pItem ) == SFX_ITEM_SET ) - { - m_aMaxRect = ((const SfxRectangleItem*)pItem)->GetValue(); - SetRectIn100thmm( m_aMaxRect ); - m_aMaxRect = GetRectIn100thmm(); - } - - if( rInAttrs.GetItemState( SCHATTR_DIAGRAM_RECT_EXCLUDING, TRUE, &pItem ) == SFX_ITEM_SET ) - { - m_aExcludingRect = ((const SfxRectangleItem*)pItem)->GetValue(); - SetRectIn100thmm( m_aExcludingRect ); - m_aExcludingRect = GetRectIn100thmm(); - } - - if( rInAttrs.GetItemState( SCHATTR_DIAGRAM_RECT_INCLUDING, TRUE, &pItem ) == SFX_ITEM_SET ) - { - m_aIncludingRect = ((const SfxRectangleItem*)pItem)->GetValue(); - SetRectIn100thmm( m_aIncludingRect ); - m_aIncludingRect = GetRectIn100thmm(); - } - - if( rInAttrs.GetItemState( SCHATTR_DIAGRAM_UI_SCALE, TRUE, &pItem ) == SFX_ITEM_SET ) - m_fUIScale = ((const SvxDoubleItem*)pItem)->GetValue(); - - m_aCurrentRect = m_aIncludingRect; - if( rInAttrs.GetItemState( SCHATTR_DIAGRAM_RECT_TO_USE, TRUE, &pItem ) == SFX_ITEM_SET ) - { - m_aCurrentRect = ((const SfxRectangleItem*)pItem)->GetValue(); - SetRectIn100thmm( m_aCurrentRect ); - m_aCurrentRect = GetRectIn100thmm(); - } - - // scale - String aStr = GetUserData(); - maCbxScale.Check( (BOOL)aStr.ToInt32() ); - mfScaleSizeX = std::max( (double)GetCoreValue( maMtrWidth, mePoolUnit ), 1.0 ); - mfScaleSizeY = std::max( (double)GetCoreValue( maMtrHeight, mePoolUnit ), 1.0 ); - - - m_bRectChangedByUser = false; - SetMinMaxPosition(); - UpdateControlStates(); -} - -// ----------------------------------------------------------------------- - -BOOL DiagramPositionTabPage::FillItemSet( SfxItemSet& rOutAttrs ) -{ - BOOL bModified(TRUE); - - //positioning mode - sal_Int32 nMode = 0; - if( m_aRbPosMode_Excluding.IsChecked() ) - nMode = 1; - else if( m_aRbPosMode_Including.IsChecked() ) - nMode = 2; - - rOutAttrs.Put( SfxInt32Item( SCHATTR_DIAGRAM_POS_MODE, nMode ) ); - - rOutAttrs.Put( SfxRectangleItem( SCHATTR_DIAGRAM_RECT_TO_USE, GetRectIn100thmm() ) ); - - return bModified; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* DiagramPositionTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) -{ - return( new DiagramPositionTabPage( pWindow, rOutAttrs ) ); -} - -//------------------------------------------------------------------------ - -void DiagramPositionTabPage::ActivatePage( const SfxItemSet& /*rSet*/ ) -{ -} - -// ----------------------------------------------------------------------- - -int DiagramPositionTabPage::DeactivatePage( SfxItemSet* pItemSet ) -{ - if( pItemSet ) - FillItemSet( *pItemSet ); - return LEAVE_PAGE; -} - -//------------------------------------------------------------------------ - -long DiagramPositionTabPage::get1oothMMPosValue( MetricField& rField ) -{ - double fValue( GetCoreValue( rField, mePoolUnit ) * m_fUIScale); - return basegfx::fround(fValue); -} - -long DiagramPositionTabPage::get1oothMMSizeValue( MetricField& rField ) -{ - double fValue = static_cast<double>(rField.GetValue( meDlgUnit )); - fValue = MetricField::ConvertDoubleValue( fValue, rField.GetBaseValue(), rField.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long nValue = long(fValue*m_fUIScale); - nValue = OutputDevice::LogicToLogic( nValue, MAP_100TH_MM, (MapUnit)mePoolUnit ); - nValue = static_cast<long>(rField.Denormalize( nValue )); - return nValue; -} - -/* -const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); -SetMetricValue(maMtrPosY, basegfx::fround(fTmp), mePoolUnit); - sal_Int64 nVal = OutputDevice::LogicToLogic( nCoreValue, (MapUnit)eUnit, MAP_100TH_MM ); - nVal = rField.Normalize( nVal ); - rField.SetValue( nVal, FUNIT_100TH_MM ); - */ - -void DiagramPositionTabPage::set1oothMMPosValue( MetricField& rField, long n100thMM ) -{ - const double fTmp( n100thMM / m_fUIScale ); - SetMetricValue(rField, basegfx::fround(fTmp), mePoolUnit); -} -void DiagramPositionTabPage::set1oothMMSizeValue( MetricField& rField, long n100thMM ) -{ - double fValue((OutputDevice::LogicToLogic( n100thMM, (MapUnit)mePoolUnit, MAP_100TH_MM)) ); - fValue /= m_fUIScale; - if(rField.GetDecimalDigits()) - fValue *= pow(10.0, rField.GetDecimalDigits()); - fValue = MetricField::ConvertDoubleValue(fValue, rField.GetBaseValue(), rField.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); - rField.SetValue(static_cast<sal_Int64>(fValue), meDlgUnit); -} - -sal_Int64 DiagramPositionTabPage::convert1oothMMValueToFieldUnit( MetricField& rField, long n100thMM ) -{ - double fValue((OutputDevice::LogicToLogic( n100thMM, (MapUnit)mePoolUnit, MAP_100TH_MM)) ); - fValue /= m_fUIScale; - if(rField.GetDecimalDigits()) - fValue *= pow(10.0, rField.GetDecimalDigits()); - fValue = MetricField::ConvertDoubleValue(fValue, rField.GetBaseValue(), rField.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); - return basegfx::fround64(fValue); -} - -//------------------------------------------------------------------------ - -void DiagramPositionTabPage::SetRectIn100thmm( const Rectangle& rRect ) -{ - ReleaseBorders(); - - m_aCurrentRect = rRect; - long nLeft = m_aCurrentRect.Left(); - long nTop = m_aCurrentRect.Top(); - long nWidth = m_aCurrentRect.getWidth(); - long nHeight = m_aCurrentRect.getHeight(); - - switch ( maCtlPos.GetActualRP() ) - { - case RP_LT: - { - break; - } - case RP_MT: - { - nLeft += nWidth / 2; - break; - } - case RP_RT: - { - nLeft += nWidth; - break; - } - case RP_LM: - { - nTop += nHeight / 2; - break; - } - case RP_MM: - { - nLeft += nWidth / 2; - nTop += nHeight / 2; - break; - } - case RP_RM: - { - nLeft += nWidth; - nTop += nHeight / 2; - break; - } - case RP_LB: - { - nTop += nHeight; - break; - } - case RP_MB: - { - nLeft += nWidth / 2; - nTop += nHeight; - break; - } - case RP_RB: - { - nLeft += nWidth; - nTop += nHeight; - break; - } - } - - set1oothMMPosValue( maMtrPosX, nLeft ); - set1oothMMPosValue( maMtrPosY, nTop ); - set1oothMMSizeValue( maMtrWidth, nWidth ); - set1oothMMSizeValue( maMtrHeight, nHeight ); - - SetMinMaxPosition(); -} - -//------------------------------------------------------------------------ - -Rectangle DiagramPositionTabPage::GetRectIn100thmm() -{ - long nX = get1oothMMPosValue( maMtrPosX ); - long nY = get1oothMMPosValue( maMtrPosY ); - long nWidth = get1oothMMSizeValue( maMtrWidth ); - long nHeight = get1oothMMSizeValue( maMtrHeight ); - - switch( maCtlPos.GetActualRP() ) - { - case RP_LT: - { - break; - } - case RP_MT: - { - nX -= nWidth/2; - break; - } - case RP_RT: - { - nX -= nWidth; - break; - } - case RP_LM: - { - nY -= nHeight/2; - break; - } - case RP_MM: - { - nX -= nWidth/2; - nY -= nHeight/2; - break; - } - case RP_RM: - { - nX -= nWidth; - nY -= nHeight/2; - break; - } - case RP_LB: - { - nY -= nHeight; - break; - } - case RP_MB: - { - nX -= nWidth/2; - nY -= nHeight; - break; - } - case RP_RB: - { - nX -= nWidth; - nY -= nHeight; - break; - } - } - - return Rectangle(nX,nY,nX+nWidth,nY+nHeight); -} - -//------------------------------------------------------------------------ - -void DiagramPositionTabPage::UpdateControlStates() -{ - bool bEnable = true; - - m_aRbPosMode_Auto.Enable( bEnable ); - m_aRbPosMode_Excluding.Enable( bEnable ); - m_aRbPosMode_Including.Enable( bEnable ); - - if( m_aRbPosMode_Auto.IsChecked() ) - bEnable = false; - - maFlPosition.Enable( bEnable ); - maFtPosX.Enable( bEnable ); - maMtrPosX.Enable( bEnable ); - maFtPosY.Enable( bEnable ); - maMtrPosY.Enable( bEnable ); - maFtPosReference.Enable( bEnable ); - maCtlPos.Enable( bEnable ); - - maFlSize.Enable( bEnable ); - maCtlSize.Enable( bEnable ); - maFtWidth.Enable( bEnable ); - maMtrWidth.Enable( bEnable ); - maFtHeight.Enable( bEnable ); - maMtrHeight.Enable( bEnable ); - maCbxScale.Enable( bEnable ); - maFtSizeReference.Enable( bEnable ); - - maCtlSize.Invalidate(); - maCtlPos.Invalidate(); -} - -//------------------------------------------------------------------------ - -void DiagramPositionTabPage::ReleaseBorders() -{ - //make it possible to set new values that will lead to different min max values afterwards - maMtrPosX.SetMin( convert1oothMMValueToFieldUnit( maMtrPosX, m_aMaxRect.Left() ), meDlgUnit); - maMtrPosX.SetMax( convert1oothMMValueToFieldUnit( maMtrPosX, m_aMaxRect.Right() ), meDlgUnit); - maMtrPosY.SetMin( convert1oothMMValueToFieldUnit( maMtrPosY, m_aMaxRect.Top() ), meDlgUnit); - maMtrPosY.SetMax( convert1oothMMValueToFieldUnit( maMtrPosY, m_aMaxRect.Bottom() ), meDlgUnit); - maMtrWidth.SetMax( convert1oothMMValueToFieldUnit( maMtrWidth, m_aMaxRect.GetWidth() ), meDlgUnit); - maMtrHeight.SetMax( convert1oothMMValueToFieldUnit( maMtrHeight, m_aMaxRect.GetHeight() ), meDlgUnit); -} - -//------------------------------------------------------------------------ - -void DiagramPositionTabPage::SetMinMaxPosition() -{ - // position - - long nLeft( m_aMaxRect.Left() ); - long nTop( m_aMaxRect.Top() ); - long nRight( m_aMaxRect.Right() ); - long nBottom( m_aMaxRect.Bottom() ); - - const long nWidth( m_aCurrentRect.GetWidth() ); - const long nHeight( m_aCurrentRect.GetHeight() ); - - switch ( maCtlPos.GetActualRP() ) - { - case RP_LT: - { - nRight -= nWidth; - nBottom -= nHeight; - break; - } - case RP_MT: - { - nLeft += nWidth / 2; - nRight -= nWidth / 2; - nBottom -= nHeight; - break; - } - case RP_RT: - { - nLeft += nWidth; - nBottom -= nHeight; - break; - } - case RP_LM: - { - nRight -= nWidth; - nTop += nHeight / 2; - nBottom -= nHeight / 2; - break; - } - case RP_MM: - { - nLeft += nWidth / 2; - nRight -= nWidth / 2; - nTop += nHeight / 2; - nBottom -= nHeight / 2; - break; - } - case RP_RM: - { - nLeft += nWidth; - nTop += nHeight / 2; - nBottom -= nHeight / 2; - break; - } - case RP_LB: - { - nRight -= nWidth; - nTop += nHeight; - break; - } - case RP_MB: - { - nLeft += nWidth / 2; - nRight -= nWidth / 2; - nTop += nHeight; - break; - } - case RP_RB: - { - nLeft += nWidth; - nTop += nHeight; - break; - } - } - - maMtrPosX.SetMin( convert1oothMMValueToFieldUnit( maMtrPosX, nLeft ), meDlgUnit); - maMtrPosX.SetFirst( convert1oothMMValueToFieldUnit( maMtrPosX, nLeft ), meDlgUnit); - maMtrPosX.SetMax( convert1oothMMValueToFieldUnit( maMtrPosX, nRight ), meDlgUnit); - maMtrPosX.SetLast( convert1oothMMValueToFieldUnit( maMtrPosX, nRight ), meDlgUnit); - maMtrPosY.SetMin( convert1oothMMValueToFieldUnit( maMtrPosY, nTop ), meDlgUnit); - maMtrPosY.SetFirst( convert1oothMMValueToFieldUnit( maMtrPosY, nTop ), meDlgUnit); - maMtrPosY.SetMax( convert1oothMMValueToFieldUnit( maMtrPosY, nBottom ), meDlgUnit); - maMtrPosY.SetLast( convert1oothMMValueToFieldUnit( maMtrPosY, nBottom ), meDlgUnit); - - // size - - nLeft = m_aMaxRect.Left(); - nTop = m_aMaxRect.Top(); - nRight = m_aMaxRect.Right(); - nBottom = m_aMaxRect.Bottom(); - - long nMaxWidth( m_aMaxRect.GetWidth() ); - long nMaxHeight( m_aMaxRect.GetHeight() ); - - switch ( maCtlSize.GetActualRP() ) - { - case RP_LT: - { - nMaxWidth -= ( m_aCurrentRect.Left() - nLeft ); - nMaxHeight -= ( m_aCurrentRect.Top() - nTop ); - break; - } - case RP_MT: - { - nMaxWidth = std::min( m_aCurrentRect.Center().X() - nLeft, nRight - m_aCurrentRect.Center().X() ) * 2; - nMaxHeight -= ( m_aCurrentRect.Top() - nTop ); - break; - } - case RP_RT: - { - nMaxWidth -= ( nRight - m_aCurrentRect.Right() ); - nMaxHeight -= ( m_aCurrentRect.Top() - nTop ); - break; - } - case RP_LM: - { - nMaxWidth -= ( m_aCurrentRect.Left() - nLeft ); - nMaxHeight = std::min( m_aCurrentRect.Center().Y() - nTop, nBottom - m_aCurrentRect.Center().Y() ) * 2; - break; - } - case RP_MM: - { - nMaxWidth = std::min( m_aCurrentRect.Center().X() - nLeft, nRight - m_aCurrentRect.Center().X() ) * 2; - nMaxHeight = std::min( m_aCurrentRect.Center().Y() - nTop, nBottom - m_aCurrentRect.Center().Y() ) * 2; - break; - } - case RP_RM: - { - nMaxWidth -= ( nRight - m_aCurrentRect.Right() ); - nMaxHeight = std::min( m_aCurrentRect.Center().Y() - nTop, nBottom - m_aCurrentRect.Center().Y() ) * 2; - break; - } - case RP_LB: - { - nMaxWidth -= ( m_aCurrentRect.Left() - nLeft ); - nMaxHeight -=( nBottom - m_aCurrentRect.Bottom() ); - break; - } - case RP_MB: - { - nMaxWidth = std::min( m_aCurrentRect.Center().X() - nLeft, nRight - m_aCurrentRect.Center().X() ) * 2; - nMaxHeight -= ( m_aCurrentRect.Bottom() - nBottom ); - break; - } - case RP_RB: - { - nMaxWidth -= ( nRight - m_aCurrentRect.Right() ); - nMaxHeight -= ( nBottom - m_aCurrentRect.Bottom() ); - break; - } - } - - if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) - { - sal_Int64 nMaxHeightResultingFromScale(basegfx::fround64((mfScaleSizeY * (double)nMaxWidth) / mfScaleSizeX)); - if( nMaxHeightResultingFromScale > nMaxHeight ) - nMaxWidth = basegfx::fround64((mfScaleSizeX * (double)nMaxHeight / mfScaleSizeY)); - sal_Int64 nMaxWidthResultingFromScale(basegfx::fround64((mfScaleSizeX * (double)nMaxHeight) / mfScaleSizeY)); - if( nMaxWidthResultingFromScale > nMaxWidth ) - nMaxHeight = basegfx::fround64((mfScaleSizeY * (double)nMaxWidth / mfScaleSizeX)); - } - - maMtrWidth.SetMax( convert1oothMMValueToFieldUnit( maMtrWidth, nMaxWidth ), meDlgUnit); - maMtrWidth.SetLast( convert1oothMMValueToFieldUnit( maMtrWidth, nMaxWidth ), meDlgUnit); - maMtrHeight.SetMax( convert1oothMMValueToFieldUnit( maMtrHeight, nMaxHeight ), meDlgUnit); - maMtrHeight.SetLast( convert1oothMMValueToFieldUnit( maMtrHeight, nMaxHeight ), meDlgUnit); -} - -//------------------------------------------------------------------------ - -void DiagramPositionTabPage::PointChanged( Window* pWindow, RECT_POINT /*eRP*/ ) -{ - if( pWindow == &maCtlPos ) - SetRectIn100thmm( m_aCurrentRect ); - else - SetMinMaxPosition(); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DiagramPositionTabPage, ChangeModeHdl, RadioButton*, pButton ) -{ - UpdateControlStates(); - if( pButton == &m_aRbPosMode_Excluding ) - { - if( !m_bRectChangedByUser ) - SetRectIn100thmm( m_aExcludingRect ); - } - else if( pButton == &m_aRbPosMode_Including ) - { - if( !m_bRectChangedByUser ) - SetRectIn100thmm( m_aIncludingRect ); - } - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DiagramPositionTabPage, ChangePosXHdl, void *, EMPTYARG ) -{ - m_aCurrentRect = GetRectIn100thmm(); - SetMinMaxPosition(); - m_bRectChangedByUser = true; - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DiagramPositionTabPage, ChangePosYHdl, void *, EMPTYARG ) -{ - m_aCurrentRect = GetRectIn100thmm(); - SetMinMaxPosition(); - m_bRectChangedByUser = true; - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DiagramPositionTabPage, ChangeWidthHdl, void *, EMPTYARG ) -{ - if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) - { - sal_Int64 nHeight(basegfx::fround64((mfScaleSizeY * (double)maMtrWidth.GetValue()) / mfScaleSizeX)); - - if(nHeight <= maMtrHeight.GetMax(FUNIT_NONE)) - { - maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); - } - else - { - nHeight = maMtrHeight.GetMax(FUNIT_NONE); - maMtrHeight.SetUserValue(nHeight); - - const sal_Int64 nWidth(basegfx::fround64((mfScaleSizeX * (double)nHeight) / mfScaleSizeY)); - maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); - } - } - m_bRectChangedByUser = true; - m_aCurrentRect = GetRectIn100thmm(); - SetMinMaxPosition(); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DiagramPositionTabPage, ChangeHeightHdl, void *, EMPTYARG ) -{ - if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) - { - sal_Int64 nWidth(basegfx::fround64((mfScaleSizeX * (double)maMtrHeight.GetValue()) / mfScaleSizeY)); - - if(nWidth <= maMtrWidth.GetMax(FUNIT_NONE)) - { - maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); - } - else - { - nWidth = maMtrWidth.GetMax(FUNIT_NONE); - maMtrWidth.SetUserValue(nWidth); - - const sal_Int64 nHeight(basegfx::fround64((mfScaleSizeY * (double)nWidth) / mfScaleSizeX)); - maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); - } - } - m_bRectChangedByUser = true; - m_aCurrentRect = GetRectIn100thmm(); - SetMinMaxPosition(); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DiagramPositionTabPage, ClickScaleHdl, void *, EMPTYARG ) -{ - if( maCbxScale.IsChecked() ) - { - mfScaleSizeX = std::max( (double)GetCoreValue( maMtrWidth, mePoolUnit ), 1.0 ); - mfScaleSizeY = std::max( (double)GetCoreValue( maMtrHeight, mePoolUnit ), 1.0 ); - } - SetMinMaxPosition(); - return( 0L ); -} - -//------------------------------------------------------------------------ - -void DiagramPositionTabPage::FillUserData() -{ - // Abgleich wird in der Ini-Datei festgehalten - UniString aStr = UniString::CreateFromInt32( (sal_Int32) maCbxScale.IsChecked() ); - SetUserData( aStr ); -} - -//............................................................................. -} //namespace chart -//............................................................................. diff --git a/chart2/source/controller/dialogs/tp_DiagramPosition.hrc b/chart2/source/controller/dialogs/tp_DiagramPosition.hrc deleted file mode 100644 index b2a558636a18..000000000000 --- a/chart2/source/controller/dialogs/tp_DiagramPosition.hrc +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: ,v $ - * $Revision: $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "ResourceIds.hrc" - -#define FL_POSITIONING_MODE 1 -#define RB_POSITIONING_MODE_AUTOMATIC 2 -#define RB_POSITIONING_MODE_EXCLUDING 3 -#define RB_POSITIONING_MODE_INCLUDING 4 -#define FL_POSITION 5 -#define FT_POS_X 6 -#define FT_POS_Y 7 -#define MTR_FLD_POS_X 8 -#define MTR_FLD_POS_Y 9 -#define FT_POSREFERENCE 10 -#define CTL_POSRECT 11 -#define FL_SIZE 12 -#define FT_WIDTH 13 -#define FT_HEIGHT 14 -#define MTR_FLD_WIDTH 15 -#define MTR_FLD_HEIGHT 16 -#define FT_SIZEREFERENCE 17 -#define CTL_SIZERECT 18 -#define CBX_SCALE 19 diff --git a/chart2/source/controller/dialogs/tp_DiagramPosition.hxx b/chart2/source/controller/dialogs/tp_DiagramPosition.hxx deleted file mode 100644 index 93dddb406500..000000000000 --- a/chart2/source/controller/dialogs/tp_DiagramPosition.hxx +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CHART2_TP_DIAGRAMPOSITION_HXX -#define _CHART2_TP_DIAGRAMPOSITION_HXX - -// header for class FormattedField -#include <svtools/fmtfield.hxx> -// header for FixedText -#include <vcl/fixed.hxx> -// header for CheckBox -#include <vcl/button.hxx> -// header for MetricField -#include <vcl/field.hxx> -// header for SvxTabPage and SvxRectCtl -#include <svx/dlgctrl.hxx> - -//............................................................................. -namespace chart -{ -//............................................................................. -class DiagramPositionTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -public: - DiagramPositionTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - - virtual BOOL FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - //SvxTabPage communication interface with SvxRectCtl - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void Construct(); - - virtual void FillUserData(); - -private: - //methods - - DECL_LINK( ChangeModeHdl, RadioButton * ); - DECL_LINK( ChangePosXHdl, void * ); - DECL_LINK( ChangePosYHdl, void * ); - DECL_LINK( ChangeWidthHdl, void * ); - DECL_LINK( ChangeHeightHdl, void * ); - DECL_LINK( ClickScaleHdl, void * ); - - void SetRectIn100thmm( const Rectangle& rRect ); - Rectangle GetRectIn100thmm(); - long get1oothMMPosValue( MetricField& rField ); - long get1oothMMSizeValue( MetricField& rField ); - void set1oothMMPosValue( MetricField& rField, long n100thMM ); - void set1oothMMSizeValue( MetricField& rField, long n100thMM ); - sal_Int64 convert1oothMMValueToFieldUnit( MetricField& rField, long n100thMM ); - void ReleaseBorders(); - void SetMinMaxPosition(); - void UpdateControlStates(); - -private: - - //positioning mode - FixedLine m_aFlPosMode; - - RadioButton m_aRbPosMode_Auto; - RadioButton m_aRbPosMode_Excluding; - RadioButton m_aRbPosMode_Including; - - // position - FixedLine maFlPosition; - FixedText maFtPosX; - MetricField maMtrPosX; - FixedText maFtPosY; - MetricField maMtrPosY; - FixedText maFtPosReference; - SvxRectCtl maCtlPos; - - // size - FixedLine maFlSize; - FixedText maFtWidth; - MetricField maMtrWidth; - FixedText maFtHeight; - MetricField maMtrHeight; - CheckBox maCbxScale; - FixedText maFtSizeReference; - SvxRectCtl maCtlSize; - -private: - Rectangle m_aExcludingRect; - Rectangle m_aIncludingRect; - Rectangle m_aMaxRect; - double m_fUIScale; - Rectangle m_aCurrentRect; - bool m_bRectChangedByUser; - - SfxMapUnit mePoolUnit; - FieldUnit meDlgUnit; - - double mfScaleSizeX; - double mfScaleSizeY; -}; - -//............................................................................. -} //namespace chart -//............................................................................. - -#endif - diff --git a/chart2/source/controller/dialogs/tp_DiagramPosition.src b/chart2/source/controller/dialogs/tp_DiagramPosition.src deleted file mode 100644 index 4c98d13c7db4..000000000000 --- a/chart2/source/controller/dialogs/tp_DiagramPosition.src +++ /dev/null @@ -1,217 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: tp_DiagramPosition.src,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "tp_DiagramPosition.hrc" -#include "TabPages.hrc" -#include <svtools/controldims.hrc> - -#define LABELWIDTH 40 -#define LABELHEIGHT 10 - -#define Y_MODE_0 3 -#define Y_MODE_1 (Y_MODE_0+18) -#define Y_MODE_2 (Y_MODE_1+13) -#define Y_MODE_3 (Y_MODE_2+13) -#define Y_POSITION (Y_MODE_3+18) -#define Y_SIZE (Y_POSITION+53) - -#define X1 6 -#define X2 12 -#define X3 (X2+LABELWIDTH+4) -#define X4 178 - - -TabPage TP_DIAGRAM_POSITION -{ - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - - FixedLine FL_POSITIONING_MODE - { - Pos = MAP_APPFONT ( X1 , Y_MODE_0 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Positioning Mode" ; - }; - RadioButton RB_POSITIONING_MODE_AUTOMATIC - { - Pos = MAP_APPFONT ( X2 , Y_MODE_1 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Automatic" ; - }; - RadioButton RB_POSITIONING_MODE_EXCLUDING - { - Pos = MAP_APPFONT ( X2 , Y_MODE_2 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Exclude labels" ; - }; - RadioButton RB_POSITIONING_MODE_INCLUDING - { - Pos = MAP_APPFONT ( X2 , Y_MODE_3 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Include labels" ; - }; - - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( X1 , Y_POSITION ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Position" ; - }; - FixedText FT_POS_X - { - Pos = MAP_APPFONT ( X2 , Y_POSITION - 3 + 16 + 8 ) ; - Size = MAP_APPFONT ( LABELWIDTH , LABELHEIGHT ) ; - Text [ en-US ] = "Position ~X" ; - }; - FixedText FT_POS_Y - { - Pos = MAP_APPFONT ( X2 , Y_POSITION - 3 + 32 + 8 ) ; - Size = MAP_APPFONT ( LABELWIDTH , LABELHEIGHT ) ; - Text [ en-US ] = "Position ~Y" ; - }; - MetricField MTR_FLD_POS_X - { - Border = TRUE ; - Pos = MAP_APPFONT ( X3 , Y_POSITION - 3 + 14 + 8 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -120000 ; - Maximum = 240000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_POS_Y - { - Border = TRUE ; - Pos = MAP_APPFONT ( X3 , Y_POSITION - 3 + 30 + 8 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -120000 ; - Maximum = 240000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - FixedText FT_POSREFERENCE - { - Pos = MAP_APPFONT ( X4 , Y_POSITION - 3 + 2 + 8 ) ; - Size = MAP_APPFONT ( 70 , LABELHEIGHT ) ; - Text [ en-US ] = "Base point"; - }; - Control CTL_POSRECT - { - Border = TRUE ; - Pos = MAP_APPFONT ( X4 , Y_POSITION - 3 + 12 + 8 ) ; - Size = MAP_APPFONT ( 48 , 34 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Base point" ; - }; - - // size - - FixedLine FL_SIZE - { - Pos = MAP_APPFONT ( X1 , Y_SIZE ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_WIDTH - { - Pos = MAP_APPFONT ( X2 , Y_SIZE - 56 + 16 + 61 ) ; - Size = MAP_APPFONT ( LABELWIDTH , LABELHEIGHT ) ; - Text [ en-US ] = "Wi~dth" ; - }; - FixedText FT_HEIGHT - { - Pos = MAP_APPFONT ( X2 , Y_SIZE - 56 + 32 + 61 ) ; - Size = MAP_APPFONT ( LABELWIDTH , LABELHEIGHT ) ; - Text [ en-US ] = "H~eight" ; - }; - MetricField MTR_FLD_WIDTH - { - Border = TRUE ; - Pos = MAP_APPFONT ( X3 , Y_SIZE - 56 + 14 + 61 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 120000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_HEIGHT - { - Border = TRUE ; - Pos = MAP_APPFONT ( X3 , Y_SIZE - 56 + 30 + 61 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 120000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - FixedText FT_SIZEREFERENCE - { - Pos = MAP_APPFONT ( X4 , Y_SIZE - 56 + 2 + 61 ) ; - Size = MAP_APPFONT ( 70 , LABELHEIGHT ) ; - Text [ en-US ] = "Base point"; - }; - Control CTL_SIZERECT - { - Border = TRUE ; - Pos = MAP_APPFONT ( X4 , Y_SIZE - 56 + 12 + 61 ) ; - Size = MAP_APPFONT ( 48 , 34 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Base point" ; - }; - CheckBox CBX_SCALE - { - Pos = MAP_APPFONT ( X2 , Y_SIZE - 56 + 47 + 61 ) ; - Size = MAP_APPFONT ( 162 , LABELHEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Keep ratio" ; - }; -}; diff --git a/chart2/source/controller/inc/DiagramItemConverter.hxx b/chart2/source/controller/inc/DiagramItemConverter.hxx deleted file mode 100644 index 280b9cffb45b..000000000000 --- a/chart2/source/controller/inc/DiagramItemConverter.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef CHART_DIAGRAM_CONVERTER_HXX -#define CHART_DIAGRAM_CONVERTER_HXX - -#include "ItemConverter.hxx" -#include <com/sun/star/awt/Size.hpp> -#include <com/sun/star/frame/XModel.hpp> - -#include <vector> -#include <memory> - -class SdrModel; - -namespace chart -{ -namespace wrapper -{ - -class DiagramItemConverter : public ::comphelper::ItemConverter -{ -public: - DiagramItemConverter( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & rPropertySet, - SfxItemPool& rItemPool, - SdrModel& rDrawModel, - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xChartModel, double fUIScale ); - virtual ~DiagramItemConverter(); - - virtual void FillItemSet( SfxItemSet & rOutItemSet ) const; - virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); - -protected: - virtual const USHORT * GetWhichPairs() const; - virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const - throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) - throw( ::com::sun::star::uno::Exception ); - -private: - ::std::vector< ItemConverter * > m_aConverters; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xChartModel; - double m_fUIScale; -}; - -} // namespace wrapper -} // namespace chart - -// CHART_DIAGRAM_CONVERTER_HXX -#endif diff --git a/chart2/source/controller/itemsetwrapper/DiagramItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DiagramItemConverter.cxx deleted file mode 100644 index bc1cd71ed338..000000000000 --- a/chart2/source/controller/itemsetwrapper/DiagramItemConverter.cxx +++ /dev/null @@ -1,223 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_chart2.hxx" -#include "DiagramItemConverter.hxx" -#include "DiagramHelper.hxx" -#include "ChartModelHelper.hxx" -#include "SchWhichPairs.hxx" -#include "macros.hxx" -#include "servicenames.hxx" -#include "chartview/ExplicitValueProvider.hxx" -#include <svl/rectitem.hxx> -#include "ItemPropertyMap.hxx" -#include "GraphicPropertyItemConverter.hxx" -#include <svx/chrtitem.hxx> -#include <svl/intitem.hxx> - -#include <functional> -#include <algorithm> - -using namespace ::com::sun::star; - -namespace chart -{ -namespace wrapper -{ - -DiagramItemConverter::DiagramItemConverter( - const uno::Reference< beans::XPropertySet > & xPropertySet - , SfxItemPool& rItemPool - , SdrModel& rDrawModel - , const uno::Reference< frame::XModel >& xChartModel - , double fUIScale ) - : ItemConverter( xPropertySet, rItemPool ) - , m_xChartModel( xChartModel ) - , m_fUIScale( fUIScale ) -{ - m_aConverters.push_back( new GraphicPropertyItemConverter( - xPropertySet, rItemPool, rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), - GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES )); -} - -DiagramItemConverter::~DiagramItemConverter() -{ - ::std::for_each( m_aConverters.begin(), m_aConverters.end(), - ::comphelper::DeleteItemConverterPtr() ); -} - -void DiagramItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const -{ - ::std::for_each( m_aConverters.begin(), m_aConverters.end(), - ::comphelper::FillItemSetFunc( rOutItemSet )); - - // own items - ItemConverter::FillItemSet( rOutItemSet ); -} - -bool DiagramItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) -{ - bool bResult = false; - - ::std::for_each( m_aConverters.begin(), m_aConverters.end(), - ::comphelper::ApplyItemSetFunc( rItemSet, bResult )); - - // own items - return ItemConverter::ApplyItemSet( rItemSet ) || bResult; -} - -const USHORT * DiagramItemConverter::GetWhichPairs() const -{ - // must span all used items! - return nDiagramWhichPairs; -} - -bool DiagramItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPropertyNameWithMemberId & /*rOutProperty*/ ) const -{ - // No own (non-special) properties - return false; -} - - -bool DiagramItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) - throw( uno::Exception ) -{ - bool bChanged = false; - - switch( nWhichId ) - { - case SCHATTR_DIAGRAM_POS_MODE: - { - try - { - sal_Int32 nValue = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue(); - DiagramPositioningMode eMode = static_cast< DiagramPositioningMode >(nValue); - bChanged = DiagramHelper::setDiagramPositioningMode( ChartModelHelper::findDiagram( m_xChartModel ), eMode ); - } - catch( uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } - } - break; - case SCHATTR_DIAGRAM_RECT_TO_USE: - { - sal_Int32 nValue = static_cast< const SfxInt32Item & >( rItemSet.Get( SCHATTR_DIAGRAM_POS_MODE )).GetValue(); - DiagramPositioningMode ePosMode = static_cast< DiagramPositioningMode >(nValue); - if( ePosMode != DiagramPositioningMode_AUTO ) - { - Rectangle aRect = static_cast< const SfxRectangleItem & >( rItemSet.Get( nWhichId )).GetValue(); - bChanged = DiagramHelper::setDiagramPositioning( m_xChartModel, awt::Rectangle( aRect.getX(), aRect.getY(), aRect.getWidth(), aRect.getHeight() ) ); - } - } - break; - } - - return bChanged; -} - -void DiagramItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const - throw( uno::Exception ) -{ - switch( nWhichId ) - { - case SCHATTR_DIAGRAM_POS_MODE: - { - DiagramPositioningMode eMode = DiagramHelper::getDiagramPositioningMode( ChartModelHelper::findDiagram( m_xChartModel ) ); - rOutItemSet.Put( SfxInt32Item( nWhichId, eMode ) ); - } - break; - case SCHATTR_DIAGRAM_RECT_TO_USE: - { - awt::Rectangle aRect(0,0,0,0); - DiagramPositioningMode eMode = DiagramHelper::getDiagramPositioningMode( ChartModelHelper::findDiagram( m_xChartModel ) ); - uno::Reference< lang::XMultiServiceFactory > xFact( m_xChartModel, uno::UNO_QUERY ); - if( xFact.is() ) - { - ExplicitValueProvider* pProvider = ExplicitValueProvider::getExplicitValueProvider( xFact->createInstance( CHART_VIEW_SERVICE_NAME ) ); - //test - awt::Rectangle aTestInclusive = pProvider->getRectangleOfObject( C2U("PlotAreaIncludingAxes") ); - awt::Rectangle aTestExclusive = pProvider->getDiagramRectangleExcludingAxes(); - awt::Rectangle aModelRect = DiagramHelper::getDiagramRectangleFromModel( m_xChartModel ); - //end test - - if( eMode == DiagramPositioningMode_EXCLUDING ) - aRect = pProvider->getDiagramRectangleExcludingAxes(); - else - aRect = pProvider->getRectangleOfObject( C2U("PlotAreaIncludingAxes") ); - rOutItemSet.Put( SfxRectangleItem( nWhichId, Rectangle( aRect.X, aRect.Y, aRect.X+aRect.Width, aRect.Y+aRect.Height ) ) ); - } - } - break; - case SCHATTR_DIAGRAM_RECT_INCLUDING: - { - uno::Reference< lang::XMultiServiceFactory > xFact( m_xChartModel, uno::UNO_QUERY ); - if( xFact.is() ) - { - ExplicitValueProvider* pProvider = ExplicitValueProvider::getExplicitValueProvider( xFact->createInstance( CHART_VIEW_SERVICE_NAME ) ); - if( pProvider ) - { - awt::Rectangle aRect = pProvider->getRectangleOfObject( C2U("PlotAreaIncludingAxes") ); - rOutItemSet.Put( SfxRectangleItem( nWhichId, Rectangle( aRect.X, aRect.Y, aRect.X+aRect.Width, aRect.Y+aRect.Height ) ) ); - } - } - } - break; - case SCHATTR_DIAGRAM_RECT_EXCLUDING: - { - uno::Reference< lang::XMultiServiceFactory > xFact( m_xChartModel, uno::UNO_QUERY ); - if( xFact.is() ) - { - ExplicitValueProvider* pProvider = ExplicitValueProvider::getExplicitValueProvider( xFact->createInstance( CHART_VIEW_SERVICE_NAME ) ); - if( pProvider ) - { - awt::Rectangle aRect = pProvider->getDiagramRectangleExcludingAxes(); - rOutItemSet.Put( SfxRectangleItem( nWhichId, Rectangle( aRect.X, aRect.Y, aRect.X+aRect.Width, aRect.Y+aRect.Height ) ) ); - } - } - } - break; - case SCHATTR_DIAGRAM_RECT_MAX: - { - awt::Size aPageSize( ChartModelHelper::getPageSize( m_xChartModel) ); - Rectangle aRect(0,0,aPageSize.Width,aPageSize.Height); - rOutItemSet.Put( SfxRectangleItem( nWhichId, aRect ) ); - } - break; - case SCHATTR_DIAGRAM_UI_SCALE: - { - rOutItemSet.Put( SvxDoubleItem( m_fUIScale, nWhichId ) ); - } - break; - } -} - -} // namespace wrapper -} // namespace chart diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx index bd971752954c..f7ddeb42c11e 100644 --- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx +++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx @@ -97,14 +97,6 @@ const USHORT nLegendWhichPairs[] = 0 }; -const USHORT nDiagramWhichPairs[] = -{ - SCHATTR_DIAGRAM_START, SCHATTR_DIAGRAM_END, - SID_ATTR_TRANSFORM_POS_Y, SID_ATTR_TRANSFORM_POS_Y, - SID_ATTR_TRANSFORM_WIDTH, SID_ATTR_TRANSFORM_HEIGHT, - 0 -}; - const USHORT nDataLabelWhichPairs[] = { SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, diff --git a/chart2/source/controller/itemsetwrapper/makefile.mk b/chart2/source/controller/itemsetwrapper/makefile.mk index 80ee9b5fed0b..8f12443c13f6 100644 --- a/chart2/source/controller/itemsetwrapper/makefile.mk +++ b/chart2/source/controller/itemsetwrapper/makefile.mk @@ -52,8 +52,7 @@ SLOFILES= $(SLO)$/ItemConverter.obj \ $(SLO)$/TitleItemConverter.obj \ $(SLO)$/RegressionCurveItemConverter.obj \ $(SLO)$/RegressionEquationItemConverter.obj \ - $(SLO)$/ErrorBarItemConverter.obj \ - $(SLO)$/DiagramItemConverter.obj + $(SLO)$/ErrorBarItemConverter.obj # --- Targets ----------------------------------------------------------------- diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 83061be07fe5..3105ee53bf14 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -130,28 +130,17 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() if( !aCID.getLength() ) return; - ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID ); + awt::Size aSelectedSize; + ExplicitValueProvider* pProvider( ExplicitValueProvider::getExplicitValueProvider( m_xChartView ) ); + if( pProvider ) + aSelectedSize = ToSize( ( pProvider->getRectangleOfObject( aCID ) ) ); UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::POS_SIZE, - ObjectNameProvider::getName( eObjectType )), + ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aCID ))), m_xUndoManager, m_aModel->getModel() ); - if( OBJECTTYPE_DIAGRAM == eObjectType || OBJECTTYPE_DIAGRAM_WALL == eObjectType ) - { - rtl::OUString aDiaCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::createParticleForDiagram( ChartModelHelper::findDiagram( m_aModel->getModel() ), m_aModel->getModel() ) ); - bool bSuccess = executeDlg_ObjectProperties_withoutUndoGuard( aDiaCID, false ); - if( bSuccess ) - aUndoGuard.commitAction(); - return; - } - - awt::Size aSelectedSize; - ExplicitValueProvider* pProvider( ExplicitValueProvider::getExplicitValueProvider( m_xChartView ) ); - if( pProvider ) - aSelectedSize = ToSize( ( pProvider->getRectangleOfObject( aCID ) ) ); - SfxAbstractTabDialog * pDlg = NULL; try { diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 1b467cdbee7a..3c5a0b135622 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -60,7 +60,6 @@ #include "Strings.hrc" #include "ReferenceSizeProvider.hxx" #include "RegressionCurveHelper.hxx" -#include "DiagramItemConverter.hxx" #include <com/sun/star/chart2/XChartDocument.hpp> //for auto_ptr @@ -152,9 +151,6 @@ namespace case OBJECTTYPE_LEGEND_ENTRY: break; case OBJECTTYPE_DIAGRAM: - pItemConverter = new wrapper::DiagramItemConverter( - xObjectProperties, rDrawModel.GetItemPool(), - rDrawModel, xChartModel, rDrawModel.GetUIScale() ); break; case OBJECTTYPE_DIAGRAM_WALL: case OBJECTTYPE_DIAGRAM_FLOOR: diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 541587cd0520..1886609d8600 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -327,8 +327,6 @@ public: static DiagramPositioningMode getDiagramPositioningMode( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); - static bool setDiagramPositioningMode( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDiagram > & xDiagram, DiagramPositioningMode eMode ); static bool setDiagramPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, const ::com::sun::star::awt::Rectangle& rPosRect /*100th mm*/ ); diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx index ed598269a420..0765c9acf94a 100644 --- a/chart2/source/inc/ObjectIdentifier.hxx +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -135,7 +135,7 @@ public: ::com::sun::star::frame::XModel >& xChartModel , sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc - static rtl::OUString createParticleForDiagram( + SAL_DLLPRIVATE static rtl::OUString createParticleForDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram , const ::com::sun::star::uno::Reference< diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index a9b827407a99..47ed75e80a9a 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -31,6 +31,7 @@ #include <svl/solar.hrc> //next free is 291 +//single free is: 134 //#define RID_APP_START 30000 ////#define STR_NULL (RID_APP_START + 1) @@ -297,7 +298,6 @@ #define STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE (RID_APP_START + 266) #define STR_PAGE_POSITIONING (RID_APP_START + 277) -#define STR_PAGE_POSITIONANDSIZE (RID_APP_START + 134) #define STR_PAGE_ASIAN (RID_APP_START + 281) //----------------------------------------------------------------------------- diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx index dc390791b81e..fbcce70bd1d6 100644 --- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -55,16 +55,7 @@ #define SCHATTR_LEGEND_POS SCHATTR_LEGEND_START #define SCHATTR_LEGEND_END SCHATTR_LEGEND_POS -#define SCHATTR_DIAGRAM_START (SCHATTR_LEGEND_END + 1) -#define SCHATTR_DIAGRAM_POS_MODE SCHATTR_DIAGRAM_START -#define SCHATTR_DIAGRAM_RECT_TO_USE SCHATTR_DIAGRAM_START + 1 -#define SCHATTR_DIAGRAM_RECT_INCLUDING SCHATTR_DIAGRAM_START + 2 -#define SCHATTR_DIAGRAM_RECT_EXCLUDING SCHATTR_DIAGRAM_START + 3 -#define SCHATTR_DIAGRAM_RECT_MAX SCHATTR_DIAGRAM_START + 4 -#define SCHATTR_DIAGRAM_UI_SCALE SCHATTR_DIAGRAM_START + 5 -#define SCHATTR_DIAGRAM_END SCHATTR_DIAGRAM_UI_SCALE - -#define SCHATTR_TEXT_START (SCHATTR_DIAGRAM_END + 1) +#define SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1) // #define SCHATTR_TEXT_ORIENT SCHATTR_TEXT_START // name changed: #define SCHATTR_TEXT_STACKED SCHATTR_TEXT_START diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 146f45ed0c63..a71daa4139eb 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -41,6 +41,7 @@ #include "servicenames_charttypes.hxx" #include "ChartModelHelper.hxx" #include "RelativePositionHelper.hxx" +#include "ControllerLockGuard.hxx" #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart2/XTitled.hpp> @@ -1435,55 +1436,6 @@ DiagramPositioningMode DiagramHelper::getDiagramPositioningMode( const uno::Refe return eMode; } -//static -bool DiagramHelper::setDiagramPositioningMode( const uno::Reference< - chart2::XDiagram > & xDiagram, DiagramPositioningMode eMode ) -{ - bool bChanged = false; - uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY ); - if( !xDiaProps.is() ) - return bChanged; - - bool bOld = false; - xDiaProps->getPropertyValue(C2U("PosSizeExcludeAxes")) >>= bOld; - bool bNew = bOld; - - if( eMode == DiagramPositioningMode_AUTO ) - { - - RelativePosition aPos; - if( (xDiaProps->getPropertyValue(C2U("RelativePosition") ) >>= aPos) ) - bChanged = true; - if( !bChanged ) - { - RelativeSize aSize; - if( (xDiaProps->getPropertyValue(C2U("RelativeSize") ) >>= aSize) ) - bChanged = true; - } - - if( bChanged ) - { - xDiaProps->setPropertyValue(C2U("RelativePosition"), uno::Any() ); - xDiaProps->setPropertyValue(C2U("RelativeSize"), uno::Any() ); - } - } - else if( eMode == DiagramPositioningMode_EXCLUDING ) - { - bNew = true; - bChanged = (bNew!=bOld); - if(bChanged) - xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(bNew) ); - } - else if( eMode == DiagramPositioningMode_INCLUDING) - { - bNew = false; - bChanged = (bNew!=bOld); - if(bChanged) - xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(bNew) ); - } - return bChanged; -} - void lcl_ensureRange0to1( double& rValue ) { if(rValue<0.0) @@ -1496,6 +1448,8 @@ void lcl_ensureRange0to1( double& rValue ) bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >& xChartModel, const awt::Rectangle& rPosRect /*100th mm*/ ) { + ControllerLockGuard aCtrlLockGuard( xChartModel ); + bool bChanged = false; awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) ); uno::Reference< beans::XPropertySet > xDiaProps( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY ); diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 222345f016e4..d8f997d36da9 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -67,13 +67,6 @@ ChartItemPool::ChartItemPool(): ppPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE); ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SvxChartLegendPosItem( CHLEGEND_RIGHT, SCHATTR_LEGEND_POS ); - ppPoolDefaults[SCHATTR_DIAGRAM_POS_MODE - SCHATTR_START] = new SfxInt32Item( SCHATTR_DIAGRAM_POS_MODE,0 ); - ppPoolDefaults[SCHATTR_DIAGRAM_RECT_TO_USE - SCHATTR_START] = new SfxRectangleItem( SCHATTR_DIAGRAM_RECT_TO_USE, Rectangle(0,0,100,100) ); - ppPoolDefaults[SCHATTR_DIAGRAM_RECT_INCLUDING - SCHATTR_START] = new SfxRectangleItem( SCHATTR_DIAGRAM_RECT_INCLUDING, Rectangle(0,0,100,100) ); - ppPoolDefaults[SCHATTR_DIAGRAM_RECT_EXCLUDING - SCHATTR_START] = new SfxRectangleItem( SCHATTR_DIAGRAM_RECT_EXCLUDING, Rectangle(0,0,100,100) ); - ppPoolDefaults[SCHATTR_DIAGRAM_RECT_MAX - SCHATTR_START] = new SfxRectangleItem( SCHATTR_DIAGRAM_RECT_MAX, Rectangle(0,0,100,100) ); - ppPoolDefaults[SCHATTR_DIAGRAM_UI_SCALE - SCHATTR_START] = new SvxDoubleItem(1.0, SCHATTR_DIAGRAM_UI_SCALE); - // ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START] = new SvxChartTextOrientItem; ppPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,FALSE); ppPoolDefaults[SCHATTR_TEXT_ORDER - SCHATTR_START] = new SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE, SCHATTR_TEXT_ORDER); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index d36c20837f95..534c24cae1ad 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -72,12 +72,15 @@ #include <vcl/svapp.hxx> #include <vos/mutex.hxx> #include <svx/unofill.hxx> +#include <unotools/saveopt.hxx> #include <time.h> #include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/ExplicitSubIncrement.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -314,7 +317,7 @@ uno::Any SAL_CALL ChartView::getTransferData( const datatransfer::DataFlavor& aF if( ! (bHighContrastMetaFile || aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMEType)) ) return aRet; - impl_updateView(); + update(); SvMemoryStream aStream( 1024, 1024 ); utl::OStreamWrapper* pStreamWrapper = new utl::OStreamWrapper( aStream ); @@ -2815,17 +2818,6 @@ void ChartView::impl_updateView() //create chart view { - /* - ::vos::OGuard aGuard( Application::GetSolarMutex()); - while( m_bViewDirty ) - { - createShapes(); - m_bViewDirty = m_bViewUpdatePending; - m_bViewUpdatePending = false; - m_bInViewUpdate = false; - } - */ - m_bViewDirty = false; m_bViewUpdatePending = false; createShapes(); @@ -2991,6 +2983,33 @@ void SAL_CALL ChartView::removeModeChangeApproveListener( const uno::Reference< void SAL_CALL ChartView::update() throw (uno::RuntimeException) { impl_updateView(); + + //#i100778# migrate all imported or old documents to a plot area sizing exclusive axes (in case the save settings allow for this): + //Although in general it is a bad idea to change the model from within the view this is exceptionally the best place to do this special conversion. + //When a view update is requested (what happens for creating the metafile or displaying + //the chart in edit mode or printing) it is most likely that all necessary informations are available - like the underlying spreadsheet data for example. + //Those data is important for the correct axis lable sizes which are needed during conversion. + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion == SvtSaveOptions::ODFVER_LATEST )//#i100778# todo: change this dependent on fileformat evolution + { + uno::Reference< ::com::sun::star::chart::XChartDocument > xOldDoc( m_xChartModel, uno::UNO_QUERY ) ; + if( xOldDoc.is() ) + { + uno::Reference< ::com::sun::star::chart::XDiagramPositioning > xDiagramPositioning( xOldDoc->getDiagram(), uno::UNO_QUERY ); + if( xDiagramPositioning.is() && !xDiagramPositioning->isAutomaticDiagramPositioning() && !xDiagramPositioning->isExcludingDiagramPositioning() ) + { + { + ControllerLockGuard aCtrlLockGuard( m_xChartModel ); + uno::Reference< util::XModifiable > xModifiable( m_xChartModel, uno::UNO_QUERY ); + bool bModelWasModified = xModifiable.is() && xModifiable->isModified(); + xDiagramPositioning->setDiagramPositionExcludingAxes( xDiagramPositioning->calculateDiagramPositionExcludingAxes() ); + if(!bModelWasModified && xModifiable.is() ) + xModifiable->setModified(sal_False); + } + impl_updateView(); + } + } + } } // ____ XPropertySet ____ |