summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-15 11:07:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-10-16 12:55:07 +0200
commitd3fff9073f70bdd9caf619a9cfe7afd7c04cffe1 (patch)
treef48b9b4f8478613fcade0cef9f6f12fdde5b41b4 /svx
parent2e412c5354134fe3cd66ea0266011c5b87dc9eb3 (diff)
add a DrawingAreaUIObject to avoid need to include layout.hxx for uitest
Change-Id: I2d7f9d38f9eac5af7b8b4d738335507beb6627df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104357 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/uiobject.hxx8
-rw-r--r--svx/source/dialog/weldeditview.cxx14
-rw-r--r--svx/source/uitest/sdrobject.cxx15
-rw-r--r--svx/source/uitest/uiobject.cxx23
4 files changed, 24 insertions, 36 deletions
diff --git a/svx/inc/uiobject.hxx b/svx/inc/uiobject.hxx
index 405b854e1f06..34659619cf83 100644
--- a/svx/inc/uiobject.hxx
+++ b/svx/inc/uiobject.hxx
@@ -17,12 +17,12 @@
class SvxShowCharSet;
class SvxNumValueSet;
-class SvxShowCharSetUIObject final : public WindowUIObject
+class SvxShowCharSetUIObject final : public DrawingAreaUIObject
{
SvxShowCharSet* mpCharSet;
public:
- SvxShowCharSetUIObject(const VclPtr<vcl::Window>& xCharSetWin, SvxShowCharSet* pCharSet);
+ SvxShowCharSetUIObject(const VclPtr<vcl::Window>& rCharSetWin);
virtual void execute(const OUString& rAction,
const StringMap& rParameters) override;
@@ -35,13 +35,13 @@ private:
};
-class SvxNumValueSetUIObject final : public WindowUIObject
+class SvxNumValueSetUIObject final : public DrawingAreaUIObject
{
SvxNumValueSet* mpNumValueSet;
public:
- SvxNumValueSetUIObject(vcl::Window* xNumValueSetWin, SvxNumValueSet* pNumValueSet);
+ SvxNumValueSetUIObject(vcl::Window* pNumValueSetWin);
virtual void execute(const OUString& rAction,
const StringMap& rParameters) override;
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index 9f4329b7adfd..9bf6f599c857 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -40,7 +40,6 @@
#include <unotools/accessiblestatesethelper.hxx>
#include <vcl/cursor.hxx>
#include <vcl/event.hxx>
-#include <vcl/layout.hxx>
#include <vcl/ptrstyle.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -1499,24 +1498,21 @@ void WeldEditView::LoseFocus()
namespace
{
-class WeldEditViewUIObject final : public WindowUIObject
+class WeldEditViewUIObject final : public DrawingAreaUIObject
{
private:
WeldEditView* mpEditView;
public:
- WeldEditViewUIObject(vcl::Window* pEditViewWin, WeldEditView* pEditView)
- : WindowUIObject(pEditViewWin)
- , mpEditView(pEditView)
+ WeldEditViewUIObject(const VclPtr<vcl::Window>& rDrawingArea)
+ : DrawingAreaUIObject(rDrawingArea)
+ , mpEditView(static_cast<WeldEditView*>(mpController))
{
}
static std::unique_ptr<UIObject> create(vcl::Window* pWindow)
{
- VclDrawingArea* pEditViewWin = dynamic_cast<VclDrawingArea*>(pWindow);
- assert(pEditViewWin);
- return std::unique_ptr<UIObject>(new WeldEditViewUIObject(
- pEditViewWin, static_cast<WeldEditView*>(pEditViewWin->GetUserData())));
+ return std::unique_ptr<UIObject>(new WeldEditViewUIObject(pWindow));
}
virtual StringMap get_state() override
diff --git a/svx/source/uitest/sdrobject.cxx b/svx/source/uitest/sdrobject.cxx
index b93223acc319..d88ce6494c19 100644
--- a/svx/source/uitest/sdrobject.cxx
+++ b/svx/source/uitest/sdrobject.cxx
@@ -15,7 +15,6 @@
#include <memory>
#include <svx/SvxColorValueSet.hxx>
-#include <vcl/layout.hxx>
SdrUIObject::~SdrUIObject()
{
@@ -166,9 +165,9 @@ OUString SdrUIObject::get_type() const
}
-SvxColorValueSetUIObject::SvxColorValueSetUIObject(vcl::Window* xColorSetWin, SvxColorValueSet* pColorSet):
- WindowUIObject(xColorSetWin),
- mpColorSet(pColorSet)
+SvxColorValueSetUIObject::SvxColorValueSetUIObject(vcl::Window* pColorSetWin)
+ : DrawingAreaUIObject(pColorSetWin)
+ , mpColorSet(static_cast<SvxColorValueSet*>(mpController))
{
}
@@ -186,14 +185,12 @@ void SvxColorValueSetUIObject::execute(const OUString& rAction,
}
}
else
- WindowUIObject::execute(rAction, rParameters);
+ DrawingAreaUIObject::execute(rAction, rParameters);
}
std::unique_ptr<UIObject> SvxColorValueSetUIObject::create(vcl::Window* pWindow)
{
- VclDrawingArea* pColorSetWin = dynamic_cast<VclDrawingArea*>(pWindow);
- assert(pColorSetWin);
- return std::unique_ptr<UIObject>(new SvxColorValueSetUIObject(pColorSetWin, static_cast<SvxColorValueSet*>(pColorSetWin->GetUserData())));
+ return std::unique_ptr<UIObject>(new SvxColorValueSetUIObject(pWindow));
}
OUString SvxColorValueSetUIObject::get_name() const
@@ -203,7 +200,7 @@ OUString SvxColorValueSetUIObject::get_name() const
StringMap SvxColorValueSetUIObject::get_state()
{
- StringMap aMap = WindowUIObject::get_state();
+ StringMap aMap = DrawingAreaUIObject::get_state();
aMap["CurrColorId"] = OUString::number( mpColorSet->GetSelectedItemId() );
aMap["CurrColorPos"] = OUString::number( mpColorSet->GetSelectItemPos() );
aMap["ColorsCount"] = OUString::number(mpColorSet->GetItemCount());
diff --git a/svx/source/uitest/uiobject.cxx b/svx/source/uitest/uiobject.cxx
index 046cece582ca..9c46d0993441 100644
--- a/svx/source/uitest/uiobject.cxx
+++ b/svx/source/uitest/uiobject.cxx
@@ -10,13 +10,12 @@
#include <memory>
#include <uiobject.hxx>
#include <svx/charmap.hxx>
-#include <vcl/layout.hxx>
#include <svx/numvset.hxx>
-SvxShowCharSetUIObject::SvxShowCharSetUIObject(const VclPtr<vcl::Window>& xCharSetWin, SvxShowCharSet* pCharSet):
- WindowUIObject(xCharSetWin),
- mpCharSet(pCharSet)
+SvxShowCharSetUIObject::SvxShowCharSetUIObject(const VclPtr<vcl::Window>& rCharSetWin)
+ : DrawingAreaUIObject(rCharSetWin)
+ , mpCharSet(static_cast<SvxShowCharSet*>(mpController))
{
}
@@ -51,9 +50,7 @@ void SvxShowCharSetUIObject::execute(const OUString& rAction,
std::unique_ptr<UIObject> SvxShowCharSetUIObject::create(vcl::Window* pWindow)
{
- VclDrawingArea* pCharSetWin = dynamic_cast<VclDrawingArea*>(pWindow);
- assert(pCharSetWin);
- return std::unique_ptr<UIObject>(new SvxShowCharSetUIObject(pCharSetWin, static_cast<SvxShowCharSet*>(pCharSetWin->GetUserData())));
+ return std::unique_ptr<UIObject>(new SvxShowCharSetUIObject(pWindow));
}
OUString SvxShowCharSetUIObject::get_name() const
@@ -62,9 +59,9 @@ OUString SvxShowCharSetUIObject::get_name() const
}
-SvxNumValueSetUIObject::SvxNumValueSetUIObject(vcl::Window* xNumValueSetWin , SvxNumValueSet* pNumValueSet):
- WindowUIObject(xNumValueSetWin),
- mpNumValueSet(pNumValueSet)
+SvxNumValueSetUIObject::SvxNumValueSetUIObject(vcl::Window* pNumValueSetWin)
+ : DrawingAreaUIObject(pNumValueSetWin)
+ , mpNumValueSet(static_cast<SvxNumValueSet*>(mpController))
{
}
@@ -82,14 +79,12 @@ void SvxNumValueSetUIObject::execute(const OUString& rAction,
}
}
else
- WindowUIObject::execute(rAction, rParameters);
+ DrawingAreaUIObject::execute(rAction, rParameters);
}
std::unique_ptr<UIObject> SvxNumValueSetUIObject::create(vcl::Window* pWindow)
{
- VclDrawingArea* pNumValueSetWin = dynamic_cast<VclDrawingArea*>(pWindow);
- assert(pNumValueSetWin);
- return std::unique_ptr<UIObject>(new SvxNumValueSetUIObject(pNumValueSetWin, static_cast<SvxNumValueSet*>(pNumValueSetWin->GetUserData())));
+ return std::unique_ptr<UIObject>(new SvxNumValueSetUIObject(pWindow));
}
OUString SvxNumValueSetUIObject::get_name() const