diff options
Diffstat (limited to 'chart2/source/controller/drawinglayer/DrawViewWrapper.cxx')
-rw-r--r-- | chart2/source/controller/drawinglayer/DrawViewWrapper.cxx | 66 |
1 files changed, 44 insertions, 22 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index 9d448b4119fe..74be51a5ee11 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -19,9 +19,11 @@ #include <DrawViewWrapper.hxx> #include <chartview/DrawModelWrapper.hxx> -#include <ConfigurationAccess.hxx> #include <unotools/lingucfg.hxx> +#include <unotools/syslocale.hxx> +#include <unotools/localedatawrapper.hxx> +#include <editeng/eeitem.hxx> #include <editeng/langitem.hxx> #include <svl/intitem.hxx> #include <svl/itempool.hxx> @@ -31,13 +33,15 @@ #include <svx/svdetc.hxx> #include <svx/svdoutl.hxx> #include <svx/svxids.hrc> -#include <svx/unoshape.hxx> #include <editeng/fhgtitem.hxx> +#include <osl/diagnose.h> -#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/drawing/XShape.hpp> #include <sfx2/objsh.hxx> +#include <sfx2/viewsh.hxx> #include <svx/helperhittest3d.hxx> +#include <officecfg/Office/Calc.hxx> using namespace ::com::sun::star; @@ -77,7 +81,6 @@ DrawViewWrapper::DrawViewWrapper( { SetBufferedOutputAllowed(true); SetBufferedOverlayAllowed(true); - SetPagePaintingAllowed(true); // #i12587# support for shapes in chart SdrOutliner* pOutliner = getOutliner(); @@ -87,12 +90,12 @@ DrawViewWrapper::DrawViewWrapper( SvtLinguConfig aLinguConfig; SvtLinguOptions aLinguOptions; aLinguConfig.GetOptions( aLinguOptions ); - pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ) ); - pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ) ); - pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ) ); + pOutlinerPool->SetUserDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ) ); + pOutlinerPool->SetUserDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ) ); + pOutlinerPool->SetUserDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ) ); // set font height without changing SdrEngineDefaults - pOutlinerPool->SetPoolDefaultItem( SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT ) ); // 12pt + pOutlinerPool->SetUserDefaultItem( SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT ) ); // 12pt } // #i121463# Use big handles by default @@ -120,7 +123,7 @@ void DrawViewWrapper::ReInit() tools::Rectangle aRect(Point(0,0), aOutputSize); SetWorkArea(aRect); - ShowSdrPage(GetModel()->GetPage(0)); + ShowSdrPage(GetModel().GetPage(0)); } DrawViewWrapper::~DrawViewWrapper() @@ -166,7 +169,7 @@ SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const //3d objects need a special treatment //because the simple PickObj method is not accurate in this case for performance reasons - E3dObject* pE3d = dynamic_cast< E3dObject* >(pRet); + E3dObject* pE3d = DynCastE3dObject(pRet); if( pE3d ) { E3dScene* pScene(pE3d->getRootE3dSceneFromE3dObject()); @@ -209,10 +212,23 @@ void DrawViewWrapper::setMarkHandleProvider( MarkHandleProvider* pMarkHandleProv void DrawViewWrapper::CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* /* pRedirector */) { - svtools::ColorConfig aColorConfig; - Color aFillColor( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); + Color aFillColor; + if (const SfxViewShell* pViewShell = SfxViewShell::Current()) + aFillColor = pViewShell->GetColorConfigColor(svtools::DOCCOLOR); + else + { + svtools::ColorConfig aColorConfig; + aFillColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor; + } SetApplicationBackgroundColor(aFillColor); + + SdrOutliner& rOutliner = GetModel().GetDrawOutliner(); + Color aOldBackColor = rOutliner.GetBackgroundColor(); + rOutliner.SetBackgroundColor(aFillColor); + E3dView::CompleteRedraw( pOut, rReg ); + + rOutliner.SetBackgroundColor(aOldBackColor); } SdrObject* DrawViewWrapper::getSelectedObject() const @@ -253,16 +269,24 @@ SdrOutliner* DrawViewWrapper::getOutliner() const SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const { + SvtSysLocale aSysLocale; + MeasurementSystem eSys = aSysLocale.GetLocaleData().getMeasurementSystemEnum(); + sal_uInt16 nAttrMetric; + if( eSys == MeasurementSystem::Metric ) + nAttrMetric = officecfg::Office::Calc::Layout::Other::MeasureUnit::Metric::get(); + else + nAttrMetric = officecfg::Office::Calc::Layout::Other::MeasureUnit::NonMetric::get(); + SfxItemSet aFullSet( - GetModel()->GetItemPool(), + GetModel().GetItemPool(), svl::Items< - SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, + SDRATTR_CORNER_RADIUS, SDRATTR_CORNER_RADIUS, SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT, - SID_ATTR_METRIC, SID_ATTR_METRIC>{}); + SID_ATTR_METRIC, SID_ATTR_METRIC>); SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() ); aFullSet.Put( aGeoSet ); - aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC,static_cast< sal_uInt16 >( ConfigurationAccess::getFieldUnit()))); + aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC, nAttrMetric) ); return aFullSet; } @@ -283,7 +307,7 @@ bool DrawViewWrapper::IsObjectHit( SdrObject const * pObj, const Point& rPnt ) if(pObj) { tools::Rectangle aRect(pObj->GetCurrentBoundRect()); - return aRect.IsInside(rPnt); + return aRect.Contains(rPnt); } return false; } @@ -291,8 +315,8 @@ bool DrawViewWrapper::IsObjectHit( SdrObject const * pObj, const Point& rPnt ) void DrawViewWrapper::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { //prevent wrong reselection of objects - SdrModel* pSdrModel( GetModel() ); - if( pSdrModel && pSdrModel->isLocked() ) + SdrModel& rSdrModel = GetModel(); + if (rSdrModel.isLocked()) return; const SdrHint* pSdrHint = ( rHint.GetId() == SfxHintId::ThisIsAnSdrHint ? static_cast<const SdrHint*>(&rHint) : nullptr ); @@ -345,9 +369,7 @@ SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference< uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY ); if(xTypeProvider.is()) { - SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape); - if(pSvxShape) - pRet = pSvxShape->GetSdrObject(); + pRet = SdrObject::getSdrObjectFromXShape(xShape); } return pRet; } |