summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-05-23 18:43:08 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-06-05 10:06:49 +0100
commite6354cc0752c5de0efefb9e3bdb9b196b205a73a (patch)
treec421429936f4162d69adf308a7ec1b93fee97f4c /svx
parentc44e55aac0dc0685c7bf3f313f4b3e6c65aaa6c6 (diff)
sidebar: Introduce PanelLayout class.
This allows sidebars to be defined using Widget layout / .ui files. Change-Id: I7d5daf2579d6359ba48d4df4be344bb75ce16273 (cherry picked from commit 4f14ed6d346a488976262e69fdbc2fd21881b659)
Diffstat (limited to 'svx')
-rw-r--r--svx/Library_svx.mk1
-rw-r--r--svx/source/sidebar/PanelLayout.cxx35
2 files changed, 36 insertions, 0 deletions
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 76f54c9bc4ae..385e5a3fe96d 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -165,6 +165,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/nbdtmg \
svx/source/sidebar/nbdtmgfact \
svx/source/sidebar/PanelFactory \
+ svx/source/sidebar/PanelLayout \
svx/source/sidebar/SelectionAnalyzer \
svx/source/sidebar/SelectionChangeHandler \
svx/source/sidebar/debug/ColorPanel \
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
new file mode 100644
index 000000000000..17c1e30e9a78
--- /dev/null
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * 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 <svx/sidebar/PanelLayout.hxx>
+#include <vcl/layout.hxx>
+
+PanelLayout::PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
+ : Control(pParent)
+{
+ m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID);
+}
+
+Size PanelLayout::GetOptimalSize() const
+{
+ if (isLayoutEnabled(this))
+ return VclContainer::getLayoutRequisition(*GetWindow(WINDOW_FIRSTCHILD));
+
+ return Control::GetOptimalSize();
+}
+
+void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags)
+{
+ Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags);
+
+ if (isLayoutEnabled(this) && (nFlags & WINDOW_POSSIZE_SIZE))
+ VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), Point(0, 0), Size(nWidth, nHeight));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */