summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2022-06-02 22:42:20 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2022-06-08 18:17:17 +0200
commitea5a0918c8c32309821ab239c4b95f4d6a3b5c12 (patch)
tree04ff84b7c076a2f178e90d0eb32eb1731b10fd3c /sfx2
parentd4123356c61db269651e950a0a2cc93e6d801c90 (diff)
VCL add vcl::WindowPosSize abstract class
... and use it to remove a duplicate and simplify code. Should mostly be a refactoring, which was mainly done by some larger sed calls, except for the new API calls, which helped shrinking some LOC. All data is also now private. Originally two of the "replaced" "classes" had unsigned width and height and one had signed. Noel pointed out, that during calculations, the value might get negative temporarly, so this now settles with signed values. Still the set size should never be negative and this is enforced this way. Not sure that is what Noel had in mind. This also includes: - rename WindowState => WindowData - rename WindowStateMask => WindowDataMask - rename WindowStateState => WindowState - move WindowState and WindowDataMask to vcl/windowstate.hxx - move WindowData(Mask) and WindowState into vcl namespace - readability: replace or'ed WindowState enums with "meta" enums + add "meta" WindowState enums PosSize and PosSizeState Change-Id: Icd16cfb498531aa7238ddbde83fcb0ed6d9e4f77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135426 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/childwin.cxx8
-rw-r--r--sfx2/source/dialog/basedlgs.cxx4
-rw-r--r--sfx2/source/dialog/recfloat.cxx9
3 files changed, 10 insertions, 11 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 1740459e7aea..0887e5106137 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -310,9 +310,9 @@ SfxChildWinInfo SfxChildWindow::GetInfo() const
weld::Dialog* pDialog = xController->getDialog();
aInfo.aPos = pDialog->get_position();
aInfo.aSize = pDialog->get_size();
- WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
+ vcl::WindowDataMask nMask = vcl::WindowDataMask::Pos | vcl::WindowDataMask::State;
if (pDialog->get_resizable())
- nMask |= WindowStateMask::Size;
+ nMask |= vcl::WindowDataMask::Size;
aInfo.aWinState = pDialog->get_window_state(nMask);
}
else if (pWindow)
@@ -321,9 +321,9 @@ SfxChildWinInfo SfxChildWindow::GetInfo() const
aInfo.aSize = pWindow->GetSizePixel();
if ( pWindow->IsSystemWindow() )
{
- WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
+ vcl::WindowDataMask nMask = vcl::WindowDataMask::Pos | vcl::WindowDataMask::State;
if ( pWindow->GetStyle() & WB_SIZEABLE )
- nMask |= WindowStateMask::Size;
+ nMask |= vcl::WindowDataMask::Size;
aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask );
}
else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get()))
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 0604f035bcd9..ab976093025a 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -173,9 +173,9 @@ void SfxModelessDialogController::ChildWinDispose()
{
if (m_xImpl->pMgr)
{
- WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
+ vcl::WindowDataMask nMask = vcl::WindowDataMask::Pos | vcl::WindowDataMask::State;
if (m_xDialog->get_resizable())
- nMask |= WindowStateMask::Size;
+ nMask |= vcl::WindowDataMask::Size;
m_xImpl->aWinState = m_xDialog->get_window_state(nMask);
GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, m_xImpl->pMgr->GetType() );
}
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index 6a6fc17dbd9a..d835e7640bc5 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -56,11 +56,10 @@ SfxRecordingFloatWrapper_Impl::SfxRecordingFloatWrapper_Impl(vcl::Window* pParen
aPos.AdjustX(20);
aPos.AdjustY(10);
- WindowStateData aState;
- aState.SetMask(WindowStateMask::Pos);
- aState.SetX(aPos.X());
- aState.SetY(aPos.Y());
- pDlg->set_window_state(aState.ToStr());
+ vcl::WindowData aState;
+ aState.setMask(vcl::WindowDataMask::Pos);
+ aState.setPos(aPos);
+ pDlg->set_window_state(aState.toStr());
pFloatDlg->Initialize(pInfo);
}