diff options
1576 files changed, 62418 insertions, 138396 deletions
diff --git a/autodoc/source/display/html/cfrstd.cxx b/autodoc/source/display/html/cfrstd.cxx index 1093932699ce..3bf56afb07cc 100644 --- a/autodoc/source/display/html/cfrstd.cxx +++ b/autodoc/source/display/html/cfrstd.cxx @@ -336,9 +336,9 @@ MakeCopyRight() plt = localtime(>); int year = 1900 + plt->tm_year; - cr << "Copyright © " + cr << "Copyright © 1995, " << year - << " Oracle"; + << ", Oracle and/or its affiliates. All rights reserved."; return String(cr.c_str()); } diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index f0cd1ed3f751..fd613a81673f 100644 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -191,41 +191,6 @@ BOOL IsTTSignatureForUnicodeTextfile( String aLine ) BasicApp aBasicApp; // Application instance -static const char * const components[] = -{ - SAL_MODULENAME( "ucb1" ) // KSO, ABI - , SAL_MODULENAME( "ucpfile1" ) - , "configmgr2.uno" SAL_DLLEXTENSION - , "sax.uno" SAL_DLLEXTENSION - , "stocservices.uno" SAL_DLLEXTENSION - , SAL_MODULENAME( "fileacc" ) - , SAL_MODULENAME( "mcnttype" ) // Clipboard Ask Oliver Braun - , "i18npool.uno" SAL_DLLEXTENSION - // Reading of files in specific encodings like UTF-8 using - // createUnoService( "com.sun.star.io.TextInputStream" ) and such - , "textinstream.uno" SAL_DLLEXTENSION - , "textoutstream.uno" SAL_DLLEXTENSION - , "introspection.uno" SAL_DLLEXTENSION - , "reflection.uno" SAL_DLLEXTENSION - // RemoteUno - , "connector.uno" SAL_DLLEXTENSION - , "bridgefac.uno" SAL_DLLEXTENSION - , "remotebridge.uno" SAL_DLLEXTENSION -#ifdef SAL_UNX -#ifdef QUARTZ - , SVLIBRARY( "dtransaqua" ) // Mac OS X Aqua uses a dedicated libdtransaqua -#else - , SVLIBRARY( "dtransX11" ) // OBR -#endif -#endif -#ifdef SAL_W32 - , SAL_MODULENAME( "sysdtrans" ) - , SAL_MODULENAME( "ftransl" ) - , SAL_MODULENAME( "dnd" ) -#endif - , 0 -}; - uno::Reference< XContentProviderManager > InitializeUCB( void ) { uno::Reference< XMultiServiceFactory > xSMgr; diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/call.s b/bridges/source/cpp_uno/gcc3_linux_intel/call.s index f345e3a764ac..45d7c5308d30 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/call.s +++ b/bridges/source/cpp_uno/gcc3_linux_intel/call.s @@ -9,7 +9,8 @@ privateSnippetExecutorGeneral: .LCFIg0: movl %esp,%ebp .LCFIg1: - subl $0x4,%esp # 32bit returnValue + subl $0x8,%esp # 32bit returnValue, and preserve potential 128bit + # stack alignment pushl %esp # 32bit &returnValue pushl %ecx # 32bit pCallStack pushl %edx # 32bit nVtableOffset @@ -30,6 +31,7 @@ privateSnippetExecutorVoid: .LCFIv0: movl %esp,%ebp .LCFIv1: + andl $0xFFFFFFF0,%esp # preserve potential 128bit stack alignment pushl $0 # 32bit null pointer (returnValue not used) pushl %ecx # 32bit pCallStack pushl %edx # 32bit nVtableOffset @@ -49,7 +51,8 @@ privateSnippetExecutorHyper: .LCFIh0: movl %esp,%ebp .LCFIh1: - subl $0x8,%esp # 64bit returnValue + subl $0x8,%esp # 64bit returnValue (preserves potential 128bit + # stack alignment) pushl %esp # 32bit &returnValue pushl %ecx # 32bit pCallStack pushl %edx # 32bit nVtableOffset @@ -71,7 +74,8 @@ privateSnippetExecutorFloat: .LCFIf0: movl %esp,%ebp .LCFIf1: - subl $0x4,%esp # 32bit returnValue + subl $0x8,%esp # 32bit returnValue, and preserve potential 128bit + # stack alignment pushl %esp # 32bit &returnValue pushl %ecx # 32bit pCallStack pushl %edx # 32bit nVtableOffset @@ -92,7 +96,8 @@ privateSnippetExecutorDouble: .LCFId0: movl %esp,%ebp .LCFId1: - subl $0x8,%esp # 64bit returnValue + subl $0x8,%esp # 64bit returnValue (preserves potential 128bit + # stack alignment) pushl %esp # 32bit &returnValue pushl %ecx # 32bit pCallStack pushl %edx # 32bit nVtableOffset @@ -113,7 +118,8 @@ privateSnippetExecutorClass: .LCFIc0: movl %esp,%ebp .LCFIc1: - subl $0x4,%esp # 32bit returnValue + subl $0x8,%esp # 32bit returnValue, and preserve potential 128bit + # stack alignment pushl %esp # 32bit &returnValue pushl %ecx # 32bit pCallStack pushl %edx # 32bit nVtableOffset diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx index afd202f683cf..4d1d3f2f8ca4 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx @@ -84,6 +84,13 @@ void callVirtualMethod( void * stackptr; asm volatile ( "mov %%esp, %6\n\t" + // preserve potential 128bit stack alignment + "and $0xfffffff0, %%esp\n\t" + "mov %0, %%eax\n\t" + "lea -4(,%%eax,4), %%eax\n\t" + "and $0xf, %%eax\n\t" + "sub $0xc, %%eax\n\t" + "add %%eax, %%esp\n\t" // copy values "mov %0, %%eax\n\t" "mov %%eax, %%edx\n\t" diff --git a/chart2/prj/build.lst b/chart2/prj/build.lst index 8a76f4a0513b..3cdc9a26e3f5 100644 --- a/chart2/prj/build.lst +++ b/chart2/prj/build.lst @@ -14,7 +14,7 @@ ch chart2\source\view\axes nmake - all ch_source_view_axes ch_source_tools ch chart2\source\view\charttypes nmake - all ch_source_view_charttypes ch_inc NULL ch chart2\source\view\diagram nmake - all ch_source_view_diagram ch_inc NULL ch chart2\source\view\main nmake - all ch_source_view_main ch_inc NULL -ch chart2\source\controller nmake - all ch_source_controller ch_source_tools ch_source_view ch_source_controller_drawinglayer ch_source_controller_itemsetwrapper ch_source_controller_dialogs ch_source_controller_main ch_source_controller_chartapiwrapper ch_source_controller_accessibility ch_inc NULL +ch chart2\source\controller nmake - all ch_source_controller ch_source_tools ch_source_view ch_source_controller_drawinglayer ch_source_controller_itemsetwrapper ch_source_controller_dialogs ch_source_controller_main ch_source_controller_chartapiwrapper ch_source_controller_accessibility ch_inc ch_source_controller_menus NULL ch chart2\source\controller\inc get - all ch_source_controller_inc NULL ch chart2\source\controller\accessibility nmake - all ch_source_controller_accessibility ch_inc NULL ch chart2\source\controller\dialogs nmake - all ch_source_controller_dialogs ch_inc NULL @@ -22,4 +22,5 @@ ch chart2\source\controller\drawinglayer nmake - all ch_source_controller_drawi ch chart2\source\controller\itemsetwrapper nmake - all ch_source_controller_itemsetwrapper ch_inc NULL ch chart2\source\controller\chartapiwrapper nmake - all ch_source_controller_chartapiwrapper ch_inc NULL ch chart2\source\controller\main nmake - all ch_source_controller_main ch_inc NULL +ch chart2\source\controller\menus nmake - all ch_source_controller_menus ch_inc NULL ch chart2\prj get - all ch_prj NULL diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index cab7d3db0d62..00335eab296e 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -29,6 +29,7 @@ #include "precompiled_chart2.hxx" #include "AccessibleBase.hxx" +#include "AccessibleChartShape.hxx" #include "ObjectHierarchy.hxx" #include "ObjectIdentifier.hxx" #include "chartview/ExplicitValueProvider.hxx" @@ -269,15 +270,15 @@ bool AccessibleBase::ImplUpdateChildren() { ObjectHierarchy::tChildContainer aModelChildren( m_aAccInfo.m_spObjectHierarchy->getChildren( GetId() )); - ::std::vector< ChildCIDMap::key_type > aAccChildren; + ::std::vector< ChildOIDMap::key_type > aAccChildren; aAccChildren.reserve( aModelChildren.size()); - ::std::transform( m_aChildCIDMap.begin(), m_aChildCIDMap.end(), + ::std::transform( m_aChildOIDMap.begin(), m_aChildOIDMap.end(), ::std::back_inserter( aAccChildren ), - ::std::select1st< ChildCIDMap::value_type >()); + ::std::select1st< ChildOIDMap::value_type >()); ::std::sort( aModelChildren.begin(), aModelChildren.end()); - ::std::vector< OUString > aChildrenToRemove, aChildrenToAdd; + ::std::vector< ObjectHierarchy::tOID > aChildrenToRemove, aChildrenToAdd; ::std::set_difference( aModelChildren.begin(), aModelChildren.end(), aAccChildren.begin(), aAccChildren.end(), ::std::back_inserter( aChildrenToAdd )); @@ -285,10 +286,10 @@ bool AccessibleBase::ImplUpdateChildren() aModelChildren.begin(), aModelChildren.end(), ::std::back_inserter( aChildrenToRemove )); - ::std::vector< OUString >::const_iterator aIt( aChildrenToRemove.begin()); + ::std::vector< ObjectHierarchy::tOID >::const_iterator aIt( aChildrenToRemove.begin()); for( ; aIt != aChildrenToRemove.end(); ++aIt ) { - RemoveChildById( *aIt ); + RemoveChildByOId( *aIt ); } AccessibleElementInfo aAccInfo( GetInfo()); @@ -296,8 +297,15 @@ bool AccessibleBase::ImplUpdateChildren() for( aIt = aChildrenToAdd.begin(); aIt != aChildrenToAdd.end(); ++aIt ) { - aAccInfo.m_aCID = *aIt; - AddChild( ChartElementFactory::CreateChartElement( aAccInfo )); + aAccInfo.m_aOID = *aIt; + if ( aIt->isAutoGeneratedObject() ) + { + AddChild( ChartElementFactory::CreateChartElement( aAccInfo ) ); + } + else if ( aIt->isAdditionalShape() ) + { + AddChild( new AccessibleChartShape( aAccInfo, true, false ) ); + } } bResult = true; } @@ -316,7 +324,7 @@ void AccessibleBase::AddChild( AccessibleBase * pChild ) Reference< XAccessible > xChild( pChild ); m_aChildList.push_back( xChild ); - m_aChildCIDMap[ pChild->GetId() ] = xChild; + m_aChildOIDMap[ pChild->GetId() ] = xChild; // inform listeners of new child if( m_bChildrenInitialized ) @@ -335,18 +343,18 @@ void AccessibleBase::AddChild( AccessibleBase * pChild ) /** in this method we imply that the Reference< XAccessible > elements in the vector are AccessibleBase objects ! */ -void AccessibleBase::RemoveChildById( const ::rtl::OUString & rId ) +void AccessibleBase::RemoveChildByOId( const ObjectIdentifier& rOId ) { // /-- ClearableMutexGuard aGuard( GetMutex() ); - ChildCIDMap::iterator aIt( m_aChildCIDMap.find( rId )); - if( aIt != m_aChildCIDMap.end()) + ChildOIDMap::iterator aIt( m_aChildOIDMap.find( rOId )); + if( aIt != m_aChildOIDMap.end()) { Reference< XAccessible > xChild( aIt->second ); // remove from map - m_aChildCIDMap.erase( aIt ); + m_aChildOIDMap.erase( aIt ); // search child in vector ChildListVectorType::iterator aVecIter = @@ -444,7 +452,7 @@ void AccessibleBase::KillAllChildren() // remove all children m_aChildList.clear(); - m_aChildCIDMap.clear(); + m_aChildOIDMap.clear(); aGuard.clear(); // \-- @@ -485,7 +493,7 @@ void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo ) AccessibleUniqueId AccessibleBase::GetId() const { - return m_aAccInfo.m_aCID; + return m_aAccInfo.m_aOID; } // ____________________________________ @@ -662,14 +670,15 @@ Reference< XAccessibleStateSet > SAL_CALL AccessibleBase::getAccessibleStateSet( { if( ! m_bStateSetInitialized ) { - OUString aSelCID; Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier ); - if( xSelSupp.is() && - ( xSelSupp->getSelection() >>= aSelCID ) && - GetId().equals( aSelCID ) ) + if ( xSelSupp.is() ) { - AddState( AccessibleStateType::SELECTED ); - AddState( AccessibleStateType::FOCUSED ); + ObjectIdentifier aOID( xSelSupp->getSelection() ); + if ( aOID.isValid() && GetId() == aOID ) + { + AddState( AccessibleStateType::SELECTED ); + AddState( AccessibleStateType::FOCUSED ); + } } m_bStateSetInitialized = true; } @@ -752,7 +761,7 @@ awt::Rectangle SAL_CALL AccessibleBase::getBounds() if( pExplicitValueProvider ) { Window* pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow )); - awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aCID )); + awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() )); if( pWindow ) { Rectangle aRect( aLogicRect.X, aLogicRect.Y, @@ -825,10 +834,11 @@ void SAL_CALL AccessibleBase::grabFocus() { CheckDisposeState(); - OUString aSelCID; Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier ); - if( xSelSupp.is()) - xSelSupp->select( uno::makeAny( GetId())); + if ( xSelSupp.is() ) + { + xSelSupp->select( GetId().getAny() ); + } } sal_Int32 SAL_CALL AccessibleBase::getForeground() @@ -849,9 +859,10 @@ sal_Int32 AccessibleBase::getColor( eColorType eColType ) if( m_bAlwaysTransparent ) return nResult; - ObjectType eType( ObjectIdentifier::getObjectType( m_aAccInfo.m_aCID )); + ObjectIdentifier aOID( m_aAccInfo.m_aOID ); + ObjectType eType( aOID.getObjectType() ); Reference< beans::XPropertySet > xObjProp; - OUString aObjectCID = m_aAccInfo.m_aCID; + OUString aObjectCID = aOID.getObjectCID(); if( eType == OBJECTTYPE_LEGEND_ENTRY ) { // for colors get the data series/point properties diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx index a2c7b7aa8261..2361cc62c389 100644 --- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx @@ -101,7 +101,7 @@ bool AccessibleChartElement::ImplUpdateChildren() bool bResult = false; Reference< chart2::XTitle > xTitle( ObjectIdentifier::getObjectPropertySet( - GetInfo().m_aCID, Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), + GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY ); m_bHasText = xTitle.is(); @@ -136,7 +136,7 @@ void AccessibleChartElement::InitTextEdit() { Reference< lang::XInitialization > xInit( m_xTextHelper, uno::UNO_QUERY_THROW ); Sequence< uno::Any > aArgs( 3 ); - aArgs[0] <<= GetInfo().m_aCID; + aArgs[0] <<= GetInfo().m_aOID.getObjectCID(); aArgs[1] <<= Reference< XAccessible >( this ); aArgs[2] <<= Reference< awt::XWindow >( GetInfo().m_xWindow ); xInit->initialize( aArgs ); @@ -224,7 +224,7 @@ OUString SAL_CALL AccessibleChartElement::getAccessibleName() throw (::com::sun::star::uno::RuntimeException) { return ObjectNameProvider::getNameForCID( - GetInfo().m_aCID, GetInfo().m_xChartDocument ); + GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument ); } // ________ AccessibleChartElement::XAccessibleContext (overloaded) ________ @@ -249,7 +249,7 @@ Reference< awt::XFont > SAL_CALL AccessibleChartElement::getFont() { Reference< beans::XMultiPropertySet > xObjProp( ObjectIdentifier::getObjectPropertySet( - GetInfo().m_aCID, Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY ); + GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY ); awt::FontDescriptor aDescr( CharacterProperties::createFontDescriptorFromPropertySet( xObjProp )); xFont = xDevice->getFont( aDescr ); @@ -270,7 +270,7 @@ OUString SAL_CALL AccessibleChartElement::getToolTipText() CheckDisposeState(); return ObjectNameProvider::getHelpText( - GetInfo().m_aCID, Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )); + GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )); } // ________ XAccessibleComponent ________ @@ -280,7 +280,7 @@ sal_Bool SAL_CALL AccessibleChartElement::containsPoint( const awt::Point& aPoin return AccessibleBase::containsPoint( aPoint ); } -Reference< accessibility::XAccessible > SAL_CALL AccessibleChartElement::getAccessibleAtPoint( const awt::Point& aPoint ) +Reference< XAccessible > SAL_CALL AccessibleChartElement::getAccessibleAtPoint( const awt::Point& aPoint ) throw (uno::RuntimeException) { return AccessibleBase::getAccessibleAtPoint( aPoint ); diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.cxx b/chart2/source/controller/accessibility/AccessibleChartShape.cxx new file mode 100644 index 000000000000..bbf6176641da --- /dev/null +++ b/chart2/source/controller/accessibility/AccessibleChartShape.cxx @@ -0,0 +1,289 @@ +/************************************************************************* + * + * 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 "AccessibleChartShape.hxx" +#include "ObjectHierarchy.hxx" +#include "ObjectIdentifier.hxx" + +#include <toolkit/helper/vclunohelper.hxx> +#include <svx/ShapeTypeHandler.hxx> +#include <svx/AccessibleShape.hxx> +#include <svx/AccessibleShapeInfo.hxx> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::accessibility; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; + + +namespace chart +{ + +AccessibleChartShape::AccessibleChartShape( + const AccessibleElementInfo& rAccInfo, + bool bMayHaveChildren, bool bAlwaysTransparent ) + :impl::AccessibleChartShape_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent ) + ,m_pAccShape( NULL ) +{ + if ( rAccInfo.m_aOID.isAdditionalShape() ) + { + Reference< drawing::XShape > xShape( rAccInfo.m_aOID.getAdditionalShape() ); + Reference< XAccessible > xParent; + if ( rAccInfo.m_pParent ) + { + xParent.set( rAccInfo.m_pParent ); + } + sal_Int32 nIndex = -1; + if ( rAccInfo.m_spObjectHierarchy ) + { + nIndex = rAccInfo.m_spObjectHierarchy->getIndexInParent( rAccInfo.m_aOID ); + } + ::accessibility::AccessibleShapeInfo aShapeInfo( xShape, xParent, nIndex ); + + m_aShapeTreeInfo.SetSdrView( rAccInfo.m_pSdrView ); + m_aShapeTreeInfo.SetController( NULL ); + m_aShapeTreeInfo.SetWindow( VCLUnoHelper::GetWindow( rAccInfo.m_xWindow ) ); + m_aShapeTreeInfo.SetViewForwarder( rAccInfo.m_pViewForwarder ); + + ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance(); + m_pAccShape = rShapeHandler.CreateAccessibleObject( aShapeInfo, m_aShapeTreeInfo ); + if ( m_pAccShape ) + { + m_pAccShape->acquire(); + m_pAccShape->Init(); + } + } +} + +AccessibleChartShape::~AccessibleChartShape() +{ + OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) ); + + if ( m_pAccShape ) + { + m_pAccShape->dispose(); + m_pAccShape->release(); + } +} + +// ________ XServiceInfo ________ +::rtl::OUString AccessibleChartShape::getImplementationName() + throw (RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleChartShape" ) ); +} + +// ________ XAccessibleContext ________ +sal_Int32 AccessibleChartShape::getAccessibleChildCount() + throw (RuntimeException) +{ + sal_Int32 nCount(0); + if ( m_pAccShape ) + { + nCount = m_pAccShape->getAccessibleChildCount(); + } + return nCount; +} + +Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i ) + throw (lang::IndexOutOfBoundsException, RuntimeException) +{ + Reference< XAccessible > xChild; + if ( m_pAccShape ) + { + xChild = m_pAccShape->getAccessibleChild( i ); + } + return xChild; +} + +sal_Int16 AccessibleChartShape::getAccessibleRole() + throw (RuntimeException) +{ + sal_Int16 nRole(0); + if ( m_pAccShape ) + { + nRole = m_pAccShape->getAccessibleRole(); + } + return nRole; +} + +::rtl::OUString AccessibleChartShape::getAccessibleDescription() + throw (::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aDescription; + if ( m_pAccShape ) + { + aDescription = m_pAccShape->getAccessibleDescription(); + } + return aDescription; +} + +::rtl::OUString AccessibleChartShape::getAccessibleName() + throw (::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aName; + if ( m_pAccShape ) + { + aName = m_pAccShape->getAccessibleName(); + } + return aName; +} + +// ________ XAccessibleComponent ________ +sal_Bool AccessibleChartShape::containsPoint( const awt::Point& aPoint ) + throw (uno::RuntimeException) +{ + sal_Bool bReturn = sal_False; + if ( m_pAccShape ) + { + bReturn = m_pAccShape->containsPoint( aPoint ); + } + return bReturn; +} + +Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt::Point& aPoint ) + throw (uno::RuntimeException) +{ + Reference< XAccessible > xResult; + if ( m_pAccShape ) + { + xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) ); + } + return xResult; +} + +awt::Rectangle AccessibleChartShape::getBounds() + throw (uno::RuntimeException) +{ + awt::Rectangle aBounds; + if ( m_pAccShape ) + { + aBounds = m_pAccShape->getBounds(); + } + return aBounds; +} + +awt::Point AccessibleChartShape::getLocation() + throw (uno::RuntimeException) +{ + awt::Point aLocation; + if ( m_pAccShape ) + { + aLocation = m_pAccShape->getLocation(); + } + return aLocation; +} + +awt::Point AccessibleChartShape::getLocationOnScreen() + throw (uno::RuntimeException) +{ + awt::Point aLocation; + if ( m_pAccShape ) + { + aLocation = m_pAccShape->getLocationOnScreen(); + } + return aLocation; +} + +awt::Size AccessibleChartShape::getSize() + throw (uno::RuntimeException) +{ + awt::Size aSize; + if ( m_pAccShape ) + { + aSize = m_pAccShape->getSize(); + } + return aSize; +} + +void AccessibleChartShape::grabFocus() + throw (uno::RuntimeException) +{ + return AccessibleBase::grabFocus(); +} + +sal_Int32 AccessibleChartShape::getForeground() + throw (uno::RuntimeException) +{ + sal_Int32 nColor(0); + if ( m_pAccShape ) + { + nColor = m_pAccShape->getForeground(); + } + return nColor; +} + +sal_Int32 AccessibleChartShape::getBackground() + throw (uno::RuntimeException) +{ + sal_Int32 nColor(0); + if ( m_pAccShape ) + { + nColor = m_pAccShape->getBackground(); + } + return nColor; +} + +// ________ XAccessibleExtendedComponent ________ +Reference< awt::XFont > AccessibleChartShape::getFont() + throw (uno::RuntimeException) +{ + Reference< awt::XFont > xFont; + if ( m_pAccShape ) + { + xFont.set( m_pAccShape->getFont() ); + } + return xFont; +} + +::rtl::OUString AccessibleChartShape::getTitledBorderText() + throw (uno::RuntimeException) +{ + ::rtl::OUString aText; + if ( m_pAccShape ) + { + aText = m_pAccShape->getTitledBorderText(); + } + return aText; +} + +::rtl::OUString AccessibleChartShape::getToolTipText() + throw (::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString aText; + if ( m_pAccShape ) + { + aText = m_pAccShape->getToolTipText(); + } + return aText; +} + +} // namespace chart diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.hxx b/chart2/source/controller/accessibility/AccessibleChartShape.hxx new file mode 100644 index 000000000000..a1236b697a69 --- /dev/null +++ b/chart2/source/controller/accessibility/AccessibleChartShape.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * 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_ACCESSIBLECHARTSHAPE_HXX_ +#define _CHART2_ACCESSIBLECHARTSHAPE_HXX_ + +#include "AccessibleBase.hxx" + +#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> +#include <cppuhelper/implbase1.hxx> +#include <svx/AccessibleShapeTreeInfo.hxx> + + +namespace accessibility +{ +class AccessibleShape; +} + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::ImplInheritanceHelper1< + AccessibleBase, + ::com::sun::star::accessibility::XAccessibleExtendedComponent > AccessibleChartShape_Base; +} + +class AccessibleChartShape : + public impl::AccessibleChartShape_Base +{ +public: + AccessibleChartShape( const AccessibleElementInfo& rAccInfo, + bool bMayHaveChildren, bool bAlwaysTransparent = false ); + virtual ~AccessibleChartShape(); + + // ________ XServiceInfo ________ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + + // ________ XAccessibleContext ________ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 i ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName() + throw (::com::sun::star::uno::RuntimeException); + + // ________ XAccessibleComponent ________ + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException); + + // ________ XAccessibleExtendedComponent ________ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText() + throw (::com::sun::star::uno::RuntimeException); + +private: + ::accessibility::AccessibleShape* m_pAccShape; + ::accessibility::AccessibleShapeTreeInfo m_aShapeTreeInfo; +}; + +} // namespace chart + +#endif diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx index 611d75992832..4833991ad7cc 100644 --- a/chart2/source/controller/accessibility/AccessibleChartView.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx @@ -36,6 +36,7 @@ #include "ObjectIdentifier.hxx" #include "ResId.hxx" #include "Strings.hrc" +#include "AccessibleViewForwarder.hxx" #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -66,19 +67,22 @@ namespace chart //............................................................................. AccessibleChartView::AccessibleChartView( - const Reference<uno::XComponentContext> & xContext ) : + const Reference< uno::XComponentContext >& xContext, SdrView* pView ) : impl::AccessibleChartView_Base( AccessibleElementInfo(), // empty for now true, // has children true // always transparent ), - m_xContext( xContext ) + m_xContext( xContext ), + m_pSdrView( pView ), + m_pViewForwarder( NULL ) { AddState( AccessibleStateType::OPAQUE ); } AccessibleChartView::~AccessibleChartView() { + delete m_pViewForwarder; } @@ -187,20 +191,6 @@ awt::Point SAL_CALL AccessibleChartView::getLocationOnScreen() } //----------------------------------------------------------------- -// lang::XServiceInfo -//----------------------------------------------------------------- - -APPHELPER_XSERVICEINFO_IMPL( AccessibleChartView, CHART2_ACCESSIBLE_SERVICE_IMPLEMENTATION_NAME ) - -uno::Sequence< rtl::OUString > AccessibleChartView::getSupportedServiceNames_Static() -{ - uno::Sequence< rtl::OUString > aSNS( 2 ); - aSNS.getArray()[ 0 ] = C2U("com.sun.star.accessibility.Accessible"); - aSNS.getArray()[ 1 ] = CHART2_ACCESSIBLE_SERVICE_NAME; - return aSNS; -} - -//----------------------------------------------------------------- // lang::XInitialization //----------------------------------------------------------------- @@ -350,7 +340,7 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments { AccessibleElementInfo aAccInfo; - aAccInfo.m_aCID = C2U("ROOT"); + aAccInfo.m_aOID = ObjectIdentifier( C2U( "ROOT" ) ); aAccInfo.m_xChartDocument = uno::WeakReference< chart2::XChartDocument >( uno::Reference< chart2::XChartDocument >( m_xChartModel.get(), uno::UNO_QUERY )); aAccInfo.m_xSelectionSupplier = m_xSelectionSupplier; @@ -358,6 +348,14 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments aAccInfo.m_xWindow = m_xWindow; aAccInfo.m_pParent = 0; aAccInfo.m_spObjectHierarchy = m_spObjectHierarchy; + aAccInfo.m_pSdrView = m_pSdrView; + Window* pWindow = VCLUnoHelper::GetWindow( m_xWindow ); + if ( m_pViewForwarder ) + { + delete m_pViewForwarder; + } + m_pViewForwarder = new AccessibleViewForwarder( this, pWindow ); + aAccInfo.m_pViewForwarder = m_pViewForwarder; // broadcasts an INVALIDATE_ALL_CHILDREN event globally SetInfo( aAccInfo ); } @@ -384,16 +382,16 @@ void SAL_CALL AccessibleChartView::selectionChanged( const lang::EventObject& /* if( xSelectionSupplier.is() ) { - rtl::OUString aSelectedObjectCID; - Any aSelection = xSelectionSupplier->getSelection(); - if(aSelection>>=aSelectedObjectCID) + ObjectIdentifier aSelectedOID( xSelectionSupplier->getSelection() ); + if ( m_aCurrentSelectionOID.isValid() ) + { + NotifyEvent( LOST_SELECTION, m_aCurrentSelectionOID ); + } + if( aSelectedOID.isValid() ) { - if( m_aCurrentSelectionCID.getLength()) - NotifyEvent( LOST_SELECTION, m_aCurrentSelectionCID ); - if( aSelectedObjectCID.getLength()) - NotifyEvent( GOT_SELECTION, aSelectedObjectCID ); - m_aCurrentSelectionCID = aSelectedObjectCID; + NotifyEvent( GOT_SELECTION, aSelectedOID ); } + m_aCurrentSelectionOID = aSelectedOID; } } diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx new file mode 100644 index 000000000000..5014198761f8 --- /dev/null +++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 "AccessibleViewForwarder.hxx" +#include "AccessibleChartView.hxx" + +#include <vcl/window.hxx> + +using namespace ::com::sun::star; + + +namespace chart +{ + +AccessibleViewForwarder::AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow ) + :m_pAccChartView( pAccChartView ) + ,m_pWindow( pWindow ) + ,m_aMapMode( MAP_100TH_MM ) +{ +} + +AccessibleViewForwarder::~AccessibleViewForwarder() +{ +} + +// ________ IAccessibleViewforwarder ________ + +BOOL AccessibleViewForwarder::IsValid() const +{ + return sal_True; +} + +Rectangle AccessibleViewForwarder::GetVisibleArea() const +{ + Rectangle aVisibleArea; + if ( m_pWindow ) + { + aVisibleArea.SetPos( Point( 0, 0 ) ); + aVisibleArea.SetSize( m_pWindow->GetOutputSizePixel() ); + aVisibleArea = m_pWindow->PixelToLogic( aVisibleArea, m_aMapMode ); + } + return aVisibleArea; +} + +Point AccessibleViewForwarder::LogicToPixel( const Point& rPoint ) const +{ + Point aPoint; + if ( m_pAccChartView && m_pWindow ) + { + awt::Point aLocation = m_pAccChartView->getLocationOnScreen(); + Point aTopLeft( aLocation.X, aLocation.Y ); + aPoint = m_pWindow->LogicToPixel( rPoint, m_aMapMode ) + aTopLeft; + } + return aPoint; +} + +Size AccessibleViewForwarder::LogicToPixel( const Size& rSize ) const +{ + Size aSize; + if ( m_pWindow ) + { + aSize = m_pWindow->LogicToPixel( rSize, m_aMapMode ); + } + return aSize; +} + +Point AccessibleViewForwarder::PixelToLogic( const Point& rPoint ) const +{ + Point aPoint; + if ( m_pAccChartView && m_pWindow ) + { + awt::Point aLocation = m_pAccChartView->getLocationOnScreen(); + Point aTopLeft( aLocation.X, aLocation.Y ); + aPoint = m_pWindow->PixelToLogic( rPoint - aTopLeft, m_aMapMode ); + } + return aPoint; +} + +Size AccessibleViewForwarder::PixelToLogic( const Size& rSize ) const +{ + Size aSize; + if ( m_pWindow ) + { + aSize = m_pWindow->PixelToLogic( rSize, m_aMapMode ); + } + return aSize; +} + +} // namespace chart diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx new file mode 100644 index 000000000000..e70aa58b8df7 --- /dev/null +++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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_ACCESSIBLEVIEWFORWARDER_HXX_ +#define _CHART2_ACCESSIBLEVIEWFORWARDER_HXX_ + +#include <vcl/mapmod.hxx> +#include <svx/IAccessibleViewForwarder.hxx> + +class Window; + +namespace chart +{ + +class AccessibleChartView; + +class AccessibleViewForwarder : public ::accessibility::IAccessibleViewForwarder +{ +public: + AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow ); + virtual ~AccessibleViewForwarder(); + + // ________ IAccessibleViewforwarder ________ + virtual BOOL IsValid() const; + virtual Rectangle GetVisibleArea() const; + virtual Point LogicToPixel( const Point& rPoint ) const; + virtual Size LogicToPixel( const Size& rSize ) const; + virtual Point PixelToLogic( const Point& rPoint ) const; + virtual Size PixelToLogic( const Size& rSize ) const; + +private: + AccessibleViewForwarder( AccessibleViewForwarder& ); + AccessibleViewForwarder& operator=( AccessibleViewForwarder& ); + + AccessibleChartView* m_pAccChartView; + Window* m_pWindow; + MapMode m_aMapMode; +}; + +} // namespace chart + +#endif diff --git a/chart2/source/controller/accessibility/ChartElementFactory.cxx b/chart2/source/controller/accessibility/ChartElementFactory.cxx index 43535a0d7fc5..b2599fec0c74 100644 --- a/chart2/source/controller/accessibility/ChartElementFactory.cxx +++ b/chart2/source/controller/accessibility/ChartElementFactory.cxx @@ -30,7 +30,6 @@ #include "ChartElementFactory.hxx" #include "ObjectIdentifier.hxx" - #include "AccessibleChartElement.hxx" namespace chart @@ -38,8 +37,8 @@ namespace chart AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElementInfo& rAccInfo ) { - ObjectType eType( - ObjectIdentifier::getObjectType( rAccInfo.m_aCID )); + ObjectIdentifier aOID( rAccInfo.m_aOID ); + ObjectType eType( aOID.getObjectType() ); switch( eType ) { @@ -72,6 +71,8 @@ AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElement return new AccessibleChartElement( rAccInfo, true, false ); case OBJECTTYPE_UNKNOWN: break; + default: + break; } return 0; diff --git a/chart2/source/controller/accessibility/makefile.mk b/chart2/source/controller/accessibility/makefile.mk index e79019ba8602..44c816d90d0e 100644 --- a/chart2/source/controller/accessibility/makefile.mk +++ b/chart2/source/controller/accessibility/makefile.mk @@ -44,7 +44,9 @@ SLOFILES= $(SLO)$/AccessibleChartView.obj \ $(SLO)$/ChartElementFactory.obj \ $(SLO)$/AccessibleBase.obj \ $(SLO)$/AccessibleChartElement.obj \ - $(SLO)$/AccessibleTextHelper.obj + $(SLO)$/AccessibleChartShape.obj \ + $(SLO)$/AccessibleTextHelper.obj \ + $(SLO)$/AccessibleViewForwarder.obj # --- Targets ----------------------------------------------------------------- diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 138a54a43036..da0c9b4e8167 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -54,6 +54,7 @@ #include "WrappedAddInProperty.hxx" #include "WrappedIgnoreProperty.hxx" #include "ChartRenderer.hxx" +#include "UndoManager.hxx" #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> @@ -1489,6 +1490,12 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( xResult.set( m_xChartView ); bServiceFound = true; } + else if ( aServiceSpecifier.equals( CHART_UNDOMANAGER_SERVICE_NAME ) ) + { + Reference< chart2::XUndoManager > xUndoManager( new UndoManager() ); + xResult.set( xUndoManager ); + bServiceFound = true; + } else { // try to create a shape diff --git a/chart2/source/controller/dialogs/ResourceIds.hrc b/chart2/source/controller/dialogs/ResourceIds.hrc index 02edc1a6bd96..2ab544c77ab1 100644 --- a/chart2/source/controller/dialogs/ResourceIds.hrc +++ b/chart2/source/controller/dialogs/ResourceIds.hrc @@ -48,6 +48,8 @@ #define DLG_SPLINE_PROPERTIES 904 #define DLG_DATA_TRENDLINE 841 #define DLG_DATA_YERRORBAR 842 +#define DLG_SHAPE_FONT 921 +#define DLG_SHAPE_PARAGRAPH 922 //----------------------------------------------------------------------------- //TabPage Ids: diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index 2d6fd9c04a66..4b4cec65426e 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -348,6 +348,11 @@ String STR_OBJECT_DIAGRAM_FLOOR Text [ en-US ] = "Chart Floor" ; }; +String STR_OBJECT_SHAPE +{ + Text [ en-US ] = "Drawing Object" ; +}; + //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index ec5f102bdaab..285464dc90ff 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -488,6 +488,8 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, SchAlignmentTabPage::CreateWithoutRotation can be deleted. */ AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::CreateWithoutRotation, NULL); break; + default: + break; } // used to find out if user left the dialog with OK. When OK is pressed but diff --git a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx new file mode 100644 index 000000000000..280a1adecba2 --- /dev/null +++ b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 "dlg_ShapeFont.hxx" +#include "ViewElementListProvider.hxx" +#include "ResId.hxx" +#include "ResourceIds.hrc" + +#include <svl/intitem.hxx> +#include <sfx2/objsh.hxx> +#include <svx/dialogs.hrc> +#include <svx/flagsdef.hxx> +#include <editeng/flstitem.hxx> + +using ::com::sun::star::uno::Reference; +using namespace ::com::sun::star; + +//............................................................................. +namespace chart +{ +//............................................................................. + +ShapeFontDialog::ShapeFontDialog( Window* pParent, const SfxItemSet* pAttr, + const ViewElementListProvider* pViewElementListProvider ) + :SfxTabDialog( pParent, SchResId( DLG_SHAPE_FONT ), pAttr ) + ,m_pViewElementListProvider( pViewElementListProvider ) +{ + FreeResource(); + + AddTabPage( RID_SVXPAGE_CHAR_NAME ); + AddTabPage( RID_SVXPAGE_CHAR_EFFECTS ); + AddTabPage( RID_SVXPAGE_CHAR_POSITION ); +} + +ShapeFontDialog::~ShapeFontDialog() +{ +} + +void ShapeFontDialog::PageCreated( USHORT nId, SfxTabPage& rPage ) +{ + SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) ); + switch ( nId ) + { + case RID_SVXPAGE_CHAR_NAME: + { + aSet.Put( SvxFontListItem( m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST ) ); + rPage.PageCreated( aSet ); + } + break; + case RID_SVXPAGE_CHAR_EFFECTS: + { + aSet.Put( SfxUInt16Item( SID_DISABLE_CTL, DISABLE_CASEMAP ) ); + rPage.PageCreated( aSet ); + } + break; + default: + { + } + break; + } +} + +//............................................................................. +} //namespace chart +//............................................................................. diff --git a/chart2/source/controller/dialogs/dlg_ShapeFont.src b/chart2/source/controller/dialogs/dlg_ShapeFont.src new file mode 100644 index 000000000000..2065bd940988 --- /dev/null +++ b/chart2/source/controller/dialogs/dlg_ShapeFont.src @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +#include "ResourceIds.hrc" +#include <svx/dialogs.hrc> + +TabDialog DLG_SHAPE_FONT +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Character" ; + Moveable = TRUE ; + Closeable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_CHAR_NAME ; + Text [ en-US ] = "Font"; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_EFFECTS ; + Text [ en-US ] = "Font Effects"; + }; + PageItem + { + Identifier = RID_SVXPAGE_CHAR_POSITION ; + Text [ en-US ] = "Font Position"; + }; + }; + }; +}; diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx new file mode 100644 index 000000000000..2f0173fc8408 --- /dev/null +++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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 "dlg_ShapeParagraph.hxx" +#include "ResId.hxx" +#include "ResourceIds.hrc" + +#include <svl/cjkoptions.hxx> +#include <svl/intitem.hxx> +#include <svx/dialogs.hrc> +#include <svx/flagsdef.hxx> + +using ::com::sun::star::uno::Reference; +using namespace ::com::sun::star; + +//............................................................................. +namespace chart +{ +//............................................................................. + +ShapeParagraphDialog::ShapeParagraphDialog( Window* pParent, const SfxItemSet* pAttr ) + :SfxTabDialog( pParent, SchResId( DLG_SHAPE_PARAGRAPH ), pAttr ) +{ + FreeResource(); + + SvtCJKOptions aCJKOptions; + + AddTabPage( RID_SVXPAGE_STD_PARAGRAPH ); + AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH ); + if ( aCJKOptions.IsAsianTypographyEnabled() ) + { + AddTabPage( RID_SVXPAGE_PARA_ASIAN ); + } + else + { + RemoveTabPage( RID_SVXPAGE_PARA_ASIAN ); + } + AddTabPage( RID_SVXPAGE_TABULATOR ); +} + +ShapeParagraphDialog::~ShapeParagraphDialog() +{ +} + +void ShapeParagraphDialog::PageCreated( USHORT nId, SfxTabPage& rPage ) +{ + SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) ); + switch ( nId ) + { + case RID_SVXPAGE_TABULATOR: + { + aSet.Put( SfxUInt16Item( SID_SVXTABULATORTABPAGE_CONTROLFLAGS, + ( TABTYPE_ALL &~TABTYPE_LEFT ) | ( TABFILL_ALL &~TABFILL_NONE ) ) ); + rPage.PageCreated( aSet ); + } + break; + default: + { + } + break; + } +} + +//............................................................................. +} //namespace chart +//............................................................................. diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.src b/chart2/source/controller/dialogs/dlg_ShapeParagraph.src new file mode 100644 index 000000000000..ff74fc1eef80 --- /dev/null +++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.src @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +#include "ResourceIds.hrc" +#include <svx/dialogs.hrc> + +TabDialog DLG_SHAPE_PARAGRAPH +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 289 , 176 ) ; + Text [ en-US ] = "Paragraph" ; + Moveable = TRUE ; + Closeable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 3 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = RID_SVXPAGE_STD_PARAGRAPH ; + Text [ en-US ] = "Indents & Spacing"; + }; + PageItem + { + Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ; + Text [ en-US ] = "Alignment"; + }; + PageItem + { + Identifier = RID_SVXPAGE_PARA_ASIAN ; + Text [ en-US ] = "Asian Typography"; + }; + PageItem + { + Identifier = RID_SVXPAGE_TABULATOR ; + Text [ en-US ] = "Tab"; + }; + }; + }; +}; diff --git a/chart2/source/controller/dialogs/makefile.mk b/chart2/source/controller/dialogs/makefile.mk index 955c1764b5aa..d22f5c83b081 100644 --- a/chart2/source/controller/dialogs/makefile.mk +++ b/chart2/source/controller/dialogs/makefile.mk @@ -98,6 +98,8 @@ SLOFILES= \ $(SLO)$/dlg_ChartType_UNO.obj \ $(SLO)$/dlg_ChartType.obj \ $(SLO)$/dlg_NumberFormat.obj \ + $(SLO)$/dlg_ShapeFont.obj \ + $(SLO)$/dlg_ShapeParagraph.obj \ $(SLO)$/RangeSelectionButton.obj \ $(SLO)$/RangeSelectionHelper.obj \ $(SLO)$/RangeSelectionListener.obj \ @@ -150,7 +152,9 @@ SRC1FILES= \ dlg_InsertErrorBars.src \ dlg_InsertTitle.src \ dlg_ChartType.src \ - dlg_CreationWizard.src + dlg_CreationWizard.src \ + dlg_ShapeFont.src \ + dlg_ShapeParagraph.src SRS1NAME=$(TARGET) diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index 299cd9efe859..fbcca6a26bde 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -31,6 +31,8 @@ #include "chartview/DrawModelWrapper.hxx" #include "ConfigurationAccess.hxx" +#include <unotools/lingucfg.hxx> +#include <editeng/langitem.hxx> // header for class SdrPage #include <svx/svdpage.hxx> //header for class SdrPageView @@ -51,6 +53,7 @@ // header for class SvxShape #include <svx/unoshape.hxx> +#include <editeng/fhgtitem.hxx> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -162,6 +165,24 @@ DrawViewWrapper::DrawViewWrapper( SdrModel* pSdrModel, OutputDevice* pOut, bool SetPagePaintingAllowed(bPaintPageForEditMode); + // #i12587# support for shapes in chart + SdrOutliner* pOutliner = getOutliner(); + SfxItemPool* pOutlinerPool = ( pOutliner ? pOutliner->GetEditTextObjectPool() : NULL ); + if ( pOutlinerPool ) + { + SvtLinguConfig aLinguConfig; + SvtLinguOptions aLinguOptions; + if ( aLinguConfig.GetOptions( aLinguOptions ) ) + { + pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ) ); + pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ) ); + pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ) ); + } + + // set font height without changing SdrEngineDefaults + pOutlinerPool->SetPoolDefaultItem( SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT ) ); // 12pt + } + ReInit(); } diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx index 46d63927a9d7..ea52a29c614b 100644 --- a/chart2/source/controller/inc/AccessibleBase.hxx +++ b/chart2/source/controller/inc/AccessibleBase.hxx @@ -27,6 +27,8 @@ #ifndef _CHART2_ACCESSIBLEBASE_HXX_ #define _CHART2_ACCESSIBLEBASE_HXX_ +#include "ObjectIdentifier.hxx" + #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> @@ -50,6 +52,12 @@ class SfxItemSet; class SdrObject; +class SdrView; + +namespace accessibility +{ +class IAccessibleViewForwarder; +} namespace chart { @@ -57,11 +65,11 @@ namespace chart class AccessibleBase; class ObjectHierarchy; -typedef rtl::OUString AccessibleUniqueId; +typedef ObjectIdentifier AccessibleUniqueId; struct AccessibleElementInfo { - AccessibleUniqueId m_aCID; + AccessibleUniqueId m_aOID; ::com::sun::star::uno::WeakReference< ::com::sun::star::chart2::XChartDocument > m_xChartDocument; @@ -75,6 +83,8 @@ struct AccessibleElementInfo ::boost::shared_ptr< ObjectHierarchy > m_spObjectHierarchy; AccessibleBase * m_pParent; + SdrView* m_pSdrView; + ::accessibility::IAccessibleViewForwarder* m_pViewForwarder; }; @@ -173,7 +183,7 @@ protected: greater than the index of the removed element get an index one less than before. */ - void RemoveChildById( const ::rtl::OUString & rId ); + void RemoveChildByOId( const ObjectIdentifier& rOId ); /** Retrieve the pixel coordinates of logical coordinates (0,0) of the current logic coordinate system. This can be used for @@ -325,14 +335,14 @@ private: /** type of the hash containing a vector index for every AccessibleUniqueId of the object in the child list */ - typedef ::std::map< ::rtl::OUString, tAccessible > ChildCIDMap; + typedef ::std::map< ObjectIdentifier, tAccessible > ChildOIDMap; bool m_bIsDisposed; const bool m_bMayHaveChildren; bool m_bChildrenInitialized; ChildListVectorType m_aChildList; - ChildCIDMap m_aChildCIDMap; + ChildOIDMap m_aChildOIDMap; ::comphelper::AccessibleEventNotifier::TClientId m_nEventNotifierId; diff --git a/chart2/source/controller/inc/AccessibleChartView.hxx b/chart2/source/controller/inc/AccessibleChartView.hxx index 435871dbf55a..2cc46825a5aa 100644 --- a/chart2/source/controller/inc/AccessibleChartView.hxx +++ b/chart2/source/controller/inc/AccessibleChartView.hxx @@ -44,13 +44,17 @@ #include <boost/shared_ptr.hpp> +namespace accessibility +{ +class IAccessibleViewForwarder; +} + //............................................................................. namespace chart { //............................................................................. class ExplicitValueProvider; -class ObjectHierarchy; namespace impl { @@ -67,14 +71,9 @@ class AccessibleChartView : public: AccessibleChartView( const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > & xContext ); + ::com::sun::star::uno::XComponentContext >& xContext, SdrView* pView ); virtual ~AccessibleChartView(); - // ____ lang::XServiceInfo ____ - APPHELPER_XSERVICEINFO_DECL() - APPHELPER_SERVICE_FACTORY_HELPER( AccessibleChartView ) - -protected: // ____ WeakComponentHelper (called from XComponent::dispose()) ____ virtual void SAL_CALL disposing(); @@ -112,6 +111,7 @@ protected: virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException); +protected: // ________ AccessibleChartElement ________ virtual ::com::sun::star::awt::Point GetUpperLeftOnScreen() const; @@ -141,7 +141,9 @@ private: // members ::com::sun::star::accessibility::XAccessible > m_xParent; ::boost::shared_ptr< ObjectHierarchy > m_spObjectHierarchy; - AccessibleUniqueId m_aCurrentSelectionCID; + AccessibleUniqueId m_aCurrentSelectionOID; + SdrView* m_pSdrView; + ::accessibility::IAccessibleViewForwarder* m_pViewForwarder; //no default constructor AccessibleChartView(); diff --git a/chart2/source/controller/inc/MenuResIds.hrc b/chart2/source/controller/inc/MenuResIds.hrc new file mode 100644 index 000000000000..38a09ad35ded --- /dev/null +++ b/chart2/source/controller/inc/MenuResIds.hrc @@ -0,0 +1,41 @@ +/************************************************************************* + * + * 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_MENURESIDS_HRC +#define CHART_MENURESIDS_HRC + +#ifndef _SOLAR_HRC +#include <svl/solar.hrc> +#endif + +//----------------------------------------------------------------------------- +// context menus + +#define RID_CONTEXTMENU_SHAPE (RID_APP_START + 1) +#define RID_CONTEXTMENU_SHAPEEDIT (RID_APP_START + 2) + +// CHART_MENURESIDS_HRC +#endif diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx index f012fb500416..857b576fe6ef 100644 --- a/chart2/source/controller/inc/ObjectHierarchy.hxx +++ b/chart2/source/controller/inc/ObjectHierarchy.hxx @@ -27,6 +27,8 @@ #ifndef CHART2_OBJECTHIERARCHY_HXX #define CHART2_OBJECTHIERARCHY_HXX +#include "ObjectIdentifier.hxx" + #include <rtl/ustring.hxx> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/awt/KeyEvent.hpp> @@ -47,8 +49,8 @@ class ImplObjectHierarchy; class ObjectHierarchy { public: - typedef ::rtl::OUString tCID; - typedef ::std::vector< tCID > tChildContainer; + typedef ObjectIdentifier tOID; + typedef ::std::vector< tOID > tChildContainer; /** @param bFlattenDiagram If <TRUE/>, the content of the diaram (data series, wall, floor, @@ -63,20 +65,20 @@ public: bool bOrderingForElementSelector = false ); ~ObjectHierarchy(); - static tCID getRootNodeCID(); - static bool isRootNode( const tCID & rCID ); + static tOID getRootNodeOID(); + static bool isRootNode( const tOID& rOID ); - /// equal to getChildren( getRootNodeCID()) + /// equal to getChildren( getRootNodeOID()) tChildContainer getTopLevelChildren() const; - bool hasChildren( const tCID & rParent ) const; - tChildContainer getChildren( const tCID & rParent ) const; + bool hasChildren( const tOID& rParent ) const; + tChildContainer getChildren( const tOID& rParent ) const; - tChildContainer getSiblings( const tCID & rNode ) const; + tChildContainer getSiblings( const tOID& rNode ) const; /// The result is empty, if the node cannot be found in the tree - tCID getParent( const tCID & rNode ) const; + tOID getParent( const tOID& rNode ) const; /// @returns -1, if no parent can be determined - sal_Int32 getIndexInParent( const tCID & rNode ) const; + sal_Int32 getIndexInParent( const tOID& rNode ) const; private: @@ -86,16 +88,16 @@ private: class ObjectKeyNavigation { public: - explicit ObjectKeyNavigation( const ObjectHierarchy::tCID & rCurrentCID, + explicit ObjectKeyNavigation( const ObjectHierarchy::tOID & rCurrentOID, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDocument, ExplicitValueProvider * pExplicitValueProvider = 0 ); bool handleKeyEvent( const ::com::sun::star::awt::KeyEvent & rEvent ); - ObjectHierarchy::tCID getCurrentSelection() const; + ObjectHierarchy::tOID getCurrentSelection() const; private: - void setCurrentSelection( const ObjectHierarchy::tCID & rCID ); + void setCurrentSelection( const ObjectHierarchy::tOID& rOID ); bool first(); bool last(); bool next(); @@ -105,7 +107,7 @@ private: bool veryFirst(); bool veryLast(); - ObjectHierarchy::tCID m_aCurrentCID; + ObjectHierarchy::tOID m_aCurrentOID; ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartDocument; ExplicitValueProvider * m_pExplicitValueProvider; diff --git a/chart2/source/controller/inc/ShapeController.hrc b/chart2/source/controller/inc/ShapeController.hrc new file mode 100644 index 000000000000..6c7b43526d22 --- /dev/null +++ b/chart2/source/controller/inc/ShapeController.hrc @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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_SHAPECONTROLLER_HRC +#define CHART_SHAPECONTROLLER_HRC + +//----------------------------------------------------------------------------- +//Command Ids: +#define COMMAND_ID_FORMAT_LINE 1 +#define COMMAND_ID_FORMAT_AREA 2 +#define COMMAND_ID_TEXT_ATTRIBUTES 3 +#define COMMAND_ID_TRANSFORM_DIALOG 4 +#define COMMAND_ID_OBJECT_TITLE_DESCRIPTION 5 +#define COMMAND_ID_RENAME_OBJECT 6 +#define COMMAND_ID_ARRANGE_ROW 7 +#define COMMAND_ID_BRING_TO_FRONT 8 +#define COMMAND_ID_FORWARD 9 +#define COMMAND_ID_BACKWARD 10 +#define COMMAND_ID_SEND_TO_BACK 11 +#define COMMAND_ID_CUT 12 +#define COMMAND_ID_COPY 13 +#define COMMAND_ID_PASTE 14 +#define COMMAND_ID_FONT_DIALOG 15 +#define COMMAND_ID_PARAGRAPH_DIALOG 16 + +// CHART_SHAPECONTROLLER_HRC +#endif diff --git a/chart2/source/controller/inc/dlg_ShapeFont.hxx b/chart2/source/controller/inc/dlg_ShapeFont.hxx new file mode 100644 index 000000000000..ec1b6553bd64 --- /dev/null +++ b/chart2/source/controller/inc/dlg_ShapeFont.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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_DLG_SHAPEFONT_HXX +#define CHART2_DLG_SHAPEFONT_HXX + +#include <sfx2/tabdlg.hxx> + +//............................................................................. +namespace chart +{ +//............................................................................. + +class ViewElementListProvider; + +/** dialog for font properties of shapes + */ +class ShapeFontDialog : public SfxTabDialog +{ +public: + ShapeFontDialog( Window* pParent, const SfxItemSet* pAttr, + const ViewElementListProvider* pViewElementListProvider ); + virtual ~ShapeFontDialog(); + +private: + virtual void PageCreated( USHORT nId, SfxTabPage& rPage ); + + const ViewElementListProvider* m_pViewElementListProvider; +}; + +//............................................................................. +} // namespace chart +//............................................................................. + +// CHART2_DLG_SHAPEFONT_HXX +#endif diff --git a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx new file mode 100644 index 000000000000..2bc57bfcffc2 --- /dev/null +++ b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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_DLG_SHAPEPARAGRAPH_HXX +#define CHART2_DLG_SHAPEPARAGRAPH_HXX + +#include <sfx2/tabdlg.hxx> + +//............................................................................. +namespace chart +{ +//............................................................................. + +/** dialog for paragraph properties of shapes + */ +class ShapeParagraphDialog : public SfxTabDialog +{ +public: + ShapeParagraphDialog( Window* pParent, const SfxItemSet* pAttr ); + virtual ~ShapeParagraphDialog(); + +private: + virtual void PageCreated( USHORT nId, SfxTabPage& rPage ); +}; + +//............................................................................. +} // namespace chart +//............................................................................. + +// CHART2_DLG_SHAPEPARAGRAPH_HXX +#endif diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index c2202b031a17..4c0c7dc38ae3 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -50,6 +50,10 @@ #include "dlg_CreationWizard.hxx" #include "dlg_ChartType.hxx" //#include "svx/ActionDescriptionProvider.hxx" +#include "AccessibleChartView.hxx" +#include "DrawCommandDispatch.hxx" +#include "ShapeController.hxx" +#include "UndoManager.hxx" #include <comphelper/InlineContainer.hxx> @@ -97,6 +101,7 @@ namespace chart //............................................................................. using namespace ::com::sun::star; +using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Reference; @@ -124,7 +129,8 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const & , m_bWaitingForMouseUp(false) , m_bConnectingToView(false) , m_xUndoManager( 0 ) - , m_aDispatchContainer( m_xCC ) + , m_aDispatchContainer( m_xCC, this ) + , m_eDrawMode( CHARTDRAW_SELECT ) { DBG_CTOR(ChartController,NULL); // m_aDispatchContainer.setUndoManager( m_xUndoManager ); @@ -438,6 +444,11 @@ APPHELPER_XSERVICEINFO_IMPL(ChartController,CHART_CONTROLLER_SERVICE_IMPLEMENTAT //@todo: createElement should become unnecessary, remove when #i79198# is fixed xLayoutManager->createElement( C2U( "private:resource/toolbar/toolbar" ) ); xLayoutManager->requestElement( C2U( "private:resource/toolbar/toolbar" ) ); + + // #i12587# support for shapes in chart + xLayoutManager->createElement( C2U( "private:resource/toolbar/drawbar" ) ); + xLayoutManager->requestElement( C2U( "private:resource/toolbar/drawbar" ) ); + xLayoutManager->requestElement( C2U( "private:resource/statusbar/statusbar" ) ); xLayoutManager->unlock(); @@ -559,13 +570,27 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent // set new model at dispatchers m_aDispatchContainer.setModel( aNewModelRef->getModel()); - ControllerCommandDispatch * pDispatch = new ControllerCommandDispatch( m_xCC, this ); + ControllerCommandDispatch * pDispatch = new ControllerCommandDispatch( m_xCC, this, &m_aDispatchContainer ); pDispatch->initialize(); // the dispatch container will return "this" for all commands returned by // impl_getAvailableCommands(). That means, for those commands dispatch() // is called here at the ChartController. - m_aDispatchContainer.setFallbackDispatch( pDispatch, impl_getAvailableCommands() ); + m_aDispatchContainer.setChartDispatch( pDispatch, impl_getAvailableCommands() ); + + DrawCommandDispatch* pDrawDispatch = new DrawCommandDispatch( m_xCC, this ); + if ( pDrawDispatch ) + { + pDrawDispatch->initialize(); + m_aDispatchContainer.setDrawCommandDispatch( pDrawDispatch ); + } + + ShapeController* pShapeController = new ShapeController( m_xCC, this ); + if ( pShapeController ) + { + pShapeController->initialize(); + m_aDispatchContainer.setShapeController( pShapeController ); + } #ifdef TEST_ENABLE_MODIFY_LISTENER uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aNewModelRef->getModel(),uno::UNO_QUERY ); @@ -1061,7 +1086,7 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) void SAL_CALL ChartController ::dispatch( const util::URL& rURL - , const uno::Sequence< beans::PropertyValue >& /* rArgs */ ) + , const uno::Sequence< beans::PropertyValue >& rArgs ) throw (uno::RuntimeException) { //@todo avoid OString (see Mathias mail on bug #104387#) @@ -1161,7 +1186,16 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) else if( aCommand.equals("FormatSelection") ) this->executeDispatch_ObjectProperties(); else if( aCommand.equals("TransformDialog")) - this->executeDispatch_PositionAndSize(); + { + if ( isShapeContext() ) + { + this->impl_ShapeControllerDispatch( rURL, rArgs ); + } + else + { + this->executeDispatch_PositionAndSize(); + } + } else if( lcl_isFormatObjectCommand(aCommand) ) this->executeDispatch_FormatObject(rURL.Path); //more format @@ -1171,10 +1205,28 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) this->executeDispatch_ChartType(); else if( aCommand.equals("View3D")) this->executeDispatch_View3D(); - else if( aCommand.equals("Forward")) - this->executeDispatch_MoveSeries( sal_True ); - else if( aCommand.equals("Backward")) - this->executeDispatch_MoveSeries( sal_False ); + else if ( aCommand.equals( "Forward" ) ) + { + if ( isShapeContext() ) + { + this->impl_ShapeControllerDispatch( rURL, rArgs ); + } + else + { + this->executeDispatch_MoveSeries( sal_True ); + } + } + else if ( aCommand.equals( "Backward" ) ) + { + if ( isShapeContext() ) + { + this->impl_ShapeControllerDispatch( rURL, rArgs ); + } + else + { + this->executeDispatch_MoveSeries( sal_False ); + } + } else if( aCommand.equals("NewArrangement")) this->executeDispatch_NewArrangement(); else if( aCommand.equals("ToggleLegend")) @@ -1390,6 +1442,20 @@ void SAL_CALL ChartController::modified( const lang::EventObject& /* aEvent */ ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +IMPL_LINK( ChartController, NotifyUndoActionHdl, SdrUndoAction*, pUndoAction ) +{ + ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID(); + if ( aObjectCID.getLength() == 0 ) + { + UndoManager* pUndoManager = UndoManager::getImplementation( m_xUndoManager ); + if ( pUndoManager ) + { + pUndoManager->addShapeUndoAction( pUndoAction ); + } + } + return 0L; +} + DrawModelWrapper* ChartController::GetDrawModelWrapper() { if( !m_pDrawModelWrapper.get() ) @@ -1397,16 +1463,26 @@ DrawModelWrapper* ChartController::GetDrawModelWrapper() ExplicitValueProvider* pProvider = ExplicitValueProvider::getExplicitValueProvider( m_xChartView ); if( pProvider ) m_pDrawModelWrapper = pProvider->getDrawModelWrapper(); + if ( m_pDrawModelWrapper.get() ) + { + m_pDrawModelWrapper->getSdrModel().SetNotifyUndoActionHdl( LINK( this, ChartController, NotifyUndoActionHdl ) ); + } } return m_pDrawModelWrapper.get(); } -uno::Reference< accessibility::XAccessible > ChartController::CreateAccessible() +DrawViewWrapper* ChartController::GetDrawViewWrapper() { - uno::Reference< accessibility::XAccessible > xResult( - m_xCC->getServiceManager()->createInstanceWithContext( - CHART2_ACCESSIBLE_SERVICE_NAME, m_xCC ), uno::UNO_QUERY ); + if ( !m_pDrawViewWrapper ) + { + impl_createDrawViewController(); + } + return m_pDrawViewWrapper; +} +uno::Reference< XAccessible > ChartController::CreateAccessible() +{ + uno::Reference< XAccessible > xResult = new AccessibleChartView( m_xCC, GetDrawViewWrapper() ); impl_initializeAccessible( uno::Reference< lang::XInitialization >( xResult, uno::UNO_QUERY ) ); return xResult; } @@ -1438,7 +1514,7 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn uno::Reference<frame::XModel> xModel(m_aModel->getModel()); aArguments[1]=uno::makeAny(xModel); aArguments[2]=uno::makeAny(m_xChartView); - uno::Reference< accessibility::XAccessible > xParent; + uno::Reference< XAccessible > xParent; if( m_pChartWindow ) { Window* pParentWin( m_pChartWindow->GetAccessibleParentWindow()); diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 130e40cb6828..8deffe47396f 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -57,6 +57,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/util/XModeChangeListener.hpp> +#include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XLayoutManagerListener.hpp> @@ -88,6 +89,8 @@ namespace chart { //............................................................................. +enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT }; + class WindowController { public: @@ -155,6 +158,9 @@ class ChartController : public ::cppu::WeakImplHelper12 < > , public WindowController { + friend class DrawCommandDispatch; + friend class ShapeController; + public: //no default constructor ChartController(::com::sun::star::uno::Reference< @@ -463,6 +469,13 @@ public: static bool isObjectDeleteable( const ::com::sun::star::uno::Any& rSelection ); + void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; } + ChartDrawMode getDrawMode() const { return m_eDrawMode; } + + bool isShapeContext() const; + + DECL_LINK( NotifyUndoActionHdl, SdrUndoAction* ); + public: //----------------------------------------------------------------- //----------------------------------------------------------------- @@ -477,6 +490,7 @@ public: private: DrawModelWrapper* GetDrawModelWrapper(); + DrawViewWrapper* GetDrawViewWrapper(); private: class TheModelRef; @@ -577,6 +591,8 @@ private: ::com::sun::star::frame::XLayoutManagerEventBroadcaster > m_xLayoutManagerEventBroadcaster; + ChartDrawMode m_eDrawMode; + private: //private methods @@ -637,11 +653,11 @@ private: void executeDispatch_DeleteMinorGrid(); void SAL_CALL executeDispatch_InsertSpecialCharacter(); - void SAL_CALL executeDispatch_EditText(); + void SAL_CALL executeDispatch_EditText( const Point* pMousePixel = NULL ); void SAL_CALL executeDispatch_SourceData(); void SAL_CALL executeDispatch_MoveSeries( sal_Bool bForward ); - void StartTextEdit(); + void StartTextEdit( const Point* pMousePixel = NULL ); bool EndTextEdit(); void SAL_CALL executeDispatch_View3D(); @@ -659,9 +675,12 @@ private: void executeDispatch_ToggleLegend(); void executeDispatch_ToggleGridHorizontal(); + void impl_ShapeControllerDispatch( const ::com::sun::star::util::URL& rURL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + // DECL_LINK( DoubleClickWaitingHdl, void* ); - void execute_DoubleClick(); + void execute_DoubleClick( const Point* pMousePixel = NULL ); void startDoubleClickWaiting(); void stopDoubleClickWaiting(); @@ -701,6 +720,8 @@ private: void impl_PasteGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > & xGraphic, const ::Point & aPosition ); + void impl_PasteShapes( SdrModel* pModel ); + void impl_PasteStringAsTextShape( const ::rtl::OUString& rString, const ::com::sun::star::awt::Point& rPosition ); void impl_SetMousePointer( const MouseEvent & rEvent ); void impl_ClearSelection(); diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index 4778f67f7bde..4df362ee80d2 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -64,15 +64,15 @@ using namespace ::com::sun::star; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void SAL_CALL ChartController::executeDispatch_EditText() +void SAL_CALL ChartController::executeDispatch_EditText( const Point* pMousePixel ) { - this->StartTextEdit(); + this->StartTextEdit( pMousePixel ); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void ChartController::StartTextEdit() +void ChartController::StartTextEdit( const Point* pMousePixel ) { //the first marked object will be edited @@ -111,6 +111,18 @@ void ChartController::StartTextEdit() */ m_pDrawViewWrapper->SetEditMode(); + // #i12587# support for shapes in chart + if ( pMousePixel ) + { + OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); + if ( pOutlinerView ) + { + MouseEvent aEditEvt( *pMousePixel, 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 ); + pOutlinerView->MouseButtonDown( aEditEvt ); + pOutlinerView->MouseButtonUp( aEditEvt ); + } + } + //we invalidate the outliner region because the outliner has some //paint problems (some characters are painted twice a little bit shifted) m_pChartWindow->Invalidate( m_pDrawViewWrapper->GetMarkedObjBoundRect() ); @@ -139,22 +151,38 @@ bool ChartController::EndTextEdit() String aString = pOutliner->GetText( pOutliner->GetParagraph( 0 ), pOutliner->GetParagraphCount() ); - uno::Reference< beans::XPropertySet > xPropSet = - ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ); - - // lock controllers till end of block - ControllerLockGuard aCLGuard( m_aModel->getModel()); - //Paragraph* pPara = - TitleHelper::setCompleteString( aString, uno::Reference< - ::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC ); - try + ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID(); + if ( aObjectCID.getLength() > 0 ) { - m_xUndoManager->postAction( C2U("Edit Text") ); + uno::Reference< beans::XPropertySet > xPropSet = + ObjectIdentifier::getObjectPropertySet( aObjectCID, getModel() ); + + // lock controllers till end of block + ControllerLockGuard aCLGuard( m_aModel->getModel()); + + TitleHelper::setCompleteString( aString, uno::Reference< + ::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC ); + + try + { + m_xUndoManager->postAction( C2U("Edit Text") ); + } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } } - catch( uno::RuntimeException& e) + else { - ASSERT_EXCEPTION( e ); + try + { + m_xUndoManager->cancelAction(); + } + catch ( uno::RuntimeException& e ) + { + ASSERT_EXCEPTION( e ); + } } } return true; diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 9edd2963aca4..352a7e1279cc 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -48,6 +48,7 @@ #include "LegendHelper.hxx" #include "AxisHelper.hxx" #include "RegressionCurveHelper.hxx" +#include "ShapeController.hxx" #include <com/sun/star/chart2/DataPointLabel.hpp> #include <com/sun/star/beans/XPropertyState.hpp> @@ -59,8 +60,6 @@ #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> -// #include <com/sun/star/drawing/XDrawPageSupplier.hpp> - #include <svx/ActionDescriptionProvider.hxx> // for TransferableDataHelper/TransferableHelper #include <svtools/transfer.hxx> @@ -77,8 +76,17 @@ // for SolarMutex #include <vcl/svapp.hxx> #include <vos/mutex.hxx> +#include <svx/dialmgr.hxx> +#include <svx/dialogs.hrc> // for OutlinerView #include <editeng/outliner.hxx> +#include <svx/svditer.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdundo.hxx> +#include <svx/unoapi.hxx> +#include <svx/unopage.hxx> + +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; @@ -184,50 +192,6 @@ bool lcl_deleteDataCurve( } // anonymous namespace -namespace -{ -void lcl_InsertStringAsTextShapeIntoDrawPage( - const Reference< lang::XMultiServiceFactory > & xShapeFactory, - const Reference< drawing::XDrawPage > & xDrawPage, - OUString & rString, - const awt::Point & aPosition ) -{ - OSL_ASSERT( xShapeFactory.is() && xDrawPage.is()); - if( ! (xShapeFactory.is() && xDrawPage.is())) - return; - - try - { - Reference< drawing::XShape > xTextShape( - xShapeFactory->createInstance( C2U("com.sun.star.drawing.TextShape")), uno::UNO_QUERY_THROW ); - xDrawPage->add( xTextShape ); - - Reference< text::XTextRange > xRange( xTextShape, uno::UNO_QUERY_THROW ); - xRange->setString( rString ); - - float fCharHeight = 10.0; - Reference< beans::XPropertySet > xProperties( xTextShape, uno::UNO_QUERY_THROW ); - xProperties->setPropertyValue( C2U("TextAutoGrowHeight"), uno::makeAny( true )); - xProperties->setPropertyValue( C2U("TextAutoGrowWidth"), uno::makeAny( true )); - xProperties->setPropertyValue( C2U("CharHeight"), uno::makeAny( fCharHeight )); - xProperties->setPropertyValue( C2U("CharHeightAsian"), uno::makeAny( fCharHeight )); - xProperties->setPropertyValue( C2U("CharHeightComplex"), uno::makeAny( fCharHeight )); - xProperties->setPropertyValue( C2U("TextVerticalAdjust"), uno::makeAny( drawing::TextVerticalAdjust_CENTER )); - xProperties->setPropertyValue( C2U("TextHorizontalAdjust"), uno::makeAny( drawing::TextHorizontalAdjust_CENTER )); - xProperties->setPropertyValue( C2U("CharFontName"), uno::makeAny( C2U( "Albany" ))); - - awt::Point aAdaptedPos( aPosition ); - aAdaptedPos.Y -= (xTextShape->getSize().Height / 2); - aAdaptedPos.X -= (xTextShape->getSize().Width / 2); - xTextShape->setPosition( aAdaptedPos ); - } - catch( const uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } -} - -} // anonymous namespace namespace chart { @@ -334,22 +298,21 @@ void ChartController::executeDispatch_Paste() TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( m_pChartWindow )); if( aDataHelper.GetTransferable().is()) { -// if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING )) -// { -// SotStorageStreamRef xStm; -// if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStm )) -// { -// xStm->Seek( 0 ); -// uno::Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm )); -// SdrModel * pModel = new SdrModel(); -// DrawModelWrapper * pDrawModelWrapper( this->GetDrawModelWrapper()); -// if( SvxDrawingLayerImport( pModel, xInputStream )) -// lcl_CopyShapesToChart( *pModel, m_pDrawModelWrapper->getSdrModel()); -// delete pModel; -// } -// } -// else - if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB )) + if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) ) + { + SotStorageStreamRef xStm; + if ( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStm ) ) + { + xStm->Seek( 0 ); + Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) ); + ::boost::scoped_ptr< SdrModel > spModel( new SdrModel() ); + if ( SvxDrawingLayerImport( spModel.get(), xInputStream ) ) + { + impl_PasteShapes( spModel.get() ); + } + } + } + else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ) ) { // graphic exchange format (graphic manager bitmap format?) SotStorageStreamRef xStm; @@ -382,14 +345,7 @@ void ChartController::executeDispatch_Paste() pOutlinerView->InsertText( aString ); else { - awt::Point aTextPos; - awt::Size aPageSize( ChartModelHelper::getPageSize( m_aModel->getModel())); - aTextPos.X = (aPageSize.Width / 2); - aTextPos.Y = (aPageSize.Height / 2); - lcl_InsertStringAsTextShapeIntoDrawPage( - m_pDrawModelWrapper->getShapeFactory(), - m_pDrawModelWrapper->getMainDrawPage(), - aString, aTextPos ); + impl_PasteStringAsTextShape( aString, awt::Point( 0, 0 ) ); } } } @@ -441,7 +397,6 @@ void ChartController::impl_PasteGraphic( uno::Reference< beans::XPropertySet > xGraphicProp( xGraphic, uno::UNO_QUERY ); awt::Size aGraphicSize( 1000, 1000 ); - awt::Point aShapePos( 100,100 ); // first try size in 100th mm, then pixel size if( ! ( xGraphicProp->getPropertyValue( C2U("Size100thMM")) >>= aGraphicSize ) && ( ( xGraphicProp->getPropertyValue( C2U("SizePixel")) >>= aGraphicSize ) && m_pChartWindow )) @@ -451,41 +406,158 @@ void ChartController::impl_PasteGraphic( aGraphicSize.Height = aVCLSize.getHeight(); } xGraphicShape->setSize( aGraphicSize ); - - awt::Size aPageSize( ChartModelHelper::getPageSize( m_aModel->getModel())); - aShapePos.X = (aPageSize.Width / 2) - (aGraphicSize.Width / 2); - aShapePos.Y = (aPageSize.Height / 2) - (aGraphicSize.Height / 2); - xGraphicShape->setPosition( aShapePos ); + xGraphicShape->setPosition( awt::Point( 0, 0 ) ); } } -void ChartController::executeDispatch_Copy() +void ChartController::impl_PasteShapes( SdrModel* pModel ) { + DrawModelWrapper* pDrawModelWrapper( this->GetDrawModelWrapper() ); + if ( pDrawModelWrapper && m_pDrawViewWrapper ) + { + Reference< drawing::XDrawPage > xDestPage( pDrawModelWrapper->getMainDrawPage() ); + SdrPage* pDestPage = GetSdrPageFromXDrawPage( xDestPage ); + if ( pDestPage ) + { + Reference< drawing::XShape > xSelShape; + m_pDrawViewWrapper->BegUndo( SVX_RESSTR( RID_SVX_3D_UNDO_EXCHANGE_PASTE ) ); + sal_uInt16 nCount = pModel->GetPageCount(); + for ( sal_uInt16 i = 0; i < nCount; ++i ) + { + const SdrPage* pPage = pModel->GetPage( i ); + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + while ( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + SdrObject* pNewObj = ( pObj ? pObj->Clone() : NULL ); + if ( pNewObj ) + { + pNewObj->SetModel( &pDrawModelWrapper->getSdrModel() ); + pNewObj->SetPage( pDestPage ); + + // set position + Reference< drawing::XShape > xShape( pNewObj->getUnoShape(), uno::UNO_QUERY ); + if ( xShape.is() ) + { + xShape->setPosition( awt::Point( 0, 0 ) ); + } + + pDestPage->InsertObject( pNewObj ); + m_pDrawViewWrapper->AddUndo( new SdrUndoInsertObj( *pNewObj ) ); + xSelShape = xShape; + } + } + } + + Reference< util::XModifiable > xModifiable( m_aModel->getModel(), uno::UNO_QUERY ); + if ( xModifiable.is() ) + { + xModifiable->setModified( true ); + } - Reference< datatransfer::XTransferable > xTransferable; + // select last inserted shape + m_aSelection.setSelection( xSelShape ); + m_aSelection.applySelection( m_pDrawViewWrapper ); + + m_pDrawViewWrapper->EndUndo(); + } + } +} +void ChartController::impl_PasteStringAsTextShape( const OUString& rString, const awt::Point& rPosition ) +{ + DrawModelWrapper* pDrawModelWrapper( this->GetDrawModelWrapper() ); + if ( pDrawModelWrapper && m_pDrawViewWrapper ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex()); - SdrObject * pSelectedObj = 0; - if( m_pDrawViewWrapper && m_pDrawModelWrapper ) - { - if( m_aSelection.getSelectedCID().getLength() ) - pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( m_aSelection.getSelectedCID() ); - else - pSelectedObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() ); + const Reference< lang::XMultiServiceFactory >& xShapeFactory( pDrawModelWrapper->getShapeFactory() ); + const Reference< drawing::XDrawPage >& xDrawPage( pDrawModelWrapper->getMainDrawPage() ); + OSL_ASSERT( xShapeFactory.is() && xDrawPage.is() ); - if( pSelectedObj ) + if ( xShapeFactory.is() && xDrawPage.is() ) + { + try { - xTransferable = Reference< datatransfer::XTransferable >( new ChartTransferable( - & m_pDrawModelWrapper->getSdrModel(), pSelectedObj )); + Reference< drawing::XShape > xTextShape( + xShapeFactory->createInstance( C2U( "com.sun.star.drawing.TextShape" ) ), uno::UNO_QUERY_THROW ); + xDrawPage->add( xTextShape ); + + Reference< text::XTextRange > xRange( xTextShape, uno::UNO_QUERY_THROW ); + xRange->setString( rString ); + + float fCharHeight = 10.0; + Reference< beans::XPropertySet > xProperties( xTextShape, uno::UNO_QUERY_THROW ); + xProperties->setPropertyValue( C2U( "TextAutoGrowHeight" ), uno::makeAny( true ) ); + xProperties->setPropertyValue( C2U( "TextAutoGrowWidth" ), uno::makeAny( true ) ); + xProperties->setPropertyValue( C2U( "CharHeight" ), uno::makeAny( fCharHeight ) ); + xProperties->setPropertyValue( C2U( "CharHeightAsian" ), uno::makeAny( fCharHeight ) ); + xProperties->setPropertyValue( C2U( "CharHeightComplex" ), uno::makeAny( fCharHeight ) ); + xProperties->setPropertyValue( C2U( "TextVerticalAdjust" ), uno::makeAny( drawing::TextVerticalAdjust_CENTER ) ); + xProperties->setPropertyValue( C2U( "TextHorizontalAdjust" ), uno::makeAny( drawing::TextHorizontalAdjust_CENTER ) ); + xProperties->setPropertyValue( C2U( "CharFontName" ), uno::makeAny( C2U( "Albany" ) ) ); + + xTextShape->setPosition( rPosition ); + + m_aSelection.setSelection( xTextShape ); + m_aSelection.applySelection( m_pDrawViewWrapper ); + + SdrObject* pObj = DrawViewWrapper::getSdrObject( xTextShape ); + if ( pObj ) + { + m_pDrawViewWrapper->BegUndo( SVX_RESSTR( RID_SVX_3D_UNDO_EXCHANGE_PASTE ) ); + m_pDrawViewWrapper->AddUndo( new SdrUndoInsertObj( *pObj ) ); + m_pDrawViewWrapper->EndUndo(); + } + } + catch ( const uno::Exception& ex ) + { + ASSERT_EXCEPTION( ex ); } } } - if( xTransferable.is() ) +} + +void ChartController::executeDispatch_Copy() +{ + if ( m_pDrawViewWrapper ) { - Reference< datatransfer::clipboard::XClipboard > xClipboard( TransferableHelper::GetSystemClipboard()); - if( xClipboard.is()) - xClipboard->setContents( xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >() ); + OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); + if ( pOutlinerView ) + { + pOutlinerView->Copy(); + } + else + { + Reference< datatransfer::XTransferable > xTransferable; + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SdrObject* pSelectedObj = 0; + if ( m_pDrawModelWrapper ) + { + ObjectIdentifier aSelOID( m_aSelection.getSelectedOID() ); + if ( aSelOID.isAutoGeneratedObject() ) + { + pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( aSelOID.getObjectCID() ); + } + else if ( aSelOID.isAdditionalShape() ) + { + pSelectedObj = DrawViewWrapper::getSdrObject( aSelOID.getAdditionalShape() ); + } + if ( pSelectedObj ) + { + xTransferable = Reference< datatransfer::XTransferable >( new ChartTransferable( + &m_pDrawModelWrapper->getSdrModel(), pSelectedObj, aSelOID.isAdditionalShape() ) ); + } + } + } + if ( xTransferable.is() ) + { + Reference< datatransfer::clipboard::XClipboard > xClipboard( TransferableHelper::GetSystemClipboard() ); + if ( xClipboard.is() ) + { + xClipboard->setContents( xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >() ); + } + } + } } } @@ -498,9 +570,10 @@ void ChartController::executeDispatch_Cut() //static bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) { - OUString aSelObjCID; - if( (rSelection >>= aSelObjCID) && aSelObjCID.getLength() > 0 ) + ObjectIdentifier aSelOID( rSelection ); + if ( aSelOID.isAutoGeneratedObject() ) { + OUString aSelObjCID( aSelOID.getObjectCID() ); ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID )); if( (OBJECTTYPE_TITLE == aObjectType) || (OBJECTTYPE_LEGEND == aObjectType) || (OBJECTTYPE_DATA_SERIES == aObjectType) ) @@ -513,6 +586,22 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) if( (OBJECTTYPE_DATA_LABELS == aObjectType) || (OBJECTTYPE_DATA_LABEL == aObjectType) ) return true; } + else if ( aSelOID.isAdditionalShape() ) + { + return true; + } + + return false; +} + +bool ChartController::isShapeContext() const +{ + if ( m_aSelection.isAdditionalShapeSelected() || + ( m_pDrawViewWrapper && m_pDrawViewWrapper->AreObjectsMarked() && + ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) ) ) + { + return true; + } return false; } @@ -779,4 +868,13 @@ void ChartController::executeDispatch_ToggleGridHorizontal() } } +void ChartController::impl_ShapeControllerDispatch( const util::URL& rURL, const Sequence< beans::PropertyValue >& rArgs ) +{ + Reference< frame::XDispatch > xDispatch( m_aDispatchContainer.getShapeController() ); + if ( xDispatch.is() ) + { + xDispatch->dispatch( rURL, rArgs ); + } +} + } // namespace chart diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index f66352d5870b..7822c8c1cc21 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -55,6 +55,8 @@ #include "AxisHelper.hxx" #include "LegendHelper.hxx" #include "servicenames_charttypes.hxx" +#include "MenuResIds.hrc" +#include "DrawCommandDispatch.hxx" #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/RelativeSize.hpp> @@ -623,7 +625,10 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) if( pDrawViewWrapper->IsTextEdit() ) { - if( pDrawViewWrapper->IsTextEditHit( aMPos, HITPIX) ) + SdrViewEvent aVEvt; + if ( pDrawViewWrapper->IsTextEditHit( aMPos, HITPIX ) || + // #i12587# support for shapes in chart + ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt ) == SDRHIT_MARKEDOBJECT ) ) { pDrawViewWrapper->MouseButtonDown(rMEvt,m_pChartWindow); return; @@ -652,6 +657,39 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) //only change selection if no selection handles are hit if( !pHitSelectionHdl ) { + // #i12587# support for shapes in chart + if ( m_eDrawMode == CHARTDRAW_INSERT && + ( !pDrawViewWrapper->IsMarkedHit( aMPos ) || !m_aSelection.isDragableObjectSelected() ) ) + { + if ( m_aSelection.hasSelection() ) + { + m_aSelection.clearSelection(); + } + if ( !pDrawViewWrapper->IsAction() ) + { + if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CAPTION ) + { + Size aCaptionSize( 2268, 1134 ); + pDrawViewWrapper->BegCreateCaptionObj( aMPos, aCaptionSize ); + } + else + { + pDrawViewWrapper->BegCreateObj( aMPos); + } + SdrObject* pObj = pDrawViewWrapper->GetCreateObj(); + DrawCommandDispatch* pDrawCommandDispatch = m_aDispatchContainer.getDrawCommandDispatch(); + if ( pObj && m_pDrawModelWrapper && pDrawCommandDispatch ) + { + SfxItemSet aSet( m_pDrawModelWrapper->GetItemPool() ); + pDrawCommandDispatch->setAttributes( pObj ); + pDrawCommandDispatch->setLineEnds( aSet ); + pObj->SetMergedItemSet( aSet ); + } + } + impl_SetMousePointer( rMEvt ); + return; + } + m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper , rMEvt.IsRight(), m_bWaitingForDoubleClick ); @@ -754,7 +792,38 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) return; } - if(pDrawViewWrapper->IsDragObj()) + // #i12587# support for shapes in chart + if ( m_eDrawMode == CHARTDRAW_INSERT && pDrawViewWrapper->IsCreateObj() ) + { + pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND ); + if ( pDrawViewWrapper->AreObjectsMarked() ) + { + if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) + { + executeDispatch_EditText(); + } + else + { + SdrObject* pObj = pDrawViewWrapper->getSelectedObject(); + if ( pObj ) + { + uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY ); + if ( xShape.is() ) + { + m_aSelection.setSelection( xShape ); + m_aSelection.applySelection( pDrawViewWrapper ); + } + } + } + } + else + { + m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper, rMEvt.IsRight(), m_bWaitingForDoubleClick ); + m_aSelection.applySelection( pDrawViewWrapper ); + setDrawMode( CHARTDRAW_SELECT ); + } + } + else if ( pDrawViewWrapper->IsDragObj() ) { bool bDraggingDone = false; SdrDragMethod* pDragMethod = pDrawViewWrapper->SdrView::GetDragMethod(); @@ -839,7 +908,11 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) m_aSelection.resetPossibleSelectionAfterSingleClickWasEnsured(); } else if( isDoubleClick(rMEvt) ) - execute_DoubleClick(); + { + // #i12587# support for shapes in chart + Point aMousePixel = rMEvt.GetPosPixel(); + execute_DoubleClick( &aMousePixel ); + } //@todo ForcePointer(&rMEvt); pWindow->ReleaseMouse(); @@ -854,13 +927,39 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) impl_notifySelectionChangeListeners(); } -void ChartController::execute_DoubleClick() +void ChartController::execute_DoubleClick( const Point* pMousePixel ) { - ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); - if( OBJECTTYPE_TITLE==eObjectType ) - executeDispatch_EditText(); + bool bEditText = false; + if ( m_aSelection.hasSelection() ) + { + ::rtl::OUString aCID( m_aSelection.getSelectedCID() ); + if ( aCID.getLength() ) + { + ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID ); + if ( OBJECTTYPE_TITLE == eObjectType ) + { + bEditText = true; + } + } + else + { + // #i12587# support for shapes in chart + SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() ); + if ( pObj && pObj->ISA( SdrTextObj ) ) + { + bEditText = true; + } + } + } + + if ( bEditText ) + { + executeDispatch_EditText( pMousePixel ); + } else + { executeDispatch_ObjectProperties(); + } } void ChartController::execute_Resize() @@ -907,272 +1006,288 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) impl_notifySelectionChangeListeners(); - // todo: the context menu should be specified by an xml file in uiconfig - uno::Reference< awt::XPopupMenu > xPopupMenu( - m_xCC->getServiceManager()->createInstanceWithContext( - C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY ); - uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY ); - if( xPopupMenu.is() && xMenuEx.is()) + if ( isShapeContext() ) + { + // #i12587# support for shapes in chart + PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ? + RID_CONTEXTMENU_SHAPEEDIT : RID_CONTEXTMENU_SHAPE ) ); + ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); + Point aPos( rCEvt.GetMousePosPixel() ); + if( !rCEvt.IsMouseEvent() ) + { + aPos = m_pChartWindow->GetPointerState().maPos; + } + aContextMenuHelper.completeAndExecute( aPos, aContextMenu ); + } + else { - sal_Int16 nUniqueId = 1; - ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); - Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_aModel->getModel() ); + // todo: the context menu should be specified by an xml file in uiconfig + uno::Reference< awt::XPopupMenu > xPopupMenu( + m_xCC->getServiceManager()->createInstanceWithContext( + C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY ); + uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY ); + if( xPopupMenu.is() && xMenuEx.is()) + { + sal_Int16 nUniqueId = 1; + ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); + Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_aModel->getModel() ); - OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, aFormatCommand ); + OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, aFormatCommand ); - //some commands for dataseries and points: - //----- - if( OBJECTTYPE_DATA_SERIES == eObjectType || OBJECTTYPE_DATA_POINT == eObjectType ) - { - bool bIsPoint = ( OBJECTTYPE_DATA_POINT == eObjectType ); - uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); - uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY ); - Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) ); - bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline ); - Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) ); - bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries, true ); - bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries ); - bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries ); - bool bHasDataLabelAtPoint = false; - sal_Int32 nPointIndex = -1; - if( bIsPoint ) + //some commands for dataseries and points: + //----- + if( OBJECTTYPE_DATA_SERIES == eObjectType || OBJECTTYPE_DATA_POINT == eObjectType ) { - nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() ); - bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex ); - } - bool bSelectedPointIsFormatted = false; - bool bHasFormattedDataPointsOtherThanSelected = false; + bool bIsPoint = ( OBJECTTYPE_DATA_POINT == eObjectType ); + uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY ); + Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) ); + bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline ); + Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) ); + bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries, true ); + bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries ); + bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries ); + bool bHasDataLabelAtPoint = false; + sal_Int32 nPointIndex = -1; + if( bIsPoint ) + { + nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() ); + bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex ); + } + bool bSelectedPointIsFormatted = false; + bool bHasFormattedDataPointsOtherThanSelected = false; - Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY ); - if( xSeriesProperties.is() ) - { - uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) + Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY ); + if( xSeriesProperties.is() ) { - if( aAttributedDataPointIndexList.hasElements() ) + uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; + if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) { - if( bIsPoint ) + if( aAttributedDataPointIndexList.hasElements() ) { - ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) ); - ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex ); - if( aIt != aIndices.end()) - bSelectedPointIsFormatted = true; + if( bIsPoint ) + { + ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) ); + ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex ); + if( aIt != aIndices.end()) + bSelectedPointIsFormatted = true; + else + bHasFormattedDataPointsOtherThanSelected = true; + } else bHasFormattedDataPointsOtherThanSelected = true; } - else - bHasFormattedDataPointsOtherThanSelected = true; } } - } - //const sal_Int32 nIdBeforeFormat = nUniqueId; - if( bIsPoint ) - { - if( bHasDataLabelAtPoint ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabel") ); - if( !bHasDataLabelAtPoint ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabel") ); - else - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabel") ); - if( bSelectedPointIsFormatted ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetDataPoint")); - - xPopupMenu->insertSeparator( -1 ); - - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataSeries") ); - } + //const sal_Int32 nIdBeforeFormat = nUniqueId; + if( bIsPoint ) + { + if( bHasDataLabelAtPoint ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabel") ); + if( !bHasDataLabelAtPoint ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabel") ); + else + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabel") ); + if( bSelectedPointIsFormatted ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetDataPoint")); + + xPopupMenu->insertSeparator( -1 ); + + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataSeries") ); + } - Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) ); - if( xChartType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) - { - try + Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) ); + if( xChartType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) { - Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY ); - if( xChartTypeProp.is() ) + try { - bool bJapaneseStyle = false; - xChartTypeProp->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle; - - if( bJapaneseStyle ) + Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY ); + if( xChartTypeProp.is() ) { - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") ); + bool bJapaneseStyle = false; + xChartTypeProp->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle; + + if( bJapaneseStyle ) + { + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") ); + } } } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } } - catch( const uno::Exception & ex ) + + if( bHasDataLabelsAtSeries ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabels") ); + if( xTrendline.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendline") ); + if( bHasEquation ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") ); + if( xMeanValue.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMeanValue") ); + if( bHasYErrorBars ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatYErrorBars") ); + + //if( nIdBeforeFormat != nUniqueId ) + xPopupMenu->insertSeparator( -1 ); + + //const sal_Int32 nIdBeforeInsert = nUniqueId; + + if( !bHasDataLabelsAtSeries ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabels") ); + if( !xTrendline.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline") ); + else if( !bHasEquation ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") ); + if( !xMeanValue.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue") ); + if( !bHasYErrorBars ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorBars") ); + + //if( nIdBeforeInsert != nUniqueId ) + // xPopupMenu->insertSeparator( -1 ); + + //const sal_Int32 nIdBeforeDelete = nUniqueId; + + if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabels") ); + if( xTrendline.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline") ); + if( bHasEquation ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") ); + if( xMeanValue.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue") ); + if( bHasYErrorBars ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorBars") ); + + if( bHasFormattedDataPointsOtherThanSelected ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetAllDataPoints")); + + //if( nIdBeforeDelete != nUniqueId ) + xPopupMenu->insertSeparator( -1 ); + + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow")); + uno::Reference< awt::XPopupMenu > xArrangePopupMenu( + m_xCC->getServiceManager()->createInstanceWithContext( + C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY ); + uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY ); + if( xArrangePopupMenu.is() && xArrangeMenuEx.is()) { - ASSERT_EXCEPTION( ex ); + sal_Int16 nSubId = nUniqueId + 1; + lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward") ); + lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward") ); + xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu ); + nUniqueId = nSubId; } + ++nUniqueId; } - - if( bHasDataLabelsAtSeries ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabels") ); - if( xTrendline.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendline") ); - if( bHasEquation ) + else if( OBJECTTYPE_DATA_CURVE == eObjectType ) + { lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") ); - if( xMeanValue.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMeanValue") ); - if( bHasYErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatYErrorBars") ); - - //if( nIdBeforeFormat != nUniqueId ) - xPopupMenu->insertSeparator( -1 ); - - //const sal_Int32 nIdBeforeInsert = nUniqueId; - - if( !bHasDataLabelsAtSeries ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabels") ); - if( !xTrendline.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline") ); - else if( !bHasEquation ) lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") ); - if( !xMeanValue.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue") ); - if( !bHasYErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorBars") ); - - //if( nIdBeforeInsert != nUniqueId ) - // xPopupMenu->insertSeparator( -1 ); - - //const sal_Int32 nIdBeforeDelete = nUniqueId; - - if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabels") ); - if( xTrendline.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline") ); - if( bHasEquation ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquationAndR2") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") ); lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") ); - if( xMeanValue.is() ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue") ); - if( bHasYErrorBars ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorBars") ); - - if( bHasFormattedDataPointsOtherThanSelected ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetAllDataPoints")); - - //if( nIdBeforeDelete != nUniqueId ) - xPopupMenu->insertSeparator( -1 ); - - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow")); - uno::Reference< awt::XPopupMenu > xArrangePopupMenu( - m_xCC->getServiceManager()->createInstanceWithContext( - C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY ); - uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY ); - if( xArrangePopupMenu.is() && xArrangeMenuEx.is()) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") ); + } + else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType ) { - sal_Int16 nSubId = nUniqueId + 1; - lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward") ); - lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward") ); - xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu ); - nUniqueId = nSubId; + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") ); } - ++nUniqueId; - } - else if( OBJECTTYPE_DATA_CURVE == eObjectType ) - { - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquationAndR2") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") ); - } - else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType ) - { - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") ); - } - //some commands for axes: and grids - //----- - else if( OBJECTTYPE_AXIS == eObjectType || OBJECTTYPE_GRID == eObjectType || OBJECTTYPE_SUBGRID == eObjectType ) - { - Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); - if( xAxis.is() && xDiagram.is() ) + //some commands for axes: and grids + //----- + else if( OBJECTTYPE_AXIS == eObjectType || OBJECTTYPE_GRID == eObjectType || OBJECTTYPE_SUBGRID == eObjectType ) { - sal_Int32 nDimensionIndex = -1; - sal_Int32 nCooSysIndex = -1; - sal_Int32 nAxisIndex = -1; - AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ); - bool bIsSecondaryAxis = nAxisIndex!=0; - bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis ); - bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram ); - bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram ); - bool bHasTitle = false; - uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY ); - if( xTitled.is()) - bHasTitle = TitleHelper::getCompleteString( xTitled->getTitleObject() ).getLength()>0; - - if( OBJECTTYPE_AXIS != eObjectType && bIsAxisVisible ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatAxis") ); - if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMajorGrid") ); - if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMinorGrid") ); - - xPopupMenu->insertSeparator( -1 ); - - if( OBJECTTYPE_AXIS != eObjectType && !bIsAxisVisible ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxis") ); - if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMajorGrid") ); - if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMinorGrid") ); - if( !bHasTitle ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxisTitle") ); - - if( bIsAxisVisible ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteAxis") ); - if( bIsMajorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMajorGrid") ); - if( bIsMinorGridVisible && !bIsSecondaryAxis ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMinorGrid") ); + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() && xDiagram.is() ) + { + sal_Int32 nDimensionIndex = -1; + sal_Int32 nCooSysIndex = -1; + sal_Int32 nAxisIndex = -1; + AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ); + bool bIsSecondaryAxis = nAxisIndex!=0; + bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis ); + bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram ); + bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram ); + bool bHasTitle = false; + uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY ); + if( xTitled.is()) + bHasTitle = TitleHelper::getCompleteString( xTitled->getTitleObject() ).getLength()>0; + + if( OBJECTTYPE_AXIS != eObjectType && bIsAxisVisible ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatAxis") ); + if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMajorGrid") ); + if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMinorGrid") ); + + xPopupMenu->insertSeparator( -1 ); + + if( OBJECTTYPE_AXIS != eObjectType && !bIsAxisVisible ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxis") ); + if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMajorGrid") ); + if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMinorGrid") ); + if( !bHasTitle ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxisTitle") ); + + if( bIsAxisVisible ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteAxis") ); + if( bIsMajorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMajorGrid") ); + if( bIsMinorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMinorGrid") ); + } } - } - if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") ); - else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") ); + if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") ); + else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog")); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog")); - if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType - || OBJECTTYPE_DIAGRAM_WALL == eObjectType - || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType - || OBJECTTYPE_UNKNOWN == eObjectType ) - { - if( OBJECTTYPE_UNKNOWN != eObjectType ) - xPopupMenu->insertSeparator( -1 ); - bool bHasLegend = LegendHelper::hasLegend( xDiagram ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTitles") ); - if( !bHasLegend ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertLegend") ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertRemoveAxes") ); - if( bHasLegend ) - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteLegend") ); + if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType + || OBJECTTYPE_DIAGRAM_WALL == eObjectType + || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType + || OBJECTTYPE_UNKNOWN == eObjectType ) + { + if( OBJECTTYPE_UNKNOWN != eObjectType ) + xPopupMenu->insertSeparator( -1 ); + bool bHasLegend = LegendHelper::hasLegend( xDiagram ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTitles") ); + if( !bHasLegend ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertLegend") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertRemoveAxes") ); + if( bHasLegend ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteLegend") ); + } + //----- + + xPopupMenu->insertSeparator( -1 ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramType")); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DataRanges")); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramData")); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D")); + xPopupMenu->insertSeparator( -1 ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Cut")); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Copy")); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Paste")); + + ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); + Point aPos( rCEvt.GetMousePosPixel() ); + if( !rCEvt.IsMouseEvent() ) + aPos = m_pChartWindow->GetPointerState().maPos; + aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } - //----- - - xPopupMenu->insertSeparator( -1 ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramType")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DataRanges")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramData")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D")); - xPopupMenu->insertSeparator( -1 ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Cut")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Copy")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Paste")); - - ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); - Point aPos( rCEvt.GetMousePosPixel() ); - if( !rCEvt.IsMouseEvent() ) - aPos = m_pChartWindow->GetPointerState().maPos; - aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } } else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) || @@ -1235,17 +1350,21 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { // Natvigation (Tab/F3/Home/End) uno::Reference< XChartDocument > xChartDoc( m_aModel->getModel(), uno::UNO_QUERY ); - ObjectKeyNavigation aObjNav( m_aSelection.getSelectedCID(), xChartDoc, ExplicitValueProvider::getExplicitValueProvider( m_xChartView )); + ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, ExplicitValueProvider::getExplicitValueProvider( m_xChartView )); awt::KeyEvent aKeyEvent( ::svt::AcceleratorExecute::st_VCLKey2AWTKey( aKeyCode )); bReturn = aObjNav.handleKeyEvent( aKeyEvent ); if( bReturn ) { - ::rtl::OUString aNewCID = aObjNav.getCurrentSelection(); + ObjectIdentifier aNewOID = aObjNav.getCurrentSelection(); uno::Any aNewSelection; - if( aNewCID.getLength()>0 && !ObjectHierarchy::isRootNode( aNewCID )) - aNewSelection <<= aNewCID; - if( m_eDragMode == SDRDRAG_ROTATE && !SelectionHelper::isRotateableObject( aNewCID, m_aModel->getModel() ) ) + if ( aNewOID.isValid() && !ObjectHierarchy::isRootNode( aNewOID ) ) + { + aNewSelection = aNewOID.getAny(); + } + if ( m_eDragMode == SDRDRAG_ROTATE && !SelectionHelper::isRotateableObject( aNewOID.getObjectCID(), m_aModel->getModel() ) ) + { m_eDragMode = SDRDRAG_MOVE; + } bReturn = select( aNewSelection ); } } @@ -1498,24 +1617,64 @@ bool ChartController::requestQuickHelp( ::select( const uno::Any& rSelection ) throw( lang::IllegalArgumentException ) { - rtl::OUString aNewCID; - if( rSelection.hasValue() && - ! (rSelection >>= aNewCID)) - return sal_False; + bool bSuccess = false; + if ( rSelection.hasValue() ) + { + const uno::Type& rType = rSelection.getValueType(); + if ( rType == ::getCppuType( static_cast< const ::rtl::OUString* >( 0 ) ) ) + { + ::rtl::OUString aNewCID; + if ( ( rSelection >>= aNewCID ) && m_aSelection.setSelection( aNewCID ) ) + { + bSuccess = true; + } + } + else if ( rType == ::getCppuType( static_cast< const uno::Reference< drawing::XShape >* >( 0 ) ) ) + { + uno::Reference< drawing::XShape > xShape; + if ( ( rSelection >>= xShape ) && m_aSelection.setSelection( xShape ) ) + { + bSuccess = true; + } + } + } + else + { + if ( m_aSelection.hasSelection() ) + { + m_aSelection.clearSelection(); + bSuccess = true; + } + } - if( m_aSelection.setSelection( aNewCID ) ) + if ( bSuccess ) { this->impl_selectObjectAndNotiy(); return sal_True; } + return sal_False; } uno::Any SAL_CALL ChartController ::getSelection() throw(uno::RuntimeException) { - return uno::makeAny(m_aSelection.getSelectedCID()); + uno::Any aReturn; + if ( m_aSelection.hasSelection() ) + { + ::rtl::OUString aCID( m_aSelection.getSelectedCID() ); + if ( aCID.getLength() ) + { + aReturn = uno::makeAny( aCID ); + } + else + { + // #i12587# support for shapes in chart + aReturn = uno::makeAny( m_aSelection.getSelectedAdditionalShape() ); + } + } + return aReturn; } void SAL_CALL ChartController @@ -1701,7 +1860,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) sal_uInt16 nModifier = rEvent.GetModifier(); BOOL bLeftDown = rEvent.IsLeft(); - if( m_pDrawViewWrapper->IsTextEdit() ) + if ( m_pDrawViewWrapper->IsTextEdit() ) { if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) ) { @@ -1726,7 +1885,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) aMousePos, pWindow, nModifier, bLeftDown ); bool bForceArrowPointer = false; - ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID(); + ObjectIdentifier aOID( m_aSelection.getSelectedOID() ); switch( aPointer.GetStyle()) { @@ -1742,7 +1901,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) bForceArrowPointer = true; break; case POINTER_MOVE: - if( ! ObjectIdentifier::isDragableObject( aObjectCID )) + if ( !aOID.isDragableObject() ) bForceArrowPointer = true; break; case POINTER_MOVEPOINT: @@ -1762,6 +1921,55 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) } else { + // #i12587# support for shapes in chart + if ( m_eDrawMode == CHARTDRAW_INSERT && + ( !m_pDrawViewWrapper->IsMarkedHit( aMousePos ) || !m_aSelection.isDragableObjectSelected() ) ) + { + PointerStyle ePointerStyle = POINTER_DRAW_RECT; + SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() ); + switch ( eKind ) + { + case OBJ_LINE: + { + ePointerStyle = POINTER_DRAW_LINE; + } + break; + case OBJ_RECT: + case OBJ_CUSTOMSHAPE: + { + ePointerStyle = POINTER_DRAW_RECT; + } + break; + case OBJ_CIRC: + { + ePointerStyle = POINTER_DRAW_ELLIPSE; + } + break; + case OBJ_FREELINE: + { + ePointerStyle = POINTER_DRAW_POLYGON; + } + break; + case OBJ_TEXT: + { + ePointerStyle = POINTER_DRAW_TEXT; + } + break; + case OBJ_CAPTION: + { + ePointerStyle = POINTER_DRAW_CAPTION; + } + break; + default: + { + ePointerStyle = POINTER_DRAW_RECT; + } + break; + } + pWindow->SetPointer( Pointer( ePointerStyle ) ); + return; + } + ::rtl::OUString aHitObjectCID( SelectionHelper::getHitObjectCID( aMousePos, *m_pDrawViewWrapper, true /*bGetDiagramInsteadOf_Wall*/ )); diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx index d64f163f634c..80041d4c3818 100644 --- a/chart2/source/controller/main/ChartTransferable.cxx +++ b/chart2/source/controller/main/ChartTransferable.cxx @@ -30,12 +30,21 @@ #include "ChartTransferable.hxx" +#include <unotools/streamwrap.hxx> #include <vcl/graph.hxx> +#include <svl/itempool.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <svx/svditer.hxx> #include <svx/svdmodel.hxx> +#include <svx/svdpage.hxx> +#include <svx/unomodel.hxx> // header for class SdrView #include <svx/svdview.hxx> +#define CHARTTRANSFER_OBJECTTYPE_DRAWMODEL 1 + using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; @@ -45,7 +54,9 @@ using ::rtl::OUString; namespace chart { -ChartTransferable::ChartTransferable( SdrModel * pDrawModel, SdrObject * pSelectedObj ) +ChartTransferable::ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing ) + :m_pMarkedObjModel( NULL ) + ,m_bDrawing( bDrawing ) { SdrExchangeView * pExchgView( new SdrView( pDrawModel )); SdrPageView* pPv = pExchgView->ShowSdrPage( pDrawModel->GetPage( 0 )); @@ -55,6 +66,10 @@ ChartTransferable::ChartTransferable( SdrModel * pDrawModel, SdrObject * pSelect pExchgView->MarkAllObj( pPv ); Graphic aGraphic( pExchgView->GetMarkedObjMetaFile( TRUE )); m_xMetaFileGraphic.set( aGraphic.GetXGraphic()); + if ( m_bDrawing ) + { + m_pMarkedObjModel = ( pExchgView ? pExchgView->GetAllMarkedModel() : NULL ); + } delete pExchgView; } @@ -63,6 +78,10 @@ ChartTransferable::~ChartTransferable() void ChartTransferable::AddSupportedFormats() { + if ( m_bDrawing ) + { + AddFormat( SOT_FORMATSTR_ID_DRAWING ); + } AddFormat( SOT_FORMAT_GDIMETAFILE ); AddFormat( SOT_FORMAT_BITMAP ); } @@ -74,7 +93,11 @@ sal_Bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataF if( HasFormat( nFormat )) { - if( nFormat == FORMAT_GDIMETAFILE ) + if ( nFormat == SOT_FORMATSTR_ID_DRAWING ) + { + bResult = SetObject( m_pMarkedObjModel, CHARTTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor ); + } + else if ( nFormat == FORMAT_GDIMETAFILE ) { Graphic aGraphic( m_xMetaFileGraphic ); bResult = SetGDIMetaFile( aGraphic.GetGDIMetaFile(), rFlavor ); @@ -89,5 +112,61 @@ sal_Bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataF return bResult; } +sal_Bool ChartTransferable::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, + const datatransfer::DataFlavor& /* rFlavor */ ) +{ + // called from SetObject, put data into stream + + sal_Bool bRet = sal_False; + switch ( nUserObjectId ) + { + case CHARTTRANSFER_OBJECTTYPE_DRAWMODEL: + { + SdrModel* pMarkedObjModel = reinterpret_cast< SdrModel* >( pUserObject ); + if ( pMarkedObjModel ) + { + rxOStm->SetBufferSize( 0xff00 ); + + // #108584# + // for the changed pool defaults from drawing layer pool set those + // attributes as hard attributes to preserve them for saving + const SfxItemPool& rItemPool = pMarkedObjModel->GetItemPool(); + const SvxFontHeightItem& rDefaultFontHeight = static_cast< const SvxFontHeightItem& >( + rItemPool.GetDefaultItem( EE_CHAR_FONTHEIGHT ) ); + sal_uInt16 nCount = pMarkedObjModel->GetPageCount(); + for ( sal_uInt16 i = 0; i < nCount; ++i ) + { + const SdrPage* pPage = pMarkedObjModel->GetPage( i ); + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + while ( aIter.IsMore() ) + { + SdrObject* pObj = aIter.Next(); + const SvxFontHeightItem& rItem = static_cast< const SvxFontHeightItem& >( + pObj->GetMergedItem( EE_CHAR_FONTHEIGHT ) ); + if ( rItem.GetHeight() == rDefaultFontHeight.GetHeight() ) + { + pObj->SetMergedItem( rDefaultFontHeight ); + } + } + } + + Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) ); + if ( SvxDrawingLayerExport( pMarkedObjModel, xDocOut ) ) + { + rxOStm->Commit(); + } + + bRet = ( rxOStm->GetError() == ERRCODE_NONE ); + } + } + break; + default: + { + DBG_ERROR( "ChartTransferable::WriteObject: unknown object id" ); + } + break; + } + return bRet; +} } // namespace chart diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx index 2ce4e811d809..401f43c6d1ae 100644 --- a/chart2/source/controller/main/ChartTransferable.hxx +++ b/chart2/source/controller/main/ChartTransferable.hxx @@ -44,7 +44,7 @@ namespace chart class ChartTransferable : public TransferableHelper { public: - explicit ChartTransferable( SdrModel * pDrawModel, SdrObject * pSelectedObj ); + explicit ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing = false ); virtual ~ChartTransferable(); protected: @@ -52,9 +52,13 @@ protected: // implementation of TransferableHelper methods virtual void AddSupportedFormats(); virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); + virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, + const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); private: ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > m_xMetaFileGraphic; + SdrModel* m_pMarkedObjModel; + bool m_bDrawing; }; } // namespace chart diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx index 09da97b45014..3761d0c33ce0 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.cxx +++ b/chart2/source/controller/main/CommandDispatchContainer.cxx @@ -33,6 +33,9 @@ #include "StatusBarCommandDispatch.hxx" #include "DisposeHelper.hxx" #include "macros.hxx" +#include "ChartController.hxx" +#include "DrawCommandDispatch.hxx" +#include "ShapeController.hxx" #include <comphelper/InlineContainer.hxx> @@ -48,8 +51,11 @@ namespace chart { CommandDispatchContainer::CommandDispatchContainer( - const Reference< uno::XComponentContext > & xContext ) : - m_xContext( xContext ) + const Reference< uno::XComponentContext > & xContext, ChartController* pController ) + :m_xContext( xContext ) + ,m_pChartController( pController ) + ,m_pDrawCommandDispatch( NULL ) + ,m_pShapeController( NULL ) { m_aContainerDocumentCommands = ::comphelper::MakeSet< OUString > @@ -75,21 +81,20 @@ void CommandDispatchContainer::setModel( // m_xUndoManager = xUndoManager; // } -void CommandDispatchContainer::setFallbackDispatch( - const Reference< frame::XDispatch > xFallbackDispatch, - const ::std::set< OUString > & rFallbackCommands ) +void CommandDispatchContainer::setChartDispatch( + const Reference< frame::XDispatch > xChartDispatch, + const ::std::set< OUString > & rChartCommands ) { - OSL_ENSURE(xFallbackDispatch.is(),"Invalid fall back dispatcher!"); - m_xFallbackDispatcher.set( xFallbackDispatch ); - m_aFallbackCommands = rFallbackCommands; - m_aToBeDisposedDispatches.push_back( m_xFallbackDispatcher ); + OSL_ENSURE(xChartDispatch.is(),"Invalid fall back dispatcher!"); + m_xChartDispatcher.set( xChartDispatch ); + m_aChartCommands = rChartCommands; + m_aToBeDisposedDispatches.push_back( m_xChartDispatcher ); } Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL( const util::URL & rURL ) { Reference< frame::XDispatch > xResult; - tDispatchMap::const_iterator aIt( m_aCachedDispatches.find( rURL.Complete )); if( aIt != m_aCachedDispatches.end()) { @@ -127,10 +132,24 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL( // ToDo: can those dispatches be cached? m_aCachedDispatches[ rURL.Complete ].set( xResult ); } - else if( m_xFallbackDispatcher.is() && - (m_aFallbackCommands.find( rURL.Path ) != m_aFallbackCommands.end()) ) + else if( m_xChartDispatcher.is() && + (m_aChartCommands.find( rURL.Path ) != m_aChartCommands.end()) ) + { + xResult.set( m_xChartDispatcher ); + m_aCachedDispatches[ rURL.Complete ].set( xResult ); + } + // #i12587# support for shapes in chart + // Note, that the chart dispatcher must be queried first, because + // the chart dispatcher is the default dispatcher for all context + // sensitive commands. + else if ( m_pDrawCommandDispatch && m_pDrawCommandDispatch->isFeatureSupported( rURL.Complete ) ) + { + xResult.set( m_pDrawCommandDispatch ); + m_aCachedDispatches[ rURL.Complete ].set( xResult ); + } + else if ( m_pShapeController && m_pShapeController->isFeatureSupported( rURL.Complete ) ) { - xResult.set( m_xFallbackDispatcher ); + xResult.set( m_pShapeController ); m_aCachedDispatches[ rURL.Complete ].set( xResult ); } } @@ -157,8 +176,11 @@ void CommandDispatchContainer::DisposeAndClear() m_aCachedDispatches.clear(); DisposeHelper::DisposeAllElements( m_aToBeDisposedDispatches ); m_aToBeDisposedDispatches.clear(); - m_xFallbackDispatcher.clear(); - m_aFallbackCommands.clear(); + m_xChartDispatcher.clear(); + m_aChartCommands.clear(); + m_pChartController = NULL; + m_pDrawCommandDispatch = NULL; + m_pShapeController = NULL; } Reference< frame::XDispatch > CommandDispatchContainer::getContainerDispatchForURL( @@ -179,4 +201,16 @@ Reference< frame::XDispatch > CommandDispatchContainer::getContainerDispatchForU return xResult; } +void CommandDispatchContainer::setDrawCommandDispatch( DrawCommandDispatch* pDispatch ) +{ + m_pDrawCommandDispatch = pDispatch; + m_aToBeDisposedDispatches.push_back( Reference< frame::XDispatch >( pDispatch ) ); +} + +void CommandDispatchContainer::setShapeController( ShapeController* pController ) +{ + m_pShapeController = pController; + m_aToBeDisposedDispatches.push_back( Reference< frame::XDispatch >( pController ) ); +} + } // namespace chart diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/main/CommandDispatchContainer.hxx index 379e86481db1..2cee65405ef4 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.hxx +++ b/chart2/source/controller/main/CommandDispatchContainer.hxx @@ -41,6 +41,10 @@ namespace chart { +class ChartController; +class DrawCommandDispatch; +class ShapeController; + /** @HTML Helper class for implementing the <code>XDispatchProvider</code> interface @@ -53,9 +57,9 @@ namespace chart <li>Check if the command is handled by this class, e.g. Undo. If so, return a corresponding <code>XDispatch</code> implementation, and cache this implementation for later use</li> - <li>Otherwise send the command to the fallback dispatch provider, if it + <li>Otherwise send the command to the chart dispatch provider, if it can handle this dispatch (determined by the list of commands given in - <code>setFallbackDispatch()</code>).</li> + <code>setChartDispatch()</code>).</li> </ul> <p>The <code>XDispatch</code>Provider is designed to return different @@ -65,17 +69,18 @@ namespace chart <p>As most commands need much information of the controller and are implemented there, the controller handles most of the commands itself (it also implements <code>XDispatch</code>). Therefore it is set here as - fallback dispatch.</p> + chart dispatch.</p> */ class CommandDispatchContainer { public: - // note: the fallback dispatcher should be removed when all commands are - // handled by other dispatchers. (Fallback is currently the controller + // note: the chart dispatcher should be removed when all commands are + // handled by other dispatchers. (Chart is currently the controller // itself) explicit CommandDispatchContainer( const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > & xContext ); + ::com::sun::star::uno::XComponentContext > & xContext, + ChartController* pController ); void setModel( const ::com::sun::star::uno::Reference< @@ -84,18 +89,18 @@ public: // const ::com::sun::star::uno::Reference< // ::com::sun::star::chart2::XUndoManager > & xUndoManager ); - /** Set a fallback dispatcher that is used for all commands contained in - rFallbackCommands + /** Set a chart dispatcher that is used for all commands contained in + rChartCommands */ - void setFallbackDispatch( + void setChartDispatch( const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatch > xFallbackDispatch, - const ::std::set< ::rtl::OUString > & rFallbackCommands ); + ::com::sun::star::frame::XDispatch > xChartDispatch, + const ::std::set< ::rtl::OUString > & rChartCommands ); /** Returns the dispatch that is able to do the command given in rURL, if implemented here. If the URL is not implemented here, it should be - checked whether the command is one of the commands given as fallback via - the setFallbackDispatch() method. If so, call the fallback dispatch. + checked whether the command is one of the commands given via + the setChartDispatch() method. If so, call the chart dispatch. <p>If all this fails, return an empty dispatch.</p> */ @@ -116,6 +121,11 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > & xChartController, const ::com::sun::star::util::URL & rURL ); + void setDrawCommandDispatch( DrawCommandDispatch* pDispatch ); + DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; } + void setShapeController( ShapeController* pController ); + ShapeController* getShapeController() { return m_pShapeController; } + private: typedef ::std::map< ::rtl::OUString, @@ -133,10 +143,14 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xFallbackDispatcher; - ::std::set< ::rtl::OUString > m_aFallbackCommands; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xChartDispatcher; + ::std::set< ::rtl::OUString > m_aChartCommands; ::std::set< ::rtl::OUString > m_aContainerDocumentCommands; + + ChartController* m_pChartController; + DrawCommandDispatch* m_pDrawCommandDispatch; + ShapeController* m_pShapeController; }; } // namespace chart diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 5fc58307b7a0..2652aadfdb32 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -42,6 +42,7 @@ #include "RegressionCurveHelper.hxx" #include "DataSeriesHelper.hxx" #include "StatisticsHelper.hxx" +#include "ShapeController.hxx" #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/frame/XStorable.hpp> @@ -178,22 +179,22 @@ void ControllerState::update( Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY ); - OUString aSelObjCID; - // Update ControllerState variables. if( xSelectionSupplier.is()) { uno::Any aSelObj( xSelectionSupplier->getSelection() ); + ObjectIdentifier aSelOID( aSelObj ); + OUString aSelObjCID( aSelOID.getObjectCID() ); - bHasSelectedObject = ((aSelObj >>= aSelObjCID) && aSelObjCID.getLength() > 0); + bHasSelectedObject = aSelOID.isValid(); ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID )); - bIsPositionableObject = (OBJECTTYPE_DATA_POINT != aObjectType) && ObjectIdentifier::isDragableObject( aSelObjCID ); + bIsPositionableObject = (OBJECTTYPE_DATA_POINT != aObjectType) && aSelOID.isDragableObject(); bIsTextObject = OBJECTTYPE_TITLE == aObjectType; uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel )); - bIsFormateableObjectSelected = bHasSelectedObject; + bIsFormateableObjectSelected = bHasSelectedObject && aSelOID.isAutoGeneratedObject(); if( OBJECTTYPE_DIAGRAM==aObjectType || OBJECTTYPE_DIAGRAM_WALL==aObjectType || OBJECTTYPE_DIAGRAM_FLOOR==aObjectType ) bIsFormateableObjectSelected = DiagramHelper::isSupportingFloorAndWall( xDiagram ); @@ -457,13 +458,15 @@ DBG_NAME(ControllerCommandDispatch) ControllerCommandDispatch::ControllerCommandDispatch( const Reference< uno::XComponentContext > & xContext, - const Reference< frame::XController > & xController ) : + ChartController* pController, CommandDispatchContainer* pContainer ) : impl::ControllerCommandDispatch_Base( xContext ), - m_xController( xController ), - m_xSelectionSupplier( xController, uno::UNO_QUERY ), - m_xDispatch( xController, uno::UNO_QUERY ), + m_pChartController( pController ), + m_xController( Reference< frame::XController >( pController ) ), + m_xSelectionSupplier( Reference< view::XSelectionSupplier >( pController ) ), + m_xDispatch( Reference< frame::XDispatch >( pController ) ), m_apModelState( new impl::ModelState() ), - m_apControllerState( new impl::ControllerState() ) + m_apControllerState( new impl::ControllerState() ), + m_pDispatchContainer( pContainer ) { DBG_CTOR(ControllerCommandDispatch,NULL); } @@ -523,6 +526,8 @@ void ControllerCommandDispatch::updateCommandAvailability() // @todo: determine correctly bool bHasSuitableClipboardContent = true; + bool bShapeContext = ( m_pChartController ? m_pChartController->isShapeContext() : false ); + // edit commands m_aCommandAvailability[ C2U(".uno:Cut")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsDeleteableObjectSelected; m_aCommandAvailability[ C2U(".uno:Copy")] = bControllerStateIsValid && m_apControllerState->bHasSelectedObject; @@ -540,7 +545,8 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ C2U(".uno:DefaultColors")] = bIsWritable; m_aCommandAvailability[ C2U(".uno:BarWidth")] = bIsWritable; m_aCommandAvailability[ C2U(".uno:NumberOfLines")] = bIsWritable; - m_aCommandAvailability[ C2U(".uno:ArrangeRow")] = m_apControllerState->bMayMoveSeriesForward || m_apControllerState->bMayMoveSeriesBackward; + m_aCommandAvailability[ C2U(".uno:ArrangeRow")] = + bShapeContext || ( bIsWritable && bControllerStateIsValid && ( m_apControllerState->bMayMoveSeriesForward || m_apControllerState->bMayMoveSeriesBackward ) ); // insert objects m_aCommandAvailability[ C2U(".uno:InsertTitles")] = m_aCommandAvailability[ C2U(".uno:InsertMenuTitles")] = bIsWritable; @@ -574,6 +580,7 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ C2U(".uno:Legend")] = bIsWritable && m_apModelState->bHasLegend; m_aCommandAvailability[ C2U(".uno:DiagramWall")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasWall; m_aCommandAvailability[ C2U(".uno:DiagramArea")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:TransformDialog")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bHasSelectedObject && m_apControllerState->bIsPositionableObject; // 3d commands @@ -623,8 +630,10 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ C2U(".uno:DiagramGridAll")] = bIsWritable && bModelStateIsValid && m_apModelState->HasAnyGrid(); // series arrangement - m_aCommandAvailability[ C2U(".uno:Forward")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesForward; - m_aCommandAvailability[ C2U(".uno:Backward")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesBackward; + m_aCommandAvailability[ C2U(".uno:Forward")] = ( bShapeContext ? isShapeControllerCommandAvailable( C2U( ".uno:Forward" ) ) : + ( bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesForward ) ); + m_aCommandAvailability[ C2U(".uno:Backward")] = ( bShapeContext ? isShapeControllerCommandAvailable( C2U( ".uno:Backward" ) ) : + ( bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesBackward ) ); m_aCommandAvailability[ C2U(".uno:InsertDataLabels")] = bIsWritable; m_aCommandAvailability[ C2U(".uno:InsertDataLabel")] = bIsWritable; @@ -667,6 +676,17 @@ bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand ) return false; } +bool ControllerCommandDispatch::isShapeControllerCommandAvailable( const ::rtl::OUString& rCommand ) +{ + ShapeController* pShapeController = ( m_pDispatchContainer ? m_pDispatchContainer->getShapeController() : NULL ); + if ( pShapeController ) + { + FeatureState aState( pShapeController->getState( rCommand ) ); + return aState.bEnabled; + } + return false; +} + void ControllerCommandDispatch::fireStatusEvent( const OUString & rURL, const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ ) diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/main/ControllerCommandDispatch.hxx index a37d8b059b57..08d57a0d6cbf 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.hxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx @@ -38,6 +38,9 @@ namespace chart { +class ChartController; +class CommandDispatchContainer; + namespace impl { struct ModelState; @@ -64,8 +67,7 @@ public: explicit ControllerCommandDispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XController > & xController ); + ChartController* pController, CommandDispatchContainer* pContainer ); virtual ~ControllerCommandDispatch(); // late initialisation, especially for adding as listener @@ -109,6 +111,9 @@ private: bool commandAvailable( const ::rtl::OUString & rCommand ); void updateCommandAvailability(); + bool isShapeControllerCommandAvailable( const ::rtl::OUString& rCommand ); + + ChartController* m_pChartController; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xController; ::com::sun::star::uno::Reference< @@ -121,6 +126,8 @@ private: mutable ::std::map< ::rtl::OUString, bool > m_aCommandAvailability; mutable ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any > m_aCommandArguments; + + CommandDispatchContainer* m_pDispatchContainer; }; } // namespace chart diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx new file mode 100644 index 000000000000..aa28028c4861 --- /dev/null +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -0,0 +1,674 @@ +/************************************************************************* + * + * 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 "DrawCommandDispatch.hxx" +#include "DrawCommandDispatch.hrc" +#include "ChartController.hxx" +#include "DrawViewWrapper.hxx" +#include "chartview/DrawModelWrapper.hxx" +#include "macros.hxx" + +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <svl/itempool.hxx> +#include <editeng/adjitem.hxx> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <svx/fmmodel.hxx> +#include <svx/gallery.hxx> +#include <svx/svdoashp.hxx> +#include <svx/svdocapt.hxx> +#include <svx/svdopath.hxx> +#include <svx/svdpage.hxx> +#include <svx/unoapi.hxx> +#include <svx/xlnedit.hxx> +#include <svx/xlnedwit.hxx> +#include <svx/xlnwtit.hxx> +#include <svx/xtable.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> + +#include <boost/bind.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::frame; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; + + +//............................................................................. +namespace +{ +//............................................................................. + + // comparing two PropertyValue instances + struct PropertyValueCompare : public ::std::binary_function< beans::PropertyValue, ::rtl::OUString, bool > + { + bool operator() ( const beans::PropertyValue& rPropValue, const ::rtl::OUString& rName ) const + { + return rPropValue.Name.equals( rName ); + } + bool operator() ( const ::rtl::OUString& rName, const beans::PropertyValue& rPropValue ) const + { + return rName.equals( rPropValue.Name ); + } + }; + +//............................................................................. +} // anonymous namespace +//............................................................................. + + +//............................................................................. +namespace chart +{ +//............................................................................. + +DrawCommandDispatch::DrawCommandDispatch( const Reference< uno::XComponentContext >& rxContext, + ChartController* pController ) + :FeatureCommandDispatchBase( rxContext ) + ,m_pChartController( pController ) +{ +} + +DrawCommandDispatch::~DrawCommandDispatch() +{ +} + +void DrawCommandDispatch::initialize() +{ + FeatureCommandDispatchBase::initialize(); +} + +bool DrawCommandDispatch::isFeatureSupported( const ::rtl::OUString& rCommandURL ) +{ + sal_uInt16 nFeatureId = 0; + ::rtl::OUString aBaseCommand; + ::rtl::OUString aCustomShapeType; + return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType ); +} + +::basegfx::B2DPolyPolygon getPolygon( sal_uInt16 nResId, SdrModel& rModel ) +{ + ::basegfx::B2DPolyPolygon aReturn; + XLineEndList* pLineEndList = rModel.GetLineEndList(); + if ( pLineEndList ) + { + String aName( SVX_RES( nResId ) ); + long nCount = pLineEndList->Count(); + for ( long nIndex = 0; nIndex < nCount; ++nIndex ) + { + XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nIndex ); + if ( pEntry->GetName() == aName ) + { + aReturn = pEntry->GetLineEnd(); + break; + } + } + } + return aReturn; +} + +void DrawCommandDispatch::setAttributes( SdrObject* pObj ) +{ + if ( m_pChartController ) + { + DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper(); + DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); + if ( pDrawModelWrapper && pDrawViewWrapper && pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CUSTOMSHAPE ) + { + sal_Bool bAttributesAppliedFromGallery = sal_False; + if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) ) + { + ::std::vector< ::rtl::OUString > aObjList; + if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) ) + { + for ( sal_uInt16 i = 0; i < aObjList.size(); ++i ) + { + if ( aObjList[ i ].equalsIgnoreAsciiCase( m_aCustomShapeType ) ) + { + FmFormModel aModel; + SfxItemPool& rPool = aModel.GetItemPool(); + rPool.FreezeIdRanges(); + if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aModel ) ) + { + const SdrObject* pSourceObj = aModel.GetPage( 0 )->GetObj( 0 ); + if ( pSourceObj ) + { + const SfxItemSet& rSource = pSourceObj->GetMergedItemSet(); + SfxItemSet aDest( pObj->GetModel()->GetItemPool(), // ranges from SdrAttrObj + SDRATTR_START, SDRATTR_SHADOW_LAST, + SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, + SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, + // Graphic Attributes + SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST, + // 3d Properties + SDRATTR_3D_FIRST, SDRATTR_3D_LAST, + // CustomShape properties + SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST, + // range from SdrTextObj + EE_ITEMS_START, EE_ITEMS_END, + // end + 0, 0); + aDest.Set( rSource ); + pObj->SetMergedItemSet( aDest ); + sal_Int32 nAngle = pSourceObj->GetRotateAngle(); + if ( nAngle ) + { + double a = nAngle * F_PI18000; + pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) ); + } + bAttributesAppliedFromGallery = sal_True; + } + } + break; + } + } + } + } + if ( !bAttributesAppliedFromGallery ) + { + pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER, 0 ) ); + pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); + pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) ); + pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) ); + ( dynamic_cast< SdrObjCustomShape* >( pObj ) )->MergeDefaultAttributes( &m_aCustomShapeType ); + } + } + } +} + +void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr ) +{ + if ( m_nFeatureId == COMMAND_ID_LINE_ARROW_END && m_pChartController ) + { + DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper(); + DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); + if ( pDrawModelWrapper && pDrawViewWrapper ) + { + ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDrawModelWrapper->getSdrModel() ) ); + if ( !aArrow.count() ) + { + ::basegfx::B2DPolygon aNewArrow; + aNewArrow.append( ::basegfx::B2DPoint( 10.0, 0.0 ) ); + aNewArrow.append( ::basegfx::B2DPoint( 0.0, 30.0) ); + aNewArrow.append( ::basegfx::B2DPoint( 20.0, 30.0 ) ); + aNewArrow.setClosed( true ); + aArrow.append( aNewArrow ); + } + + SfxItemSet aSet( pDrawViewWrapper->GetModel()->GetItemPool() ); + pDrawViewWrapper->GetAttributes( aSet ); + + long nWidth = 300; // (1/100th mm) + if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE ) + { + long nValue = ( ( const XLineWidthItem& ) aSet.Get( XATTR_LINEWIDTH ) ).GetValue(); + if ( nValue > 0 ) + { + nWidth = nValue * 3; + } + } + + rAttr.Put( XLineEndItem( SVX_RESSTR( RID_SVXSTR_ARROW ), aArrow ) ); + rAttr.Put( XLineEndWidthItem( nWidth ) ); + } + } +} + +// WeakComponentImplHelperBase +void DrawCommandDispatch::disposing() +{ +} + +// XEventListener +void DrawCommandDispatch::disposing( const lang::EventObject& /* Source */ ) + throw (uno::RuntimeException) +{ +} + +FeatureState DrawCommandDispatch::getState( const ::rtl::OUString& rCommand ) +{ + FeatureState aReturn; + aReturn.bEnabled = false; + aReturn.aState <<= false; + + sal_uInt16 nFeatureId = 0; + ::rtl::OUString aBaseCommand; + ::rtl::OUString aCustomShapeType; + if ( parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) ) + { + switch ( nFeatureId ) + { + case COMMAND_ID_OBJECT_SELECT: + case COMMAND_ID_DRAW_LINE: + case COMMAND_ID_LINE_ARROW_END: + case COMMAND_ID_DRAW_RECT: + case COMMAND_ID_DRAW_ELLIPSE: + case COMMAND_ID_DRAW_FREELINE_NOFILL: + case COMMAND_ID_DRAW_TEXT: + case COMMAND_ID_DRAW_CAPTION: + case COMMAND_ID_DRAWTBX_CS_BASIC: + case COMMAND_ID_DRAWTBX_CS_SYMBOL: + case COMMAND_ID_DRAWTBX_CS_ARROW: + case COMMAND_ID_DRAWTBX_CS_FLOWCHART: + case COMMAND_ID_DRAWTBX_CS_CALLOUT: + case COMMAND_ID_DRAWTBX_CS_STAR: + { + aReturn.bEnabled = true; + aReturn.aState <<= false; + } + break; + default: + { + aReturn.bEnabled = false; + aReturn.aState <<= false; + } + break; + } + } + + return aReturn; +} + +void DrawCommandDispatch::execute( const ::rtl::OUString& rCommand, const Sequence< beans::PropertyValue>& rArgs ) +{ + (void)rArgs; + + ChartDrawMode eDrawMode = CHARTDRAW_SELECT; + SdrObjKind eKind = OBJ_NONE; + bool bCreate = false; + + sal_uInt16 nFeatureId = 0; + ::rtl::OUString aBaseCommand; + ::rtl::OUString aCustomShapeType; + if ( parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) ) + { + m_nFeatureId = nFeatureId; + m_aCustomShapeType = aCustomShapeType; + + switch ( nFeatureId ) + { + case COMMAND_ID_OBJECT_SELECT: + { + eDrawMode = CHARTDRAW_SELECT; + eKind = OBJ_NONE; + } + break; + case COMMAND_ID_DRAW_LINE: + case COMMAND_ID_LINE_ARROW_END: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_LINE; + } + break; + case COMMAND_ID_DRAW_RECT: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_RECT; + } + break; + case COMMAND_ID_DRAW_ELLIPSE: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_CIRC; + } + break; + case COMMAND_ID_DRAW_FREELINE_NOFILL: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_FREELINE; + } + break; + case COMMAND_ID_DRAW_TEXT: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_TEXT; + bCreate = true; + } + break; + case COMMAND_ID_DRAW_CAPTION: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_CAPTION; + } + break; + case COMMAND_ID_DRAWTBX_CS_BASIC: + case COMMAND_ID_DRAWTBX_CS_SYMBOL: + case COMMAND_ID_DRAWTBX_CS_ARROW: + case COMMAND_ID_DRAWTBX_CS_FLOWCHART: + case COMMAND_ID_DRAWTBX_CS_CALLOUT: + case COMMAND_ID_DRAWTBX_CS_STAR: + { + eDrawMode = CHARTDRAW_INSERT; + eKind = OBJ_CUSTOMSHAPE; + } + break; + default: + { + eDrawMode = CHARTDRAW_SELECT; + eKind = OBJ_NONE; + } + break; + } + + if ( m_pChartController ) + { + DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); + if ( pDrawViewWrapper ) + { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + m_pChartController->setDrawMode( eDrawMode ); + setInsertObj( sal::static_int_cast< USHORT >( eKind ) ); + if ( bCreate ) + { + pDrawViewWrapper->SetCreateMode(); + } + + const ::rtl::OUString sKeyModifier( C2U( "KeyModifier" ) ); + const beans::PropertyValue* pIter = rArgs.getConstArray(); + const beans::PropertyValue* pEnd = pIter + rArgs.getLength(); + const beans::PropertyValue* pKeyModifier = ::std::find_if( + pIter, pEnd, ::std::bind2nd( PropertyValueCompare(), boost::cref( sKeyModifier ) ) ); + sal_Int16 nKeyModifier = 0; + if ( pKeyModifier && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier == KEY_MOD1 ) + { + if ( eDrawMode == CHARTDRAW_INSERT ) + { + SdrObject* pObj = createDefaultObject( nFeatureId ); + if ( pObj ) + { + SdrPageView* pPageView = pDrawViewWrapper->GetSdrPageView(); + pDrawViewWrapper->InsertObjectAtView( pObj, *pPageView ); + Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY ); + if ( xShape.is() ) + { + m_pChartController->m_aSelection.setSelection( xShape ); + m_pChartController->m_aSelection.applySelection( pDrawViewWrapper ); + } + if ( nFeatureId == SID_DRAW_TEXT ) + { + m_pChartController->StartTextEdit(); + } + } + } + } + } + } + } +} + +void DrawCommandDispatch::describeSupportedFeatures() +{ + implDescribeSupportedFeature( ".uno:SelectObject", COMMAND_ID_OBJECT_SELECT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:Line", COMMAND_ID_DRAW_LINE, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:LineArrowEnd", COMMAND_ID_LINE_ARROW_END, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:Rect", COMMAND_ID_DRAW_RECT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:Ellipse", COMMAND_ID_DRAW_ELLIPSE, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:Freeline_Unfilled", COMMAND_ID_DRAW_FREELINE_NOFILL, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:DrawText", COMMAND_ID_DRAW_TEXT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:DrawCaption", COMMAND_ID_DRAW_CAPTION, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:BasicShapes", COMMAND_ID_DRAWTBX_CS_BASIC, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:SymbolShapes", COMMAND_ID_DRAWTBX_CS_SYMBOL, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:ArrowShapes", COMMAND_ID_DRAWTBX_CS_ARROW, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:FlowChartShapes", COMMAND_ID_DRAWTBX_CS_FLOWCHART, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:CalloutShapes", COMMAND_ID_DRAWTBX_CS_CALLOUT, CommandGroup::INSERT ); + implDescribeSupportedFeature( ".uno:StarShapes", COMMAND_ID_DRAWTBX_CS_STAR, CommandGroup::INSERT ); +} + +void DrawCommandDispatch::setInsertObj( USHORT eObj ) +{ + DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL ); + if ( pDrawViewWrapper ) + { + pDrawViewWrapper->SetCurrentObj( eObj /*, Inventor */); + } +} + +SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID ) +{ + SdrObject* pObj = NULL; + DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL ); + DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : NULL ); + + if ( pDrawViewWrapper && pDrawModelWrapper ) + { + Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() ); + SdrPage* pPage = GetSdrPageFromXDrawPage( xDrawPage ); + if ( pPage ) + { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + pObj = SdrObjFactory::MakeNewObject( pDrawViewWrapper->GetCurrentObjInventor(), + pDrawViewWrapper->GetCurrentObjIdentifier(), pPage ); + if ( pObj ) + { + long nDefaultObjectSizeWidth = 4000; + long nDefaultObjectSizeHeight = 2500; + Size aObjectSize( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight ); + Rectangle aPageRect( Rectangle( Point( 0, 0 ), pPage->GetSize() ) ); + Point aObjectPos = aPageRect.Center(); + aObjectPos.X() -= aObjectSize.Width() / 2; + aObjectPos.Y() -= aObjectSize.Height() / 2; + Rectangle aRect( aObjectPos, aObjectSize ); + + switch ( nID ) + { + case COMMAND_ID_DRAW_LINE: + case COMMAND_ID_LINE_ARROW_END: + { + if ( pObj->ISA( SdrPathObj ) ) + { + Point aStart = aRect.TopLeft(); + Point aEnd = aRect.BottomRight(); + sal_Int32 nYMiddle( ( aRect.Top() + aRect.Bottom() ) / 2 ); + basegfx::B2DPolygon aPoly; + aPoly.append( basegfx::B2DPoint( aStart.X(), nYMiddle ) ); + aPoly.append( basegfx::B2DPoint( aEnd.X(), nYMiddle ) ); + ( dynamic_cast< SdrPathObj* >( pObj ) )->SetPathPoly( basegfx::B2DPolyPolygon( aPoly ) ); + SfxItemSet aSet( pDrawModelWrapper->GetItemPool() ); + setLineEnds( aSet ); + pObj->SetMergedItemSet( aSet ); + } + } + break; + case COMMAND_ID_DRAW_FREELINE_NOFILL: + { + if ( pObj->ISA( SdrPathObj ) ) + { + basegfx::B2DPolygon aInnerPoly; + aInnerPoly.append( basegfx::B2DPoint( aRect.Left(), aRect.Bottom() ) ); + aInnerPoly.appendBezierSegment( + basegfx::B2DPoint( aRect.Left(), aRect.Top() ), + basegfx::B2DPoint( aRect.Center().X(), aRect.Top() ), + basegfx::B2DPoint( aRect.Center().X(), aRect.Center().Y() ) ); + aInnerPoly.appendBezierSegment( + basegfx::B2DPoint( aRect.Center().X(), aRect.Bottom() ), + basegfx::B2DPoint( aRect.Right(), aRect.Bottom() ), + basegfx::B2DPoint( aRect.Right(), aRect.Top() ) ); + basegfx::B2DPolyPolygon aPoly; + aPoly.append( aInnerPoly ); + ( dynamic_cast< SdrPathObj* >( pObj ) )->SetPathPoly( aPoly ); + } + } + break; + case COMMAND_ID_DRAW_TEXT: + case COMMAND_ID_DRAW_TEXT_VERTICAL: + { + if ( pObj->ISA( SdrTextObj ) ) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); + if ( pTextObj ) + { + pTextObj->SetLogicRect( aRect ); + BOOL bVertical = ( nID == SID_DRAW_TEXT_VERTICAL ); + pTextObj->SetVerticalWriting( bVertical ); + if ( bVertical ) + { + SfxItemSet aSet( pDrawModelWrapper->GetItemPool() ); + aSet.Put( SdrTextAutoGrowWidthItem( TRUE ) ); + aSet.Put( SdrTextAutoGrowHeightItem( FALSE ) ); + aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_TOP ) ); + aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) ); + pTextObj->SetMergedItemSet( aSet ); + } + } + } + } + break; + case COMMAND_ID_DRAW_CAPTION: + case COMMAND_ID_DRAW_CAPTION_VERTICAL: + { + if ( pObj->ISA( SdrCaptionObj ) ) + { + sal_Bool bIsVertical( SID_DRAW_CAPTION_VERTICAL == nID ); + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); + if ( pTextObj ) + { + pTextObj->SetVerticalWriting( bIsVertical ); + } + if ( bIsVertical ) + { + SfxItemSet aSet( pObj->GetMergedItemSet() ); + aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); + aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) ); + pObj->SetMergedItemSet( aSet ); + } + SdrCaptionObj* pCaptionObj = dynamic_cast< SdrCaptionObj* >( pObj ); + if ( pCaptionObj ) + { + pCaptionObj->SetLogicRect( aRect ); + pCaptionObj->SetTailPos( + aRect.TopLeft() - Point( aRect.GetWidth() / 2, aRect.GetHeight() / 2 ) ); + } + } + } + break; + default: + { + pObj->SetLogicRect( aRect ); + SfxItemSet aSet( pDrawModelWrapper->GetItemPool() ); + setAttributes( pObj ); + pObj->SetMergedItemSet( aSet ); + } + break; + } + } + } + } + + return pObj; +} + +bool DrawCommandDispatch::parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId, + ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType ) +{ + bool bFound = true; + sal_uInt16 nFeatureId = 0; + ::rtl::OUString aBaseCommand; + ::rtl::OUString aType; + + sal_Int32 nIndex = 1; + ::rtl::OUString aToken = rCommandURL.getToken( 0, '.', nIndex ); + if ( nIndex == -1 || !aToken.getLength() ) + { + aBaseCommand = rCommandURL; + SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand ); + if ( aIter != m_aSupportedFeatures.end() ) + { + nFeatureId = aIter->second.nFeatureId; + + switch ( nFeatureId ) + { + case COMMAND_ID_DRAWTBX_CS_BASIC: + { + aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "diamond" ) ); + } + break; + case COMMAND_ID_DRAWTBX_CS_SYMBOL: + { + aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "smiley" ) ); + } + break; + case COMMAND_ID_DRAWTBX_CS_ARROW: + { + aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "left-right-arrow" ) ); + } + break; + case COMMAND_ID_DRAWTBX_CS_FLOWCHART: + { + aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "flowchart-internal-storage" ) ); + } + break; + case COMMAND_ID_DRAWTBX_CS_CALLOUT: + { + aType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "round-rectangular-callout" ) ); + } + break; + case COMMAND_ID_DRAWTBX_CS_STAR: + { + aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "star5" ) ); + } + break; + default: + { + } + break; + } + } + else + { + bFound = false; + } + } + else + { + aBaseCommand = rCommandURL.copy( 0, nIndex - 1 ); + SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand ); + if ( aIter != m_aSupportedFeatures.end() ) + { + nFeatureId = aIter->second.nFeatureId; + aType = rCommandURL.getToken( 0, '.', nIndex ); + } + else + { + bFound = false; + } + } + + *pnFeatureId = nFeatureId; + *pBaseCommand = aBaseCommand; + *pCustomShapeType = aType; + + return bFound; +} + +//............................................................................. +} // namespace chart +//............................................................................. diff --git a/chart2/source/controller/main/DrawCommandDispatch.hrc b/chart2/source/controller/main/DrawCommandDispatch.hrc new file mode 100644 index 000000000000..4e31fafaaf63 --- /dev/null +++ b/chart2/source/controller/main/DrawCommandDispatch.hrc @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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_DRAWCOMMANDDISPATCH_HRC +#define CHART_DRAWCOMMANDDISPATCH_HRC + +//----------------------------------------------------------------------------- +//Command Ids: +#define COMMAND_ID_OBJECT_SELECT 1 +#define COMMAND_ID_DRAW_LINE 2 +#define COMMAND_ID_LINE_ARROW_END 3 +#define COMMAND_ID_DRAW_RECT 4 +#define COMMAND_ID_DRAW_ELLIPSE 5 +#define COMMAND_ID_DRAW_FREELINE_NOFILL 6 +#define COMMAND_ID_DRAW_TEXT 7 +#define COMMAND_ID_DRAW_TEXT_VERTICAL 8 +#define COMMAND_ID_DRAW_CAPTION 9 +#define COMMAND_ID_DRAW_CAPTION_VERTICAL 10 +#define COMMAND_ID_DRAWTBX_CS_BASIC 11 +#define COMMAND_ID_DRAWTBX_CS_SYMBOL 12 +#define COMMAND_ID_DRAWTBX_CS_ARROW 13 +#define COMMAND_ID_DRAWTBX_CS_FLOWCHART 14 +#define COMMAND_ID_DRAWTBX_CS_CALLOUT 15 +#define COMMAND_ID_DRAWTBX_CS_STAR 16 + +// CHART_DRAWCOMMANDDISPATCH_HRC +#endif diff --git a/chart2/source/controller/main/DrawCommandDispatch.hxx b/chart2/source/controller/main/DrawCommandDispatch.hxx new file mode 100644 index 000000000000..38c886e29abb --- /dev/null +++ b/chart2/source/controller/main/DrawCommandDispatch.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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_DRAWCOMMANDDISPATCH_HXX +#define CHART2_DRAWCOMMANDDISPATCH_HXX + +#include "FeatureCommandDispatchBase.hxx" + +#include <tools/solar.h> + +class SfxItemSet; +class SdrObject; + +//............................................................................. +namespace chart +{ +//............................................................................. + +class ChartController; + +/** This is a CommandDispatch implementation for drawing objects. + */ +class DrawCommandDispatch: public FeatureCommandDispatchBase +{ +public: + DrawCommandDispatch( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& rxContext, ChartController* pController ); + virtual ~DrawCommandDispatch(); + + // late initialisation, especially for adding as listener + virtual void initialize(); + + virtual bool isFeatureSupported( const ::rtl::OUString& rCommandURL ); + + void setAttributes( SdrObject* pObj ); + void setLineEnds( SfxItemSet& rAttr ); + +protected: + // WeakComponentImplHelperBase + virtual void SAL_CALL disposing(); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException); + + // state of a feature + virtual FeatureState getState( const ::rtl::OUString& rCommand ); + + // execute a feature + virtual void execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs ); + + // all the features which should be handled by this class + virtual void describeSupportedFeatures(); + +private: + void setInsertObj( USHORT eObj ); + SdrObject* createDefaultObject( const sal_uInt16 nID ); + + bool parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId, ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType ); + + ChartController* m_pChartController; + ::rtl::OUString m_aCustomShapeType; +}; + +//............................................................................. +} // namespace chart +//............................................................................. + +// CHART2_DRAWCOMMANDDISPATCH_HXX +#endif diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index 49a8736bb11b..3b41fd1b6b66 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -34,6 +34,9 @@ #include "ObjectHierarchy.hxx" #include "servicenames.hxx" #include <chartview/ExplicitValueProvider.hxx> +#include "DrawViewWrapper.hxx" +#include "ResId.hxx" +#include "Strings.hrc" #include <toolkit/helper/vclunohelper.hxx> #include <vos/mutex.hxx> @@ -71,20 +74,21 @@ SelectorListBox::~SelectorListBox() { } -void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tCID & rParent, std::vector< ListBoxEntryData >& rEntries +void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tOID & rParent, std::vector< ListBoxEntryData >& rEntries , const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc ) { ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) ); ObjectHierarchy::tChildContainer::const_iterator aIt( aChildren.begin()); while( aIt != aChildren.end() ) { - ::rtl::OUString aCID = *aIt; + ObjectHierarchy::tOID aOID = *aIt; + ::rtl::OUString aCID = aOID.getObjectCID(); ListBoxEntryData aEntry; - aEntry.CID = aCID; + aEntry.OID = aOID; aEntry.UIName += ObjectNameProvider::getNameForCID( aCID, xChartDoc ); aEntry.nHierarchyDepth = nHierarchyDepth; rEntries.push_back(aEntry); - lcl_addObjectsToList( rHierarchy, aCID, rEntries, nHierarchyDepth+1, xChartDoc ); + lcl_addObjectsToList( rHierarchy, aOID, rEntries, nHierarchyDepth+1, xChartDoc ); ++aIt; } } @@ -103,14 +107,18 @@ void SelectorListBox::UpdateChartElementsListAndSelection() if( xChartController.is() ) { Reference< view::XSelectionSup |