Tag: cws_dev300_rptchart02 User: oj Date: 2008-04-30 13:03:38+0000 Modified: dba/reportdesign/source/core/api/Shape.cxx dba/reportdesign/source/core/sdr/RptObject.cxx dba/reportdesign/source/ui/inc/InsertFunctions.hxx dba/reportdesign/source/ui/report/InsertFunctions.cxx dba/reportdesign/source/ui/report/ReportSection.cxx dba/reportdesign/source/ui/report/ViewsWindow.cxx dba/reportdesign/source/ui/report/dlgedfunc.cxx
Log: #i88843# impl clone method File Changes: Directory: /dba/reportdesign/source/core/api/ ============================================= File [changed]: Shape.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/api/Shape.cxx?r1=1.4.4.2&r2=1.4.4.3 Delta lines: +35 -23 --------------------- --- Shape.cxx 2008-04-16 06:28:00+0000 1.4.4.2 +++ Shape.cxx 2008-04-30 13:03:34+0000 1.4.4.3 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: Shape.cxx,v $ - * $Revision: 1.4.4.2 $ + * $Revision: 1.4.4.3 $ * * This file is part of OpenOffice.org. * @@ -28,22 +28,25 @@ * ************************************************************************/ #include "Shape.hxx" + +#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> -#include "corestrings.hrc" #include <com/sun/star/beans/XPropertyState.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include "core_resource.hrc" -#include "core_resource.hxx" +#include <com/sun/star/text/ParagraphVertAlign.hpp> +#include <comphelper/property.hxx> #include <comphelper/sequence.hxx> #include <tools/debug.hxx> -#include <comphelper/property.hxx> +#include <tools/diagnose_ex.h> +#include <boost/bind.hpp> +#include <svx/unoshape.hxx> + +#include "corestrings.hrc" +#include "core_resource.hrc" +#include "core_resource.hxx" #include "Tools.hxx" #include "RptObject.hxx" #include "FormatCondition.hxx" -#include <com/sun/star/text/ParagraphVertAlign.hpp> #include "ReportHelperImpl.hxx" -#include <boost/bind.hpp> -#include <svx/unoshape.hxx> // ============================================================================= namespace reportdesign { @@ -311,6 +314,8 @@ { uno::Reference< report::XReportComponent> xSource = this; uno::Reference< report::XReportComponent> xSet; + try + { SvxShape* pShape = SvxShape::getImplementation( xSource ); if ( pShape ) { @@ -321,8 +326,15 @@ if ( pClone ) { xSet.set(pClone->getUnoShape(),uno::UNO_QUERY_THROW ); + + // ::comphelper::copyProperties(xSource.get(),xSet.get()); } } + } // if ( pShape ) + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION(); } return xSet.get(); } Directory: /dba/reportdesign/source/core/sdr/ ============================================= File [changed]: RptObject.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/sdr/RptObject.cxx?r1=1.7.4.3&r2=1.7.4.4 Delta lines: +92 -10 --------------------- --- RptObject.cxx 2008-04-16 06:28:15+0000 1.7.4.3 +++ RptObject.cxx 2008-04-30 13:03:34+0000 1.7.4.4 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: RptObject.cxx,v $ - * $Revision: 1.7.4.3 $ + * $Revision: 1.7.4.4 $ * * This file is part of OpenOffice.org. * @@ -32,9 +32,6 @@ #include <vector> #include <algorithm> -#ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC -#include "corestrings.hrc" -#endif #include <RptDef.hxx> #include <svx/unoshape.hxx> #include "RptModel.hxx" @@ -42,15 +39,11 @@ #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/convert.hxx> #include "RptPage.hxx" -#ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC #include "corestrings.hrc" -#endif #include <dbaccess/singledoccontroller.hxx> #include "ModuleHelper.hxx" -#ifndef _REPORT_DLGRESID_HRC #include <RptResId.hrc> -#endif #include <svx/xflclit.hxx> #include <svx/xlnclit.hxx> #include <svx/xlndsit.hxx> @@ -65,13 +58,18 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> -#include <comphelper/genericpropertyset.hxx> #include <com/sun/star/script/XScriptEventsSupplier.hpp> #include <com/sun/star/container/XContainer.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/report/XShape.hpp> #include <com/sun/star/report/XFixedLine.hpp> +#include <com/sun/star/chart/ChartDataRowSource.hpp> +#include <com/sun/star/chart2/data/XDataReceiver.hpp> +#include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <comphelper/genericpropertyset.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/property.hxx> #include "PropertyForward.hxx" #include <connectivity/dbtools.hxx> #include "UndoActions.hxx" @@ -812,6 +810,19 @@ { return OObjectBase::getUnoShapeOf( *this ); } +// ----------------------------------------------------------------------------- +SdrObject* OUnoObject::Clone() const +{ + SdrObject* pClone = SdrUnoObj::Clone(); + if ( pClone ) + { + Reference<XPropertySet> xSource(const_cast<OUnoObject*>(this)->getUnoShape(),uno::UNO_QUERY); + Reference<XPropertySet> xDest(pClone->getUnoShape(),uno::UNO_QUERY); + if ( xSource.is() && xDest.is() ) + comphelper::copyProperties(xSource.get(),xDest.get()); + } // if ( pClone ) + return pClone; +} //---------------------------------------------------------------------------- // OOle2Obj //---------------------------------------------------------------------------- @@ -992,6 +1003,77 @@ return xShape; } // ----------------------------------------------------------------------------- +uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider(const uno::Reference < embed::XEmbeddedObject >& _xObj) +{ + uno::Reference< chart2::data::XDatabaseDataProvider > xSource; + uno::Reference< embed::XComponentSupplier > xCompSupp(_xObj,uno::UNO_QUERY); + if( xCompSupp.is()) + { + uno::Reference< chart2::XChartDocument> xChartDoc( xCompSupp->getComponent(), uno::UNO_QUERY ); + if ( xChartDoc.is() ) + { + xSource.set(xChartDoc->getDataProvider(),uno::UNO_QUERY); + } + } // if( xCompSupp.is()) + return xSource; +} +// ----------------------------------------------------------------------------- +// Clone() soll eine komplette Kopie des Objektes erzeugen. +SdrObject* OOle2Obj::Clone() const +{ + OOle2Obj* pObj = static_cast<OOle2Obj*>(SdrOle2Obj::Clone()); + OReportModel* pRptModel = static_cast<OReportModel*>(GetModel()); + svt::EmbeddedObjectRef::TryRunningState( pObj->GetObjRef() ); + pObj->initializeChart(pRptModel->getReportDefinition().get()); + uno::Reference< chart2::data::XDatabaseDataProvider > xSource( lcl_getDataProvider(GetObjRef()) ); + uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(pObj->GetObjRef()) ); + if ( xSource.is() && xDest.is() ) + comphelper::copyProperties(xSource.get(),xDest.get()); + return pObj; +} +// ----------------------------------------------------------------------------- +void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel) +{ + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + uno::Reference< chart2::data::XDataReceiver > xReceiver; + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); + if( xCompSupp.is()) + xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); + OSL_ASSERT( xReceiver.is()); + if( xReceiver.is() ) + { + // lock the model to suppress any internal updates + uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY ); + if( xChartModel.is() ) + xChartModel->lockControllers(); + + uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY_THROW); + uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY); + xReceiver->attachDataProvider( xDataProvider.get() ); + + uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( _xModel, uno::UNO_QUERY ); + xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); + + uno::Sequence< beans::PropertyValue > aArgs( 4 ); + aArgs[0] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1, + uno::makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("all")) ), beans::PropertyState_DIRECT_VALUE ); + aArgs[1] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("HasCategories"), -1, + uno::makeAny( sal_True ), beans::PropertyState_DIRECT_VALUE ); + aArgs[2] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1, + uno::makeAny( sal_False ), beans::PropertyState_DIRECT_VALUE ); + aArgs[3] = beans::PropertyValue( + ::rtl::OUString::createFromAscii("DataRowSource"), -1, + uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE ); + xReceiver->setArguments( aArgs ); + + if( xChartModel.is() ) + xChartModel->unlockControllers(); + } +} +// ----------------------------------------------------------------------------- uno::Reference< style::XStyle> getUsedStyle(const uno::Reference< report::XReportDefinition>& _xReport) { uno::Reference<container::XNameAccess> xStyles = _xReport->getStyleFamilies(); Directory: /dba/reportdesign/source/ui/inc/ =========================================== File [changed]: InsertFunctions.hxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/inc/InsertFunctions.hxx?r1=1.3&r2=1.3.2.1 Delta lines: +2 -4 ------------------- --- InsertFunctions.hxx 2008-04-10 19:02:10+0000 1.3 +++ InsertFunctions.hxx 2008-04-30 13:03:35+0000 1.3.2.1 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: InsertFunctions.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.2.1 $ * * This file is part of OpenOffice.org. * @@ -42,8 +42,6 @@ namespace rptui { /************************************************************************/ - void InitializeChart( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel, - const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj); // --------- } // namespace rptui // --------- Directory: /dba/reportdesign/source/ui/report/ ============================================== File [changed]: InsertFunctions.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/InsertFunctions.cxx?r1=1.2.4.2&r2=1.2.4.3 Delta lines: +2 -89 -------------------- --- InsertFunctions.cxx 2008-04-16 06:30:23+0000 1.2.4.2 +++ InsertFunctions.cxx 2008-04-30 13:03:35+0000 1.2.4.3 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: InsertFunctions.cxx,v $ - * $Revision: 1.2.4.2 $ + * $Revision: 1.2.4.3 $ * * This file is part of OpenOffice.org. * @@ -82,93 +82,6 @@ namespace rptui { //------------------------------------------------------------------------ -void InitializeChart( const uno::Reference< frame::XModel>& _xModel, - const uno::Reference < embed::XEmbeddedObject >& xObj) -{ - //ScDocShell* pDocShell = pViewData->GetDocShell(); - //ScDocument* pScDoc = pDocShell->GetDocument(); - - //rtl::OUString aRangeString( rRangeParam ); - //if ( !aRangeString.getLength() ) - //{ - // SCCOL nCol1 = 0; - // SCROW nRow1 = 0; - // SCTAB nTab1 = 0; - // SCCOL nCol2 = 0; - // SCROW nRow2 = 0; - // SCTAB nTab2 = 0; - - // ScMarkData& rMark = pViewData->GetMarkData(); - // if ( !rMark.IsMarked() ) - // pViewData->GetView()->MarkDataArea( TRUE ); - - // if ( pViewData->GetSimpleArea( nCol1,nRow1,nTab1, nCol2,nRow2,nTab2 ) ) - // { - // PutInOrder( nCol1, nCol2 ); - // PutInOrder( nRow1, nRow2 ); - // if ( nCol2>nCol1 || nRow2>nRow1 ) - // { - // ScDocument* pDoc = pViewData->GetDocument(); - // pDoc->LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 ); - - // String aStr; - // ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); - // aRange.Format( aStr, SCR_ABS_3D, pScDoc ); - // aRangeString = aStr; - // } - // } - //} - - //if ( rRangeParam.getLength() ) - { - // connect to Calc data (if no range string, leave chart alone, with its own data) - - uno::Reference< chart2::data::XDataReceiver > xReceiver; - uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); - if( xCompSupp.is()) - xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); - OSL_ASSERT( xReceiver.is()); - if( xReceiver.is() ) - { - // lock the model to suppress any internal updates - uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY ); - if( xChartModel.is() ) - xChartModel->lockControllers(); - - uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY_THROW); - uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY); - xReceiver->attachDataProvider( xDataProvider.get() ); - - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( _xModel, uno::UNO_QUERY ); - xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); - - uno::Sequence< beans::PropertyValue > aArgs( 4 ); - aArgs[0] = beans::PropertyValue( - ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1, - uno::makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("all")) ), beans::PropertyState_DIRECT_VALUE ); - aArgs[1] = beans::PropertyValue( - ::rtl::OUString::createFromAscii("HasCategories"), -1, - uno::makeAny( sal_True ), beans::PropertyState_DIRECT_VALUE ); - aArgs[2] = beans::PropertyValue( - ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1, - uno::makeAny( sal_False ), beans::PropertyState_DIRECT_VALUE ); - aArgs[3] = beans::PropertyValue( - ::rtl::OUString::createFromAscii("DataRowSource"), -1, - uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE ); - xReceiver->setArguments( aArgs ); - - if( xChartModel.is() ) - xChartModel->unlockControllers(); - - //uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY ); - // if ( xPersist.is() ) - // { - // xPersist->storeOwn(); - // xPersist->saveCompleted( sal_True ); - // } - } - } -} // ----------------------------------------------------------------------------- } // namespace rptui // ----------------------------------------------------------------------------- File [changed]: ReportSection.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/ReportSection.cxx?r1=1.8.4.5&r2=1.8.4.6 Delta lines: +3 -3 ------------------- --- ReportSection.cxx 2008-04-16 06:30:36+0000 1.8.4.5 +++ ReportSection.cxx 2008-04-30 13:03:35+0000 1.8.4.6 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ReportSection.cxx,v $ - * $Revision: 1.8.4.5 $ + * $Revision: 1.8.4.6 $ * * This file is part of OpenOffice.org. * File [changed]: ViewsWindow.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/ViewsWindow.cxx?r1=1.7.22.3&r2=1.7.22.4 Delta lines: +4 -4 ------------------- --- ViewsWindow.cxx 2008-04-16 06:30:52+0000 1.7.22.3 +++ ViewsWindow.cxx 2008-04-30 13:03:35+0000 1.7.22.4 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ViewsWindow.cxx,v $ - * $Revision: 1.7.22.3 $ + * $Revision: 1.7.22.4 $ * * This file is part of OpenOffice.org. * @@ -1502,7 +1502,8 @@ } else pInSection->EndDragObj(FALSE); - } + } // for (; aIter != aEnd; ++aIter) + if ( aAllreadyCopiedObjects.getLength() ) { beans::NamedValue* pIter = aAllreadyCopiedObjects.getArray(); @@ -1854,4 +1855,3 @@ //============================================================================== } // rptui //============================================================================== - File [changed]: dlgedfunc.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/report/dlgedfunc.cxx?r1=1.7.4.4&r2=1.7.4.5 Delta lines: +14 -13 --------------------- --- dlgedfunc.cxx 2008-04-16 06:30:59+0000 1.7.4.4 +++ dlgedfunc.cxx 2008-04-30 13:03:35+0000 1.7.4.5 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dlgedfunc.cxx,v $ - * $Revision: 1.7.4.4 $ + * $Revision: 1.7.4.5 $ * * This file is part of OpenOffice.org. * @@ -29,19 +29,24 @@ ************************************************************************/ #include "precompiled_reportdesign.hxx" #include <vcl/scrbar.hxx> -#include <svx/svdview.hxx> -#include <svx/svdpagv.hxx> -#include <svx/outlobj.hxx> #include <vcl/svapp.hxx> -#include <svx/unolingu.hxx> +#include <vcl/seleng.hxx> #include <com/sun/star/linguistic2/XSpellChecker1.hpp> #include <com/sun/star/embed/EmbedStates.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <svx/svdview.hxx> +#include <svx/svdpagv.hxx> +#include <svx/outlobj.hxx> +#include <svx/unolingu.hxx> #include <svx/svdetc.hxx> #include <svx/editstat.hxx> #include <svx/svdoutl.hxx> #include <svx/svddrgmt.hxx> #include <svx/svdoashp.hxx> +#include <svx/svxids.hrc> +#include <svx/svditer.hxx> + #include <toolkit/helper/vclunohelper.hxx> #include "dlgedfunc.hxx" @@ -53,18 +58,14 @@ #include "ReportWindow.hxx" #include "RptObject.hxx" #include "ScrollHelper.hxx" -#include <vcl/seleng.hxx> + #include "ReportRuler.hxx" #include "UITools.hxx" -#include <svx/svxids.hrc> -#include <svx/svditer.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> + #include <uistrings.hrc> #include "UndoEnv.hxx" #include <RptModel.hxx> #include <tools/diagnose_ex.h> -#include "InsertFunctions.hxx" #define DEFAUL_MOVE_SIZE 100 namespace rptui @@ -738,7 +739,7 @@ OOle2Obj* pObj = dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj()); if ( pObj && !pObj->IsEmpty() ) { - InitializeChart(pController->getModel(),pObj->GetObjRef()); + pObj->initializeChart(pController->getModel()); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
