diff options
-rw-r--r-- | chart2/inc/ChartView.hxx | 10 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 16 | ||||
-rw-r--r-- | include/svx/charthelper.hxx | 2 | ||||
-rw-r--r-- | include/svx/sdr/contact/viewcontact.hxx | 2 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/util/XUpdatable2.idl | 43 | ||||
-rw-r--r-- | svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontact.cxx | 6 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 32 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontact.cxx | 29 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/charthelper.cxx | 15 |
12 files changed, 146 insertions, 24 deletions
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index d155c45983f9..047192aec7b6 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -37,7 +37,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/util/XModeChangeBroadcaster.hpp> -#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/util/XUpdatable2.hpp> #include <com/sun/star/qa/XDumper.hpp> #include <vector> @@ -96,7 +96,7 @@ class ChartView : public ::cppu::WeakImplHelper10< ,::com::sun::star::lang::XUnoTunnel ,::com::sun::star::util::XModifyListener ,::com::sun::star::util::XModeChangeBroadcaster - ,::com::sun::star::util::XUpdatable + ,::com::sun::star::util::XUpdatable2 ,::com::sun::star::beans::XPropertySet ,::com::sun::star::lang::XMultiServiceFactory ,::com::sun::star::qa::XDumper @@ -169,6 +169,10 @@ public: // ::com::sun::star::util::XUpdatable virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // util::XUpdatable2 + virtual void SAL_CALL updateSoft() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL updateHard() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // ::com::sun::star::beans::XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; @@ -217,7 +221,7 @@ private: //methods void impl_refreshAddIn(); bool impl_AddInDrawsAllByItself(); - void impl_updateView(); + void impl_updateView( bool bCheckLockedCtrler = true ); void render(); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 63ba12abda30..edf6dc983693 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2627,7 +2627,7 @@ void SAL_CALL ChartView::disposing( const lang::EventObject& /* rSource */ ) { } -void ChartView::impl_updateView() +void ChartView::impl_updateView( bool bCheckLockedCtrler ) { if( !m_pDrawModelWrapper ) return; @@ -2638,7 +2638,7 @@ void ChartView::impl_updateView() return; } - if (mrChartModel.hasControllersLocked()) + if (bCheckLockedCtrler && mrChartModel.hasControllersLocked()) return; if( m_bViewDirty && !m_bInViewUpdate ) @@ -2822,7 +2822,7 @@ void SAL_CALL ChartView::removeModeChangeApproveListener( const uno::Reference< // ____ XUpdatable ____ void SAL_CALL ChartView::update() throw (uno::RuntimeException, std::exception) { - impl_updateView(); + impl_updateView(true); //#i100778# migrate all imported or old documents to a plot area sizing exclusive axes (in case the save settings allow for this): //Although in general it is a bad idea to change the model from within the view this is exceptionally the best place to do this special conversion. @@ -2833,6 +2833,16 @@ void SAL_CALL ChartView::update() throw (uno::RuntimeException, std::exception) impl_updateView(); } +void SAL_CALL ChartView::updateSoft() throw (uno::RuntimeException, std::exception) +{ + update(); +} + +void SAL_CALL ChartView::updateHard() throw (uno::RuntimeException, std::exception) +{ + impl_updateView(false); +} + // ____ XPropertySet ____ Reference< beans::XPropertySetInfo > SAL_CALL ChartView::getPropertySetInfo() throw (uno::RuntimeException, std::exception) diff --git a/include/svx/charthelper.hxx b/include/svx/charthelper.hxx index f88b8c4e370d..33ffa3201414 100644 --- a/include/svx/charthelper.hxx +++ b/include/svx/charthelper.hxx @@ -35,7 +35,7 @@ public: static bool isGL3DDiagram(const css::uno::Reference<css::chart2::XDiagram>& xDiagram); /// Use chart's XUpdatable::update() to update values. - static void updateChart(const css::uno::Reference< css::frame::XModel >& rXModel); + static void updateChart( const css::uno::Reference< css::frame::XModel >& rXModel, bool bHardUpdate ); // try to access rXModel in case of a chart to to get the chart content // as sequence of primitives. Return range of primitives (chart size) in rRange; diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx index 4e2d022d17b9..8cdf1ce61de0 100644 --- a/include/svx/sdr/contact/viewcontact.hxx +++ b/include/svx/sdr/contact/viewcontact.hxx @@ -152,6 +152,8 @@ namespace sdr // for 3D scenes virtual drawinglayer::primitive2d::Primitive2DSequence embedToObjectSpecificInformation(const drawinglayer::primitive2d::Primitive2DSequence& rSource) const; + virtual basegfx::B2DRange getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const; + // delete all existing VOCs including DrawHierarchy which will invalidate all // visualisations, too. Used mostly at object removal from DrawHierarchy to // delete all existing VOCs by purpose, but can also be used for other purposes. diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index b317d8c8eb16..781a9baae8c7 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -4138,6 +4138,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/util,\ XURLTransformer \ XUniqueIDFactory \ XUpdatable \ + XUpdatable2 \ )) $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/view,\ DocumentZoomType \ diff --git a/offapi/com/sun/star/util/XUpdatable2.idl b/offapi/com/sun/star/util/XUpdatable2.idl new file mode 100644 index 000000000000..ce5652a96a39 --- /dev/null +++ b/offapi/com/sun/star/util/XUpdatable2.idl @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef __com_sun_star_util_XUpdatable2_idl__ +#define __com_sun_star_util_XUpdatable2_idl__ + +#include <com/sun/star/util/XUpdatable.idl> + +module com { module sun { module star { module util { + +/** + * This interface extends XUpdatable in order to provide more fine-tuned + * update modes. When performing a <i>soft</i> update, the implementor may + * decide not to update in certain cases, such as when the controller is + * locked. When performing a <i>hard</i> update, on the other hand, the + * implementor should perform update more aggressively even when the + * controller is locked. + */ +interface XUpdatable2: com::sun::star::util::XUpdatable +{ + /** + * Perform update, but update may not always be performed especially when + * the controller is locked. + */ + void updateSoft(); + + /** + * Perform update, even when the controller is locked. + */ + void updateHard(); +}; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx b/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx index fba70b22523e..29fc2dfa8092 100644 --- a/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx +++ b/svx/inc/sdr/contact/viewcontactofsdrole2obj.hxx @@ -69,6 +69,8 @@ namespace sdr // #i123539# get rid of buffered chart content (if there) on change virtual void ActionChanged() SAL_OVERRIDE; + virtual basegfx::B2DRange getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const SAL_OVERRIDE; + protected: // This method is responsible for creating the graphical visualisation data // ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false) diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index 292bfba3c2bb..b4c4020d5387 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -308,6 +308,12 @@ namespace sdr return rSource; } + basegfx::B2DRange ViewContact::getRange( const drawinglayer::geometry::ViewInformation2D& /*rViewInfo2D*/ ) const + { + // Return empty range. + return basegfx::B2DRange(); + } + void ViewContact::flushViewObjectContacts(bool bWithHierarchy) { if(bWithHierarchy) diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index f8fb29353c95..1704fdda6e1d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -91,12 +91,11 @@ namespace sdr const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); // this may be refined more granular; if no content, attributes may get simpler - const bool bHasContent(true); const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, GetOle2Obj().getText(0), - bHasContent)); + true)); drawinglayer::primitive2d::Primitive2DReference xContent; if(GetOle2Obj().IsChart()) @@ -170,6 +169,35 @@ namespace sdr return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + basegfx::B2DRange ViewContactOfSdrOle2Obj::getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const + { + // this may be refined more granular; if no content, attributes may get simpler + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute = + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + GetOle2Obj().GetMergedItemSet(), + GetOle2Obj().getText(0), + true); + + basegfx::B2DHomMatrix aObjectMatrix = createObjectTransform(); + + drawinglayer::primitive2d::Primitive2DReference xContent = + new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + GetOle2Obj(), + aObjectMatrix, + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion()); + + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrOle2Primitive2D( + drawinglayer::primitive2d::Primitive2DSequence(&xContent, 1), + aObjectMatrix, + aAttribute)); + + drawinglayer::primitive2d::Primitive2DSequence xSeq = + drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + + return drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSeq, rViewInfo2D); + } + void ViewContactOfSdrOle2Obj::ActionChanged() { // call parent diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 140c5c8ba6fe..664f5b1fbded 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -206,15 +206,23 @@ const basegfx::B2DRange& ViewObjectContact::getObjectRange() const { if(maObjectRange.isEmpty()) { - // if range is not computed (new or LazyInvalidate objects), force it - const DisplayInfo aDisplayInfo; - const drawinglayer::primitive2d::Primitive2DSequence xSequence(getPrimitive2DSequence(aDisplayInfo)); - - if(xSequence.hasElements()) + const drawinglayer::geometry::ViewInformation2D& rViewInfo2D = GetObjectContact().getViewInformation2D(); + basegfx::B2DRange aTempRange = GetViewContact().getRange(rViewInfo2D); + if (!aTempRange.isEmpty()) { - const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); - const_cast< ViewObjectContact* >(this)->maObjectRange = - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSequence, rViewInformation2D); + const_cast< ViewObjectContact* >(this)->maObjectRange = aTempRange; + } + else + { + // if range is not computed (new or LazyInvalidate objects), force it + const DisplayInfo aDisplayInfo; + const drawinglayer::primitive2d::Primitive2DSequence xSequence(getPrimitive2DSequence(aDisplayInfo)); + + if(xSequence.hasElements()) + { + const_cast< ViewObjectContact* >(this)->maObjectRange = + drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSequence, rViewInfo2D); + } } } @@ -257,7 +265,7 @@ void ViewObjectContact::triggerLazyInvalidate() // drawn by the drawinglayer ViewContactOfSdrOle2Obj* pViewContact = dynamic_cast<ViewContactOfSdrOle2Obj*>(&GetViewContact()); if (pViewContact && pViewContact->GetOle2Obj().IsReal3DChart()) - ChartHelper::updateChart(pViewContact->GetOle2Obj().getXModel()); + ChartHelper::updateChart(pViewContact->GetOle2Obj().getXModel(), false); #endif // force ObjectRange @@ -415,7 +423,8 @@ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2D const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); // check geometrical visibility - if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) + bool bVisible = aViewRange.isEmpty() || aViewRange.overlaps(aObjectRange); + if(!bVisible) { // not visible, release xRetval.realloc(0); diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx index 2273f4b434e2..0c9afc62db49 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx @@ -23,6 +23,7 @@ #include <svx/sdr/contact/objectcontact.hxx> #include <svx/sdr/contact/displayinfo.hxx> #include <sdr/contact/objectcontactofpageview.hxx> +#include <sdr/contact/viewcontactofsdrole2obj.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdrpaintwindow.hxx> #include <svx/svdobj.hxx> @@ -138,6 +139,17 @@ bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayIn } } + // Check if this object is in the visible range. + const drawinglayer::geometry::ViewInformation2D& rViewInfo = GetObjectContact().getViewInformation2D(); + basegfx::B2DRange aObjRange = GetViewContact().getRange(rViewInfo); + if (!aObjRange.isEmpty()) + { + const basegfx::B2DRange& rViewRange = rViewInfo.getViewport(); + bool bVisible = rViewRange.isEmpty() || rViewRange.overlaps(aObjRange); + if (!bVisible) + return false; + } + return true; } diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx index 4965e073d53e..643a2be5cf1e 100644 --- a/svx/source/svdraw/charthelper.cxx +++ b/svx/source/svdraw/charthelper.cxx @@ -24,7 +24,7 @@ #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/util/XUpdatable2.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> @@ -67,7 +67,7 @@ bool ChartHelper::isGL3DDiagram( const css::uno::Reference<css::chart2::XDiagram return false; } -void ChartHelper::updateChart(const uno::Reference< ::frame::XModel >& rXModel) +void ChartHelper::updateChart( const uno::Reference< ::frame::XModel >& rXModel, bool bHardUpdate ) { if (!rXModel.is()) return; @@ -76,10 +76,15 @@ void ChartHelper::updateChart(const uno::Reference< ::frame::XModel >& rXModel) { const uno::Reference< lang::XMultiServiceFactory > xChartFact(rXModel, uno::UNO_QUERY_THROW); const uno::Reference< lang::XUnoTunnel > xChartView(xChartFact->createInstance("com.sun.star.chart2.ChartView"), uno::UNO_QUERY_THROW); - const uno::Reference< util::XUpdatable > xUpdatable(xChartView, uno::UNO_QUERY_THROW); + const uno::Reference<util::XUpdatable2> xUpdatable(xChartView, uno::UNO_QUERY_THROW); if (xUpdatable.is()) - xUpdatable->update(); + { + if (bHardUpdate) + xUpdatable->updateHard(); + else + xUpdatable->updateSoft(); + } } catch(uno::Exception&) { @@ -96,7 +101,7 @@ drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContent if (!rXModel.is()) return aRetval; - updateChart(rXModel); + updateChart(rXModel, true); try { |