diff options
-rw-r--r-- | sc/source/core/tool/charthelper.cxx | 152 | ||||
-rw-r--r-- | sc/source/filter/xcl97/xcl97rec.cxx | 75 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 7 | ||||
-rw-r--r-- | sc/util/makefile.mk | 3 |
4 files changed, 228 insertions, 9 deletions
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx index 223d89806..d7c4d7fd7 100644 --- a/sc/source/core/tool/charthelper.cxx +++ b/sc/source/core/tool/charthelper.cxx @@ -286,4 +286,156 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument xModel->unlockControllers(); } +void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrObject* pObject ) +{ + if ( pDocument && pObject && ( pObject->GetObjIdentifier() == OBJ_OLE2 ) ) + { + SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject ); + if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() ) + { + uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = pSdrOle2Obj->GetObjRef(); + if ( xEmbeddedObj.is() ) + { + bool bDisableDataTableDialog = false; + svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj ); + uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY ); + if ( xProps.is() && + ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) && + bDisableDataTableDialog ) + { + ::rtl::OUString aChartName = pSdrOle2Obj->GetPersistName(); + ScRange aEmptyRange; + ScChartListener aSearcher( aChartName, pDocument, aEmptyRange ); + USHORT nIndex = 0; + ScChartListenerCollection* pCollection = pDocument->GetChartListenerCollection(); + if ( pCollection && pCollection->Search( &aSearcher, nIndex ) ) + { + ScChartListener* pListener = static_cast< ScChartListener* >( pCollection->At( nIndex ) ); + if ( pListener ) + { + const ScRangeListRef& rRangeList = pListener->GetRangeList(); + if ( rRangeList.Is() ) + { + rRangesVector.push_back( *rRangeList ); + } + } + } + } + } + } + } +} + +void ScChartHelper::FillProtectedChartRangesVector( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrPage* pPage ) +{ + if ( pDocument && pPage ) + { + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + SdrObject* pObject = aIter.Next(); + while ( pObject ) + { + AddRangesIfProtectedChart( rRangesVector, pDocument, pObject ); + pObject = aIter.Next(); + } + } +} + +void ScChartHelper::GetChartNames( ::std::vector< ::rtl::OUString >& rChartNames, SdrPage* pPage ) +{ + if ( pPage ) + { + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + SdrObject* pObject = aIter.Next(); + while ( pObject ) + { + if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) + { + SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject ); + if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() ) + { + rChartNames.push_back( pSdrOle2Obj->GetPersistName() ); + } + } + pObject = aIter.Next(); + } + } +} + +void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab, + const ScRangeListVector& rRangesVector, const ::std::vector< ::rtl::OUString >& rExcludedChartNames, bool bSameDoc ) +{ + if ( pDoc && pPage && pModelObj ) + { + size_t nRangeListCount = rRangesVector.size(); + size_t nRangeList = 0; + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + SdrObject* pObject = aIter.Next(); + while ( pObject ) + { + if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) + { + SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject ); + if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() ) + { + ::rtl::OUString aChartName = pSdrOle2Obj->GetPersistName(); + ::std::vector< ::rtl::OUString >::const_iterator aEnd = rExcludedChartNames.end(); + ::std::vector< ::rtl::OUString >::const_iterator aFound = ::std::find( rExcludedChartNames.begin(), aEnd, aChartName ); + if ( aFound == aEnd ) + { + uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = pSdrOle2Obj->GetObjRef(); + if ( xEmbeddedObj.is() && ( nRangeList < nRangeListCount ) ) + { + bool bDisableDataTableDialog = false; + svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj ); + uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY ); + if ( xProps.is() && + ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) && + bDisableDataTableDialog ) + { + if ( bSameDoc ) + { + ScRange aEmptyRange; + ScChartListener aSearcher( aChartName, pDoc, aEmptyRange ); + USHORT nIndex = 0; + ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection(); + if ( pCollection && !pCollection->Search( &aSearcher, nIndex ) ) + { + ScRangeList aRangeList( rRangesVector[ nRangeList++ ] ); + ScRangeListRef rRangeList( new ScRangeList( aRangeList ) ); + ScChartListener* pChartListener = new ScChartListener( aChartName, pDoc, rRangeList ); + pCollection->Insert( pChartListener ); + pChartListener->StartListeningTo(); + } + } + else + { + xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ), + uno::makeAny( sal_False ) ); + xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableComplexChartTypes" ) ), + uno::makeAny( sal_False ) ); + } + } + } + + if ( pModelObj && pModelObj->HasChangesListeners() ) + { + Rectangle aRectangle = pSdrOle2Obj->GetSnapRect(); + ScRange aRange( pDoc->GetRange( nTab, aRectangle ) ); + ScRangeList aChangeRanges; + aChangeRanges.Append( aRange ); + + uno::Sequence< beans::PropertyValue > aProperties( 1 ); + aProperties[ 0 ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ); + aProperties[ 0 ].Value <<= aChartName; + + pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert-chart" ) ), aChangeRanges, aProperties ); + } + } + } + } + pObject = aIter.Next(); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 4e499f417..50f49fc56 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -523,6 +523,81 @@ void XclObjComment::Save( XclExpStream& rStrm ) XclObj::Save( rStrm ); } +class VmlCommentExporter : public VMLExport +{ + ScAddress maScPos; + SdrCaptionObj* mpCaption; + bool mbVisible; + Rectangle maFrom; + Rectangle maTo; + +public: + VmlCommentExporter ( sax_fastparser::FSHelperPtr p, ScAddress aScPos, SdrCaptionObj* pCaption, bool bVisible, Rectangle &aFrom, Rectangle &aTo ); +protected: + virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); + virtual sal_Int32 StartShape(); + virtual void EndShape( sal_Int32 nShapeElement ); +}; + + +VmlCommentExporter::VmlCommentExporter( sax_fastparser::FSHelperPtr p, ScAddress aScPos, SdrCaptionObj* pCaption, + bool bVisible, Rectangle &aFrom, Rectangle &aTo ) + : VMLExport( p ) + , maScPos( aScPos ) + , mpCaption( pCaption ) + , mbVisible( bVisible ) + , maFrom ( aFrom ) + , maTo ( aTo ) +{ +} + +void VmlCommentExporter::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ) +{ + lcl_FillProps( rProps, mpCaption, mbVisible ); + rProps.AddOpt( ESCHER_Prop_fHidden, 1 ); // bool field + + VMLExport::Commit( rProps, rRect ); +} + +sal_Int32 VmlCommentExporter::StartShape() +{ + AddShapeAttribute( XML_type, OString( "#_x0000_t202") ); + + sal_Int32 nId = VMLExport::StartShape(); + + return nId; +} + +void VmlCommentExporter::EndShape( sal_Int32 nShapeElement ) +{ + char pAnchor[100]; + sax_fastparser::FSHelperPtr pVmlDrawing = GetFS(); + snprintf( pAnchor, 100, "%ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld", + maFrom.Left(), maFrom.Top(), maFrom.Right(), maFrom.Bottom(), + maTo.Left(), maTo.Top(), maTo.Right(), maTo.Bottom() ); + + pVmlDrawing->startElement( FSNS( XML_x, XML_ClientData ), + XML_ObjectType, "Note", + FSEND ); + pVmlDrawing->singleElement( FSNS( XML_x, XML_MoveWithCells ), + FSEND ); + pVmlDrawing->singleElement( FSNS( XML_x, XML_SizeWithCells ), + FSEND ); + XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Anchor ), pAnchor ); + XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_AutoFill ), "False" ); + XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Row ), maScPos.Row() ); + XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Column ), sal_Int32( maScPos.Col() ) ); + pVmlDrawing->endElement( FSNS( XML_x, XML_ClientData ) ); + + VMLExport::EndShape( nShapeElement ); +} + +void XclObjComment::SaveXml( XclExpXmlStream& rStrm ) +{ + VmlCommentExporter aCommentExporter( rStrm.GetCurrentStream(), maScPos, mpCaption.get(), mbVisible, maFrom, maTo ); + aCommentExporter.AddSdrObject( *mpCaption ); +} + // --- class XclObjDropDown ------------------------------------------ XclObjDropDown::XclObjDropDown( XclExpObjectManager& rObjMgr, const ScAddress& rPos, BOOL bFilt ) : diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index b198c0e13..21df8bc2a 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -548,13 +548,6 @@ public: const rtl::OString& sHelpId , int nId ); - virtual AbstractScTabBgColorDlg * CreateScTabBgColorDlg ( Window* pParent, //add for ScStringInputDlg - const String& rTitle, //Dialog Title - const String& rTabBgColorNoColorText, //Label for no tab color - const Color& rDefaultColor, //Currently selected Color - ULONG nHelpId , - int nId ); - virtual AbstractScImportOptionsDlg * CreateScImportOptionsDlg ( Window* pParent, //add for ScImportOptionsDlg int nId, BOOL bAscii = TRUE, diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk index 0929a575c..3b75037ce 100644 --- a/sc/util/makefile.mk +++ b/sc/util/makefile.mk @@ -50,8 +50,7 @@ RESLIB1LIST=\ $(SRS)$/formdlgs.srs \ $(SRS)$/pagedlg.srs \ $(SRS)$/navipi.srs \ - $(SRS)$/cctrl.srs \ - $(SOLARCOMMONRESDIR)$/sfx.srs + $(SRS)$/cctrl.srs RESLIB1NAME=sc RESLIB1IMAGES=\ |