[Libreoffice-commits] core.git: include/vcl vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 28 07:45:46 UTC 2018


 include/vcl/layout.hxx       |    6 +++---
 vcl/source/window/dialog.cxx |   22 +++++++++-------------
 2 files changed, 12 insertions(+), 16 deletions(-)

New commits:
commit 30e9f06dcfb578c894d2e5c003403bfbda57ae13
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Aug 31 16:43:18 2018 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 28 09:45:23 2018 +0200

    Constify vcl::Window child lookup
    
    Also removes the function comments before the implementations,
    as these are just the same as already in the header.
    
    Change-Id: I11425dc4aa372423fcf469ab1374159ce8b180e2
    Reviewed-on: https://gerrit.libreoffice.org/61035
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 50fd57663542..0f8818989268 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -767,21 +767,21 @@ public:
 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
 //in a flat hierarchy where dialogs only have one layer
 //of children
-VCL_DLLPUBLIC vcl::Window* firstLogicalChildOfParent(vcl::Window *pTopLevel);
+VCL_DLLPUBLIC vcl::Window* firstLogicalChildOfParent(const vcl::Window *pTopLevel);
 
 //Get next window after pChild of a pTopLevel window as
 //if any intermediate layout widgets didn't exist
 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
 //in a flat hierarchy where dialogs only have one layer
 //of children
-VCL_DLLPUBLIC vcl::Window* nextLogicalChildOfParent(vcl::Window *pTopLevel, vcl::Window *pChild);
+VCL_DLLPUBLIC vcl::Window* nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
 
 //Get previous window before pChild of a pTopLevel window as
 //if any intermediate layout widgets didn't exist
 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
 //in a flat hierarchy where dialogs only have one layer
 //of children
-VCL_DLLPUBLIC vcl::Window* prevLogicalChildOfParent(vcl::Window *pTopLevel, vcl::Window *pChild);
+VCL_DLLPUBLIC vcl::Window* prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild);
 
 //Returns true is the Window has a single child which is a container
 VCL_DLLPUBLIC bool isLayoutEnabled(const vcl::Window *pWindow);
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index ed3016ad64d2..99b1cede0a8b 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -126,11 +126,9 @@ void ImplHideSplash()
             pSVData->mpIntroWindow->Hide();
 }
 
-//Get next window after pChild of a pTopLevel window as
-//if any intermediate layout widgets didn't exist
-vcl::Window * nextLogicalChildOfParent(vcl::Window *pTopLevel, vcl::Window *pChild)
+vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
 {
-    vcl::Window *pLastChild = pChild;
+    const vcl::Window *pLastChild = pChild;
 
     if (isContainerWindow(*pChild))
         pChild = pChild->GetWindow(GetWindowType::FirstChild);
@@ -151,12 +149,12 @@ vcl::Window * nextLogicalChildOfParent(vcl::Window *pTopLevel, vcl::Window *pChi
     if (pChild && isContainerWindow(*pChild))
         pChild = nextLogicalChildOfParent(pTopLevel, pChild);
 
-    return pChild;
+    return const_cast<vcl::Window *>(pChild);
 }
 
-vcl::Window * prevLogicalChildOfParent(vcl::Window *pTopLevel, vcl::Window *pChild)
+vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
 {
-    vcl::Window *pLastChild = pChild;
+    const vcl::Window *pLastChild = pChild;
 
     if (isContainerWindow(*pChild))
         pChild = pChild->GetWindow(GetWindowType::LastChild);
@@ -177,17 +175,15 @@ vcl::Window * prevLogicalChildOfParent(vcl::Window *pTopLevel, vcl::Window *pChi
     if (pChild && isContainerWindow(*pChild))
         pChild = prevLogicalChildOfParent(pTopLevel, pChild);
 
-    return pChild;
+    return const_cast<vcl::Window *>(pChild);
 }
 
-//Get first window of a pTopLevel window as
-//if any intermediate layout widgets didn't exist
-vcl::Window * firstLogicalChildOfParent(vcl::Window *pTopLevel)
+vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
 {
-    vcl::Window *pChild = pTopLevel->GetWindow(GetWindowType::FirstChild);
+    const vcl::Window *pChild = pTopLevel->GetWindow(GetWindowType::FirstChild);
     if (pChild && isContainerWindow(*pChild))
         pChild = nextLogicalChildOfParent(pTopLevel, pChild);
-    return pChild;
+    return const_cast<vcl::Window *>(pChild);
 }
 
 void Accelerator::GenerateAutoMnemonicsOnHierarchy(vcl::Window* pWindow)


More information about the Libreoffice-commits mailing list