[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - include/svx svx/inc svx/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 6 09:57:55 PST 2015


 include/svx/sdr/overlay/overlaymanager.hxx        |    8 ++++++--
 include/svx/sdr/overlay/overlayobjectlist.hxx     |    1 +
 svx/inc/sdr/overlay/overlaymanagerbuffered.hxx    |    2 ++
 svx/source/sdr/overlay/overlaymanager.cxx         |    7 ++++---
 svx/source/sdr/overlay/overlaymanagerbuffered.cxx |    5 ++++-
 svx/source/sdr/overlay/overlayobjectlist.cxx      |    8 +++++++-
 svx/source/svdraw/sdrpaintwindow.cxx              |    4 ++--
 7 files changed, 26 insertions(+), 9 deletions(-)

New commits:
commit e0d9fe71fb6fbd1bc78b99d91201fd12ecd5b56c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 6 18:23:58 2015 +0100

    sdr::overlay::OverlayObjectList: when tiled rendering, don't work with pixels
    
    Change-Id: Iaf7c31db65ecc4945f9d19e9031632443fa3823f

diff --git a/include/svx/sdr/overlay/overlayobjectlist.hxx b/include/svx/sdr/overlay/overlayobjectlist.hxx
index a3bda78..57f6860 100644
--- a/include/svx/sdr/overlay/overlayobjectlist.hxx
+++ b/include/svx/sdr/overlay/overlayobjectlist.hxx
@@ -27,6 +27,7 @@
 
 
 #define DEFAULT_VALUE_FOR_HITTEST_PIXEL         (2L)
+#define DEFAULT_VALUE_FOR_HITTEST_TWIP          (30L)
 
 
 
diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx
index 5b949c3..16c9264 100644
--- a/svx/source/sdr/overlay/overlayobjectlist.cxx
+++ b/svx/source/sdr/overlay/overlayobjectlist.cxx
@@ -19,6 +19,7 @@
 
 #include <svx/sdr/overlay/overlayobjectlist.hxx>
 #include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/svdmodel.hxx>
 #include <vcl/outdev.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <tools/gen.hxx>
@@ -72,8 +73,13 @@ namespace sdr
                 {
                     if(0.0 == fLogicTolerance)
                     {
-                        const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
+                        Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
                             Size(DEFAULT_VALUE_FOR_HITTEST_PIXEL, DEFAULT_VALUE_FOR_HITTEST_PIXEL)));
+
+                        // When tiled rendering, we always work in twips, use the non-pixel default.
+                        if (pManager->getModel()->isTiledRendering())
+                            aSizeLogic = Size(DEFAULT_VALUE_FOR_HITTEST_TWIP, DEFAULT_VALUE_FOR_HITTEST_TWIP);
+
                         fLogicTolerance = aSizeLogic.Width();
                     }
 
commit 6e0ed503c5e2b372e91b136a0b2349387faca3ef
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 6 17:36:16 2015 +0100

    Add sdr::overlay::OverlayManager::getModel()
    
    Can't access the SdrModel from sdr::overlay::OverlayObjectList
    otherwise.
    
    Change-Id: I0530985fb79659bd9de95d944b06edfb883f4403

diff --git a/include/svx/sdr/overlay/overlaymanager.hxx b/include/svx/sdr/overlay/overlaymanager.hxx
index 24e77e8..ef9fa5b 100644
--- a/include/svx/sdr/overlay/overlaymanager.hxx
+++ b/include/svx/sdr/overlay/overlaymanager.hxx
@@ -36,6 +36,7 @@
 // predeclarations
 
 class OutputDevice;
+class SdrModel;
 namespace vcl { class Region; }
 
 namespace sdr { namespace overlay {
@@ -63,6 +64,7 @@ namespace sdr
         protected:
             // the OutputDevice to work on, set on construction and not to be changed
             OutputDevice&                               rmOutputDevice;
+            const SdrModel*                             mpModel;
 
             // the vector of registered OverlayObjects
             OverlayObjectVector                         maOverlayObjects;
@@ -92,11 +94,11 @@ namespace sdr
             // ViewTransformation and evtl. correct mfDiscreteOne
             double getDiscreteOne() const;
 
-            OverlayManager(OutputDevice& rOutputDevice);
+            OverlayManager(OutputDevice& rOutputDevice, const SdrModel* pModel);
             virtual ~OverlayManager();
 
         public:
-            static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice);
+            static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice, const SdrModel* pModel);
 
             // access to current ViewInformation2D; this call checks and evtl. updates ViewInformation2D
             const drawinglayer::geometry::ViewInformation2D getCurrentViewInformation2D() const;
