diff options
author | Jürgen Schmidt <jsc@apache.org> | 2011-10-19 09:35:16 +0000 |
---|---|---|
committer | Jürgen Schmidt <jsc@apache.org> | 2011-10-19 09:35:16 +0000 |
commit | c13162c59402230bdd8f46300bbfa8142c4e01b7 (patch) | |
tree | b4056f4c6997a83842f319eeb3801b9309cad0b1 | |
parent | 6bf17dc7ffa79f52458df707c9da798951e19b2e (diff) |
#118524: apply patch, followup fixes to 118485, thanks to Armin Le Grand (alg)
-rw-r--r-- | sc/source/ui/app/client.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/docshell/sdclient.cxx | 25 | ||||
-rw-r--r-- | svx/inc/svx/svdoole2.hxx | 7 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 36 |
7 files changed, 91 insertions, 17 deletions
diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx index 9dac737372ae..aa3a648bd06b 100644 --- a/sc/source/ui/app/client.cxx +++ b/sc/source/ui/app/client.cxx @@ -169,7 +169,23 @@ void __EXPORT ScClient::ObjectAreaChanged() SdrOle2Obj* pDrawObj = GetDrawObj(); if (pDrawObj) { - pDrawObj->SetLogicRect( GetScaledObjArea() ); + Rectangle aNewRectangle(GetScaledObjArea()); + + // #i118524# if sheared/rotated, center to non-rotated LogicRect + pDrawObj->setSuppressSetVisAreaSize(true); + + if(pDrawObj->GetGeoStat().nDrehWink || pDrawObj->GetGeoStat().nShearWink) + { + pDrawObj->SetLogicRect( aNewRectangle ); + + const Rectangle& rBoundRect = pDrawObj->GetCurrentBoundRect(); + const Point aDelta(aNewRectangle.Center() - rBoundRect.Center()); + + aNewRectangle.Move(aDelta.X(), aDelta.Y()); + } + + pDrawObj->SetLogicRect( aNewRectangle ); + pDrawObj->setSuppressSetVisAreaSize(false); // set document modified (SdrModel::SetChanged is not used) // TODO/LATER: is there a reason that this code is not executed in Draw? diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index a20c73d04adf..17ef37237618 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -603,7 +603,10 @@ void ScTabView::DigitLanguageChanged() void ScTabView::ScrollToObject( SdrObject* pDrawObj ) { if ( pDrawObj ) - MakeVisible( pDrawObj->GetLogicRect() ); + { + // #i118524# use the BoundRect, this defines the visible area + MakeVisible(pDrawObj->GetCurrentBoundRect()); + } } void ScTabView::MakeVisible( const Rectangle& rHMMRect ) diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index c1fb1d9959a9..659d59695ba0 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -225,6 +225,11 @@ sal_Bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) if (nErr != ERRCODE_NONE && !bErrorShown) ErrorHandler::HandleError(nErr); + // #i118524# refresh handles to suppress for activated OLE + if(GetSdrView()) + { + GetSdrView()->AdjustMarkHdl(); + } //! SetDocumentName sollte schon im Sfx passieren ??? //TODO/LATER: how "SetDocumentName"? //xIPObj->SetDocumentName( GetViewData()->GetDocShell()->GetTitle() ); diff --git a/sd/source/ui/docshell/sdclient.cxx b/sd/source/ui/docshell/sdclient.cxx index bb1cd14f87f5..bfc4acd95a25 100644 --- a/sd/source/ui/docshell/sdclient.cxx +++ b/sd/source/ui/docshell/sdclient.cxx @@ -142,10 +142,29 @@ void Client::ObjectAreaChanged() if (rMarkList.GetMarkCount() == 1) { SdrMark* pMark = rMarkList.GetMark(0); - SdrObject* pObj = pMark->GetMarkedSdrObj(); + SdrOle2Obj* pObj = dynamic_cast< SdrOle2Obj* >(pMark->GetMarkedSdrObj()); - // no need to check for changes, this method is called only if the area really changed - pObj->SetLogicRect( GetScaledObjArea() ); + if(pObj) + { + // no need to check for changes, this method is called only if the area really changed + Rectangle aNewRectangle(GetScaledObjArea()); + + // #i118524# if sheared/rotated, center to non-rotated LogicRect + pObj->setSuppressSetVisAreaSize(true); + + if(pObj->GetGeoStat().nDrehWink || pObj->GetGeoStat().nShearWink) + { + pObj->SetLogicRect( aNewRectangle ); + + const Rectangle& rBoundRect = pObj->GetCurrentBoundRect(); + const Point aDelta(aNewRectangle.Center() - rBoundRect.Center()); + + aNewRectangle.Move(aDelta.X(), aDelta.Y()); + } + + pObj->SetLogicRect( aNewRectangle ); + pObj->setSuppressSetVisAreaSize(false); + } } } diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx index 0d95214d4121..8fdb3004890a 100644 --- a/svx/inc/svx/svdoole2.hxx +++ b/svx/inc/svx/svdoole2.hxx @@ -73,6 +73,8 @@ protected: // wg. Kompatibilitaet erstmal am SdrTextObj sal_Bool bFrame : 1; sal_Bool bInDestruction : 1; + // #i118524# + bool mbSuppressSetVisAreaSize : 1; mutable bool m_bTypeAsked; mutable bool m_bChart; @@ -98,6 +100,8 @@ public: const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const { return xObjRef; } sal_Int64 GetAspect() const { return xObjRef.GetViewAspect(); } + bool isInplaceActive() const; + bool isUiActive() const; void SetAspect( sal_Int64 nAspect ); // Ein OLE-Zeichenobjekt kann eine StarView-Grafik beinhalten. @@ -110,6 +114,9 @@ public: // no conversion is done if no target mode is provided Size GetOrigObjSize( MapMode* pTargetMapMode = NULL ) const; + // #i118524# Allow suppress SetVisAreaSize in changing methods when call + // comes from OLE client + void setSuppressSetVisAreaSize(bool bNew) { mbSuppressSetVisAreaSize = bNew; } // OLE object has got a separate PersistName member now; // !!! use ::SetPersistName( ... ) only, if you know what you do !!! diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index f9055fedcabc..407789306dac 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -731,7 +731,17 @@ void SdrMarkView::SetMarkHandles() && pMarkedObj->ISA(SdrTextObj) && ((SdrTextObj*)pMarkedObj)->IsInEditMode()); - if(!aRect.IsEmpty() && !bHideHandlesWhenInTextEdit) + // #i118524# if inplace activated OLE is selected, + // suppress handles + bool bHideHandlesWhenOleActive(false); + const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pMarkedObj); + + if(pSdrOle2Obj && (pSdrOle2Obj->isInplaceActive() || pSdrOle2Obj->isUiActive())) + { + bHideHandlesWhenOleActive = true; + } + + if(!aRect.IsEmpty() && !bHideHandlesWhenInTextEdit && !bHideHandlesWhenOleActive) { // sonst nix gefunden if( bSingleTextObjMark ) { diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 8cf88c20ffb4..3b1b6cc493a6 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -762,6 +762,7 @@ SdrOle2Obj::SdrOle2Obj(FASTBOOL bFrame_) : m_bTypeAsked(false) { DBG_CTOR( SdrOle2Obj,NULL); bInDestruction = sal_False; + mbSuppressSetVisAreaSize = false; Init(); bFrame=bFrame_; } @@ -774,6 +775,7 @@ SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, FASTBOOL bFram { DBG_CTOR( SdrOle2Obj,NULL); bInDestruction = sal_False; + mbSuppressSetVisAreaSize = false; Init(); bFrame=bFrame_; @@ -795,6 +797,7 @@ SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const XubStrin { DBG_CTOR( SdrOle2Obj,NULL); bInDestruction = sal_False; + mbSuppressSetVisAreaSize = false; Init(); mpImpl->aPersistName = rNewObjName; @@ -818,6 +821,7 @@ SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const XubStri { DBG_CTOR( SdrOle2Obj,NULL); bInDestruction = sal_False; + mbSuppressSetVisAreaSize = false; Init(); mpImpl->aPersistName = rNewObjName; @@ -884,6 +888,18 @@ void SdrOle2Obj::SetAspect( sal_Int64 nAspect ) } // ----------------------------------------------------------------------------- +bool SdrOle2Obj::isInplaceActive() const +{ + return xObjRef.is() && embed::EmbedStates::INPLACE_ACTIVE == xObjRef->getCurrentState(); +} + +// ----------------------------------------------------------------------------- +bool SdrOle2Obj::isUiActive() const +{ + return xObjRef.is() && embed::EmbedStates::UI_ACTIVE == xObjRef->getCurrentState(); +} + +// ----------------------------------------------------------------------------- void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf) { @@ -1749,6 +1765,10 @@ void SdrOle2Obj::operator=(const SdrObject& rObj) void SdrOle2Obj::ImpSetVisAreaSize() { + // #i118524# do not again set VisAreaSize when the call comes from OLE client (e.g. ObjectAreaChanged) + if(mbSuppressSetVisAreaSize) + return; + // currently there is no need to recalculate scaling for iconified objects // TODO/LATER: it might be needed in future when it is possible to change the icon if ( GetAspect() == embed::Aspects::MSOLE_ICON ) @@ -1893,17 +1913,7 @@ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract } SdrRectObj::NbcResize(rRef,xFact,yFact); - if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0) { // kleine Korrekturen - if (aGeo.nDrehWink>=9000 && aGeo.nDrehWink<27000) { - aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.Bottom()); - } - aGeo.nDrehWink=0; - aGeo.nShearWink=0; - aGeo.nSin=0.0; - aGeo.nCos=1.0; - aGeo.nTan=0.0; - SetRectsDirty(); - } + if( pModel && !pModel->isLocked() ) ImpSetVisAreaSize(); } @@ -1913,6 +1923,7 @@ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract void SdrOle2Obj::SetGeoData(const SdrObjGeoData& rGeo) { SdrRectObj::SetGeoData(rGeo); + if( pModel && !pModel->isLocked() ) ImpSetVisAreaSize(); } @@ -1922,6 +1933,7 @@ void SdrOle2Obj::SetGeoData(const SdrObjGeoData& rGeo) void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect) { SdrRectObj::NbcSetSnapRect(rRect); + if( pModel && !pModel->isLocked() ) ImpSetVisAreaSize(); @@ -1939,6 +1951,7 @@ void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect) void SdrOle2Obj::NbcSetLogicRect(const Rectangle& rRect) { SdrRectObj::NbcSetLogicRect(rRect); + if( pModel && !pModel->isLocked() ) ImpSetVisAreaSize(); } @@ -1968,6 +1981,7 @@ Size SdrOle2Obj::GetOrigObjSize( MapMode* pTargetMapMode ) const void SdrOle2Obj::NbcMove(const Size& rSize) { SdrRectObj::NbcMove(rSize); + if( pModel && !pModel->isLocked() ) ImpSetVisAreaSize(); } |