[Libreoffice-commits] .: Branch 'feature/cmclayouttrans' - vcl/inc vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Sep 27 01:39:36 PDT 2012
vcl/inc/vcl/builder.hxx | 28 ++-------------
vcl/inc/vcl/layout.hxx | 28 ++-------------
vcl/source/uipreviewer/previewer.cxx | 27 ++------------
vcl/source/window/builder.cxx | 65 ++++++++++++++---------------------
vcl/source/window/layout.cxx | 27 ++------------
vcl/source/window/window.cxx | 4 +-
6 files changed, 47 insertions(+), 132 deletions(-)
New commits:
commit 16daab13a0c4a25e9b6fe14fa53c2d0634828219
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 27 09:38:41 2012 +0100
sort child positions within parents according to grid position
so that tabbing between widgets jumps between then in a sensible
order
Change-Id: I852f4fb08781da2b703f8f87e84abdf4c366fa26
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index bd5cd6e..a84f6d1 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -1,30 +1,12 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Initial Developer of the Original Code is
- * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
- * Portions created by the Initial Developer are Copyright (C) 2011 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Caolán McNamara <caolanm at redhat.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+
#ifndef _VCLBUILDER_HXX
#define _VCLBUILDER_HXX
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 4735528..9e869a3 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -1,30 +1,12 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Initial Developer of the Original Code is
- * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
- * Portions created by the Initial Developer are Copyright (C) 2011 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Caolán McNamara <caolanm at redhat.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+
#ifndef _VCLLAYOUT_HXX
#define _VCLLAYOUT_HXX
diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx
index 42c0353..2432986 100644
--- a/vcl/source/uipreviewer/previewer.cxx
+++ b/vcl/source/uipreviewer/previewer.cxx
@@ -1,29 +1,10 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Initial Developer of the Original Code is
- * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
- * Portions created by the Initial Developer are Copyright (C) 2011 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Caolán McNamara <caolanm at redhat.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <com/sun/star/lang/XComponent.hpp>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 31e72ce..33e43b6 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1,29 +1,10 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Initial Developer of the Original Code is
- * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
- * Portions created by the Initial Developer are Copyright (C) 2012 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Caolán McNamara <caolanm at redhat.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <osl/module.hxx>
@@ -767,6 +748,22 @@ void VclBuilder::handleTabChild(Window *pParent, xmlreader::XmlReader &reader)
pTabControl->RemovePage(pTabControl->GetCurPageId());
}
+namespace
+{
+ bool sortByGridPositions(Window *pA, Window *pB)
+ {
+ sal_Int32 nTopA = pA->get_grid_top_attach();
+ sal_Int32 nTopB = pB->get_grid_top_attach();
+ if (nTopA < nTopB)
+ return true;
+ if (nTopA > nTopB)
+ return false;
+ sal_Int32 nLeftA = pA->get_grid_left_attach();
+ sal_Int32 nLeftB = pB->get_grid_left_attach();
+ return nLeftA < nLeftB;
+ }
+}
+
void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
{
Window *pCurrentChild = NULL;
@@ -818,8 +815,6 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
{
//To-Do make reorder a virtual in Window, move this foo
//there and see above
-
- rtl::OString sPosition(RTL_CONSTASCII_STRINGPARAM("position"));
std::vector<Window*> aChilds;
for (Window* pChild = pCurrentChild->GetWindow(WINDOW_FIRSTCHILD); pChild;
pChild = pChild->GetWindow(WINDOW_NEXT))
@@ -827,26 +822,20 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
aChilds.push_back(pChild);
}
+ //sort child order within parent list by grid position
+ //so that tabbing between controls goes in a visually sensible sequence
+ std::stable_sort(aChilds.begin(), aChilds.end(), sortByGridPositions);
for (size_t i = 0; i < aChilds.size(); ++i)
- {
- sal_Int32 nPosition = get_window_packing_position(aChilds[i]);
- if (nPosition == -1)
- continue;
- reorderWithinParent(*aChilds[i], nPosition);
- }
+ reorderWithinParent(*aChilds[i], i);
-#if TODO
-//sort by ltr ttb
- rtl::OString sLeftAttach(RTL_CONSTASCII_STRINGPARAM("left-attach"));
- rtl::OString sTopAttach(RTL_CONSTASCII_STRINGPARAM("top-attach"));
+ //honour box positions if there is any
for (size_t i = 0; i < aChilds.size(); ++i)
{
- sal_uInt16 nPosition = aChilds[i]->getWidgetProperty<sal_uInt16>(sPosition, 0xFFFF);
- if (nPosition == 0xFFFF)
+ sal_Int32 nPosition = get_window_packing_position(aChilds[i]);
+ if (nPosition == -1)
continue;
reorderWithinParent(*aChilds[i], nPosition);
}
-#endif
}
}
}
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index d20cede..b125c2d 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1,29 +1,10 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
*
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Initial Developer of the Original Code is
- * Caolán McNamara <caolanm at redhat.com> (Red Hat, Inc.)
- * Portions created by the Initial Developer are Copyright (C) 2011 the
- * Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Caolán McNamara <caolanm at redhat.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <vcl/dialog.hxx>
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 47ea865..3925209 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -640,8 +640,8 @@ void Window::ImplInitWindowData( WindowType nType )
mpWindowImpl->mePackType = VCL_PACK_START;
mpWindowImpl->mnPadding = 0;
mpWindowImpl->mnGridHeight = 1;
- mpWindowImpl->mnGridLeftAttach = 0;
- mpWindowImpl->mnGridTopAttach = 0;
+ mpWindowImpl->mnGridLeftAttach = -1;
+ mpWindowImpl->mnGridTopAttach = -1;
mpWindowImpl->mnGridWidth = 1;
mpWindowImpl->mnBorderWidth = 0;
mpWindowImpl->mnMarginLeft = 0;
More information about the Libreoffice-commits
mailing list