@@ -115,6 +117,8 @@ namespace sdr
 
             // get the OutputDevice
             OutputDevice& getOutputDevice() const { return rmOutputDevice; }
+            // Get the draw model.
+            const SdrModel* getModel() const { return mpModel; }
 
             // add and remove OverlayObjects
             void add(OverlayObject& rOverlayObject);
diff --git a/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx b/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx
index 7379597..95ad3d2 100644
--- a/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx
+++ b/svx/inc/sdr/overlay/overlaymanagerbuffered.hxx
@@ -63,11 +63,13 @@ namespace sdr
 
             OverlayManagerBuffered(
                 OutputDevice& rOutputDevice,
+                const SdrModel* pModel,
                 bool bRefreshWithPreRendering = false);
             virtual ~OverlayManagerBuffered();
 
         public:
             static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice,
+                const SdrModel* pModel,
                 bool bRefreshWithPreRendering = false);
 
             // complete redraw
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index 1d8e778..76a7d45 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -115,9 +115,10 @@ namespace sdr
             return mfDiscreteOne;
         }
 
-        OverlayManager::OverlayManager(OutputDevice& rOutputDevice)
+        OverlayManager::OverlayManager(OutputDevice& rOutputDevice, const SdrModel* pModel)
         :   Scheduler(),
             rmOutputDevice(rOutputDevice),
+            mpModel(pModel),
             maOverlayObjects(),
             maStripeColorA(Color(COL_BLACK)),
             maStripeColorB(Color(COL_WHITE)),
@@ -140,9 +141,9 @@ namespace sdr
             }
         }
 
-        rtl::Reference<OverlayManager> OverlayManager::create(OutputDevice& rOutputDevice)
+        rtl::Reference<OverlayManager> OverlayManager::create(OutputDevice& rOutputDevice, const SdrModel* pModel)
         {
-            return rtl::Reference<OverlayManager>(new OverlayManager(rOutputDevice));
+            return rtl::Reference<OverlayManager>(new OverlayManager(rOutputDevice, pModel));
         }
 
         const drawinglayer::geometry::ViewInformation2D OverlayManager::getCurrentViewInformation2D() const
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 218ad26..f824516 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -424,8 +424,9 @@ namespace sdr
 
         OverlayManagerBuffered::OverlayManagerBuffered(
             OutputDevice& rOutputDevice,
+            const SdrModel* pModel,
             bool bRefreshWithPreRendering)
-        :   OverlayManager(rOutputDevice),
+        :   OverlayManager(rOutputDevice, pModel),
             mbRefreshWithPreRendering(bRefreshWithPreRendering)
         {
             // Init timer
@@ -435,9 +436,11 @@ namespace sdr
 
         rtl::Reference<OverlayManager> OverlayManagerBuffered::create(
             OutputDevice& rOutputDevice,
+            const SdrModel* pModel,
             bool bRefreshWithPreRendering)
         {
             return rtl::Reference<OverlayManager>(new OverlayManagerBuffered(rOutputDevice,
+                pModel,
                 bRefreshWithPreRendering));
         }
 
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index ae6f6d5..8692c53 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -209,7 +209,7 @@ void SdrPaintWindow::impCreateOverlayManager()
                 // whether that refresh itself will use a 2nd vdev to avoid flickering.
                 // Also hand over the old OverlayManager if existent; this means to take over
                 // the registered OverlayObjects from it
-                mxOverlayManager = ::sdr::overlay::OverlayManagerBuffered::create(GetOutputDevice(), true);
+                mxOverlayManager = ::sdr::overlay::OverlayManagerBuffered::create(GetOutputDevice(), GetPaintView().GetModel(), true);
             }
             else
             {
@@ -217,7 +217,7 @@ void SdrPaintWindow::impCreateOverlayManager()
                 // take place
                 // Also hand over the old OverlayManager if existent; this means to take over
                 // the registered OverlayObjects from it
-                mxOverlayManager = ::sdr::overlay::OverlayManager::create(GetOutputDevice());
+                mxOverlayManager = ::sdr::overlay::OverlayManager::create(GetOutputDevice(), GetPaintView().GetModel());
             }
 
             OSL_ENSURE(mxOverlayManager.is(), "SdrPaintWindow::SdrPaintWindow: Could not allocate an overlayManager (!)");


More information about the Libreoffice-commits mailing list