diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-01-28 11:44:02 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-01-28 11:44:02 +0100 |
commit | 3f3ec2b85f8f5b828cb4af4d045d11c979c71110 (patch) | |
tree | 6710f08b75ced64832df2965cacf572a188199fc /sc | |
parent | d1959d69204893ee006c14dcb6f389e4dfe15449 (diff) | |
parent | 6f68642b7b2310b902264849a5ffc5dca6c15510 (diff) |
undoapi: pulled and merged DEV300.m98
Diffstat (limited to 'sc')
80 files changed, 685 insertions, 884 deletions
diff --git a/sc/inc/addruno.hxx b/sc/inc/addruno.hxx index d6df571a29aa..6e71230b21d4 100644 --- a/sc/inc/addruno.hxx +++ b/sc/inc/addruno.hxx @@ -47,7 +47,7 @@ private: sal_Int32 nRefSheet; sal_Bool bIsRange; - sal_Bool ParseUIString( const String& rUIString ); + sal_Bool ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv = ::formula::FormulaGrammar::CONV_OOO ); public: diff --git a/sc/inc/charthelper.hxx b/sc/inc/charthelper.hxx index 50b8586bdace..7966e07d00f8 100644 --- a/sc/inc/charthelper.hxx +++ b/sc/inc/charthelper.hxx @@ -31,10 +31,15 @@ #include <tools/solar.h> #include "address.hxx" #include "global.hxx" +#include "rangelst.hxx" #include <com/sun/star/chart2/XChartDocument.hpp> class SdrObject; +class SdrPage; +class ScModelObj; + +typedef ::std::vector< ScRangeList > ScRangeListVector; /** Use this to handle charts in a calc document */ @@ -49,6 +54,12 @@ public: ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges ); static void SetChartRanges( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, const ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges ); + + static void AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrObject* pObject ); + static void FillProtectedChartRangesVector( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrPage* pPage ); + static void GetChartNames( ::std::vector< ::rtl::OUString >& rChartNames, SdrPage* pPage ); + static void CreateProtectedChartListenersAndNotify( ScDocument* pDoc, SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab, + const ScRangeListVector& rRangesVector, const ::std::vector< ::rtl::OUString >& rExcludedChartNames, bool bSameDoc = true ); }; #endif diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx index 78b5474229d1..ce2d4ef30f46 100644 --- a/sc/inc/clipparam.hxx +++ b/sc/inc/clipparam.hxx @@ -30,6 +30,7 @@ #include "rangelst.hxx" #include "rangenam.hxx" +#include "charthelper.hxx" #include <vector> @@ -41,9 +42,11 @@ struct ScClipParam { enum Direction { Unspecified, Column, Row }; - ScRangeList maRanges; - Direction meDirection; - bool mbCutMode; + ScRangeList maRanges; + Direction meDirection; + bool mbCutMode; + sal_uInt32 mnSourceDocID; + ScRangeListVector maProtectedChartRangesVector; ScClipParam(); ScClipParam(const ScRange& rRange, bool bCutMode); @@ -70,6 +73,9 @@ struct ScClipParam ScRange getWholeRange() const; void transpose(); + + sal_uInt32 getSourceDocID() const { return mnSourceDocID; } + void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; } }; // ============================================================================ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 90aac02aab7f..8fe7425bf759 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1513,6 +1513,8 @@ public: BOOL ContinueOnlineSpelling(); // TRUE = etwas gefunden + void RepaintRange( const ScRange& rRange ); + BOOL IsIdleDisabled() const { return bIdleDisabled; } void DisableIdle(BOOL bDo) { bIdleDisabled = bDo; } diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 92424e8178f4..0e37ceb40b06 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -135,6 +135,8 @@ public: void AfterXMLLoading(sal_Bool bRet); ScSheetSaveData* GetSheetSaveData(); + void RepaintRange( const ScRange& rRange ); + bool HasChangesListeners() const; void NotifyChanges( const ::rtl::OUString& rOperation, const ScRangeList& rRanges, diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx index eebd808c30a4..6b79f88f4263 100644 --- a/sc/inc/fmtuno.hxx +++ b/sc/inc/fmtuno.hxx @@ -95,7 +95,6 @@ public: void FillFormat( ScConditionalFormat& rFormat, ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar) const; - void DataChanged(); // XSheetConditionalEntries virtual void SAL_CALL addNew( const ::com::sun::star::uno::Sequence< @@ -157,13 +156,11 @@ class ScTableConditionalEntry : public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo > { private: - ScTableConditionalFormat* pParent; ScCondFormatEntryItem aData; ScTableConditionalEntry(); // disabled public: - ScTableConditionalEntry(ScTableConditionalFormat* pPar, - const ScCondFormatEntryItem& aItem); + ScTableConditionalEntry(const ScCondFormatEntryItem& aItem); virtual ~ScTableConditionalEntry(); void GetData(ScCondFormatEntryItem& rData) const; @@ -241,7 +238,6 @@ public: ScValidationData* CreateValidationData( ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar ) const; - void DataChanged(); // XSheetCondition virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator() diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx index 048d7b638d57..e90a8c46b6a3 100644..100755 --- a/sc/inc/pch/precompiled_sc.hxx +++ b/sc/inc/pch/precompiled_sc.hxx @@ -218,7 +218,7 @@ #include <vcl/dndhelp.hxx> #include <vcl/edit.hxx> #include <vcl/field.hxx> -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> #include <vcl/gdimtf.hxx> #include <vcl/inputctx.hxx> #include <vcl/jobset.hxx> @@ -235,7 +235,7 @@ #include <vcl/svapp.hxx> #include <vcl/vclevent.hxx> #include <vcl/window.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vos/macros.hxx> #include <vos/object.hxx> #include <vos/types.hxx> diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 159da72a34d2..b38bec784b54 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -928,7 +928,6 @@ #define STR_REPLCELLSWARN (STR_START + 91) #define SCSTR_DPFUNCLISTBOX (STR_START + 92) -#define STR_PRINT_NOTHING (STR_START + 93) #define SCSTR_ALLFILTER (STR_START + 94) #define SCSTR_MOREBTN_MOREOPTIONS (STR_START + 95) #define SCSTR_MOREBTN_FEWEROPTIONS (STR_START + 96) diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 1e56743d8129..a9c08c2884fd 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -528,6 +528,7 @@ #define SC_UNO_ZOOMTYPE "ZoomType" #define SC_UNO_ZOOMVALUE "ZoomValue" #define SC_UNO_UPDTEMPL "UpdateFromTemplate" +#define SC_UNO_VISAREASCREEN "VisibleAreaOnScreen" /*Stampit enable/disable print cancel */ #define SC_UNO_ALLOWPRINTJOBCANCEL "AllowPrintJobCancel" @@ -610,6 +611,7 @@ #define SC_UNONAME_ADDRESS "Address" #define SC_UNONAME_UIREPR "UserInterfaceRepresentation" #define SC_UNONAME_PERSREPR "PersistentRepresentation" +#define SC_UNONAME_XLA1REPR "XLA1Representation" #define SC_UNONAME_REFSHEET "ReferenceSheet" // --> PB 2004-08-23 #i33095# Security Options diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx index 9ab5995ca26c..352c599e54bb 100644 --- a/sc/source/core/data/clipparam.cxx +++ b/sc/source/core/data/clipparam.cxx @@ -36,13 +36,15 @@ using ::std::vector; ScClipParam::ScClipParam() : meDirection(Unspecified), - mbCutMode(false) + mbCutMode(false), + mnSourceDocID(0) { } ScClipParam::ScClipParam(const ScRange& rRange, bool bCutMode) : meDirection(Unspecified), - mbCutMode(bCutMode) + mbCutMode(bCutMode), + mnSourceDocID(0) { maRanges.Append(rRange); } @@ -50,7 +52,9 @@ ScClipParam::ScClipParam(const ScRange& rRange, bool bCutMode) : ScClipParam::ScClipParam(const ScClipParam& r) : maRanges(r.maRanges), meDirection(r.meDirection), - mbCutMode(r.mbCutMode) + mbCutMode(r.mbCutMode), + mnSourceDocID(r.mnSourceDocID), + maProtectedChartRangesVector(r.maProtectedChartRangesVector) { } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index b08838198477..3fff9faf2105 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1432,7 +1432,7 @@ void ScConditionalFormat::DoRepaint( const ScRange* pModified ) } } - pSh->Broadcast( ScPaintHint( aRange, PAINT_GRID ) ); + pDoc->RepaintRange( aRange ); } } } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index f3b3f1ab32c6..b64babdf2dd7 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -169,8 +169,7 @@ void ScDocument::SetDBCollection( ScDBCollection* pNewDBCollection, BOOL bRemove RemoveFlagsTab( aOldRange.aStart.Col(), aOldRange.aStart.Row(), aOldRange.aEnd.Col(), aOldRange.aEnd.Row(), aOldRange.aStart.Tab(), SC_MF_AUTO ); - if (pShell) - pShell->Broadcast( ScPaintHint( aOldRange, PAINT_GRID ) ); + RepaintRange( aOldRange ); } } } diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index d86d174ab414..303dbd2ccae3 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -469,9 +469,12 @@ void ScDocument::UpdateChart( const String& rChartName ) } // After the update, chart keeps track of its own data source ranges, - // the listener doesn't need to listen anymore. - if(pChartListenerCollection) + // the listener doesn't need to listen anymore, except the chart has + // an internal data provider. + if ( !( xChartDoc.is() && xChartDoc->hasInternalDataProvider() ) && pChartListenerCollection ) + { pChartListenerCollection->ChangeListening( rChartName, new ScRangeList ); + } } void ScDocument::RestoreChartListener( const String& rName ) @@ -579,9 +582,28 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode, svt::EmbeddedObjectRef::TryRunningState( xIPObj ); // After the change, chart keeps track of its own data source ranges, - // the listener doesn't need to listen anymore. - - pChartListener->ChangeListening( new ScRangeList, bDataChanged ); + // the listener doesn't need to listen anymore, except the chart has + // an internal data provider. + bool bInternalDataProvider = false; + if ( xIPObj.is() ) + { + try + { + uno::Reference< chart2::XChartDocument > xChartDoc( xIPObj->getComponent(), uno::UNO_QUERY_THROW ); + bInternalDataProvider = xChartDoc->hasInternalDataProvider(); + } + catch ( uno::Exception& ) + { + } + } + if ( bInternalDataProvider ) + { + pChartListener->ChangeListening( aNewRLR, bDataChanged ); + } + else + { + pChartListener->ChangeListening( new ScRangeList, bDataChanged ); + } } } } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index e3c9d251fab7..9eb4bad7466d 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -94,6 +94,7 @@ #include "sc.hrc" #include "charthelper.hxx" #include "dpobject.hxx" +#include "docuno.hxx" #define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue() @@ -902,6 +903,16 @@ void ScDocument::RemoveAutoSpellObj() pTab[nTab]->RemoveAutoSpellObj(); } +void ScDocument::RepaintRange( const ScRange& rRange ) +{ + if ( bIsVisible && pShell ) + { + ScModelObj* pModel = ScModelObj::getImplementation( pShell->GetModel() ); + if ( pModel ) + pModel->RepaintRange( rRange ); // locked repaints are checked there + } +} + //------------------------------------------------------------------------ BOOL ScDocument::IdleCheckLinks() // TRUE = demnaechst wieder versuchen diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk index 95ce6bcec179..51c01febcd36 100755..100644 --- a/sc/source/core/data/makefile.mk +++ b/sc/source/core/data/makefile.mk @@ -140,6 +140,7 @@ EXCEPTIONSFILES= \ $(SLO)$/documen3.obj \ $(SLO)$/documen5.obj \ $(SLO)$/documen6.obj \ + $(SLO)$/documen8.obj \ $(SLO)$/documen9.obj \ $(SLO)$/dpcachetable.obj \ $(SLO)$/dptablecache.obj \ diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index a4bc9a473768..999a3194eaa6 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -762,10 +762,13 @@ void ScPostIt::RemoveCaption() { pDrawPage->RecalcObjOrdNums(); // create drawing undo action (before removing the object to have valid draw page in undo action) - if( pDrawLayer && pDrawLayer->IsRecording() ) + bool bRecording = ( pDrawLayer && pDrawLayer->IsRecording() ); + if( bRecording ) pDrawLayer->AddCalcUndo( pDrawLayer->GetSdrUndoFactory().CreateUndoDeleteObject( *maNoteData.mpCaption ) ); // remove the object from the drawing page, delete if undo is disabled - pDrawPage->RemoveObject( maNoteData.mpCaption->GetOrdNum() ); + SdrObject* pObj = pDrawPage->RemoveObject( maNoteData.mpCaption->GetOrdNum() ); + if( !bRecording ) + SdrObject::Free( pObj ); } } maNoteData.mpCaption = 0; diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index a3319eafd3fd..bfe3fa04a398 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -136,6 +136,13 @@ BOOL __EXPORT ScStyleSheet::SetParent( const String& rParentName ) { SfxItemSet& rParentSet = pStyle->GetItemSet(); GetItemSet().SetParent( &rParentSet ); + + // #i113491# Drag&Drop in the stylist's hierarchical view doesn't execute a slot, + // so the repaint has to come from here (after modifying the ItemSet). + // RepaintRange checks the document's IsVisible flag and locked repaints. + ScDocument* pDoc = static_cast<ScStyleSheetPool&>(GetPool()).GetDocument(); + if (pDoc) + pDoc->RepaintRange( ScRange( 0,0,0, MAXCOL,MAXROW,MAXTAB ) ); } } diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index e534bb9dfb78..151478324ef7 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1267,11 +1267,7 @@ void ScTable::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW { UpdatePageBreaks(NULL); - SfxObjectShell* pDocSh = pDocument->GetDocumentShell(); - if (pDocSh) - pDocSh->Broadcast( ScPaintHint( - ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), - PAINT_GRID ) ); + pDocument->RepaintRange( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab) ); } } } diff --git a/sc/source/core/inc/core_pch.hxx b/sc/source/core/inc/core_pch.hxx index 899169154d8d..36595fe4c956 100644 --- a/sc/source/core/inc/core_pch.hxx +++ b/sc/source/core/inc/core_pch.hxx @@ -125,7 +125,7 @@ #include <vcl/outdev.hxx> #include <vcl/pointr.hxx> #include <vcl/ptrstyle.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/event.hxx> #include <tools/ownlist.hxx> #include <svl/itempool.hxx> diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx index 1b2cde3d4a6d..6c091250c80d 100644 --- a/sc/source/core/tool/charthelper.cxx +++ b/sc/source/core/tool/charthelper.cxx @@ -33,6 +33,7 @@ #include "drwlayer.hxx" #include "rangelst.hxx" #include "chartlis.hxx" +#include "docuno.hxx" //#include <vcl/svapp.hxx> #include <svx/svditer.hxx> @@ -296,3 +297,155 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument if( xModel.is() ) 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(); + } + } +} diff --git a/sc/source/core/tool/formulaparserpool.cxx b/sc/source/core/tool/formulaparserpool.cxx index 75d1c874eba8..c4c2f3b5a4ab 100644 --- a/sc/source/core/tool/formulaparserpool.cxx +++ b/sc/source/core/tool/formulaparserpool.cxx @@ -33,7 +33,6 @@ #include <com/sun/star/container/XContentEnumerationAccess.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sheet/XFilterFormulaParser.hpp> #include <rtl/instance.hxx> #include <comphelper/processfactory.hxx> @@ -62,27 +61,19 @@ public: const OUString& rNamespace ); private: - typedef ::std::hash_map< - OUString, - Reference< XSingleComponentFactory >, - OUStringHash, - ::std::equal_to< OUString > > FactoryMap; + typedef ::std::hash_map< OUString, Reference< XSingleComponentFactory >, OUStringHash > FactoryMap; - Reference< XComponentContext > mxContext; /// Default context of global process factory. + Reference< XComponentContext > mxContext; /// Global component context. FactoryMap maFactories; /// All parser factories, mapped by formula namespace. }; -ScParserFactoryMap::ScParserFactoryMap() +ScParserFactoryMap::ScParserFactoryMap() : + mxContext( ::comphelper::getProcessComponentContext() ) { - try + if( mxContext.is() ) try { - // get process factory and default component context - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW ); - Reference< XPropertySet > xPropSet( xFactory, UNO_QUERY_THROW ); - mxContext.set( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), UNO_QUERY_THROW ); - // enumerate all implementations of the FormulaParser service - Reference< XContentEnumerationAccess > xFactoryEA( xFactory, UNO_QUERY_THROW ); + Reference< XContentEnumerationAccess > xFactoryEA( mxContext->getServiceManager(), UNO_QUERY_THROW ); Reference< XEnumeration > xEnum( xFactoryEA->createContentEnumeration( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FilterFormulaParser" ) ) ), UNO_SET_THROW ); while( xEnum->hasMoreElements() ) try // single try/catch for every element { diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index f20b63efe7ba..7295d42cc2e2 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -84,8 +84,7 @@ #include <math.h> -#include <oox/core/tokens.hxx> - +using namespace ::oox; using ::rtl::OString; static String lcl_GetVbaTabName( SCTAB n ) @@ -791,7 +790,7 @@ void ExcDocument::WriteXml( SvStream& rStrm ) { InitializeSave(); - XclExpXmlStream aStrm( ::comphelper::getProcessServiceFactory(), rStrm, GetRoot() ); + XclExpXmlStream aStrm( ::comphelper::getProcessComponentContext(), rStrm, GetRoot() ); sax_fastparser::FSHelperPtr& rWorkbook = aStrm.GetCurrentStream(); rWorkbook->startElement( XML_workbook, diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 90ac8011a4bf..e238100f75f8 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -94,7 +94,7 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument aArgs[ 0 ] <<= getProcessServiceFactory(); aArgs[ 1 ] <<= aArgSeq; uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs( - CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW ); + CREATE_OUSTRING( "com.sun.star.comp.oox.xls.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW ); xImporter->setTargetDocument( xComponent ); MediaDescriptor aMediaDesc; diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 77afeb58d945..60b8e20f9447 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -30,10 +30,9 @@ #include "excimp8.hxx" -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> - #include <scitems.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/mediadescriptor.hxx> #include <unotools/fltrcfg.hxx> #include <svtools/wmf.hxx> @@ -42,6 +41,11 @@ #include <sfx2/docfile.hxx> #include <sfx2/objsh.hxx> +#include <sfx2/request.hxx> +#include <sfx2/app.hxx> +#include <sfx2/docinf.hxx> +#include <sfx2/frame.hxx> + #include <editeng/brshitem.hxx> #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> @@ -54,20 +58,16 @@ #include <editeng/crsditem.hxx> #include <editeng/flditem.hxx> #include <svx/xflclit.hxx> -#include <filter/msfilter/svxmsbas.hxx> -#include <oox/xls/excelvbaproject.hxx> -#include <basic/basmgr.hxx> #include <vcl/graph.hxx> #include <vcl/bmpacc.hxx> #include <sot/exchange.hxx> -#include <sfx2/docinf.hxx> +#include <svl/stritem.hxx> #include <tools/string.hxx> #include <tools/urlobj.hxx> #include <rtl/math.hxx> -#include <rtl/ustrbuf.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/charclass.hxx> #include <drwlayer.hxx> @@ -103,10 +103,11 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -#include <cppuhelper/component_context.hxx> -#include <sfx2/app.hxx> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> using namespace com::sun::star; +using namespace ::comphelper; using ::rtl::OUString; @@ -233,22 +234,49 @@ void ImportExcel8::ReadBasic( void ) { SfxObjectShell* pShell = GetDocShell(); SotStorageRef xRootStrg = GetRootStorage(); - SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get(); - if( pShell && xRootStrg.Is() && pFilterOpt ) + if( pShell && xRootStrg.Is() ) try { - bool bLoadCode = pFilterOpt->IsLoadExcelBasicCode(); - bool bLoadExecutable = pFilterOpt->IsLoadExcelBasicExecutable(); - bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage(); - if( bLoadCode || bLoadStrg ) + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW ); + uno::Reference< lang::XMultiComponentFactory > xFactory( xContext->getServiceManager(), uno::UNO_SET_THROW ); + uno::Sequence< beans::NamedValue > aArgSeq( 1 ); + aArgSeq[ 0 ].Name = CREATE_OUSTRING( "ColorPalette" ); + aArgSeq[ 0 ].Value <<= GetPalette().CreateColorSequence(); + + uno::Sequence< uno::Any > aArgs( 2 ); + // framework calls filter objects with factory as first argument + aArgs[ 0 ] <<= xFactory; + aArgs[ 1 ] <<= aArgSeq; + + uno::Reference< document::XImporter > xImporter( xFactory->createInstanceWithArgumentsAndContext( + CREATE_OUSTRING( "com.sun.star.comp.oox.xls.ExcelVbaProjectFilter" ), aArgs, xContext ), uno::UNO_QUERY_THROW ); + + uno::Reference< lang::XComponent > xComponent( pShell->GetModel(), uno::UNO_QUERY_THROW ); + xImporter->setTargetDocument( xComponent ); + + MediaDescriptor aMediaDesc; + SfxMedium& rMedium = GetMedium(); + SfxItemSet* pItemSet = rMedium.GetItemSet(); + if( pItemSet ) { - SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg ); - bool bAsComment = !bLoadExecutable; - aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment ); - - uno::Reference< sheet::XSpreadsheetDocument > xDocument( pShell->GetModel(), uno::UNO_QUERY ); - ::oox::xls::ExcelVbaProject aVbaProject( ::comphelper::getProcessServiceFactory(), xDocument ); - aVbaProject.createMissingModules(); + SFX_ITEMSET_ARG( pItemSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False ); + if( pFileNameItem ) + aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pFileNameItem->GetValue() ); + SFX_ITEMSET_ARG( pItemSet, pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False ); + if( pPasswordItem ) + aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pPasswordItem->GetValue() ); + SFX_ITEMSET_ARG( pItemSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if( pEncryptionDataItem ) + aMediaDesc[ MediaDescriptor::PROP_ENCRYPTIONDATA() ] = pEncryptionDataItem->GetValue(); } + aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream(); + aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler(); + + // call the filter + uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW ); + xFilter->filter( aMediaDesc.getAsConstPropertyValueList() ); + } + catch( uno::Exception& ) + { } } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 9a66325db419..91758c9affce 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -96,11 +96,9 @@ #include "xcl97rec.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::com::sun::star::uno::Sequence; - - using ::rtl::OString; //--------------------------------------------------------- class ExcDummy_00 - diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 7bfd57be7290..516f4c3bdee2 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -55,7 +55,7 @@ #include "xestyle.hxx" #include "xename.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index b2801df7f54a..6ced6f9cc937 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -64,7 +64,7 @@ #include "xename.hxx" #include "xestyle.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::rtl::OUString; diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 34e48671a3bc..92b48f9633de 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -1759,7 +1759,11 @@ void XclExpFmlaCompImpl::AppendTrailingParam( XclExpFuncData& rFuncData ) break; - default:; + default: + // #i108420# function without parameters stored as macro call needs the external name reference + if( (nParamCount == 0) && rFuncData.IsMacroFunc() ) + AppendDefaultParam( rFuncData ); + } } diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index af275bef7eef..2ba4d1327f92 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -41,9 +41,10 @@ // for filter manager #include "excrecds.hxx" -#include <oox/core/tokens.hxx> #include <formula/grammar.hxx> +using namespace ::oox; + using ::rtl::OString; // ============================================================================ diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 6194a04c27f6..65be5b535d98 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -48,7 +48,7 @@ #include <set> #include <limits> -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::std::set; diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index ddcdb3243167..3f2e3f506f51 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -51,7 +51,7 @@ #include "xestring.hxx" #include "xelink.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::com::sun::star::sheet::DataPilotFieldOrientation; using ::com::sun::star::sheet::DataPilotFieldOrientation_HIDDEN; diff --git a/sc/source/filter/excel/xerecord.cxx b/sc/source/filter/excel/xerecord.cxx index fed58411aa5c..b596234fe2e4 100644 --- a/sc/source/filter/excel/xerecord.cxx +++ b/sc/source/filter/excel/xerecord.cxx @@ -30,7 +30,7 @@ #include "xerecord.hxx" #include "xeroot.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; // Base classes to export Excel records ======================================= diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 356b0d8bab42..0a4e76a47e86 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -32,6 +32,7 @@ #include <utility> #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> #include <rtl/random.h> #include <sax/fshelper.hxx> #include <unotools/streamwrap.hxx> @@ -46,27 +47,24 @@ #include "rangelst.hxx" #include "compiler.hxx" -#include <oox/core/tokens.hxx> +#include <oox/xls/excelvbaproject.hxx> #include <formula/grammar.hxx> #define DEBUG_XL_ENCRYPTION 0 -using ::com::sun::star::beans::PropertyValue; -using ::com::sun::star::io::XOutputStream; -using ::com::sun::star::io::XStream; -using ::com::sun::star::lang::XComponent; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::lang::XServiceInfo; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::UNO_QUERY; using ::rtl::OString; using ::rtl::OUString; +using ::rtl::OUStringBuffer; using ::utl::OStreamWrapper; using ::std::vector; -using namespace formula; -using namespace ::com::sun::star; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sheet; +using namespace ::com::sun::star::uno; +using namespace ::formula; +using namespace ::oox; // ============================================================================ @@ -491,8 +489,8 @@ XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot ) : mnOldPos(STREAM_SEEK_TO_END), mbValid(false) { - uno::Sequence< beans::NamedValue > aEncryptionData = rRoot.GetEncryptionData(); - if ( aEncryptionData.getLength() == 0 ) + Sequence< NamedValue > aEncryptionData = rRoot.GetEncryptionData(); + if( !aEncryptionData.hasElements() ) // Empty password. Get the default biff8 password. aEncryptionData = rRoot.GenerateDefaultEncryptionData(); Init( aEncryptionData ); @@ -579,11 +577,11 @@ void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int32 nData ) Encrypt(rStrm, static_cast<sal_uInt32>(nData)); } -void XclExpBiff8Encrypter::Init( const uno::Sequence< beans::NamedValue >& aEncryptionData ) +void XclExpBiff8Encrypter::Init( const Sequence< NamedValue >& rEncryptionData ) { mbValid = false; - if ( maCodec.InitCodec( aEncryptionData ) ) + if( maCodec.InitCodec( rEncryptionData ) ) { maCodec.GetDocId( mpnDocId ); @@ -599,7 +597,7 @@ void XclExpBiff8Encrypter::Init( const uno::Sequence< beans::NamedValue >& aEncr // generate salt hash. ::msfilter::MSCodec_Std97 aCodec; - aCodec.InitCodec( aEncryptionData ); + aCodec.InitCodec( rEncryptionData ); aCodec.CreateSaltDigest( mpnSalt, mpnSaltDigest ); // verify to make sure it's in good shape. @@ -609,12 +607,12 @@ void XclExpBiff8Encrypter::Init( const uno::Sequence< beans::NamedValue >& aEncr sal_uInt32 XclExpBiff8Encrypter::GetBlockPos( sal_Size nStrmPos ) const { - return static_cast<sal_uInt32>(nStrmPos / EXC_ENCR_BLOCKSIZE); + return static_cast< sal_uInt32 >( nStrmPos / EXC_ENCR_BLOCKSIZE ); } sal_uInt16 XclExpBiff8Encrypter::GetOffsetInBlock( sal_Size nStrmPos ) const { - return static_cast<sal_uInt16>(nStrmPos % EXC_ENCR_BLOCKSIZE); + return static_cast< sal_uInt16 >( nStrmPos % EXC_ENCR_BLOCKSIZE ); } void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBytes ) @@ -681,9 +679,9 @@ void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBy mnOldPos = nStrmPos; } -rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sStream, sal_Int32 nId ) +OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sStream, sal_Int32 nId ) { - rtl::OUStringBuffer sBuf; + OUStringBuffer sBuf; if( sStreamDir ) sBuf.appendAscii( sStreamDir ); sBuf.appendAscii( sStream ); @@ -693,7 +691,7 @@ rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sS return sBuf.makeStringAndClear(); } -rtl::OString XclXmlUtils::ToOString( const Color& rColor ) +OString XclXmlUtils::ToOString( const Color& rColor ) { char buf[9]; sprintf( buf, "%.2X%.2X%.2X%.2X", rColor.GetTransparency(), rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() ); @@ -701,37 +699,37 @@ rtl::OString XclXmlUtils::ToOString( const Color& rColor ) return OString( buf ); } -rtl::OString XclXmlUtils::ToOString( const ::rtl::OUString& s ) +OString XclXmlUtils::ToOString( const OUString& s ) { return OUStringToOString( s, RTL_TEXTENCODING_UTF8 ); } -rtl::OString XclXmlUtils::ToOString( const String& s ) +OString XclXmlUtils::ToOString( const String& s ) { - return rtl::OString( s.GetBuffer(), s.Len(), RTL_TEXTENCODING_UTF8 ); + return OString( s.GetBuffer(), s.Len(), RTL_TEXTENCODING_UTF8 ); } -rtl::OString XclXmlUtils::ToOString( const ScAddress& rAddress ) +OString XclXmlUtils::ToOString( const ScAddress& rAddress ) { String sAddress; rAddress.Format( sAddress, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1 ) ); return ToOString( sAddress ); } -rtl::OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer ) +OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer ) { const sal_uInt16* pBuffer = &rBuffer [0]; - return ::rtl::OString( pBuffer, rBuffer.size(), RTL_TEXTENCODING_UTF8 ); + return OString( pBuffer, rBuffer.size(), RTL_TEXTENCODING_UTF8 ); } -rtl::OString XclXmlUtils::ToOString( const ScRange& rRange ) +OString XclXmlUtils::ToOString( const ScRange& rRange ) { String sRange; rRange.Format( sRange, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1 ) ); return ToOString( sRange ); } -rtl::OString XclXmlUtils::ToOString( const ScRangeList& rRangeList ) +OString XclXmlUtils::ToOString( const ScRangeList& rRangeList ) { String s; rRangeList.Format( s, SCA_VALID, NULL, FormulaGrammar::CONV_XL_A1, ' ' ); @@ -751,12 +749,12 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress ) return aAddress; } -rtl::OString XclXmlUtils::ToOString( const XclAddress& rAddress ) +OString XclXmlUtils::ToOString( const XclAddress& rAddress ) { return ToOString( lcl_ToAddress( rAddress ) ); } -rtl::OString XclXmlUtils::ToOString( const XclExpString& s ) +OString XclXmlUtils::ToOString( const XclExpString& s ) { DBG_ASSERT( !s.IsRich(), "XclXmlUtils::ToOString(XclExpString): rich text string found!" ); return ToOString( s.GetUnicodeBuffer() ); @@ -772,7 +770,7 @@ static ScRange lcl_ToRange( const XclRange& rRange ) return aRange; } -rtl::OString XclXmlUtils::ToOString( const XclRangeList& rRanges ) +OString XclXmlUtils::ToOString( const XclRangeList& rRanges ) { ScRangeList aRanges; for( XclRangeList::const_iterator i = rRanges.begin(), end = rRanges.end(); @@ -801,7 +799,7 @@ OUString XclXmlUtils::ToOUString( const String& s ) return OUString( s.GetBuffer(), s.Len() ); } -rtl::OUString XclXmlUtils::ToOUString( ScDocument& rDocument, const ScAddress& rAddress, ScTokenArray* pTokenArray ) +OUString XclXmlUtils::ToOUString( ScDocument& rDocument, const ScAddress& rAddress, ScTokenArray* pTokenArray ) { ScCompiler aCompiler( &rDocument, rAddress, *pTokenArray); aCompiler.SetGrammar(FormulaGrammar::GRAM_NATIVE_XL_A1); @@ -823,8 +821,8 @@ const char* XclXmlUtils::ToPsz( bool b ) // ============================================================================ -XclExpXmlStream::XclExpXmlStream( const Reference< XMultiServiceFactory >& rSMgr, SvStream& rStrm, const XclExpRoot& rRoot ) - : XmlFilterBase( rSMgr ) +XclExpXmlStream::XclExpXmlStream( const Reference< XComponentContext >& rxContext, SvStream& rStrm, const XclExpRoot& rRoot ) + : XmlFilterBase( rxContext ) , mrRoot( rRoot ) { Sequence< PropertyValue > aArgs( 1 ); @@ -980,7 +978,7 @@ sax_fastparser::FSHelperPtr XclExpXmlStream::CreateOutputStream ( const Reference< XOutputStream >& xParentRelation, const char* sContentType, const char* sRelationshipType, - ::rtl::OUString* pRelationshipId ) + OUString* pRelationshipId ) { OUString sRelationshipId; if (xParentRelation.is()) @@ -1029,7 +1027,12 @@ bool XclExpXmlStream::exportDocument() throw() return false; } -::rtl::OUString XclExpXmlStream::implGetImplementationName() const +::oox::ole::VbaProject* XclExpXmlStream::implCreateVbaProject() const +{ + return new ::oox::xls::ExcelVbaProject( getComponentContext(), Reference< XSpreadsheetDocument >( getModel(), UNO_QUERY ) ); +} + +OUString XclExpXmlStream::implGetImplementationName() const { return CREATE_OUSTRING( "TODO" ); } diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx index cd0b083aa208..1c3270015981 100644 --- a/sc/source/filter/excel/xestring.cxx +++ b/sc/source/filter/excel/xestring.cxx @@ -35,7 +35,7 @@ #include "xestyle.hxx" #include "xestring.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::rtl::OUString; diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index ccebe9a4280f..da937e405080 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -55,7 +55,7 @@ #include "globstr.hrc" #include "xestring.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::rtl::OUString; diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index b5ca318a91b4..b5896a352c5b 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -43,7 +43,7 @@ #include "xecontent.hxx" #include "xeescher.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::rtl::OUString; diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx index 035afd0a5830..2abd807e8872 100644 --- a/sc/source/filter/excel/xeview.cxx +++ b/sc/source/filter/excel/xeview.cxx @@ -34,7 +34,7 @@ #include "xelink.hxx" #include "xestyle.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index b210d18f479c..4aaf0ac9b944 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -917,14 +917,13 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm ) String aTables( rStrm.ReadUniString() ); const sal_Unicode cSep = ';'; - aTables.SearchAndReplaceAll( ',', cSep ); String aQuotedPairs( RTL_CONSTASCII_USTRINGPARAM( "\"\"" ) ); - xub_StrLen nTokenCnt = aTables.GetQuotedTokenCount( aQuotedPairs, cSep ); + xub_StrLen nTokenCnt = aTables.GetQuotedTokenCount( aQuotedPairs, ',' ); maTables.Erase(); xub_StrLen nStringIx = 0; for( xub_StrLen nToken = 0; nToken < nTokenCnt; ++nToken ) { - String aToken( aTables.GetQuotedToken( 0, aQuotedPairs, cSep, nStringIx ) ); + String aToken( aTables.GetQuotedToken( 0, aQuotedPairs, ',', nStringIx ) ); sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.ToInt32() : 0; if( nTabNum > 0 ) ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep ); diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 1559ef5530f5..3045924a7807 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -88,6 +88,19 @@ ColorData XclImpPalette::GetColorData( sal_uInt16 nXclIndex ) const return GetDefColorData( nXclIndex ); } +::com::sun::star::uno::Sequence< sal_Int32 > XclImpPalette::CreateColorSequence() const +{ + sal_Int32 nCount = static_cast< sal_Int32 >( maColorTable.size() ); + ::com::sun::star::uno::Sequence< sal_Int32 > aSeq( nCount ); + if( nCount > 0 ) + { + sal_Int32* pnSeqColor = aSeq.getArray(); + for( ColorDataVec::const_iterator aIt = maColorTable.begin(), aEnd = maColorTable.end(); aIt != aEnd; ++aIt, ++pnSeqColor ) + *pnSeqColor = static_cast< sal_Int32 >( *aIt ); + } + return aSeq; +} + void XclImpPalette::ReadPalette( XclImpStream& rStrm ) { sal_uInt16 nCount; diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index d613f1279242..aad0061377c9 100644..100755 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -393,7 +393,7 @@ static const XclFunctionInfo saFuncTable_Odf[] = EXC_FUNCENTRY_ODF( ocVariationen2, 2, 2, 0, "PERMUTATIONA" ), EXC_FUNCENTRY_ODF( ocPhi, 1, 1, 0, "PHI" ), EXC_FUNCENTRY_ODF( ocZGZ, 3, 3, 0, "RRI" ), - EXC_FUNCENTRY_ODF( ocTable, 1, 1, 0, "SHEET" ), + EXC_FUNCENTRY_ODF( ocTable, 0, 1, 0, "SHEET" ), EXC_FUNCENTRY_ODF( ocTables, 0, 1, 0, "SHEETS" ), EXC_FUNCENTRY_ODF( ocNoName, 1, MX, 0, "SKEWP" ), EXC_FUNCENTRY_ODF( ocUnichar, 1, 1, 0, "UNICHAR" ), diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 0dd988d67586..47420ab8dcfd 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -695,9 +695,9 @@ const OUString XclTools::maSbMacroSuffix( RTL_CONSTASCII_USTRINGPARAM( "?languag OUString XclTools::GetSbMacroUrl( const String& rMacroName, SfxObjectShell* pDocShell ) { OSL_ENSURE( rMacroName.Len() > 0, "XclTools::GetSbMacroUrl - macro name is empty" ); - ::ooo::vba::VBAMacroResolvedInfo aMacroInfo = ::ooo::vba::resolveVBAMacro( pDocShell, rMacroName, false ); - if( aMacroInfo.IsResolved() ) - return ::ooo::vba::makeMacroURL( aMacroInfo.ResolvedMacro() ); + ::ooo::vba::MacroResolvedInfo aMacroInfo = ::ooo::vba::resolveVBAMacro( pDocShell, rMacroName, false ); + if( aMacroInfo.mbFound ) + return ::ooo::vba::makeMacroURL( aMacroInfo.msResolvedMacro ); return OUString(); } diff --git a/sc/source/filter/inc/filt_pch.hxx b/sc/source/filter/inc/filt_pch.hxx index 7ab2aadf1511..d624b7afeaf8 100644 --- a/sc/source/filter/inc/filt_pch.hxx +++ b/sc/source/filter/inc/filt_pch.hxx @@ -126,7 +126,7 @@ #include <tools/fract.hxx> #include <vcl/bitmap.hxx> #include <vcl/mapmod.hxx> -#include <vcl/mapunit.hxx> +#include <tools/mapunit.hxx> #include <vcl/region.hxx> #include <svl/lstner.hxx> #include <patattr.hxx> @@ -182,7 +182,7 @@ #include <vcl/window.hxx> #include <vcl/pointr.hxx> #include <vcl/ptrstyle.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/inputctx.hxx> #include <vcl/event.hxx> #include <tools/ownlist.hxx> @@ -253,7 +253,7 @@ #include <vcl/menu.hxx> #include <vcl/combobox.hxx> #include <vcl/combobox.h> -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hdl> #include <com/sun/star/awt/XWindow.hpp> diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index 38acef2783e8..b1cc596ad75e 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -37,6 +37,7 @@ #include <string> #include <oox/core/xmlfilterbase.hxx> +#include <oox/token/tokens.hxx> #include <sax/fshelper.hxx> #include "xlstream.hxx" @@ -306,7 +307,7 @@ public: class XclExpXmlStream : public oox::core::XmlFilterBase { public: - XclExpXmlStream( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr, SvStream& rStrm, const XclExpRoot& rRoot ); + XclExpXmlStream( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, SvStream& rStrm, const XclExpRoot& rRoot ); virtual ~XclExpXmlStream(); /** Returns the filter root data. */ @@ -342,6 +343,7 @@ public: void Trace( const char* format, ...); private: + virtual ::oox::ole::VbaProject* implCreateVbaProject() const; virtual ::rtl::OUString implGetImplementationName() const; typedef std::map< ::rtl::OUString, diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 104002542a17..80006f354b4b 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -64,6 +64,9 @@ public: @return The color from current or default palette or COL_AUTO, if nothing else found. */ inline Color GetColor( sal_uInt16 nXclIndex ) const { return Color( GetColorData( nXclIndex ) ); } + /** Returns the palette colors as UNO sequence. */ + ::com::sun::star::uno::Sequence< sal_Int32 > + CreateColorSequence() const; /** Reads a PALETTE record. */ void ReadPalette( XclImpStream& rStrm ); diff --git a/sc/source/filter/inc/xlescher.hxx b/sc/source/filter/inc/xlescher.hxx index 921da6b8741b..cba56eeccc9e 100644 --- a/sc/source/filter/inc/xlescher.hxx +++ b/sc/source/filter/inc/xlescher.hxx @@ -29,7 +29,7 @@ #define SC_XLESCHER_HXX #include <tools/gen.hxx> -#include <vcl/mapunit.hxx> +#include <tools/mapunit.hxx> #include "fapihelper.hxx" #include "xladdress.hxx" #include "xlstyle.hxx" diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 209bbc83f6c3..a4a3d233cbde 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -77,7 +77,7 @@ #include "patattr.hxx" #include "tabprotection.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::rtl::OUString; diff --git a/sc/source/filter/xml/XMLCodeNameProvider.cxx b/sc/source/filter/xml/XMLCodeNameProvider.cxx index ca4bac7eb511..646d245c13f1 100755..100644 --- a/sc/source/filter/xml/XMLCodeNameProvider.cxx +++ b/sc/source/filter/xml/XMLCodeNameProvider.cxx @@ -156,7 +156,7 @@ uno::Sequence< OUString > SAL_CALL XMLCodeNameProvider::getElementNames( ) uno::Type SAL_CALL XMLCodeNameProvider::getElementType( ) throw (uno::RuntimeException) { - return uno::Type(); + return getCppuType( static_cast< uno::Sequence< beans::PropertyValue >* >( 0 ) ); } ::sal_Bool SAL_CALL XMLCodeNameProvider::hasElements() diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index b256233d7394..22153ff5ae6c 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -68,6 +68,9 @@ #include "drawview.hxx" #include "viewdata.hxx" #include "scmod.hxx" +#include "chartlis.hxx" +#include "rangeutl.hxx" +#include "formula/grammar.hxx" // #108584# #include "scitems.hxx" @@ -79,6 +82,7 @@ #include <editeng/fhgtitem.hxx> #include <vcl/svapp.hxx> + using namespace com::sun::star; // ----------------------------------------------------------------------- @@ -235,9 +239,15 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain // if ( pContainerShell ) { - const ScDocument* pDoc = pContainerShell->GetDocument(); + ScDocument* pDoc = pContainerShell->GetDocument(); if ( pDoc ) + { nSourceDocID = pDoc->GetDocumentID(); + if ( pPage ) + { + ScChartHelper::FillProtectedChartRangesVector( m_aProtectedChartRangesVector, pDoc, pPage ); + } + } } } diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index b028a0a153ce..4dcd7eb4da86 100755 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -770,11 +770,11 @@ ScTextWnd::ScTextWnd( Window* pParent ) __EXPORT ScTextWnd::~ScTextWnd() { - delete pEditView; - delete pEditEngine; while (!maAccTextDatas.empty()) { maAccTextDatas.back()->Dispose(); } + delete pEditView; + delete pEditEngine; } void __EXPORT ScTextWnd::Paint( const Rectangle& rRec ) diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index b90a51ed6bee..f9e5a4d7679b 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -35,7 +35,7 @@ #include <vcl/outdev.hxx> #include <vcl/settings.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/decoview.hxx> #include "strload.hxx" #include "global.hxx" diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index d819785c843b..1cd4c4700894 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -270,9 +270,9 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter, SfxMedium* pMed = new SfxMedium(aNewUrl, STREAM_STD_READ, FALSE, pFilter); + // aRef->DoClose() will be closed explicitly, but it is still more safe to use SfxObjectShellLock here ScDocShell* pSrcShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL); -//REMOVE SvEmbeddedObjectRef aRef = pSrcShell; - SfxObjectShellRef aRef = pSrcShell; + SfxObjectShellLock aRef = pSrcShell; pSrcShell->DoLoad(pMed); ScDocument* pSrcDoc = pSrcShell->GetDocument(); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index fddb687abd55..5e4a9c97808a 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -3121,6 +3121,8 @@ BOOL ScDocFunc::SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRa ScSizeMode eMode, USHORT nSizeTwips, BOOL bRecord, BOOL bApi ) { + ScDocShellModificator aModificator( rDocShell ); + if (!nRangeCnt) return TRUE; @@ -3282,6 +3284,7 @@ BOOL ScDocFunc::SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRa pDoc->UpdatePageBreaks( nTab ); rDocShell.PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_ALL); + aModificator.SetDocumentModified(); return bSuccess; } @@ -4861,9 +4864,11 @@ BOOL ScDocFunc::InsertAreaLink( const String& rFile, const String& rFilter, } // Update hat sein eigenes Undo - - pLink->SetDoInsert(bFitBlock); // beim ersten Update ggf. nichts einfuegen - pLink->Update(); // kein SetInCreate -> Update ausfuehren + if (pDoc->IsExecuteLinkEnabled()) + { + pLink->SetDoInsert(bFitBlock); // beim ersten Update ggf. nichts einfuegen + pLink->Update(); // kein SetInCreate -> Update ausfuehren + } pLink->SetDoInsert(TRUE); // Default = TRUE SfxBindings* pBindings = rDocShell.GetViewBindings(); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 89039d43c26d..5d9af06a7d65 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2605,6 +2605,7 @@ void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ ) if ( pPaintLockData && bIsModified ) { //! BCA_BRDCST_ALWAYS etc. also needed here? + aDocument.InvalidateTableArea(); // #i105279# needed here aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); pPaintLockData->SetModified(); // spaeter... diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index bba756b397cb..5de8b17b0598 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -55,7 +55,6 @@ using namespace ::com::sun::star; #include <svtools/sfxecode.hxx> #include <svx/ofaitem.hxx> #include <sot/formats.hxx> -#include <svtools/printdlg.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> #include <vcl/waitobj.hxx> @@ -782,8 +781,9 @@ void ScDocShell::Execute( SfxRequest& rReq ) { SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, pMed->GetName() ); + // pOtherDocSh->DoClose() will be called explicitly later, but it is still more safe to use SfxObjectShellLock here ScDocShell* pOtherDocSh = new ScDocShell; - SfxObjectShellRef aDocShTablesRef = pOtherDocSh; + SfxObjectShellLock aDocShTablesRef = pOtherDocSh; pOtherDocSh->DoLoad( pMed ); ULONG nErr = pOtherDocSh->GetErrorCode(); if (nErr) @@ -1828,373 +1828,6 @@ void ScDocShell::GetStatePageStyle( SfxViewShell& /* rCaller */, } } -void lcl_GetPrintData( ScDocShell* pDocShell /*in*/, - ScDocument* pDocument /*in*/, SfxPrinter* pPrinter /*in*/, - PrintDialog* pPrintDialog /*in*/, bool bForceSelected /*in*/, - ScMarkData* pMarkData /*inout*/, bool& rbHasOptions /*out*/, - ScPrintOptions& rOptions /*out*/, bool& rbAllTabs /*out*/, - long& rnTotalPages /*out*/, long aPageArr[] /*out*/, - MultiSelection& rPageRanges /*out*/, ScRange** ppMarkedRange /*out*/ ) -{ - // get settings from print options sub-dialog - const SfxItemSet& rOptionSet = pPrinter->GetOptions(); - const SfxPoolItem* pItem; - rbHasOptions = ( rOptionSet.GetItemState( SID_SCPRINTOPTIONS, FALSE, &pItem ) == SFX_ITEM_SET ); - if ( rbHasOptions ) - { - rOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions(); - } - else - { - // use configuration - rOptions = SC_MOD()->GetPrintOptions(); - } - - // update all pending row heights with a single progress bar, - // instead of a separate progress for each sheet from ScPrintFunc - pDocShell->UpdatePendingRowHeights( MAXTAB, true ); - - // get number of total pages - rnTotalPages = 0; - SCTAB nTabCount = pDocument->GetTableCount(); - for ( SCTAB nTab = 0; nTab < nTabCount; ++nTab ) - { - ScPrintFunc aPrintFunc( pDocShell, pPrinter, nTab, 0, 0, NULL, &rOptions ); - long nThisTab = aPrintFunc.GetTotalPages(); - aPageArr[nTab] = nThisTab; - rnTotalPages += nThisTab; - } - - rPageRanges.SetTotalRange( Range( 0, RANGE_MAX ) ); - rPageRanges.Select( Range( 1, rnTotalPages ) ); - - rbAllTabs = ( pPrintDialog ? ( pPrintDialog->GetCheckedSheetRange() == PRINTSHEETS_ALL ) : SC_MOD()->GetPrintOptions().GetAllSheets() ); - if ( bForceSelected ) - { - rbAllTabs = false; - } - - if ( ( pPrintDialog && pPrintDialog->GetCheckedSheetRange() == PRINTSHEETS_SELECTED_CELLS ) || bForceSelected ) - { - if ( pMarkData && ( pMarkData->IsMarked() || pMarkData->IsMultiMarked() ) ) - { - pMarkData->MarkToMulti(); - *ppMarkedRange = new ScRange; - pMarkData->GetMultiMarkArea( **ppMarkedRange ); - pMarkData->MarkToSimple(); - } - } - - PrintDialogRange eDlgOption = pPrintDialog ? pPrintDialog->GetCheckedRange() : PRINTDIALOG_ALL; - if ( eDlgOption == PRINTDIALOG_RANGE ) - { - rPageRanges = MultiSelection( pPrintDialog->GetRangeText() ); - } - - // get number of total pages if selection - if ( !rbAllTabs ) - { - rnTotalPages = 0; - for ( SCTAB nTab = 0; nTab < nTabCount; ++nTab ) - { - if ( *ppMarkedRange ) // selected range is used instead of print ranges -> page count is different - { - ScPrintFunc aPrintFunc( pDocShell, pPrinter, nTab, 0, 0, *ppMarkedRange, &rOptions ); - aPageArr[nTab] = aPrintFunc.GetTotalPages(); - } - if ( !pMarkData || pMarkData->GetTableSelect( nTab ) ) - { - rnTotalPages += aPageArr[nTab]; - } - } - if ( eDlgOption == PRINTDIALOG_ALL || bForceSelected ) - { - rPageRanges.Select( Range( 1, rnTotalPages ) ); - } - } -} - -bool ScDocShell::CheckPrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData, bool bForceSelected, bool bIsAPI ) -{ - SfxPrinter* pPrinter = GetPrinter(); - if ( !pPrinter ) - { - return false; - } - - bool bHasOptions = false; - ScPrintOptions aOptions; - bool bAllTabs = true; - long nTotalPages = 0; - long aPageArr[MAXTABCOUNT]; // pages per sheet - MultiSelection aPageRanges; // pages to print - ScRange* pMarkedRange = NULL; - - lcl_GetPrintData( this, &aDocument, pPrinter, pPrintDialog, bForceSelected, - pMarkData, bHasOptions, aOptions, bAllTabs, nTotalPages, - aPageArr, aPageRanges, &pMarkedRange ); - - delete pMarkedRange; - - if ( nTotalPages == 0 ) - { - if ( !bIsAPI ) - { - WarningBox aWarningBox( GetActiveDialogParent(), WinBits( WB_OK ), - String( ScResId( STR_PRINT_NOTHING ) ) ); - aWarningBox.Execute(); - } - return false; - } - - return true; -} - -void ScDocShell::PreparePrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData ) -{ - SfxPrinter* pPrinter = GetPrinter(); - if ( !pPrinter ) - { - return; - } - - delete pOldJobSetup; // gesetzt nur bei Fehler in StartJob() - pOldJobSetup = new ScJobSetup( pPrinter ); // Einstellungen merken - - // Einstellungen fuer die erste gedruckte Seite muessen hier (vor StartJob) gesetzt werden - //! Selection etc. mit Print() zusammenfassen !!! - //! Seiten nur einmal zaehlen - - bool bHasOptions = false; - ScPrintOptions aOptions; - bool bAllTabs = true; - long nTotalPages = 0; - long aPageArr[MAXTABCOUNT]; // pages per sheet - MultiSelection aPageRanges; // pages to print - ScRange* pMarkedRange = NULL; - - lcl_GetPrintData( this, &aDocument, pPrinter, pPrintDialog, false, - pMarkData, bHasOptions, aOptions, bAllTabs, nTotalPages, - aPageArr, aPageRanges, &pMarkedRange ); - - BOOL bFound = FALSE; // erste Seite gefunden - long nTabStart = 0; - SCTAB nTabCount = aDocument.GetTableCount(); - for ( SCTAB nTab=0; nTab<nTabCount && !bFound; nTab++ ) - { - if ( bAllTabs || !pMarkData || pMarkData->GetTableSelect( nTab ) ) - { - long nNext = nTabStart + aPageArr[nTab]; - BOOL bSelected = FALSE; - for (long nP=nTabStart+1; nP<=nNext; nP++) // 1-basiert - if (aPageRanges.IsSelected( nP )) // eine Seite von dieser Tabelle selektiert? - bSelected = TRUE; - - if (bSelected) - { - ScPrintFunc aPrintFunc( this, pPrinter, nTab ); - - aPrintFunc.ApplyPrintSettings(); // dann Settings fuer diese Tabelle - bFound = TRUE; - } - nTabStart = nNext; - } - } - - delete pMarkedRange; -} - -BOOL lcl_HasTransparent( ScDocument* pDoc, SCTAB nTab, const ScRange* pRange ) -{ - BOOL bFound = FALSE; - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); - if (pDrawLayer) - { - SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); - DBG_ASSERT(pPage,"Page ?"); - if (pPage) - { - Rectangle aMMRect; - if ( pRange ) - aMMRect = pDoc->GetMMRect( pRange->aStart.Col(), pRange->aStart.Row(), - pRange->aEnd.Col(), pRange->aEnd.Row(), nTab ); - - SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); - SdrObject* pObject = aIter.Next(); - while (pObject && !bFound) - { - if (pObject->IsTransparent()) - { - if ( pRange ) - { - Rectangle aObjRect = pObject->GetLogicRect(); - if ( aObjRect.IsOver( aMMRect ) ) - bFound = TRUE; - } - else - bFound = TRUE; - } - - pObject = aIter.Next(); - } - } - } - - return bFound; -} - -void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, - ScMarkData* pMarkData, Window* pDialogParent, BOOL bForceSelected, BOOL bIsAPI ) -{ - SfxPrinter* pPrinter = GetPrinter(); - if ( !pPrinter ) - { - return; - } - - bool bHasOptions = false; - ScPrintOptions aOptions; - bool bAllTabs = true; - long nTotalPages = 0; - long aPageArr[MAXTABCOUNT]; // pages per sheet - MultiSelection aPageRanges; // pages to print - ScRange* pMarkedRange = NULL; - - lcl_GetPrintData( this, &aDocument, pPrinter, pPrintDialog, bForceSelected, - pMarkData, bHasOptions, aOptions, bAllTabs, nTotalPages, - aPageArr, aPageRanges, &pMarkedRange ); - - USHORT nCollateCopies = 1; - if ( pPrintDialog && pPrintDialog->IsCollateEnabled() && pPrintDialog->IsCollateChecked() ) - nCollateCopies = pPrintDialog->GetCopyCount(); - - // test if printed range contains transparent objects - - BOOL bHasTransp = FALSE; - BOOL bAnyPrintRanges = aDocument.HasPrintRange(); - ScStyleSheetPool* pStylePool = aDocument.GetStyleSheetPool(); - SCTAB nTabCount = aDocument.GetTableCount(); - for ( SCTAB nTab=0; nTab<nTabCount && !bHasTransp; nTab++ ) - { - if ( bAllTabs || !pMarkData || pMarkData->GetTableSelect( nTab ) ) - { - SfxStyleSheetBase* pStyleSheet = pStylePool->Find( - aDocument.GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ); - if ( pStyleSheet ) - { - const SfxItemSet& rSet = pStyleSheet->GetItemSet(); - if ( ((const ScViewObjectModeItem&)rSet.Get(ATTR_PAGE_CHARTS)).GetValue() == VOBJ_MODE_SHOW || - ((const ScViewObjectModeItem&)rSet.Get(ATTR_PAGE_OBJECTS)).GetValue() == VOBJ_MODE_SHOW || - ((const ScViewObjectModeItem&)rSet.Get(ATTR_PAGE_DRAWINGS)).GetValue() == VOBJ_MODE_SHOW ) - { - if ( pMarkedRange ) - bHasTransp = bHasTransp || lcl_HasTransparent( &aDocument, nTab, pMarkedRange ); - else if ( aDocument.GetPrintRangeCount(nTab) ) - { - USHORT nRangeCount = aDocument.GetPrintRangeCount(nTab); - for (USHORT i=0; i<nRangeCount; i++) - bHasTransp = bHasTransp || - lcl_HasTransparent( &aDocument, nTab, aDocument.GetPrintRange( nTab, i ) ); - } - else if (!bAnyPrintRanges || aDocument.IsPrintEntireSheet(nTab)) - bHasTransp = bHasTransp || lcl_HasTransparent( &aDocument, nTab, NULL ); - } - } - } - } - - BOOL bContinue = pPrinter->InitJob( pDialogParent, !bIsAPI && bHasTransp ); - - if ( bContinue ) - { - for ( USHORT n=0; n<nCollateCopies; n++ ) - { - long nTabStart = 0; - long nDisplayStart = 0; - long nAttrPage = 1; - long nPrinted = 0; - - for ( SCTAB nTab=0; nTab<nTabCount; nTab++ ) - { - if ( bAllTabs || !pMarkData || pMarkData->GetTableSelect( nTab ) ) - { - FmFormView* pDrawView = NULL; - Rectangle aFull( 0, 0, LONG_MAX, LONG_MAX ); - - // #114135# - ScDrawLayer* pModel = aDocument.GetDrawLayer(); // ist nicht NULL - - if(pModel) - { - pDrawView = new FmFormView( pModel, pPrinter ); - pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab)); - pDrawView->SetPrintPreview( TRUE ); - } - - ScPrintFunc aPrintFunc( this, pPrinter, nTab, nAttrPage, nTotalPages, pMarkedRange, &aOptions ); - aPrintFunc.SetDrawView( pDrawView ); - nPrinted += aPrintFunc.DoPrint( aPageRanges, nTabStart, nDisplayStart, TRUE, &rProgress, NULL ); - - nTabStart += aPageArr[nTab]; - if ( aDocument.NeedPageResetAfterTab(nTab) ) - nDisplayStart = 0; - else - nDisplayStart += aPageArr[nTab]; - nAttrPage = aPrintFunc.GetFirstPageNo(); // behalten oder aus Vorlage - - delete pDrawView; - } - } - - if ( n+1 < nCollateCopies && - (pPrinter->GetDuplexMode() == DUPLEX_SHORTEDGE || pPrinter->GetDuplexMode() == DUPLEX_LONGEDGE) && - ( nPrinted % 2 ) == 1 ) - { - // #105584# when several collated copies are printed in duplex mode, and there is - // an odd number of pages, print an empty page between copies, so the first page of - // the second copy isn't printed on the back of the last page of the first copy. - // (same as in Writer ViewShell::Prt) - - // FIXME: needs to be adapted to XRenderable interface - #if 0 - pPrinter->StartPage(); - pPrinter->EndPage(); - #endif - } - } - } - - delete pMarkedRange; - - if (pOldJobSetup) - { - pPrinter->SetOrientation( pOldJobSetup->eOrientation ); - pPrinter->SetPaperBin ( pOldJobSetup->nPaperBin ); - pPrinter->SetPaper ( pOldJobSetup->ePaper ); - - if ( PAPER_USER == pOldJobSetup->ePaper ) - { - pPrinter->SetMapMode( pOldJobSetup->aUserMapMode ); - pPrinter->SetPaperSizeUser( pOldJobSetup->aUserSize ); - } - - delete pOldJobSetup; - pOldJobSetup = NULL; - } - - if ( bHasOptions ) - { - // remove PrintOptions from printer ItemSet, - // so next time the options from the configuration are used - - SfxItemSet aSet( pPrinter->GetOptions() ); - aSet.ClearItem( SID_SCPRINTOPTIONS ); - pPrinter->SetOptions( aSet ); - } - - PostPaintGridAll(); //! nur wenn geaendert -} - void ScDocShell::GetState( SfxItemSet &rSet ) { SfxWhichIter aIter(rSet); diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 697b39052b9f..5414e19c1ca4 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -219,8 +219,9 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter, if ( bInEdit ) // only if using the edit dialog, pMed->UseInteractionHandler( TRUE ); // enable the filter options dialog + // aRef->DoClose() will be called explicitly, but it is still more safe to use SfxObjectShellLock here ScDocShell* pSrcShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL); - SfxObjectShellRef aRef = pSrcShell; + SfxObjectShellLock aRef = pSrcShell; pSrcShell->DoLoad(pMed); // Optionen koennten gesetzt worden sein diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 4a456522003c..6e174a186b84 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -56,6 +56,9 @@ #include "drwlayer.hxx" #include "userdat.hxx" #include "scmod.hxx" +#include "charthelper.hxx" +#include "docuno.hxx" +#include "docsh.hxx" // ----------------------------------------------------------------------- @@ -399,6 +402,14 @@ BOOL __EXPORT FuSelection::MouseButtonUp(const MouseEvent& rMEvt) Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); + bool bCopy = false; + ScViewData* pViewData = ( pViewShell ? pViewShell->GetViewData() : NULL ); + ScDocument* pDocument = ( pViewData ? pViewData->GetDocument() : NULL ); + SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : NULL ); + SdrPage* pPage = ( pPageView ? pPageView->GetPage() : NULL ); + ::std::vector< ::rtl::OUString > aExcludedChartNames; + ScRangeListVector aProtectedChartRangesVector; + if ( rMEvt.IsLeft() ) { if ( pView->IsDragObj() ) @@ -406,6 +417,29 @@ BOOL __EXPORT FuSelection::MouseButtonUp(const MouseEvent& rMEvt) /****************************************************************** * Objekt wurde verschoben ******************************************************************/ + if ( rMEvt.IsMod1() ) + { + if ( pPage ) + { + ScChartHelper::GetChartNames( aExcludedChartNames, pPage ); + } + if ( pView && pDocument ) + { + const SdrMarkList& rSdrMarkList = pView->GetMarkedObjectList(); + ULONG nMarkCount = rSdrMarkList.GetMarkCount(); + for ( ULONG i = 0; i < nMarkCount; ++i ) + { + SdrMark* pMark = rSdrMarkList.GetMark( i ); + SdrObject* pObj = ( pMark ? pMark->GetMarkedSdrObj() : NULL ); + if ( pObj ) + { + ScChartHelper::AddRangesIfProtectedChart( aProtectedChartRangesVector, pDocument, pObj ); + } + } + } + bCopy = true; + } + pView->EndDragObj( rMEvt.IsMod1() ); pView->ForceMarkedToAnotherPage(); @@ -566,6 +600,18 @@ BOOL __EXPORT FuSelection::MouseButtonUp(const MouseEvent& rMEvt) pViewShell->GetViewData()->GetDispatcher(). Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); + if ( bCopy && pViewData && pDocument && pPage ) + { + ScDocShell* pDocShell = pViewData->GetDocShell(); + ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL ); + if ( pModelObj ) + { + SCTAB nTab = pViewData->GetTabNo(); + ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab, + aProtectedChartRangesVector, aExcludedChartNames ); + } + } + return (bReturn); } diff --git a/sc/source/ui/drawfunc/makefile.mk b/sc/source/ui/drawfunc/makefile.mk index a50c450ab373..f82008e4cdeb 100644 --- a/sc/source/ui/drawfunc/makefile.mk +++ b/sc/source/ui/drawfunc/makefile.mk @@ -75,6 +75,7 @@ SLOFILES = \ $(SLO)$/mediash.obj EXCEPTIONSFILES= \ + $(SLO)$/fusel.obj \ $(SLO)$/fuins2.obj \ $(SLO)$/graphsh.obj \ $(SLO)$/mediash.obj diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index ba79cd8270ea..132652891959 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -45,7 +45,6 @@ class ScEditEngineDefaulter; class FontList; -class PrintDialog; class SfxStyleSheetBasePool; class SfxStyleSheetHint; struct ChartSelectionInfo; @@ -304,13 +303,6 @@ public: void DoRecalc( BOOL bApi ); void DoHardRecalc( BOOL bApi ); - bool CheckPrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData, - bool bForceSelected, bool bIsAPI ); - void PreparePrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData ); - void Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, - ScMarkData* pMarkData, Window* pDialogParent, - BOOL bForceSelected, BOOL bIsAPI ); - void UpdateOle( const ScViewData* pViewData, BOOL bSnapSize = FALSE ); BOOL IsOle(); diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx index 9a1175d3310d..cb04b6114efe 100644 --- a/sc/source/ui/inc/drwtrans.hxx +++ b/sc/source/ui/inc/drwtrans.hxx @@ -34,6 +34,8 @@ #include <sfx2/objsh.hxx> #include "global.hxx" +#include "charthelper.hxx" +#include "rangelst.hxx" class SdrModel; @@ -69,6 +71,8 @@ private: sal_uInt32 nSourceDocID; + ScRangeListVector m_aProtectedChartRangesVector; + void InitDocShell(); //REMOVE SvInPlaceObjectRef GetSingleObject(); @@ -104,6 +108,8 @@ public: static ScDrawTransferObj* GetOwnClipboard( Window* pUIWin ); virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( com::sun::star::uno::RuntimeException ); static const com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + + const ScRangeListVector& GetProtectedChartRangesVector() const { return m_aProtectedChartRangesVector; } }; #endif diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx index 7ff97f8d0152..79f4d799223a 100644 --- a/sc/source/ui/inc/prevwsh.hxx +++ b/sc/source/ui/inc/prevwsh.hxx @@ -116,11 +116,7 @@ public: virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE ); virtual USHORT SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ); - virtual PrintDialog* CreatePrintDialog( Window* pParent ); virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); - virtual void PreparePrint( PrintDialog* pPrintDialog = NULL ); - virtual ErrCode DoPrint( SfxPrinter *pPrinter, PrintDialog *pPrintDialog, BOOL bSilent, BOOL bIsAPI ); - virtual USHORT Print( SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pPrintDialog = NULL ); void AddAccessibilityObject( SfxListener& rObject ); void RemoveAccessibilityObject( SfxListener& rObject ); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 62adbeb9089a..69832218f172 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -369,13 +369,7 @@ public: virtual USHORT SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false ); - virtual PrintDialog* CreatePrintDialog( Window* pParent ); virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); - virtual void PreparePrint( PrintDialog* pPrintDialog = NULL ); - virtual ErrCode DoPrint( SfxPrinter *pPrinter, - PrintDialog *pPrintDialog, - BOOL bSilent, BOOL bIsAPI ); - virtual USHORT Print( SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pPrintDialog = NULL ); void ConnectObject( SdrOle2Obj* pObj ); BOOL ActivateObject( SdrOle2Obj* pObj, long nVerb ); diff --git a/sc/source/ui/inc/ui_pch.hxx b/sc/source/ui/inc/ui_pch.hxx index a1dcbf904694..c7ec17209085 100644 --- a/sc/source/ui/inc/ui_pch.hxx +++ b/sc/source/ui/inc/ui_pch.hxx @@ -81,7 +81,7 @@ #include <vcl/outdev.hxx> #include <vcl/pointr.hxx> #include <vcl/ptrstyle.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/event.hxx> #include <limits.h> #include <tools/errinf.hxx> @@ -185,7 +185,6 @@ #include <sfx2/ipfrm.hxx> #include <docsh.hxx> //REMOVE #include <sfx2/interno.hxx> -#include <vcl/wintypes.hxx> #include <sfx2/docfac.hxx> #include <scitems.hxx> #include <vcl/virdev.hxx> diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 59da2966cc60..60dc1bc7b115 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -53,6 +53,7 @@ class SfxItemSet; class SvxBorderLine; class SvxBoxItem; class SvxBoxInfoItem; +class SfxStyleSheetBase; class SfxStyleSheet; class SfxPoolItem; class EditTextObject; @@ -187,8 +188,8 @@ public: const SfxStyleSheet* GetStyleSheetFromMarked(); void SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, BOOL bRecord = TRUE ); - void RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet ); - void UpdateStyleSheetInUse( SfxStyleSheet* pStyleSheet ); + void RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ); + void UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ); void SetNumberFormat( short nFormatType, ULONG nAdd = 0 ); void SetNumFmtByStr( const String& rCode ); diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src index 9c47a42239cc..17b7b99b2e04 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -553,11 +553,6 @@ String STR_REPLCELLSWARN Text [ en-US ] = "You are pasting data into cells that already contain data.\nDo you really want to overwrite the existing data?"; }; -String STR_PRINT_NOTHING -{ - Text [ en-US ] = "There is nothing to print. The selected print range or sheet is empty."; -}; - String SCSTR_ALLFILTER { Text [ en-US ] = "All"; @@ -749,22 +744,13 @@ StringArray SCSTR_PRINT_OPTIONS { < "Pages"; >; < "~Include output of empty pages"; >; - < "If checked empty pages that have no cell contents or draw objects are not printed."; >; - < "Sheets"; >; - < "Print ~only selected sheets"; >; - < "If checked only contents from selected sheets are printed, even if you specify a wider range in the Format - Print Ranges dialog. Content from sheets that are not selected will not be printed."; >; < "Print content"; >; < "~All sheets"; >; - < "The printout will be created from all sheets in the document."; >; < "~Selected sheets"; >; - < "The printout will be created only from the currently selected sheets."; >; < "Selected cells"; >; - < "The printout will be created only from the currently selected cells."; >; < "Thereof print"; >; < "All ~pages"; >; - < "Print all pages of the printable content."; >; < "Pa~ges"; >; - < "Print only some pages of the printable content."; >; < "%PRODUCTNAME %s"; >; }; }; diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index 10627222be80..9b3ce8e3d4bc 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -69,7 +69,7 @@ void ScAddressConversionObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } -sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString ) +sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv ) { if (!pDocShell) return sal_False; @@ -78,7 +78,7 @@ sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString ) sal_Bool bSuccess = sal_False; if ( bIsRange ) { - USHORT nResult = aRange.ParseAny( rUIString, pDoc ); + USHORT nResult = aRange.ParseAny( rUIString, pDoc, eConv ); if ( nResult & SCA_VALID ) { if ( ( nResult & SCA_TAB_3D ) == 0 ) @@ -92,7 +92,7 @@ sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString ) } else { - USHORT nResult = aRange.aStart.Parse( rUIString, pDoc ); + USHORT nResult = aRange.aStart.Parse( rUIString, pDoc, eConv ); if ( nResult & SCA_VALID ) { if ( ( nResult & SCA_TAB_3D ) == 0 ) @@ -118,6 +118,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_XLA1REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 }, {0,0,0,0,0,0} }; static uno::Reference<beans::XPropertySetInfo> aRef(new SfxItemPropertySetInfo( aPropertyMap )); @@ -131,6 +132,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 }, {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_XLA1REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 }, {0,0,0,0,0,0} }; static uno::Reference<beans::XPropertySetInfo> aRef(new SfxItemPropertySetInfo( aPropertyMap )); @@ -190,8 +192,11 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const rtl::OUString& aPr bSuccess = ParseUIString( aUIString ); } } - else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) ) + else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XLA1REPR ) ) { + ::formula::FormulaGrammar::AddressConvention eConv = aNameStr.EqualsAscii( SC_UNONAME_XLA1REPR ) ? + ::formula::FormulaGrammar::CONV_OOO : ::formula::FormulaGrammar::CONV_XL_A1; + // parse the file format string rtl::OUString sRepresentation; if (aValue >>= sRepresentation) @@ -212,7 +217,7 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const rtl::OUString& aPr } // parse the rest like a UI string - bSuccess = ParseUIString( aUIString ); + bSuccess = ParseUIString( aUIString, eConv ); } } else @@ -265,17 +270,23 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const rtl::OUString& aRange.aStart.Format( aFormatStr, nFlags, pDoc ); aRet <<= rtl::OUString( aFormatStr ); } - else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) ) + else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XLA1REPR ) ) { + ::formula::FormulaGrammar::AddressConvention eConv = aNameStr.EqualsAscii( SC_UNONAME_XLA1REPR ) ? + ::formula::FormulaGrammar::CONV_OOO : ::formula::FormulaGrammar::CONV_XL_A1; + // generate file format string - always include sheet String aFormatStr; - aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc ); + aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, eConv ); if ( bIsRange ) { // manually concatenate range so both parts always have the sheet name aFormatStr.Append( (sal_Unicode) ':' ); String aSecond; - aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc ); + USHORT nFlags = SCA_VALID; + if( eConv != ::formula::FormulaGrammar::CONV_XL_A1 ) + nFlags |= SCA_TAB_3D; + aRange.aEnd.Format( aSecond, nFlags, pDoc, eConv ); aFormatStr.Append( aSecond ); } aRet <<= rtl::OUString( aFormatStr ); diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 86f59d66a7a4..168202548a30 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -232,7 +232,8 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName, // Rechteck anpassen //! Fehler/Exception, wenn leer/ungueltig ??? Point aRectPos( aRect.X, aRect.Y ); - if (aRectPos.X() < 0) aRectPos.X() = 0; + bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + if ( ( aRectPos.X() < 0 && !bLayoutRTL ) || ( aRectPos.X() > 0 && bLayoutRTL ) ) aRectPos.X() = 0; if (aRectPos.Y() < 0) aRectPos.Y() = 0; Size aRectSize( aRect.Width, aRect.Height ); if (aRectSize.Width() <= 0) aRectSize.Width() = 5000; // Default-Groesse @@ -298,7 +299,7 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName, xObj->setVisualAreaSize( nAspect, aSz ); pPage->InsertObject( pObj ); - pModel->AddUndo( new SdrUndoInsertObj( *pObj ) ); //! Undo-Kommentar? + pModel->AddUndo( new SdrUndoNewObj( *pObj ) ); // Dies veranlaesst Chart zum sofortigen Update //SvData aEmpty; @@ -318,7 +319,7 @@ void SAL_CALL ScChartsObj::removeByName( const rtl::OUString& aName ) ScDrawLayer* pModel = pDoc->GetDrawLayer(); // ist nicht 0 SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab)); // ist nicht 0 - pModel->AddUndo( new SdrUndoRemoveObj( *pObj ) ); //! Undo-Kommentar? + pModel->AddUndo( new SdrUndoDelObj( *pObj ) ); pPage->RemoveObject( pObj->GetOrdNum() ); //! Notify etc.??? diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index c7bf89671161..342f12ee1205 100755..100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1394,6 +1394,23 @@ void ScDataPilotTableObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { Refreshed_Impl(); } + else if ( rHint.ISA( ScUpdateRefHint ) ) + { + ScRange aRange( 0, 0, nTab ); + ScRangeList aRanges; + aRanges.Append( aRange ); + const ScUpdateRefHint& rRef = static_cast< const ScUpdateRefHint& >( rHint ); + if ( aRanges.UpdateReference( rRef.GetMode(), GetDocShell()->GetDocument(), rRef.GetRange(), + rRef.GetDx(), rRef.GetDy(), rRef.GetDz() ) && + aRanges.Count() == 1 ) + { + const ScRange* pRange = aRanges.GetObject( 0 ); + if ( pRange ) + { + nTab = pRange->aStart.Tab(); + } + } + } ScDataPilotDescriptorBase::Notify( rBC, rHint ); } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 828ec8f09297..eb493f3be426 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -225,53 +225,53 @@ ScPrintUIOptions::ScPrintUIOptions() sal_Bool bSuppress = rPrintOpt.GetSkipEmpty(); ResStringArray aStrings( ScResId( SCSTR_PRINT_OPTIONS ) ); - DBG_ASSERT( aStrings.Count() >= 19, "resource incomplete" ); - if( aStrings.Count() < 19 ) // bad resource ? + DBG_ASSERT( aStrings.Count() >= 10, "resource incomplete" ); + if( aStrings.Count() < 10 ) // bad resource ? return; m_aUIProperties.realloc( 8 ); // create Section for spreadsheet (results in an extra tab page in dialog) SvtModuleOptions aOpt; - String aAppGroupname( aStrings.GetString( 18 ) ); + String aAppGroupname( aStrings.GetString( 9 ) ); aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), aOpt.GetModuleName( SvtModuleOptions::E_SCALC ) ); - m_aUIProperties[0].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); + m_aUIProperties[0].Value = getGroupControlOpt( aAppGroupname, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:TabPage:AppPage" ) ) ); // create subgroup for pages m_aUIProperties[1].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 0 ) ), rtl::OUString() ); // create a bool option for empty pages m_aUIProperties[2].Value = getBoolControlOpt( rtl::OUString( aStrings.GetString( 1 ) ), - rtl::OUString( aStrings.GetString( 2 ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:IsIncludeEmptyPages:CheckBox" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsIncludeEmptyPages" ) ), ! bSuppress ); // create Subgroup for print content vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); - m_aUIProperties[3].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 6 ) ), + m_aUIProperties[3].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 2 ) ), rtl::OUString(), aPrintRangeOpt ); // create a choice for the content to create - uno::Sequence< rtl::OUString > aChoices( 3 ), aHelpTexts( 3 ); - aChoices[0] = aStrings.GetString( 7 ); - aHelpTexts[0] = aStrings.GetString( 8 ); - aChoices[1] = aStrings.GetString( 9 ); - aHelpTexts[1] = aStrings.GetString( 10 ); - aChoices[2] = aStrings.GetString( 11 ); - aHelpTexts[2] = aStrings.GetString( 12 ); + uno::Sequence< rtl::OUString > aChoices( 3 ), aHelpIds( 3 ); + aChoices[0] = aStrings.GetString( 3 ); + aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ) ); + aChoices[1] = aStrings.GetString( 4 ); + aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ) ); + aChoices[2] = aStrings.GetString( 5 ); + aHelpIds[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2" ) ); m_aUIProperties[4].Value = getChoiceControlOpt( rtl::OUString(), - aHelpTexts, + aHelpIds, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ), aChoices, nContent ); // create Subgroup for print range aPrintRangeOpt.mbInternalOnly = sal_True; - m_aUIProperties[5].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 13 ) ), + m_aUIProperties[5].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 6 ) ), rtl::OUString(), aPrintRangeOpt ); @@ -279,13 +279,13 @@ ScPrintUIOptions::ScPrintUIOptions() // create a choice for the range to print rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); aChoices.realloc( 2 ); - aHelpTexts.realloc( 2 ); - aChoices[0] = aStrings.GetString( 14 ); - aHelpTexts[0] = aStrings.GetString( 15 ); - aChoices[1] = aStrings.GetString( 16 ); - aHelpTexts[1] = aStrings.GetString( 17 ); + aHelpIds.realloc( 2 ); + aChoices[0] = aStrings.GetString( 7 ); + aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:0" ) ); + aChoices[1] = aStrings.GetString( 8 ); + aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintRange:RadioButton:1" ) ); m_aUIProperties[6].Value = getChoiceControlOpt( rtl::OUString(), - aHelpTexts, + aHelpIds, aPrintRangeName, aChoices, 0 ); @@ -293,24 +293,11 @@ ScPrintUIOptions::ScPrintUIOptions() // create a an Edit dependent on "Pages" selected vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); m_aUIProperties[7].Value = getEditControlOpt( rtl::OUString(), - rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageRange:Edit" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), rtl::OUString(), aPageRangeOpt ); - - // "Print only selected sheets" isn't needed because of the "Selected Sheets" choice in "Print content" -#if 0 - // create subgroup for sheets - m_aUIProperties[8].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 3 ) ), rtl::OUString() ); - - // create a bool option for selected pages only - m_aUIProperties[9].Value = getBoolControlOpt( rtl::OUString( aStrings.GetString( 4 ) ), - rtl::OUString( aStrings.GetString( 5 ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsOnlySelectedSheets" ) ), - i_bSelectedOnly - ); -#endif } void ScPrintUIOptions::SetDefaults() @@ -449,6 +436,12 @@ ScSheetSaveData* ScModelObj::GetSheetSaveData() return NULL; } +void ScModelObj::RepaintRange( const ScRange& rRange ) +{ + if (pDocShell) + pDocShell->PostPaint( rRange, PAINT_GRID ); +} + uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) { diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 392533c7cf93..6da02cf9e4e3 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -236,16 +236,11 @@ ScTableConditionalFormat::~ScTableConditionalFormat() void ScTableConditionalFormat::AddEntry_Impl(const ScCondFormatEntryItem& aEntry) { - ScTableConditionalEntry* pNew = new ScTableConditionalEntry(this, aEntry); + ScTableConditionalEntry* pNew = new ScTableConditionalEntry(aEntry); pNew->acquire(); aEntries.Insert( pNew, LIST_APPEND ); } -void ScTableConditionalFormat::DataChanged() -{ - // wenn's mal das "lebende Objekt" ist, muss hier was passieren... -} - // XSheetConditionalFormat ScTableConditionalEntry* ScTableConditionalFormat::GetObjectByIndex_Impl(USHORT nIndex) const @@ -348,7 +343,6 @@ void SAL_CALL ScTableConditionalFormat::addNew( } AddEntry_Impl(aEntry); - DataChanged(); } void SAL_CALL ScTableConditionalFormat::removeByIndex( sal_Int32 nIndex ) @@ -360,7 +354,6 @@ void SAL_CALL ScTableConditionalFormat::removeByIndex( sal_Int32 nIndex ) { aEntries.Remove(pEntry); pEntry->release(); - DataChanged(); } } @@ -371,8 +364,6 @@ void SAL_CALL ScTableConditionalFormat::clear() throw(uno::RuntimeException) aEntries.First(); while ( ( pEntry = (ScTableConditionalEntry*)aEntries.Remove() ) != NULL ) pEntry->release(); - - DataChanged(); } // XEnumerationAccess @@ -525,19 +516,14 @@ ScTableConditionalFormat* ScTableConditionalFormat::getImplementation( //UNUSED2008-05 { //UNUSED2008-05 } -ScTableConditionalEntry::ScTableConditionalEntry(ScTableConditionalFormat* pPar, - const ScCondFormatEntryItem& aItem) : - pParent( pPar ), +ScTableConditionalEntry::ScTableConditionalEntry(const ScCondFormatEntryItem& aItem) : aData( aItem ) { - if (pParent) - pParent->acquire(); + // #i113668# only store the settings, keep no reference to parent object } ScTableConditionalEntry::~ScTableConditionalEntry() { - if (pParent) - pParent->release(); } void ScTableConditionalEntry::GetData(ScCondFormatEntryItem& rData) const @@ -559,8 +545,6 @@ void SAL_CALL ScTableConditionalEntry::setOperator( sheet::ConditionOperator nOp { ScUnoGuard aGuard; aData.meMode = lcl_ConditionOperatorToMode( nOperator ); - if (pParent) - pParent->DataChanged(); } rtl::OUString SAL_CALL ScTableConditionalEntry::getFormula1() throw(uno::RuntimeException) @@ -574,8 +558,6 @@ void SAL_CALL ScTableConditionalEntry::setFormula1( const rtl::OUString& aFormul { ScUnoGuard aGuard; aData.maExpr1 = String( aFormula1 ); - if (pParent) - pParent->DataChanged(); } rtl::OUString SAL_CALL ScTableConditionalEntry::getFormula2() throw(uno::RuntimeException) @@ -589,8 +571,6 @@ void SAL_CALL ScTableConditionalEntry::setFormula2( const rtl::OUString& aFormul { ScUnoGuard aGuard; aData.maExpr2 = String( aFormula2 ); - if (pParent) - pParent->DataChanged(); } table::CellAddress SAL_CALL ScTableConditionalEntry::getSourcePosition() throw(uno::RuntimeException) @@ -608,8 +588,6 @@ void SAL_CALL ScTableConditionalEntry::setSourcePosition( const table::CellAddre { ScUnoGuard aGuard; aData.maPos.Set( (SCCOL)aSourcePosition.Column, (SCROW)aSourcePosition.Row, aSourcePosition.Sheet ); - if (pParent) - pParent->DataChanged(); } // XSheetConditionalEntry @@ -625,8 +603,6 @@ void SAL_CALL ScTableConditionalEntry::setStyleName( const rtl::OUString& aStyle { ScUnoGuard aGuard; aData.maStyle = ScStyleNameConversion::ProgrammaticToDisplayName( aStyleName, SFX_STYLE_FAMILY_PARA ); - if (pParent) - pParent->DataChanged(); } //------------------------------------------------------------------------ @@ -739,11 +715,6 @@ ScTableValidationObj::~ScTableValidationObj() { } -void ScTableValidationObj::DataChanged() -{ - // wenn's mal das "lebende Objekt" ist, muss hier was passieren... -} - // XSheetCondition sheet::ConditionOperator SAL_CALL ScTableValidationObj::getOperator() @@ -758,7 +729,6 @@ void SAL_CALL ScTableValidationObj::setOperator( sheet::ConditionOperator nOpera { ScUnoGuard aGuard; nMode = sal::static_int_cast<USHORT>( lcl_ConditionOperatorToMode( nOperator ) ); - DataChanged(); } rtl::OUString SAL_CALL ScTableValidationObj::getFormula1() throw(uno::RuntimeException) @@ -772,7 +742,6 @@ void SAL_CALL ScTableValidationObj::setFormula1( const rtl::OUString& aFormula1 { ScUnoGuard aGuard; aExpr1 = String( aFormula1 ); - DataChanged(); } rtl::OUString SAL_CALL ScTableValidationObj::getFormula2() throw(uno::RuntimeException) @@ -786,7 +755,6 @@ void SAL_CALL ScTableValidationObj::setFormula2( const rtl::OUString& aFormula2 { ScUnoGuard aGuard; aExpr2 = String( aFormula2 ); - DataChanged(); } table::CellAddress SAL_CALL ScTableValidationObj::getSourcePosition() throw(uno::RuntimeException) @@ -804,7 +772,6 @@ void SAL_CALL ScTableValidationObj::setSourcePosition( const table::CellAddress& { ScUnoGuard aGuard; aSrcPos.Set( (SCCOL)aSourcePosition.Column, (SCROW)aSourcePosition.Row, aSourcePosition.Sheet ); - DataChanged(); } uno::Sequence<sheet::FormulaToken> SAL_CALL ScTableValidationObj::getTokens( sal_Int32 nIndex ) @@ -963,8 +930,6 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( if ( aValue >>= nVal ) meGrammar2 = static_cast< FormulaGrammar::Grammar >(nVal); } - - DataChanged(); } uno::Any SAL_CALL ScTableValidationObj::getPropertyValue( const rtl::OUString& aPropertyName ) diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 7646e52c030f..71ed56a93dad 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -51,6 +51,7 @@ #include <sfx2/viewfrm.hxx> #include <rtl/uuid.h> #include <toolkit/helper/convert.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include "drawsh.hxx" #include "drtxtob.hxx" @@ -114,6 +115,7 @@ const SfxItemPropertyMapEntry* lcl_GetViewOptPropertyMap() {MAP_CHAR_LEN(SC_UNO_VISAREA), 0, &getCppuType((awt::Rectangle*)0), 0, 0}, {MAP_CHAR_LEN(SC_UNO_ZOOMTYPE), 0, &getCppuType((sal_Int16*)0), 0, 0}, {MAP_CHAR_LEN(SC_UNO_ZOOMVALUE), 0, &getCppuType((sal_Int16*)0), 0, 0}, + {MAP_CHAR_LEN(SC_UNO_VISAREASCREEN),0, &getCppuType((awt::Rectangle*)0), 0, 0}, {0,0,0,0,0,0} }; return aViewOptPropertyMap_Impl; @@ -418,10 +420,15 @@ awt::Rectangle ScViewPaneBase::GetVisArea() const ScAddress aCell(pViewShell->GetViewData()->GetPosX(eWhichH), pViewShell->GetViewData()->GetPosY(eWhichV), pViewShell->GetViewData()->GetTabNo()); - Rectangle aVisRect(pDoc->GetMMRect(aCell.Col(), aCell.Row(), aCell.Col(), aCell.Row(), aCell.Tab())); - - aVisRect.SetSize(pWindow->PixelToLogic(pWindow->GetSizePixel(), pWindow->GetDrawMapMode(sal_True))); - + Rectangle aCellRect( pDoc->GetMMRect( aCell.Col(), aCell.Row(), aCell.Col(), aCell.Row(), aCell.Tab() ) ); + Size aVisSize( pWindow->PixelToLogic( pWindow->GetSizePixel(), pWindow->GetDrawMapMode( sal_True ) ) ); + Point aVisPos( aCellRect.TopLeft() ); + if ( pDoc->IsLayoutRTL( aCell.Tab() ) ) + { + aVisPos = aCellRect.TopRight(); + aVisPos.X() -= aVisSize.Width(); + } + Rectangle aVisRect( aVisPos, aVisSize ); aVisArea = AWTRectangle(aVisRect); } } @@ -2038,6 +2045,16 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const rtl::OUString& aProperty else if ( aString.EqualsAscii( SC_UNO_VISAREA ) ) aRet <<= GetVisArea(); else if ( aString.EqualsAscii( SC_UNO_ZOOMTYPE ) ) aRet <<= GetZoomType(); else if ( aString.EqualsAscii( SC_UNO_ZOOMVALUE ) ) aRet <<= GetZoom(); + else if ( aString.EqualsAscii( SC_UNO_VISAREASCREEN ) ) + { + ScViewData* pViewData = pViewSh->GetViewData(); + Window* pActiveWin = ( pViewData ? pViewData->GetActiveWin() : NULL ); + if ( pActiveWin ) + { + Rectangle aRect = pActiveWin->GetWindowExtentsRelative( NULL ); + aRet <<= AWTRectangle( aRect ); + } + } } return aRet; diff --git a/sc/source/ui/vba/vbasheetobject.cxx b/sc/source/ui/vba/vbasheetobject.cxx index 28e54de859ad..7c8d80d9fcfa 100644 --- a/sc/source/ui/vba/vbasheetobject.cxx +++ b/sc/source/ui/vba/vbasheetobject.cxx @@ -377,14 +377,14 @@ void SAL_CALL ScVbaControlObjectBase::setOnAction( const OUString& rMacroName ) // if a macro name has been passed, try to attach it to the event if( rMacroName.getLength() > 0 ) { - VBAMacroResolvedInfo aResolvedMacro = resolveVBAMacro( getSfxObjShell( mxModel ), rMacroName ); - if( !aResolvedMacro.IsResolved() ) + MacroResolvedInfo aResolvedMacro = resolveVBAMacro( getSfxObjShell( mxModel ), rMacroName ); + if( !aResolvedMacro.mbFound ) throw uno::RuntimeException(); script::ScriptEventDescriptor aDescriptor; aDescriptor.ListenerType = maListenerType; aDescriptor.EventMethod = maEventMethod; aDescriptor.ScriptType = CREATE_OUSTRING( "Script" ); - aDescriptor.ScriptCode = makeMacroURL( aResolvedMacro.ResolvedMacro() ); + aDescriptor.ScriptCode = makeMacroURL( aResolvedMacro.msResolvedMacro ); xEventMgr->registerScriptEvent( nIndex, aDescriptor ); } } diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 04571c0c6ca4..1d748246a1d6 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -530,19 +530,15 @@ void ScDrawView::MarkListHasChanged() SfxViewFrame* pViewFrame = pViewSh->GetViewFrame(); BOOL bOle = pViewSh->GetViewFrame()->GetFrame().IsInPlace(); + uno::Sequence< embed::VerbDescriptor > aVerbs; if ( pOle2Obj && !bOle ) { uno::Reference < embed::XEmbeddedObject > xObj = pOle2Obj->GetObjRef(); + DBG_ASSERT( xObj.is(), "SdrOle2Obj ohne ObjRef" ); if (xObj.is()) - pViewSh->SetVerbs( xObj->getSupportedVerbs() ); - else - { - DBG_ERROR("SdrOle2Obj ohne ObjRef"); - pViewSh->SetVerbs( 0 ); - } + aVerbs = xObj->getSupportedVerbs(); } - else - pViewSh->SetVerbs( 0 ); + pViewSh->SetVerbs( aVerbs ); // Image-Map Editor diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 6f6b10f5e362..377ebed987f2 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -453,7 +453,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) { if ( pStyleSheet ) { - pTabViewShell->RemoveStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->RemoveStyleSheetInUse( pStyleSheet ); pStylePool->Remove( pStyleSheet ); pTabViewShell->InvalidateAttribs(); nRetMask = TRUE; @@ -556,7 +556,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // Attribute uebernehmen und Style anwenden pStyleSheet->GetItemSet().Put( aAttrSet ); - pTabViewShell->UpdateStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); // call SetStyleSheetToMarked after adding the ScUndoModifyStyle // (pStyleSheet pointer is used!) @@ -578,7 +578,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } pStyleSheet->GetItemSet().Put( aAttrSet ); - pTabViewShell->UpdateStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); // call SetStyleSheetToMarked after adding the ScUndoModifyStyle // (pStyleSheet pointer is used!) @@ -868,7 +868,7 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) (const SvxNumberInfoItem&) *(pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO)) ); - pTabViewShell->UpdateStyleSheetInUse( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); pTabViewShell->InvalidateAttribs(); } diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 6e28d6ba846d..52d3217d7881 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -44,7 +44,6 @@ #include <sfx2/dispatch.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> -#include <svtools/printdlg.hxx> #include <svl/stritem.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> @@ -484,40 +483,6 @@ USHORT __EXPORT ScPreviewShell::SetPrinter( SfxPrinter *pNewPrinter, USHORT nDif return pDocShell->SetPrinter( pNewPrinter, nDiffFlags ); } -PrintDialog* __EXPORT ScPreviewShell::CreatePrintDialog( Window* pParent ) -{ - pDocShell->GetDocument()->SetPrintOptions(); // Optionen aus OFA am Printer setzen - (void)GetPrinter(); - - const long nCurPage = pPreview->GetPageNo()+1; - const long nDocPageMax = pPreview->GetTotalPages(); - PrintDialog* pDlg = new PrintDialog( pParent, true ); -// wenn zu langsam wieder einbauen -// if ( pPreview->AllTested() ) -// nPageMax = pPreview->GetTotalPages(); - - pDlg->EnableSheetRange( true, PRINTSHEETS_ALL ); - pDlg->EnableSheetRange( true, PRINTSHEETS_SELECTED_SHEETS ); - pDlg->EnableSheetRange( false, PRINTSHEETS_SELECTED_CELLS ); - bool bAllTabs = SC_MOD()->GetPrintOptions().GetAllSheets(); - pDlg->CheckSheetRange( bAllTabs ? PRINTSHEETS_ALL : PRINTSHEETS_SELECTED_SHEETS ); - - if ( nDocPageMax > 0 ) - pDlg->SetRangeText( String::CreateFromInt32( nCurPage ) ); - - pDlg->EnableRange ( PRINTDIALOG_ALL ); - pDlg->EnableRange ( PRINTDIALOG_RANGE ); - pDlg->SetFirstPage ( 1 ); - pDlg->SetMinPage ( 1 ); - pDlg->SetLastPage ( (USHORT)nDocPageMax ); - pDlg->SetMaxPage ( (USHORT)nDocPageMax ); - pDlg->EnableCollate (); - - // Selektion hier nicht - - return pDlg; -} - SfxTabPage* ScPreviewShell::CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); @@ -529,66 +494,6 @@ SfxTabPage* ScPreviewShell::CreatePrintOptionsPage( Window *pParent, const SfxIt return 0; } -void __EXPORT ScPreviewShell::PreparePrint( PrintDialog* pPrintDialog ) -{ - SfxViewShell::PreparePrint( pPrintDialog ); - - ScMarkData aMarkData; - aMarkData.SelectTable( static_cast< SCTAB >( pPreview->GetTab() ), TRUE ); - pDocShell->PreparePrint( pPrintDialog, &aMarkData ); -} - -ErrCode ScPreviewShell::DoPrint( SfxPrinter *pPrinter, - PrintDialog *pPrintDialog, BOOL bSilent, BOOL bIsAPI ) -{ - ErrCode nRet = ERRCODE_IO_ABORT; - - ScMarkData aMarkData; - aMarkData.SelectTable( static_cast< SCTAB >( pPreview->GetTab() ), TRUE ); - - if ( pDocShell->CheckPrint( pPrintDialog, &aMarkData, false, bIsAPI ) ) - { - // SfxViewShell::DoPrint calls Print (after StartJob etc.) - nRet = SfxViewShell::DoPrint( pPrinter, pPrintDialog, bSilent, bIsAPI ); - } - - return nRet; -} - -USHORT __EXPORT ScPreviewShell::Print( SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pPrintDialog ) -{ - pDocShell->GetDocument()->SetPrintOptions(); // Optionen aus OFA am Printer setzen - - // get the list of affected sheets before SfxViewShell::Print - bool bAllTabs = ( pPrintDialog ? ( pPrintDialog->GetCheckedSheetRange() == PRINTSHEETS_ALL ) : SC_MOD()->GetPrintOptions().GetAllSheets() ); - - ScMarkData aMarkData; - aMarkData.SelectTable( static_cast< SCTAB >( pPreview->GetTab() ), TRUE ); - - uno::Sequence< sal_Int32 > aSheets; - SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); - sal_Int32 nPrinted = 0; - for ( SCTAB nTab = 0; nTab < nTabCount; ++nTab ) - { - if ( bAllTabs || aMarkData.GetTableSelect( nTab ) ) - { - aSheets.realloc( nPrinted + 1 ); - aSheets[nPrinted] = nTab; - ++nPrinted; - } - } - - uno::Sequence < beans::PropertyValue > aProps(1); - aProps[0].Name = ::rtl::OUString::createFromAscii( "PrintSheets" ); - aProps[0].Value <<= aSheets; - SetAdditionalPrintOptions( aProps ); - - SfxViewShell::Print( rProgress, bIsAPI, pPrintDialog ); - pDocShell->Print( rProgress, pPrintDialog, &aMarkData, pPreview, FALSE, bIsAPI ); - - return 0; -} - //------------------------------------------------------------------------ void __EXPORT ScPreviewShell::Activate(BOOL bMDI) diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 93d1edd7fee5..886a3035a847 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -767,11 +767,13 @@ void ScTabView::AlignToCursor( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode, if ( nCurX < nDeltaX || nCurX >= nDeltaX+nSizeX ) { nNewDeltaX = nDeltaX + nCurX - aViewData.GetCurX(); + if (nNewDeltaX < 0) nNewDeltaX = 0; nSizeX = (SCsCOL) aViewData.CellsAtX( nNewDeltaX, 1, eAlignX ); } if ( nCurY < nDeltaY || nCurY >= nDeltaY+nSizeY ) { nNewDeltaY = nDeltaY + nCurY - aViewData.GetCurY(); + if (nNewDeltaY < 0) nNewDeltaY = 0; nSizeY = (SCsROW) aViewData.CellsAtY( nNewDeltaY, 1, eAlignY ); } @@ -780,7 +782,7 @@ void ScTabView::AlignToCursor( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode, if ( nCurX < nNewDeltaX || nCurX >= nNewDeltaX+nSizeX ) { nNewDeltaX = nCurX - (nSizeX / 2); - if (nNewDeltaX < 0) nNewDeltaY = 0; + if (nNewDeltaX < 0) nNewDeltaX = 0; nSizeX = (SCsCOL) aViewData.CellsAtX( nNewDeltaX, 1, eAlignX ); } if ( nCurY < nNewDeltaY || nCurY >= nNewDeltaY+nSizeY ) diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 3be2d1daed89..f23ed39b34c5 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -46,7 +46,6 @@ #include <sfx2/request.hxx> #include <sfx2/printer.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/printdlg.hxx> #include <svl/whiter.hxx> #include <unotools/moduleoptions.hxx> #include <rtl/logfile.hxx> @@ -1159,57 +1158,6 @@ USHORT __EXPORT ScTabViewShell::SetPrinter( SfxPrinter *pNewPrinter, USHORT nDif return GetViewData()->GetDocShell()->SetPrinter( pNewPrinter, nDiffFlags ); } -PrintDialog* __EXPORT ScTabViewShell::CreatePrintDialog( Window *pParent ) -{ - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - ScDocument* pDoc = pDocShell->GetDocument(); - - pDoc->SetPrintOptions(); // Optionen aus OFA am Printer setzen - SfxPrinter* pPrinter = GetPrinter(); - - String aStrRange; - PrintDialog* pDlg = new PrintDialog( pParent, true ); - SCTAB nTabCount = pDoc->GetTableCount(); - long nDocPageMax = 0; - - pDlg->EnableSheetRange( true, PRINTSHEETS_ALL ); - pDlg->EnableSheetRange( true, PRINTSHEETS_SELECTED_SHEETS ); - pDlg->EnableSheetRange( true, PRINTSHEETS_SELECTED_CELLS ); - bool bAllTabs = SC_MOD()->GetPrintOptions().GetAllSheets(); - pDlg->CheckSheetRange( bAllTabs ? PRINTSHEETS_ALL : PRINTSHEETS_SELECTED_SHEETS ); - - // update all pending row heights with a single progress bar, - // instead of a separate progress for each sheet from ScPrintFunc - pDocShell->UpdatePendingRowHeights( MAXTAB, true ); - - for ( SCTAB i=0; i<nTabCount; i++ ) - { - ScPrintFunc aPrintFunc( pDocShell, pPrinter, i ); - nDocPageMax += aPrintFunc.GetTotalPages(); - } - - if ( nDocPageMax > 0 ) - { - aStrRange = '1'; - if ( nDocPageMax > 1 ) - { - aStrRange += '-'; - aStrRange += String::CreateFromInt32( nDocPageMax ); - } - } - - pDlg->SetRangeText ( aStrRange ); - pDlg->EnableRange ( PRINTDIALOG_ALL ); - pDlg->EnableRange ( PRINTDIALOG_RANGE ); - pDlg->SetFirstPage ( 1 ); - pDlg->SetMinPage ( 1 ); - pDlg->SetLastPage ( (USHORT)nDocPageMax ); - pDlg->SetMaxPage ( (USHORT)nDocPageMax ); - pDlg->EnableCollate (); - - return pDlg; -} - SfxTabPage* ScTabViewShell::CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); @@ -1221,78 +1169,6 @@ SfxTabPage* ScTabViewShell::CreatePrintOptionsPage( Window *pParent, const SfxIt return 0; } -void __EXPORT ScTabViewShell::PreparePrint( PrintDialog* pPrintDialog ) -{ - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - - SfxViewShell::PreparePrint( pPrintDialog ); - pDocShell->PreparePrint( pPrintDialog, &GetViewData()->GetMarkData() ); -} - -ErrCode ScTabViewShell::DoPrint( SfxPrinter *pPrinter, - PrintDialog *pPrintDialog, BOOL bSilent, BOOL bIsAPI ) -{ - // #72527# if SID_PRINTDOCDIRECT is executed and there's a selection, - // ask if only the selection should be printed - - const ScMarkData& rMarkData = GetViewData()->GetMarkData(); - if ( !pPrintDialog && !bSilent && !bIsAPI && ( rMarkData.IsMarked() || rMarkData.IsMultiMarked() ) ) - { - SvxPrtQryBox aQuery( GetDialogParent() ); - short nBtn = aQuery.Execute(); - - if ( nBtn == RET_CANCEL ) - return ERRCODE_IO_ABORT; - - if ( nBtn == RET_OK ) - bPrintSelected = TRUE; - } - - ErrCode nRet = ERRCODE_IO_ABORT; - - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - if ( pDocShell->CheckPrint( pPrintDialog, &GetViewData()->GetMarkData(), bPrintSelected, bIsAPI ) ) - { - // get the list of affected sheets before SfxViewShell::Print - bool bAllTabs = ( pPrintDialog ? ( pPrintDialog->GetCheckedSheetRange() == PRINTSHEETS_ALL ) : SC_MOD()->GetPrintOptions().GetAllSheets() ); - - uno::Sequence<sal_Int32> aSheets; - SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); - USHORT nPrinted = 0; - for ( SCTAB nTab=0; nTab<nTabCount; nTab++ ) - if ( bAllTabs || rMarkData.GetTableSelect(nTab) ) - { - aSheets.realloc( nPrinted + 1 ); - aSheets[nPrinted] = nTab; - ++nPrinted; - } - - uno::Sequence < beans::PropertyValue > aProps(1); - aProps[0].Name=::rtl::OUString::createFromAscii("PrintSheets"); - aProps[0].Value <<= aSheets; - SetAdditionalPrintOptions( aProps ); - - // SfxViewShell::DoPrint calls Print (after StartJob etc.) - nRet = SfxViewShell::DoPrint( pPrinter, pPrintDialog, bSilent, bIsAPI ); - } - - bPrintSelected = FALSE; - - return nRet; -} - -USHORT __EXPORT ScTabViewShell::Print( SfxProgress& rProgress, BOOL bIsAPI, - PrintDialog* pPrintDialog ) -{ - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - pDocShell->GetDocument()->SetPrintOptions(); // Optionen aus OFA am Printer setzen - - SfxViewShell::Print( rProgress, bIsAPI, pPrintDialog ); - pDocShell->Print( rProgress, pPrintDialog, &GetViewData()->GetMarkData(), - GetDialogParent(), bPrintSelected, bIsAPI ); - return 0; -} - void ScTabViewShell::StopEditShell() { if ( pEditShell != NULL && !bDontSwitch ) diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 30d7030c8c8a..0dc77a19121c 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -164,6 +164,9 @@ #include "scitems.hxx" #include <svx/dbexch.hrc> #include <svx/svdetc.hxx> +#include <svx/svditer.hxx> +#include <svx/svdoole2.hxx> +#include <svx/svdpage.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> #include <svl/stritem.hxx> @@ -206,6 +209,10 @@ #include "drwtrans.hxx" #include "docuno.hxx" #include "clipparam.hxx" +#include "drawview.hxx" +#include "chartlis.hxx" +#include "charthelper.hxx" + using namespace com::sun::star; @@ -337,7 +344,28 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI } ScClipParam aClipParam(aRange, bCut); + aClipParam.setSourceDocID( pDoc->GetDocumentID() ); pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, bIncludeObjects); + + if ( pDoc && pClipDoc ) + { + ScDrawLayer* pDrawLayer = pClipDoc->GetDrawLayer(); + if ( pDrawLayer ) + { + ScClipParam& rClipParam = pClipDoc->GetClipParam(); + ScRangeListVector& rRangesVector = rClipParam.maProtectedChartRangesVector; + SCTAB nTabCount = pClipDoc->GetTableCount(); + for ( SCTAB nTab = 0; nTab < nTabCount; ++nTab ) + { + SdrPage* pPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( nTab ) ); + if ( pPage ) + { + ScChartHelper::FillProtectedChartRangesVector( rRangesVector, pDoc, pPage ); + } + } + } + } + if (bSysClip) { ScDrawLayer::SetGlobalDrawPersist(NULL); @@ -1350,8 +1378,19 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, AdjustBlockHeight(); // update row heights before pasting objects + ::std::vector< ::rtl::OUString > aExcludedChartNames; + SdrPage* pPage = NULL; + if ( nFlags & IDF_OBJECTS ) { + ScDrawView* pScDrawView = GetScDrawView(); + SdrModel* pModel = ( pScDrawView ? pScDrawView->GetModel() : NULL ); + pPage = ( pModel ? pModel->GetPage( static_cast< sal_uInt16 >( nStartTab ) ) : NULL ); + if ( pPage ) + { + ScChartHelper::GetChartNames( aExcludedChartNames, pPage ); + } + // Paste the drawing objects after the row heights have been updated. pDoc->CopyFromClip( aUserRange, aFilteredMark, IDF_OBJECTS, pRefUndoDoc, pClipDoc, @@ -1450,6 +1489,19 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, aModificator.SetDocumentModified(); PostPasteFromClip(aUserRange, rMark); + + if ( nFlags & IDF_OBJECTS ) + { + ScModelObj* pModelObj = ( pDocSh ? ScModelObj::getImplementation( pDocSh->GetModel() ) : NULL ); + if ( pDoc && pPage && pModelObj ) + { + bool bSameDoc = ( rClipParam.getSourceDocID() == pDoc->GetDocumentID() ); + const ScRangeListVector& rProtectedChartRangesVector( rClipParam.maProtectedChartRangesVector ); + ScChartHelper::CreateProtectedChartListenersAndNotify( pDoc, pPage, pModelObj, nStartTab, + rProtectedChartRangesVector, aExcludedChartNames, bSameDoc ); + } + } + return TRUE; } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 123464cd5fda..ded411aca9ed 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -392,9 +392,11 @@ void ScViewFunc::DoThesaurus( BOOL bRecord ) if (pCell) { ((ScEditCell*) pCell)->GetData(pTObject); - pOldTObj = pTObject->Clone(); if (pTObject) + { + pOldTObj = pTObject->Clone(); pThesaurusEngine->SetText(*pTObject); + } } } else diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index afa06ddfee3e..bdc0ac895b8e 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -56,6 +56,10 @@ #include "drwlayer.hxx" #include "drwtrans.hxx" #include "globstr.hrc" +#include "chartlis.hxx" +#include "docuno.hxx" +#include "docsh.hxx" +#include "convuno.hxx" extern Point aDragStartDiff; @@ -149,9 +153,16 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, else { SdrModel* pDrawModel = pDragEditView->GetModel(); - SdrPage* pDestPage = pDrawModel->GetPage( static_cast<sal_uInt16>(GetViewData()->GetTabNo()) ); + SCTAB nTab = GetViewData()->GetTabNo(); + SdrPage* pDestPage = pDrawModel->GetPage( static_cast< sal_uInt16 >( nTab ) ); DBG_ASSERT(pDestPage,"nanu, Page?"); + ::std::vector< ::rtl::OUString > aExcludedChartNames; + if ( pDestPage ) + { + ScChartHelper::GetChartNames( aExcludedChartNames, pDestPage ); + } + SdrMarkList aMark = pDragEditView->GetMarkedObjectList(); aMark.ForceSort(); ULONG nMarkAnz=aMark.GetMarkCount(); @@ -184,6 +195,16 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, if (bPasteIsMove) pDragEditView->DeleteMarked(); + + ScDocument* pDocument = GetViewData()->GetDocument(); + ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL ); + if ( pDocument && pDestPage && pModelObj && pDrawTrans ) + { + const ScRangeListVector& rProtectedChartRangesVector( pDrawTrans->GetProtectedChartRangesVector() ); + ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pDestPage, pModelObj, nTab, + rProtectedChartRangesVector, aExcludedChartNames, bSameDoc ); + } } } else @@ -204,6 +225,15 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, if ( pClient && pClient->IsObjectInPlaceActive() ) nOptions |= SDRINSERT_DONTMARK; + ::std::vector< ::rtl::OUString > aExcludedChartNames; + SCTAB nTab = GetViewData()->GetTabNo(); + SdrPage* pPage = pScDrawView->GetModel()->GetPage( static_cast< sal_uInt16 >( nTab ) ); + DBG_ASSERT( pPage, "Page?" ); + if ( pPage ) + { + ScChartHelper::GetChartNames( aExcludedChartNames, pPage ); + } + // #89247# Set flag for ScDocument::UpdateChartListeners() which is // called during paste. if ( !bSameDocClipboard ) @@ -216,10 +246,6 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // #68991# Paste puts all objects on the active (front) layer // controls must be on SC_LAYER_CONTROLS - - SCTAB nTab = GetViewData()->GetTabNo(); - SdrPage* pPage = pScDrawView->GetModel()->GetPage(static_cast<sal_uInt16>(nTab)); - DBG_ASSERT(pPage,"Page?"); if (pPage) { SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); @@ -234,6 +260,18 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // #75299# all graphics objects must have names GetViewData()->GetDocument()->EnsureGraphicNames(); + + ScDocument* pDocument = GetViewData()->GetDocument(); + ScDocShell* pDocShell = GetViewData()->GetDocShell(); + ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL ); + ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard( NULL ); + if ( pDocument && pPage && pModelObj && ( pTransferObj || pDrawTrans ) ) + { + const ScRangeListVector& rProtectedChartRangesVector( + pTransferObj ? pTransferObj->GetProtectedChartRangesVector() : pDrawTrans->GetProtectedChartRangesVector() ); + ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab, + rProtectedChartRangesVector, aExcludedChartNames, bSameDocClipboard ); + } } if (bGroup) diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 231eb4e67562..e0ebb8f3024f 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1545,7 +1545,7 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, BOOL bRecord } -void ScViewFunc::RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet ) +void ScViewFunc::RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) { if ( !pStyleSheet) return; // ------------------------------------------------------------------- @@ -1572,7 +1572,7 @@ void ScViewFunc::RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet ) pHdl->ForgetLastPattern(); } -void ScViewFunc::UpdateStyleSheetInUse( SfxStyleSheet* pStyleSheet ) +void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ) { if ( !pStyleSheet) return; // ------------------------------------------------------------------- |