Kaydet (Commit) 7c1a2289 authored tarafından Miklos Vajna's avatar Miklos Vajna

Add sdr::overlay::OverlayManager::getModel()

Can't access the SdrModel from sdr::overlay::OverlayObjectList
otherwise.

Change-Id: I0530985fb79659bd9de95d944b06edfb883f4403
üst 619f033d
......@@ -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& mrOutputDevice;
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 mrOutputDevice; }
// Get the draw model.
const SdrModel* getModel() const { return mpModel; }
// add and remove OverlayObjects
void add(OverlayObject& rOverlayObject);
......
......@@ -64,11 +64,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
......
......@@ -115,9 +115,10 @@ namespace sdr
return mfDiscreteOne;
}
OverlayManager::OverlayManager(OutputDevice& rOutputDevice)
OverlayManager::OverlayManager(OutputDevice& rOutputDevice, const SdrModel* pModel)
: Scheduler(),
mrOutputDevice(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
......
......@@ -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));
}
......
......@@ -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 (!)");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment