[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sc/source setup_native/source sfx2/inc sfx2/Library_sfx.mk sfx2/Package_inc.mk sfx2/source svx/source sw/source sysui/desktop
Jürgen Schmidt
jsc at apache.org
Fri Jul 5 03:13:01 PDT 2013
sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 26
sc/source/ui/sidebar/AlignmentPropertyPanel.hxx | 2
sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 20
sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx | 2
sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 19
sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx | 2
setup_native/source/win32/nsis/ooosetup.ico |binary
sfx2/Library_sfx.mk | 2
sfx2/Package_inc.mk | 2
sfx2/inc/sfx2/sidebar/GridLayouter.hxx | 207 +++++
sfx2/inc/sfx2/sidebar/Layouter.hxx | 83 ++
sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx | 4
sfx2/source/sidebar/GridLayouter.cxx | 728 +++++++++++++++++++
sfx2/source/sidebar/Layouter.cxx | 118 +++
svx/source/sidebar/area/AreaPropertyPanel.cxx | 49 +
svx/source/sidebar/area/AreaPropertyPanel.hxx | 5
svx/source/sidebar/graphic/GraphicPropertyPanel.cxx | 70 +
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx | 4
svx/source/sidebar/line/LinePropertyPanel.cxx | 61 +
svx/source/sidebar/line/LinePropertyPanel.hrc | 4
svx/source/sidebar/line/LinePropertyPanel.hxx | 5
svx/source/sidebar/line/LinePropertyPanel.src | 4
svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 87 ++
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx | 5
svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 55 +
svx/source/sidebar/possize/PosSizePropertyPanel.hxx | 4
svx/source/sidebar/text/TextPropertyPanel.cxx | 34
svx/source/sidebar/text/TextPropertyPanel.hrc | 26
svx/source/sidebar/text/TextPropertyPanel.hxx | 5
svx/source/sidebar/text/TextPropertyPanel.src | 22
sw/source/ui/sidebar/PagePropertyPanel.cxx | 58 +
sw/source/ui/sidebar/PagePropertyPanel.hxx | 5
sysui/desktop/icons/ooo3_main_app.ico |binary
sysui/desktop/icons/ooo3_open.ico |binary
34 files changed, 1667 insertions(+), 51 deletions(-)
New commits:
commit e045f9900cdf2eadeeb6b1dd4a9adf40ca2069e9
Author: Jürgen Schmidt <jsc at apache.org>
Date: Fri Jul 5 09:26:07 2013 +0000
#122620# update ico file with new orb
diff --git a/setup_native/source/win32/nsis/ooosetup.ico b/setup_native/source/win32/nsis/ooosetup.ico
old mode 100644
new mode 100755
index 8a6ee67..8367b88
Binary files a/setup_native/source/win32/nsis/ooosetup.ico and b/setup_native/source/win32/nsis/ooosetup.ico differ
diff --git a/sysui/desktop/icons/ooo3_main_app.ico b/sysui/desktop/icons/ooo3_main_app.ico
index 98fcea3..f9c2b09 100755
Binary files a/sysui/desktop/icons/ooo3_main_app.ico and b/sysui/desktop/icons/ooo3_main_app.ico differ
diff --git a/sysui/desktop/icons/ooo3_open.ico b/sysui/desktop/icons/ooo3_open.ico
index 98fcea3..f9c2b09 100755
Binary files a/sysui/desktop/icons/ooo3_open.ico and b/sysui/desktop/icons/ooo3_open.ico differ
commit 4f9ac2af7157786ee6fba46551bd6782730d8b55
Author: Andre Fischer <af at apache.org>
Date: Fri Jul 5 08:53:11 2013 +0000
122635: Add layouting to some sidebar panels.
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 4b0c9a0..3dbf387 100755
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -24,6 +24,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <AlignmentPropertyPanel.hxx>
#include <AlignmentPropertyPanel.hrc>
#include <svx/dialmgr.hxx>
@@ -38,6 +39,7 @@
using namespace css;
using namespace cssu;
+using ::sfx2::sidebar::Layouter;
using ::sfx2::sidebar::ControlFactory;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
@@ -98,6 +100,13 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
mpFTLeftIndent->SetBackground(Wallpaper());
mpFtRotate->SetBackground(Wallpaper());
+
+ Layouter::PrepareForLayouting(*mpFTLeftIndent);
+ Layouter::PrepareForLayouting(*mpFtRotate);
+ Layouter::PrepareForLayouting(*mpCBXWrapText);
+ Layouter::PrepareForLayouting(*mpCBXMergeCell);
+ Layouter::PrepareForLayouting(*mpCbStacked);
+
}
//////////////////////////////////////////////////////////////////////////////
@@ -630,10 +639,17 @@ void AlignmentPropertyPanel::UpdateVerAlign()
}
}
-//////////////////////////////////////////////////////////////////////////////
-// namespace close
-}} // end of namespace ::sc::sidebar
-//////////////////////////////////////////////////////////////////////////////
-// eof
+
+void AlignmentPropertyPanel::Resize (void)
+{
+ const sal_Int32 nRight (GetSizePixel().Width() - Layouter::MapWidth(*this, TB_BORDER));
+ Layouter::SetRight(*mpFtRotate, nRight);
+ Layouter::SetRight(*mpCBXWrapText, nRight);
+ Layouter::SetRight(*mpCBXMergeCell, nRight);
+ Layouter::SetRight(*mpCbStacked, nRight);
+}
+
+
+}} // end of namespace ::sc::sidebar
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index 6ae2e4a..0dd2e38 100755
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -61,6 +61,8 @@ public:
SfxBindings* GetBindings();
+ virtual void Resize (void);
+
private:
//ui controls
::boost::scoped_ptr<Window> mpTBHorizontalBackground;
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 64b45b7..5e3cd53 100755
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -24,6 +24,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <CellAppearancePropertyPanel.hxx>
#include <CellAppearancePropertyPanel.hrc>
#include "sc.hrc"
@@ -48,6 +49,8 @@
using namespace css;
using namespace cssu;
+using ::sfx2::sidebar::Layouter;
+
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
@@ -247,6 +250,9 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
{
Initialize();
FreeResource();
+
+ Layouter::PrepareForLayouting(*mpFTFillColor);
+ Layouter::PrepareForLayouting(*mpFTCellBorder);
}
//////////////////////////////////////////////////////////////////////////////
@@ -873,8 +879,18 @@ void CellAppearancePropertyPanel::UpdateControlState()
}
}
-//////////////////////////////////////////////////////////////////////////////
-// namespace close
+
+
+
+void CellAppearancePropertyPanel::Resize (void)
+{
+ const sal_Int32 nRight (GetSizePixel().Width() - Layouter::MapWidth(*this, TB_BORDER));
+ Layouter::SetRight(*mpFTFillColor, nRight);
+ Layouter::SetRight(*mpFTCellBorder, nRight);
+ Layouter::SetRight(*mpCBXShowGrid, nRight);
+}
+
+
}} // end of namespace ::sc::sidebar
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index c422486..02ad167 100755
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -69,6 +69,8 @@ public:
SfxBindings* GetBindings();
+ virtual void Resize (void);
+
private:
//ui controls
::boost::scoped_ptr< FixedText > mpFTFillColor;
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index 77aedc4..5447e62 100755
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -23,6 +23,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
#include <NumberFormatPropertyPanel.hxx>
#include <NumberFormatPropertyPanel.hrc>
@@ -40,6 +41,7 @@
using namespace css;
using namespace cssu;
+using ::sfx2::sidebar::Layouter;
using ::sfx2::sidebar::Theme;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
@@ -81,6 +83,10 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel(
{
Initialize();
FreeResource();
+
+ Layouter::PrepareForLayouting(*mpFtCategory);
+ Layouter::PrepareForLayouting(*mpFtDecimals);
+ Layouter::PrepareForLayouting(*mpFtLeadZeroes);
}
//////////////////////////////////////////////////////////////////////////////
@@ -393,8 +399,17 @@ SfxBindings* NumberFormatPropertyPanel::GetBindings()
return mpBindings;
}
-//////////////////////////////////////////////////////////////////////////////
-// namespace close
+
+
+
+void NumberFormatPropertyPanel::Resize (void)
+{
+ const sal_Int32 nRight (GetSizePixel().Width() - Layouter::MapWidth(*this, TB_BORDER));
+ Layouter::SetRight(*mpFtCategory, nRight);
+ Layouter::SetRight(*mpFtLeadZeroes, nRight);
+ Layouter::SetRight(*mpBtnNegRed, nRight);
+ Layouter::SetRight(*mpBtnThousand, nRight);
+}
}} // end of namespace ::sc::sidebar
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
index 3795251..db1ca40 100755
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -58,6 +58,8 @@ public:
SfxBindings* GetBindings();
+ virtual void Resize (void);
+
private:
//ui controls
::boost::scoped_ptr< FixedText > mpFtCategory;
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 6200e18..5d93b65 100755
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -237,9 +237,11 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/DrawHelper \
sfx2/source/sidebar/EnumContext \
sfx2/source/sidebar/FocusManager \
+ sfx2/source/sidebar/GridLayouter \
sfx2/source/sidebar/MenuButton \
sfx2/source/sidebar/IContextChangeReceiver \
sfx2/source/sidebar/ILayoutableWindow \
+ sfx2/source/sidebar/Layouter \
sfx2/source/sidebar/Paint \
sfx2/source/sidebar/Panel \
sfx2/source/sidebar/PanelDescriptor \
diff --git a/sfx2/Package_inc.mk b/sfx2/Package_inc.mk
index 22eae63..01a5365 100644
--- a/sfx2/Package_inc.mk
+++ b/sfx2/Package_inc.mk
@@ -136,8 +136,10 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControlFactory.hxx,s
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerFactory.hxx,sfx2/sidebar/ControllerFactory.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ControllerItem.hxx,sfx2/sidebar/ControllerItem.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/EnumContext.hxx,sfx2/sidebar/EnumContext.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/GridLayouter.hxx,sfx2/sidebar/GridLayouter.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/IContextChangeReceiver.hxx,sfx2/sidebar/IContextChangeReceiver.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ILayoutableWindow.hxx,sfx2/sidebar/ILayoutableWindow.hxx))
+$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Layouter.hxx,sfx2/sidebar/Layouter.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/ResourceDefinitions.hrc,sfx2/sidebar/ResourceDefinitions.hrc))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/Sidebar.hxx,sfx2/sidebar/Sidebar.hxx))
$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/sidebar/SidebarChildWindow.hxx,sfx2/sidebar/SidebarChildWindow.hxx))
diff --git a/sfx2/inc/sfx2/sidebar/GridLayouter.hxx b/sfx2/inc/sfx2/sidebar/GridLayouter.hxx
new file mode 100644
index 0000000..bcf4263
--- /dev/null
+++ b/sfx2/inc/sfx2/sidebar/GridLayouter.hxx
@@ -0,0 +1,207 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef SFX_SIDEBAR_GRID_LAYOUTER_HXX
+#define SFX_SIDEBAR_GRID_LAYOUTER_HXX
+
+#include "sfx2/dllapi.h"
+#include <boost/scoped_ptr.hpp>
+
+class Rectangle;
+class Window;
+
+namespace sfx2 { namespace sidebar {
+
+class CellDescriptor;
+class ColumnDescriptor;
+
+/** A simple layouter that organizes controls in a grid.
+ At the moment only horizontal positions and sizes are processed.
+ It can handle all or only a subset of the controls in one panel.
+*/
+class SFX2_DLLPUBLIC GridLayouter
+{
+public:
+ GridLayouter (Window& rParent);
+ ~GridLayouter (void);
+
+ /** Return the cell descriptor for the specified cell.
+ This creates empty column data structures as needed.
+
+ By default a cell has only one cell descriptor. Different
+ variants allow different cell descriptors for different
+ controls. This is useful if different controls are displayed
+ for different contexts, and, say, one has a fixed width and
+ another is to fill the column.
+
+ During layouting only cell descriptors are processed that have
+ visible controls.
+ */
+ CellDescriptor& GetCell (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const sal_Int32 nVariant = 0);
+
+ ColumnDescriptor& GetColumn (
+ const sal_Int32 nColumn);
+
+ /** Calculate positions and sizes for all visible controls under
+ the control of the grid layouter according to the current size
+ of the parent window.
+ */
+ void Layout (void);
+
+ /** Paint some debug information.
+ */
+ void Paint (const Rectangle& rBox);
+
+private:
+ class Implementation;
+ ::boost::scoped_ptr<Implementation> mpImplementation;
+};
+
+
+
+/** A collection of attributes for a single cell in a grid layout.
+ Represents one control.
+*/
+class SFX2_DLLPUBLIC CellDescriptor
+{
+public:
+ CellDescriptor (void);
+ ~CellDescriptor (void);
+
+ /** Set the number of columns covered by the cell. The default
+ value is 1.
+ */
+ CellDescriptor& SetGridWidth (const sal_Int32 nColumnCount);
+
+ /** Set the control represented by the cell and whose position and
+ size will be modified in subsequent calls to
+ GridLayouter::Layout().
+ The cell is only taken into account in Layout() when the
+ control is visible.
+ */
+ CellDescriptor& SetControl (Window& rWindow);
+
+ /** Set the minimum and maximum width of the cell to the given
+ value.
+ */
+ CellDescriptor& SetFixedWidth (const sal_Int32 nWidth);
+
+ /** Set the minimum and maximum width of the cell to the current
+ width of the control.
+ */
+ CellDescriptor& SetFixedWidth (void);
+ CellDescriptor& SetMinimumWidth (const sal_Int32 nWidth);
+
+ /** Set the horizontal offset of the control with respect to the
+ containing column. The offset is only used when the position
+ of the control is calculated not when the sizes of columns are
+ calculated.
+ */
+ CellDescriptor& SetOffset (const sal_Int32 nOffset);
+
+ sal_Int32 GetGridWidth (void) const;
+ Window* GetControl (void) const;
+ sal_Int32 GetMinimumWidth (void) const;
+ sal_Int32 GetMaximumWidth (void) const;
+ sal_Int32 GetOffset (void) const;
+
+private:
+ Window* mpControl;
+ sal_Int32 mnGridWidth;
+ sal_Int32 mnMinimumWidth;
+ sal_Int32 mnMaximumWidth;
+ sal_Int32 mnOffset;
+};
+
+
+
+/** A collection of attributes for a single column in a grid layout.
+*/
+class SFX2_DLLPUBLIC ColumnDescriptor
+{
+public:
+ ColumnDescriptor (void);
+ ~ColumnDescriptor (void);
+
+ ColumnDescriptor& SetWeight (
+ const sal_Int32 nWeight);
+ ColumnDescriptor& SetMinimumWidth (
+ const sal_Int32 nWidth);
+ /** Set both minimum and maximum width to the given value.
+ */
+ ColumnDescriptor& SetFixedWidth (
+ const sal_Int32 nWidth);
+
+ /** Set external padding on the left side of the column.
+ */
+ ColumnDescriptor& SetLeftPadding (
+ const sal_Int32 nPadding);
+
+ /** Set external padding on the right side of the column.
+ */
+ ColumnDescriptor& SetRightPadding (
+ const sal_Int32 nPadding);
+
+ sal_Int32 GetWeight (void) const;
+
+ /** Return the minimum width of the column without external
+ padding. This is the value last set with SetMinimumWidth() or SetFixedWidth().
+ */
+ sal_Int32 GetMinimumWidth (void) const;
+
+ /** Return the maximum width of the column without external
+ padding. This is the value last set with SetFixedWidth().
+ */
+ sal_Int32 GetMaximumWidth (void) const;
+
+ /** Return the maximum width of the column including external
+ padding.
+ */
+ sal_Int32 GetTotalMaximumWidth (void) const;
+
+ sal_Int32 GetLeftPadding (void) const;
+ sal_Int32 GetRightPadding (void) const;
+
+ /** The width of the column is a temporary and internal value that
+ is calculated in GridLayouter::Layout().
+ Calling this method outside of Layout() does not have any effect.
+ */
+ void SetWidth (const sal_Int32 nWidth);
+ sal_Int32 GetWidth (void) const;
+
+private:
+ sal_Int32 mnWeight;
+ sal_Int32 mnMinimumWidth;
+ sal_Int32 mnMaximumWidth;
+ sal_Int32 mnLeftPadding;
+ sal_Int32 mnRightPadding;
+
+ // Temporary values set calculated in the Layout() method.
+ sal_Int32 mnWidth;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/sfx2/inc/sfx2/sidebar/Layouter.hxx b/sfx2/inc/sfx2/sidebar/Layouter.hxx
new file mode 100644
index 0000000..bf16a38
--- /dev/null
+++ b/sfx2/inc/sfx2/sidebar/Layouter.hxx
@@ -0,0 +1,83 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#ifndef SFX_SIDEBAR_LAYOUTER_HXX
+#define SFX_SIDEBAR_LAYOUTER_HXX
+
+#include "sfx2/dllapi.h"
+
+class Window;
+
+namespace sfx2 { namespace sidebar {
+
+/** Collection of simple helper functions for layouting sidebar panels.
+*/
+class SFX2_DLLPUBLIC Layouter
+{
+public:
+ /** Make the given control wider by the given value. Negative
+ values would make the control smaller.
+ The height and the position of the control remain unchanged.
+ */
+ static void EnlargeControlHorizontally (
+ Window& rControl,
+ const sal_Int32 nDeltaX);
+
+ static void SetWidth (
+ Window& rControl,
+ const sal_Int32 nWidth);
+
+ static void SetRight (
+ Window& rControl,
+ const sal_Int32 nRight);
+
+ /** Move the given control by the given value to the right.
+ A negative value would move the control to the left.
+ The y-position and the size of the control remain unchanged.
+ */
+ static void MoveControlHorizontally (
+ Window& rControl,
+ const sal_Int32 nDeltaX);
+
+ static void SetHorizontalPosition (
+ Window& rControl,
+ const sal_Int32 nX);
+
+ /** Set the WB_ELLIPSIS flag at the given control so that when it
+ can not be shown completely it is shortened more gracefully
+ then just cutting it off. The ellipsis flag can not be set
+ via the resource file.
+ */
+ static void PrepareForLayouting (
+ Window& rControl);
+
+ static sal_Int32 MapX (
+ const Window& rControl,
+ const sal_Int32 nValue);
+
+ static sal_Int32 MapWidth (
+ const Window& rControl,
+ const sal_Int32 nValue);
+};
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx b/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
index bfe2adc..a8144061 100644
--- a/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
+++ b/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
@@ -99,6 +99,10 @@ private:
DECL_LINK(Activate, ToolBox*);
DECL_LINK(Deactivate, ToolBox*);
+ using ToolBox::Activate;
+ using ToolBox::Deactivate;
+ using DockingWindow::SetPosSizePixel;
+
void CreateController (
const sal_uInt16 nItemId,
const cssu::Reference<css::frame::XFrame>& rxFrame,
diff --git a/sfx2/source/sidebar/GridLayouter.cxx b/sfx2/source/sidebar/GridLayouter.cxx
new file mode 100644
index 0000000..ada929d
--- /dev/null
+++ b/sfx2/source/sidebar/GridLayouter.cxx
@@ -0,0 +1,728 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+#include "sfx2/sidebar/GridLayouter.hxx"
+
+#include <vcl/window.hxx>
+
+namespace sfx2 { namespace sidebar {
+
+typedef std::vector<CellDescriptor> CellData;
+typedef std::vector<CellData> ColumnData;
+
+class GridLayouter::Implementation
+{
+public:
+ Implementation (Window& rParent);
+ ~Implementation (void);
+
+ CellDescriptor& GetCell (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const sal_Int32 nVariant);
+
+ void Layout (void);
+ void LayoutColumn(
+ ColumnData& rColumn,
+ const sal_Int32 nX,
+ const sal_Int32 nColumnIndex);
+
+ void DistributeWidth (const sal_Int32 nTotalWidth);
+ sal_Int32 GetMinimumColumnWidth (
+ ColumnData& rColumn,
+ const ColumnDescriptor& rDescriptor) const;
+
+ void Paint (void);
+
+ Window& mrParent;
+ ::std::vector<ColumnData> maColumns;
+ ::std::vector<ColumnDescriptor> maColumnDescriptors;
+};
+
+#define ForAllColumnDescriptors(I) \
+ for (::std::vector<ColumnDescriptor>::iterator \
+ I(maColumnDescriptors.begin()), \
+ iEnd(maColumnDescriptors.end()); \
+ I!=iEnd; \
+ ++I)
+
+#define ForAllColumns(I,N) \
+ sal_Int32 N (0); \
+ for (::std::vector<ColumnData>::iterator \
+ I(maColumns.begin()), \
+ iEnd(maColumns.end()); \
+ I!=iEnd; \
+ ++I,++N)
+
+#define ForAllRows(ColumnData,I) \
+ for (std::vector<CellData>::iterator \
+ I((ColumnData).begin()), \
+ iRowEnd((ColumnData).end()); \
+ I!=iRowEnd; \
+ ++I)
+
+#define ForAllCells(CellData,I) \
+ for (::std::vector<CellDescriptor>::iterator \
+ I((CellData).begin()), \
+ iCellEnd((CellData).end()); \
+ I!=iCellEnd; \
+ ++I)
+
+
+//===== GridLayouter ==========================================================
+
+GridLayouter::GridLayouter (Window& rParent)
+ : mpImplementation(new Implementation(rParent))
+{
+}
+
+
+
+
+GridLayouter::~GridLayouter (void)
+{
+}
+
+
+
+
+CellDescriptor& GridLayouter::GetCell (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const sal_Int32 nVariant)
+{
+ return mpImplementation->GetCell(nRow, nColumn, nVariant);
+}
+
+
+
+
+ColumnDescriptor& GridLayouter::GetColumn (
+ const sal_Int32 nColumn)
+{
+ // Make sure that the specified column exists.
+ mpImplementation->GetCell(0, nColumn, 0);
+ return mpImplementation->maColumnDescriptors[nColumn];
+}
+
+
+
+
+void GridLayouter::Layout (void)
+{
+ mpImplementation->Layout();
+}
+
+
+
+
+void GridLayouter::Paint (const Rectangle& rBox)
+{
+ (void)rBox;
+
+ mpImplementation->Paint();
+}
+
+
+
+
+//===== CellDescriptor ========================================================
+
+CellDescriptor::CellDescriptor (void)
+ : mpControl(NULL),
+ mnGridWidth(1),
+ mnMinimumWidth(-1),
+ mnMaximumWidth(-1),
+ mnOffset(0)
+{
+}
+
+
+
+
+CellDescriptor::~CellDescriptor (void)
+{
+}
+
+
+
+
+CellDescriptor& CellDescriptor::SetGridWidth (const sal_Int32 nColumnCount)
+{
+ mnGridWidth = nColumnCount;
+ return *this;
+}
+
+
+
+
+CellDescriptor& CellDescriptor::SetControl (Window& rControl)
+{
+ mpControl = &rControl;
+ return *this;
+}
+
+
+
+
+CellDescriptor& CellDescriptor::SetFixedWidth (const sal_Int32 nWidth)
+{
+ mnMinimumWidth = nWidth;
+ mnMaximumWidth = nWidth;
+ return *this;
+}
+
+
+
+CellDescriptor& CellDescriptor::SetOffset (const sal_Int32 nOffset)
+{
+ mnOffset = nOffset;
+ return *this;
+}
+
+
+
+
+CellDescriptor& CellDescriptor::SetFixedWidth (void)
+{
+ sal_Int32 nMaxControlWidth (0);
+ if (mpControl != NULL)
+ {
+ const sal_Int32 nControlWidth (mpControl->GetSizePixel().Width());
+ if (nControlWidth > nMaxControlWidth)
+ nMaxControlWidth = nControlWidth;
+ }
+ mnMinimumWidth = nMaxControlWidth;
+ mnMaximumWidth = nMaxControlWidth;
+
+ return *this;
+}
+
+
+
+
+CellDescriptor& CellDescriptor::SetMinimumWidth (const sal_Int32 nWidth)
+{
+ mnMinimumWidth = nWidth;
+ return *this;
+}
+
+
+
+sal_Int32 CellDescriptor::GetGridWidth (void) const
+{
+ return mnGridWidth;
+}
+
+
+
+
+Window* CellDescriptor::GetControl (void) const
+{
+ return mpControl;
+}
+
+
+
+
+sal_Int32 CellDescriptor::GetMinimumWidth (void) const
+{
+ return mnMinimumWidth + mnOffset;
+}
+
+
+
+
+sal_Int32 CellDescriptor::GetMaximumWidth (void) const
+{
+ return mnMaximumWidth;
+}
+
+
+
+sal_Int32 CellDescriptor::GetOffset (void) const
+{
+ return mnOffset;
+}
+
+
+
+
+//===== GridLayouter::Implementation ==========================================
+
+GridLayouter::Implementation::Implementation (Window& rParent)
+ : mrParent(rParent),
+ maColumns(),
+ maColumnDescriptors()
+{
+}
+
+
+
+
+GridLayouter::Implementation::~Implementation (void)
+{
+}
+
+
+
+
+CellDescriptor& GridLayouter::Implementation::GetCell (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const sal_Int32 nVariant)
+{
+ if (nColumn<0 || nRow<0 || nVariant<0)
+ {
+ OSL_ASSERT(nColumn>=0);
+ OSL_ASSERT(nRow>=0);
+ OSL_ASSERT(nVariant>=0);
+ return GetCell(0,0,0);
+ }
+
+ // Provide missing columns.
+ if (maColumns.size() <= static_cast<size_t>(nColumn))
+ {
+ maColumns.resize(nColumn+1);
+ maColumnDescriptors.resize(nColumn+1);
+ }
+
+ // Provide missing rows.
+ ColumnData& rColumn (maColumns[nColumn]);
+ if (rColumn.size() <= static_cast<size_t>(nRow))
+ rColumn.resize(nRow+1);
+
+ // Provide missing variants.
+ CellData& rCellData (rColumn[nRow]);
+ if (rCellData.size() <= static_cast<size_t>(nVariant))
+ rCellData.resize(nVariant+1);
+
+ return rCellData[nVariant];
+}
+
+
+
+
+void GridLayouter::Implementation::Layout (void)
+{
+ if (maColumns.empty())
+ {
+ // There are no columns and therefore no controls => nothing
+ // to do.
+ return;
+ }
+
+ const Size aParentSize (mrParent.GetSizePixel());
+
+ // Determine the total column weight.
+ sal_Int32 nTotalColumnWeight (0);
+ ForAllColumnDescriptors(iDescriptor)
+ nTotalColumnWeight += iDescriptor->GetWeight();
+ if (nTotalColumnWeight <= 0)
+ {
+ OSL_ASSERT(nTotalColumnWeight>0);
+ return;
+ }
+
+ // Distribute the width of the parent window to the columns.
+ DistributeWidth(aParentSize.Width());
+
+ // Set the new positions and widths.
+ sal_Int32 nX (0);
+ ForAllColumns(iColumn,nColumnIndex)
+ {
+ LayoutColumn(
+ *iColumn,
+ nX,
+ nColumnIndex);
+
+ nX += maColumnDescriptors[nColumnIndex].GetWidth();
+ }
+}
+
+
+
+
+void GridLayouter::Implementation::LayoutColumn(
+ ColumnData& rColumn,
+ const sal_Int32 nX,
+ const sal_Int32 nColumnIndex)
+{
+ ColumnDescriptor& rDescriptor (maColumnDescriptors[nColumnIndex]);
+ const sal_Int32 nLeft (nX + rDescriptor.GetLeftPadding());
+ const sal_Int32 nWidth (rDescriptor.GetWidth() - rDescriptor.GetLeftPadding() - rDescriptor.GetRightPadding());
+
+ sal_Int32 nRow (-1);
+ ForAllRows(rColumn, iCell)
+ {
+ ++nRow;
+
+ ForAllCells(*iCell, iCellDescriptor)
+ {
+ Window* pControl = iCellDescriptor->GetControl();
+ if (pControl==NULL || ! pControl->IsVisible())
+ continue;
+
+ sal_Int32 nCellWidth (nWidth);
+ const sal_Int32 nGridWidth (iCellDescriptor->GetGridWidth());
+ if (nGridWidth < 0)
+ continue;
+ else if (nGridWidth > 1)
+ {
+ // Cell spans more than one column. Sum all their
+ // widths.
+ for (sal_Int32 nOffset=1;
+ nOffset<nGridWidth && static_cast<size_t>(nColumnIndex+nOffset)<maColumnDescriptors.size();
+ ++nOffset)
+ {
+ nCellWidth += maColumnDescriptors[nColumnIndex+nOffset].GetWidth();
+ }
+ nCellWidth -= maColumnDescriptors[nColumnIndex+nGridWidth-1].GetRightPadding();
+ }
+
+ // Check width against valid range of cell.
+ if (iCellDescriptor->GetMinimumWidth() > 0)
+ if (nCellWidth < iCellDescriptor->GetMinimumWidth())
+ nCellWidth = iCellDescriptor->GetMinimumWidth();
+ if (iCellDescriptor->GetMaximumWidth() > 0)
+ if (nCellWidth > iCellDescriptor->GetMaximumWidth())
+ nCellWidth = iCellDescriptor->GetMaximumWidth();
+
+ pControl->SetPosSizePixel(
+ nLeft + iCellDescriptor->GetOffset(),
+ 0,
+ nCellWidth,
+ 0,
+ WINDOW_POSSIZE_X | WINDOW_POSSIZE_WIDTH);
+ }
+ }
+}
+
+
+
+
+void GridLayouter::Implementation::DistributeWidth (const sal_Int32 nTotalWidth)
+{
+ // Prepare width distribution:
+ // a) Setup minimum widths for all columns.
+ // b) Sum up the width of columns that have zero weight.
+ // c) Sum up the non-zero weights.
+ sal_Int32 nZeroWeightWidth (0);
+ sal_Int32 nTotalColumnWeight (0);
+ for (sal_uInt32 nColumn=0; nColumn<maColumns.size(); ++nColumn)
+ {
+ ColumnDescriptor& rDescriptor (maColumnDescriptors[nColumn]);
+ ColumnData& rColumn (maColumns[nColumn]);
+
+ const sal_Int32 nWidth (GetMinimumColumnWidth(rColumn, rDescriptor));
+
+ rDescriptor.SetWidth(nWidth);
+
+ if (rDescriptor.GetWeight() <= 0)
+ nZeroWeightWidth += nWidth;
+ else
+ nTotalColumnWeight += rDescriptor.GetWeight();
+ }
+
+ sal_Int32 nRemainingWidth (nTotalWidth - nZeroWeightWidth);
+ if (nRemainingWidth < 0)
+ nRemainingWidth = 0;
+
+
+ // Distribute the remaining width between columns that have
+ // non-zero width.
+ const sal_Int32 nDistributableWidth (nRemainingWidth);
+ for (sal_uInt32 nColumn=0; nColumn<maColumns.size(); ++nColumn)
+ {
+ ColumnDescriptor& rDescriptor (maColumnDescriptors[nColumn]);
+
+ if (rDescriptor.GetWeight() > 0)
+ {
+ sal_Int32 nWidth (nDistributableWidth * rDescriptor.GetWeight() / nTotalColumnWeight);
+ // Make sure the width lies inside the valid range of
+ // column widths.
+ if (nWidth < rDescriptor.GetWidth())
+ nWidth = rDescriptor.GetWidth();
+ if (rDescriptor.GetMaximumWidth()>0)
+ if (nWidth > rDescriptor.GetTotalMaximumWidth())
+ nWidth = rDescriptor.GetTotalMaximumWidth();
+
+ rDescriptor.SetWidth(nWidth);
+ nRemainingWidth -= nWidth;
+ }
+ }
+
+ // If there are some pixels left (due to rounding errors), then
+ // give them to the first column that has non-zero weight.
+ if (nRemainingWidth > 0)
+ for (sal_uInt32 nColumn=0; nColumn<maColumns.size(); ++nColumn)
+ {
+ ColumnDescriptor& rDescriptor (maColumnDescriptors[nColumn]);
+ if (rDescriptor.GetWeight() > 0)
+ {
+ rDescriptor.SetWidth(rDescriptor.GetWidth() + nRemainingWidth);
+ break;
+ }
+ }
+}
+
+
+
+
+sal_Int32 GridLayouter::Implementation::GetMinimumColumnWidth (
+ ColumnData& rColumn,
+ const ColumnDescriptor& rDescriptor) const
+{
+ // Start with the minimum width of the whole column.
+ sal_Int32 nMinimumWidth (rDescriptor.GetMinimumWidth());
+
+ // Take also into account the minimum widths of all cells in the column.
+ ForAllRows(rColumn, iCell)
+ ForAllCells(*iCell, iCellDescriptor)
+ {
+ if (iCellDescriptor->GetGridWidth() != 1)
+ continue;
+ const sal_Int32 nMinimumCellWidth (iCellDescriptor->GetMinimumWidth());
+ if (nMinimumCellWidth > nMinimumWidth)
+ nMinimumWidth = nMinimumCellWidth;
+ }
+
+ // Make sure that the minimum width does not become larger than
+ // the maximum width of the column.
+ if (nMinimumWidth > rDescriptor.GetMaximumWidth() && rDescriptor.GetMaximumWidth()>0)
+ nMinimumWidth = rDescriptor.GetMaximumWidth();
+
+ // Add the horizontal padding.
+ return nMinimumWidth
+ + rDescriptor.GetLeftPadding()
+ + rDescriptor.GetRightPadding();
+}
+
+
+
+
+void GridLayouter::Implementation::Paint (void)
+{
+ const Size aParentSize (mrParent.GetSizePixel());
+
+ static const Color aSeparatorColor (0x66cdaa);
+ static const Color aLeftPaddingColor (0x98fb98);
+ static const Color aRightPaddingColor (0xff69b4);
+ static const Color aControlOverlayColor (0xffff00);
+
+ sal_Int32 nX (0);
+ mrParent.SetLineColor();
+ mrParent.SetFillColor(aLeftPaddingColor);
+ ForAllColumnDescriptors(iColumn)
+ {
+ if (iColumn->GetLeftPadding() > 0)
+ {
+ mrParent.DrawRect(Rectangle(
+ nX,0,
+ nX+iColumn->GetLeftPadding(),aParentSize.Height()));
+ }
+
+ nX += iColumn->GetWidth();
+ }
+
+ nX = 0;
+ mrParent.SetFillColor(aRightPaddingColor);
+ ForAllColumnDescriptors(iColumn)
+ {
+ if (iColumn->GetRightPadding() > 0)
+ {
+ const sal_Int32 nRight (nX + iColumn->GetWidth());
+ const sal_Int32 nLeft (nRight - iColumn->GetRightPadding());
+ mrParent.DrawRect(Rectangle(
+ nLeft,0,
+ nRight,aParentSize.Height()));
+ }
+
+ nX += iColumn->GetWidth();
+ }
+
+ nX = 0;
+ mrParent.SetFillColor();
+ mrParent.SetLineColor(aSeparatorColor);
+ ForAllColumnDescriptors(iColumn)
+ {
+ mrParent.DrawLine(Point(nX,0), Point(nX,aParentSize.Height()));
+ nX += iColumn->GetWidth();
+ }
+
+ mrParent.SetFillColor();
+ mrParent.SetLineColor(aControlOverlayColor);
+ ForAllColumns(iColumn,nColumnIndex)
+ ForAllRows(*iColumn, iCell)
+ ForAllCells(*iCell, iCellDescriptor)
+ {
+ Window* pControl (iCellDescriptor->GetControl());
+ if (pControl!=NULL && pControl->IsVisible())
+ {
+ Rectangle aBox (
+ pControl->GetPosPixel(),
+ pControl->GetSizePixel());
+ --aBox.Left();
+ --aBox.Top();
+ ++aBox.Right();
+ ++aBox.Bottom();
+ mrParent.DrawRect(aBox);
+ }
+ }
+}
+
+
+
+
+//===== ColumnDescriptor ======================================================
+
+ColumnDescriptor::ColumnDescriptor (void)
+ : mnWeight(1),
+ mnMinimumWidth(0),
+ mnMaximumWidth(-1),
+ mnLeftPadding(0),
+ mnRightPadding(0),
+ mnWidth(0)
+{
+}
+
+
+
+
+ColumnDescriptor::~ColumnDescriptor (void)
+{
+}
+
+
+
+
+ColumnDescriptor& ColumnDescriptor::SetWeight (const sal_Int32 nWeight)
+{
+ mnWeight = nWeight;
+
+ return *this;
+}
+
+
+
+
+ColumnDescriptor& ColumnDescriptor::SetMinimumWidth (const sal_Int32 nWidth)
+{
+ mnMinimumWidth = nWidth;
+
+ return *this;
+}
+
+
+
+ColumnDescriptor& ColumnDescriptor::SetFixedWidth (const sal_Int32 nWidth)
+{
+ mnMinimumWidth = nWidth;
+ mnMaximumWidth = nWidth;
+
+ return *this;
+}
+
+
+
+ColumnDescriptor& ColumnDescriptor::SetLeftPadding (const sal_Int32 nPadding)
+{
+ mnLeftPadding = nPadding;
+
+ return *this;
+}
+
+
+
+
+ColumnDescriptor& ColumnDescriptor::SetRightPadding (const sal_Int32 nPadding)
+{
+ mnRightPadding = nPadding;
+
+ return *this;
+}
+
+
+
+
+sal_Int32 ColumnDescriptor::GetWeight (void) const
+{
+ return mnWeight;
+}
+
+
+
+
+sal_Int32 ColumnDescriptor::GetMinimumWidth (void) const
+{
+ return mnMinimumWidth;
+}
+
+
+
+
+sal_Int32 ColumnDescriptor::GetMaximumWidth (void) const
+{
+ return mnMaximumWidth;
+}
+
+
+
+
+sal_Int32 ColumnDescriptor::GetTotalMaximumWidth (void) const
+{
+ return mnMaximumWidth + mnLeftPadding + mnRightPadding;
+}
+
+
+
+
+sal_Int32 ColumnDescriptor::GetLeftPadding (void) const
+{
+ return mnLeftPadding;
+}
+
+
+
+
+sal_Int32 ColumnDescriptor::GetRightPadding (void) const
+{
+ return mnRightPadding;
+}
+
+
+
+
+void ColumnDescriptor::SetWidth (const sal_Int32 nWidth)
+{
+ mnWidth = nWidth;
+}
+
+
+
+
+sal_Int32 ColumnDescriptor::GetWidth (void) const
+{
+ return mnWidth;
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/Layouter.cxx b/sfx2/source/sidebar/Layouter.cxx
new file mode 100644
index 0000000..5b651e3
--- /dev/null
+++ b/sfx2/source/sidebar/Layouter.cxx
@@ -0,0 +1,118 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+#include "precompiled_sfx2.hxx"
+#include "sfx2/sidebar/Layouter.hxx"
+
+#include <vcl/window.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/outdev.hxx>
+
+namespace sfx2 { namespace sidebar {
+
+void Layouter::EnlargeControlHorizontally (
+ Window& rControl,
+ const sal_Int32 nDeltaX)
+{
+ Size aSize (rControl.GetSizePixel());
+ aSize.Width() += nDeltaX;
+ rControl.SetSizePixel(aSize);
+
+}
+
+
+
+
+void Layouter::SetWidth (
+ Window& rControl,
+ const sal_Int32 nWidth)
+{
+ rControl.SetPosSizePixel(
+ 0,0,
+ nWidth,0,
+ WINDOW_POSSIZE_WIDTH);
+}
+
+
+
+
+void Layouter::SetRight (
+ Window& rControl,
+ const sal_Int32 nRight)
+{
+ rControl.SetPosSizePixel(
+ 0,0,
+ nRight-rControl.GetPosPixel().X(),0,
+ WINDOW_POSSIZE_WIDTH);
+}
+
+
+
+
+void Layouter::MoveControlHorizontally (
+ Window& rControl,
+ const sal_Int32 nDeltaX)
+{
+ Point aPosition (rControl.GetPosPixel());
+ aPosition.Move(nDeltaX, 0);
+ rControl.SetPosPixel(aPosition);
+}
+
+
+
+
+void Layouter::SetHorizontalPosition (
+ Window& rControl,
+ const sal_Int32 nX)
+{
+ rControl.SetPosPixel(Point(nX, rControl.GetPosPixel().Y()));
+}
+
+
+
+
+void Layouter::PrepareForLayouting (
+ Window& rControl)
+{
+ // rControl.SetStyle(rControl.GetStyle() | WB_PATHELLIPSIS | WB_INFO);
+}
+
+
+
+
+sal_Int32 Layouter::MapX (
+ const Window& rControl,
+ const sal_Int32 nValue)
+{
+ return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X();
+}
+
+
+
+
+sal_Int32 Layouter::MapWidth (
+ const Window& rControl,
+ const sal_Int32 nValue)
+{
+ return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X();
+}
+
+} } // end of namespace sfx2::sidebar
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index e07c6bb..97ccb1e 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -25,6 +25,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <AreaPropertyPanel.hxx>
#include <AreaPropertyPanel.hrc>
#include <svx/dialogs.hrc>
@@ -47,6 +48,7 @@
using namespace css;
using namespace cssu;
+using ::sfx2::sidebar::Layouter;
using ::sfx2::sidebar::Theme;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
@@ -130,10 +132,41 @@ AreaPropertyPanel::AreaPropertyPanel(
mpTransparanceItem(),
mxFrame(rxFrame),
mpBindings(pBindings),
- mbColorAvail(true)
+ mbColorAvail(true),
+ maLayouter(*this)
{
Initialize();
FreeResource();
+
+ // Setup the grid layouter.
+ const sal_Int32 nMappedMboxWidth (Layouter::MapWidth(*this, MBOX_WIDTH));
+
+ maLayouter.GetCell(0,0).SetControl(*mpColorTextFT).SetGridWidth(3);
+ maLayouter.GetCell(1,0).SetControl(*mpLbFillType);
+ maLayouter.GetCell(1,2,0).SetControl(*mpToolBoxColorBackground).SetFixedWidth();
+ maLayouter.GetCell(1,2,1).SetControl(*mpLbFillAttr);
+
+ maLayouter.GetCell(2,0).SetControl(*mpTrspTextFT).SetGridWidth(3);
+ maLayouter.GetCell(3,0).SetControl(*mpLBTransType);
+ maLayouter.GetCell(3,2,0).SetControl(*mpMTRTransparent);
+ maLayouter.GetCell(3,2,1).SetControl(*mpBTNGradient);
+
+ maLayouter.GetColumn(0)
+ .SetWeight(1)
+ .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetMinimumWidth(nMappedMboxWidth);
+ maLayouter.GetColumn(1)
+ .SetWeight(0)
+ .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
+ maLayouter.GetColumn(2)
+ .SetWeight(1)
+ .SetMinimumWidth(nMappedMboxWidth)
+ .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
+
+ // Make controls that display text handle short widths more
+ // graceful.
+ Layouter::PrepareForLayouting(*mpColorTextFT);
+ Layouter::PrepareForLayouting(*mpTrspTextFT);
}
@@ -423,6 +456,8 @@ IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox )
mpLbFillType->Selected();
}
}
+
+ maLayouter.Layout();
}
return 0;
@@ -1109,6 +1144,8 @@ void AreaPropertyPanel::NotifyItemUpdate(
break;
}
}
+
+ maLayouter.Layout();
}
@@ -1439,6 +1476,16 @@ sal_Int32 AreaPropertyPanel::GetSelectedTransparencyTypeIndex (void) const
return mpLBTransType->GetSelectEntryPos();
}
+
+
+
+void AreaPropertyPanel::Resize (void)
+{
+ maLayouter.Layout();
+}
+
+
+
} } // end of namespace svx::sidebar
// eof
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx
index 2633fac..4fee98e 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.hxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -27,6 +27,7 @@
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/GridLayouter.hxx>
#include <svx/xgrad.hxx>
#include <svx/itemwin.hxx>
#include <svx/xfillit0.hxx>
@@ -85,6 +86,8 @@ public:
void SetGradient (const XGradient& rGradient);
sal_Int32 GetSelectedTransparencyTypeIndex (void) const;
+ virtual void Resize (void);
+
private:
sal_uInt16 meLastXFS;
Color maLastColor;
@@ -165,6 +168,8 @@ private:
/// bitfield
bool mbColorAvail : 1;
+ ::sfx2::sidebar::GridLayouter maLayouter;
+
DECL_LINK(SelectFillTypeHdl, ListBox* );
DECL_LINK(SelectFillAttrHdl, ListBox* );
DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
index fc91398..2c24250 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -22,6 +22,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <GraphicPropertyPanel.hxx>
#include <GraphicPropertyPanel.hrc>
#include <svx/dialogs.hrc>
@@ -35,12 +36,13 @@
using namespace css;
using namespace cssu;
+using ::sfx2::sidebar::Layouter;
using ::sfx2::sidebar::Theme;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
//////////////////////////////////////////////////////////////////////////////
-// namespace open
+
namespace svx { namespace sidebar {
@@ -78,10 +80,58 @@ GraphicPropertyPanel::GraphicPropertyPanel(
maImgBlue(this, SVX_RES(IMG_BLUE)),
maImgGamma(this, SVX_RES(IMG_GAMMA)),
mxFrame(rxFrame),
- mpBindings(pBindings)
+ mpBindings(pBindings),
+ maLayouter(*this)
{
Initialize();
FreeResource();
+
+ // Setup the grid layouter.
+ maLayouter.GetCell(0,0).SetControl(*mpFtBrightness).SetGridWidth(2);
+ maLayouter.GetCell(1,0).SetControl(*mpMtrBrightness).SetGridWidth(2);
+
+ maLayouter.GetCell(0,3).SetControl(*mpFtContrast).SetGridWidth(2);
+ maLayouter.GetCell(1,3).SetControl(*mpMtrContrast).SetGridWidth(2);
+
+ maLayouter.GetCell(2,0).SetControl(*mpFtColorMode).SetGridWidth(2);
+ maLayouter.GetCell(3,0).SetControl(*mpLBColorMode).SetGridWidth(2);
+
+ maLayouter.GetCell(2,3).SetControl(*mpFtTrans).SetGridWidth(2);
+ maLayouter.GetCell(3,3).SetControl(*mpMtrTrans).SetGridWidth(2);
+
+ maLayouter.GetCell(4,0).SetControl(maImgRed).SetFixedWidth();
+ maLayouter.GetCell(4,1).SetControl(*mpMtrRed);
+
+ maLayouter.GetCell(5,0).SetControl(maImgBlue).SetFixedWidth();
+ maLayouter.GetCell(5,1).SetControl(*mpMtrBlue);
+
+ maLayouter.GetCell(4,3).SetControl(maImgGreen).SetFixedWidth();
+ maLayouter.GetCell(4,4).SetControl(*mpMtrGreen);
+ maLayouter.GetCell(5,3).SetControl(maImgGamma).SetFixedWidth();
+ maLayouter.GetCell(5,4).SetControl(*mpMtrGamma);
+
+ maLayouter.GetColumn(0)
+ .SetWeight(0)
+ .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
+ maLayouter.GetColumn(1)
+ .SetWeight(1)
+ .SetMinimumWidth(Layouter::MapWidth(*this, MBOX_WIDTH - 10));
+ maLayouter.GetColumn(2)
+ .SetWeight(0)
+ .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
+ maLayouter.GetColumn(3)
+ .SetWeight(0);
+ maLayouter.GetColumn(4)
+ .SetWeight(1)
+ .SetMinimumWidth(Layouter::MapWidth(*this, MBOX_WIDTH - 10))
+ .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
+
+ // Make controls that display text handle short widths more
+ // graceful.
+ Layouter::PrepareForLayouting(*mpFtBrightness);
+ Layouter::PrepareForLayouting(*mpFtContrast);
+ Layouter::PrepareForLayouting(*mpFtColorMode);
+ Layouter::PrepareForLayouting(*mpFtTrans);
}
//////////////////////////////////////////////////////////////////////////////
@@ -486,17 +536,19 @@ void GraphicPropertyPanel::NotifyItemUpdate(
-//////////////////////////////////////////////////////////////////////////////
-
SfxBindings* GraphicPropertyPanel::GetBindings()
{
return mpBindings;
}
-//////////////////////////////////////////////////////////////////////////////
-// namespace close
-}} // end of namespace ::svx::sidebar
-//////////////////////////////////////////////////////////////////////////////
-// eof
+
+void GraphicPropertyPanel::Resize (void)
+{
+ maLayouter.Layout();
+}
+
+
+
+}} // end of namespace ::svx::sidebar
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
index b45c16f..4135ba3 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
@@ -25,6 +25,7 @@
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/GridLayouter.hxx>
#include <vcl/fixed.hxx>
#include <boost/scoped_ptr.hpp>
@@ -57,6 +58,8 @@ public:
SfxBindings* GetBindings();
+ virtual void Resize (void);
+
private:
//ui controls
::boost::scoped_ptr< FixedText > mpFtBrightness;
@@ -98,6 +101,7 @@ private:
cssu::Reference<css::frame::XFrame> mxFrame;
SfxBindings* mpBindings;
+ ::sfx2::sidebar::GridLayouter maLayouter;
DECL_LINK( ModifyBrightnessHdl, void * );
DECL_LINK( ModifyContrastHdl, void * );
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index 4284481..12d0def 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -22,6 +22,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <LinePropertyPanel.hxx>
#include <LinePropertyPanel.hrc>
#include <svx/dialogs.hrc>
@@ -59,8 +60,10 @@
using namespace css;
using namespace cssu;
+using ::sfx2::sidebar::Layouter;
using ::sfx2::sidebar::Theme;
+
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
namespace {
@@ -231,10 +234,58 @@ LinePropertyPanel::LinePropertyPanel(
mxFrame(rxFrame),
mpBindings(pBindings),
mbColorAvailable(true),
- mbWidthValuable(true)
+ mbWidthValuable(true),
+ maLayouter(*this)
{
Initialize();
FreeResource();
+
+ // Setup the grid layouter.
+ const sal_Int32 nMappedToolBoxWidth (Layouter::MapWidth(*this, TOOLBOX_WIDTH));
+
+ maLayouter.GetCell(0,0).SetControl(*mpFTWidth);
+ maLayouter.GetCell(1,0).SetControl(*mpTBWidthBackground).SetFixedWidth();
+
+ maLayouter.GetCell(0,2).SetControl(*mpFTColor);
+ maLayouter.GetCell(1,2).SetControl(*mpTBColorBackground).SetFixedWidth();
+
+ maLayouter.GetCell(2,0).SetControl(*mpFTStyle);
+ maLayouter.GetCell(3,0).SetControl(*mpLBStyle);
+
+ maLayouter.GetCell(2,2).SetControl(*mpFTTrancparency);
+ maLayouter.GetCell(3,2).SetControl(*mpMFTransparent);
+
+ maLayouter.GetCell(4,0).SetControl(*mpFTArrow).SetGridWidth(3);
+ maLayouter.GetCell(5,0).SetControl(*mpLBStart);
+ maLayouter.GetCell(5,2).SetControl(*mpLBEnd);
+
+ maLayouter.GetCell(6,0).SetControl(*mpFTEdgeStyle);
+ maLayouter.GetCell(7,0).SetControl(*mpLBEdgeStyle);
+
+ maLayouter.GetCell(6,2).SetControl(*mpFTCapStyle);
+ maLayouter.GetCell(7,2).SetControl(*mpLBCapStyle);
+
+ maLayouter.GetColumn(0)
+ .SetWeight(1)
+ .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetMinimumWidth(nMappedToolBoxWidth);
+ maLayouter.GetColumn(1)
+ .SetWeight(0)
+ .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
+ maLayouter.GetColumn(2)
+ .SetWeight(1)
+ .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetMinimumWidth(nMappedToolBoxWidth);
+
+ // Make controls that display text handle short widths more
+ // graceful.
+ Layouter::PrepareForLayouting(*mpFTWidth);
+ Layouter::PrepareForLayouting(*mpFTColor);
+ Layouter::PrepareForLayouting(*mpFTStyle);
+ Layouter::PrepareForLayouting(*mpFTTrancparency);
+ Layouter::PrepareForLayouting(*mpFTArrow);
+ Layouter::PrepareForLayouting(*mpFTEdgeStyle);
+ Layouter::PrepareForLayouting(*mpFTCapStyle);
}
@@ -982,6 +1033,14 @@ void LinePropertyPanel::EndLineWidthPopupMode (void)
+void LinePropertyPanel::Resize (void)
+{
+ maLayouter.Layout();
+}
+
+
+
+
void LinePropertyPanel::SetWidthIcon(int n)
{
if(n==0)
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hrc b/svx/source/sidebar/line/LinePropertyPanel.hrc
index 8f6d08d..f35b5c2 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hrc
+++ b/svx/source/sidebar/line/LinePropertyPanel.hrc
@@ -25,6 +25,10 @@
#define CUSTOM_W 74
#define CUSTOM_H POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + 12 + TEXT_CONTROL_SPACING_VERTICAL
+#define TOOLBOX_WIDTH 50
+#define TOOLBOX_HEIGHT 14
+#define LISTBOX_HEIGHT 99
+
#define FT_COLOR 1
#define TB_COLOR 2
#define FT_WIDTH 3
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index 6cc170b..bbbe27f 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -26,6 +26,7 @@
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/GridLayouter.hxx>
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <boost/scoped_ptr.hpp>
@@ -92,6 +93,8 @@ public:
void EndLineWidthPopupMode (void);
+ virtual void Resize (void);
+
private:
//ui controls
::boost::scoped_ptr< FixedText > mpFTWidth;
@@ -156,6 +159,8 @@ private:
bool mbColorAvailable : 1;
bool mbWidthValuable : 1;
+ ::sfx2::sidebar::GridLayouter maLayouter;
+
void SetupIcons(void);
void Initialize();
void FillLineEndList();
diff --git a/svx/source/sidebar/line/LinePropertyPanel.src b/svx/source/sidebar/line/LinePropertyPanel.src
index 5cfbbe6..dc8980a 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.src
+++ b/svx/source/sidebar/line/LinePropertyPanel.src
@@ -24,10 +24,6 @@
#include <svx/dialogs.hrc>
#include "helpid.hrc"
-#define TOOLBOX_WIDTH 50
-#define TOOLBOX_HEIGHT 14
-#define LISTBOX_HEIGHT 99
-
Control RID_SIDEBAR_LINE_PANEL
{
OutputSize = TRUE;
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 67af37b..7f136a4 100755
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -34,6 +34,7 @@
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <sfx2/sidebar/Tools.hxx>
#include <svx/sidebar/PopupContainer.hxx>
#include <sfx2/dispatch.hxx>
@@ -50,8 +51,10 @@
#include <sfx2/objsh.hxx>
#include <svtools/unitconv.hxx>
#include <boost/bind.hpp>
+
using namespace css;
using namespace cssu;
+using namespace ::sfx2::sidebar;
using ::sfx2::sidebar::Theme;
using ::sfx2::sidebar::ControlFactory;
@@ -111,6 +114,7 @@ namespace svx {namespace sidebar {
#define LINE_POINT3_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y2), MAP_APPFONT))
#define LINE_POINT4_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y2), MAP_APPFONT))
+
ParaPropertyPanel* ParaPropertyPanel::Create (
Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame,
@@ -357,10 +361,34 @@ void ParaPropertyPanel::ReSize(bool bSize)
SetSizePixel(aSize);
}
+ maLayouter.Layout();
+
if (mxSidebar.is())
mxSidebar->requestLayout();
}
+
+
+
+void ParaPropertyPanel::Resize (void)
+{
+ switch (maContext.GetCombinedContext_DI())
+ {
+ case CombinedEnumContext(Application_Calc, Context_DrawText):
+ case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
+ case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
+ ReSize(false);
+ break;
+
+ default:
+ ReSize(true);
+ break;
+ }
+}
+
+
+
+
void ParaPropertyPanel::EndSpacingPopupMode (void)
{
maLineSpacePopup.Hide();
@@ -1648,10 +1676,67 @@ ParaPropertyPanel::ParaPropertyPanel(Window* pParent,
maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
- mxSidebar(rxSidebar)
+ mxSidebar(rxSidebar),
+ maLayouter(*this)
{
initial();
FreeResource();
+
+ // Setup the grid layouter.
+ const sal_Int32 nMappedImageWidth (Layouter::MapWidth(*this, IMAGE_SIZE));
+ const sal_Int32 nMappedImageOffset (Layouter::MapWidth(*this, -3));
+ const sal_Int32 nMappedToolBoxItemWidth (Layouter::MapWidth(*this, TOOLBOX_ITEM_WIDTH));
+ const sal_Int32 nMappedControlWidth (Layouter::MapWidth(*this, CONTROL_WIDTH -10));
+
+ maLayouter.GetCell(0,0).SetControl(*mpFTUL).SetGridWidth(2);
+ maLayouter.GetCell(1,0).SetControl(*mpTbxUL_IncDecBackground).SetGridWidth(2).SetFixedWidth();
+
+ maLayouter.GetCell(0,3).SetControl(*mpFTIndent).SetGridWidth(2);
+ maLayouter.GetCell(1,3,0)
+ .SetControl(*mpTbxIndent_IncDecBackground)
+ .SetGridWidth(2).SetFixedWidth();
+ maLayouter.GetCell(1,3,1)
+ .SetControl(*mpTbxProDemoteBackground)
+ .SetGridWidth(2).SetFixedWidth();
+ maLayouter.GetCell(2,0).SetControl(maFISpace1).SetFixedWidth().SetOffset(nMappedImageOffset);
+ maLayouter.GetCell(2,1).SetControl(*mpTopDist);
+ maLayouter.GetCell(3,0).SetControl(maFISpace2).SetFixedWidth().SetOffset(nMappedImageOffset);
+ maLayouter.GetCell(3,1).SetControl(*mpBottomDist);
+ maLayouter.GetCell(4,0).SetControl(*mpLineSPTbxBackground).SetGridWidth(2).SetFixedWidth();
+
+ maLayouter.GetCell(2,3).SetControl(maFIndent1).SetFixedWidth().SetOffset(nMappedImageOffset);
+ maLayouter.GetCell(2,4).SetControl(*mpLeftIndent);
+ maLayouter.GetCell(3,3).SetControl(maFIndent2).SetFixedWidth().SetOffset(nMappedImageOffset);
+ maLayouter.GetCell(3,4).SetControl(*mpRightIndent);
+ maLayouter.GetCell(4,3).SetControl(maFIndent3).SetFixedWidth().SetOffset(nMappedImageOffset);
+ maLayouter.GetCell(4,4).SetControl(*mpFLineIndent);
+
+ maLayouter.GetColumn(0)
+ .SetWeight(0)
+ .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetFixedWidth(nMappedToolBoxItemWidth + nMappedImageOffset);
+ maLayouter.GetColumn(1)
+ .SetWeight(1)
+ .SetMinimumWidth(nMappedControlWidth);
+ maLayouter.GetColumn(2)
+ .SetWeight(0)
+ .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
+ maLayouter.GetColumn(3)
+ .SetWeight(0)
+ .SetFixedWidth(nMappedToolBoxItemWidth + nMappedImageOffset);
+ maLayouter.GetColumn(4)
+ .SetWeight(1)
+ .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetMinimumWidth(nMappedControlWidth);
+
+ // Make controls that display text handle short widths more
+ // graceful.
+ sfx2::sidebar::Layouter::PrepareForLayouting(*mpFTUL);
+ sfx2::sidebar::Layouter::PrepareForLayouting(*mpFTIndent);
+
+ if (mxSidebar.is())
+ mxSidebar->requestLayout();
+
}
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
index b66b0da..f581909 100755
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -25,6 +25,7 @@
#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/GridLayouter.hxx>
#include <editeng/lspcitem.hxx>
#include <svtools/ctrlbox.hxx>
#include <svx/tbxcolorupdate.hxx>
@@ -210,7 +211,7 @@ private:
ParaNumberingPopup maNumberingPopup;
ColorPopup maBGColorPopup;
cssu::Reference<css::ui::XSidebar> mxSidebar;
-
+ ::sfx2::sidebar::GridLayouter maLayouter;
ParaPropertyPanel (
Window* pParent,
@@ -248,6 +249,8 @@ private:
void initial();
void ReSize(bool bSize);
+ // Inherited from vcl Window.
+ virtual void Resize (void);
PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index de12d70..97b471a 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -22,6 +22,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include "PosSizePropertyPanel.hxx"
#include "PosSizePropertyPanel.hrc"
#include <svx/sidebar/SidebarDialControl.hxx>
@@ -44,6 +45,7 @@
using namespace css;
using namespace cssu;
+using ::sfx2::sidebar::Layouter;
using ::sfx2::sidebar::Theme;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
@@ -122,7 +124,8 @@ PosSizePropertyPanel::PosSizePropertyPanel(
mbAutoHeight(false),
mbAdjustEnabled(false),
mbIsFlip(false),
- mxSidebar(rxSidebar)
+ mxSidebar(rxSidebar),
+ maLayouter(*this)
{
Initialize();
FreeResource();
@@ -131,6 +134,47 @@ PosSizePropertyPanel::PosSizePropertyPanel(
mpBindings->Update( SID_ATTR_TRANSFORM_HEIGHT );
mpBindings->Update( SID_ATTR_TRANSFORM_PROTECT_SIZE );
mpBindings->Update( SID_ATTR_METRIC );
+
+ // Setup the grid layouter.
+ const sal_Int32 nMappedMboxWidth (Layouter::MapWidth(*this, MBOX_WIDTH));
+
+ maLayouter.GetCell(0,0).SetControl(*mpFtPosX);
+ maLayouter.GetCell(1,0).SetControl(*mpMtrPosX);
+
+ maLayouter.GetCell(0,2).SetControl(*mpFtPosY);
+ maLayouter.GetCell(1,2).SetControl(*mpMtrPosY);
+
+ maLayouter.GetCell(2,0).SetControl(*mpFtWidth);
+ maLayouter.GetCell(3,0).SetControl(*mpMtrWidth);
+
+ maLayouter.GetCell(2,2).SetControl(*mpFtHeight);
+ maLayouter.GetCell(3,2).SetControl(*mpMtrHeight);
+
+ maLayouter.GetCell(4,0).SetControl(*mpCbxScale).SetGridWidth(3);
+ maLayouter.GetCell(5,0).SetControl(*mpFtAngle).SetGridWidth(3);
+
+
+ maLayouter.GetColumn(0)
+ .SetWeight(1)
+ .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetMinimumWidth(nMappedMboxWidth);
+ maLayouter.GetColumn(1)
+ .SetWeight(0)
+ .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
+ maLayouter.GetColumn(2)
+ .SetWeight(1)
+ .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetMinimumWidth(nMappedMboxWidth);
+
+ // Make controls that display text handle short widths more
+ // graceful.
+ Layouter::PrepareForLayouting(*mpFtPosX);
+ Layouter::PrepareForLayouting(*mpFtPosY);
+ Layouter::PrepareForLayouting(*mpFtWidth);
+ Layouter::PrepareForLayouting(*mpFtHeight);
+ Layouter::PrepareForLayouting(*mpCbxScale);
+ Layouter::PrepareForLayouting(*mpFtAngle);
+
}
@@ -184,6 +228,15 @@ namespace
+
+void PosSizePropertyPanel::Resize (void)
+{
+ maLayouter.Layout();
+}
+
+
+
+
void PosSizePropertyPanel::Initialize()
{
mpFtPosX->SetBackground(Wallpaper());
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index a8baf42..1a5412e 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -26,6 +26,7 @@
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/GridLayouter.hxx>
#include <boost/scoped_ptr.hpp>
#include <svx/rectenum.hxx>
#include <svl/poolitem.hxx>
@@ -71,6 +72,8 @@ public:
SfxBindings* GetBindings();
void ShowMenu (void);
+ virtual void Resize (void);
+
private:
//Position
::boost::scoped_ptr< FixedText > mpFtPosX;
@@ -151,6 +154,7 @@ private:
bool mbIsFlip : 1;
cssu::Reference<css::ui::XSidebar> mxSidebar;
+ ::sfx2::sidebar::GridLayouter maLayouter;
DECL_LINK( ChangePosXHdl, void * );
DECL_LINK( ChangePosYHdl, void * );
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index e00f079..82577d7 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -45,6 +45,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/ControlFactory.hxx>
#include <sfx2/sidebar/ControllerFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/SidebarToolBox.hxx>
#include "sfx2/imagemgr.hxx"
@@ -65,11 +66,16 @@
using namespace css;
using namespace cssu;
+using namespace ::sfx2::sidebar;
using ::sfx2::sidebar::Theme;
using ::sfx2::sidebar::ControlFactory;
+using ::sfx2::sidebar::Layouter;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+
+
namespace svx { namespace sidebar {
#undef HAS_IA2
@@ -197,13 +203,31 @@ TextPropertyPanel::TextPropertyPanel (
maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
mxFrame(rxFrame),
maContext(),
- mpBindings(pBindings)
+ mpBindings(pBindings),
+ maLayouter(*this)
{
Initialize();
FreeResource();
UpdateFontColorToolbox(rContext);
+
+ // Setup the grid layouter.
+ maLayouter.GetCell(0,0).SetControl(*mpFontNameBox).SetMinimumWidth(Layouter::MapWidth(*this,FONTNAME_WIDTH));
+ maLayouter.GetCell(0,2).SetControl(maFontSizeBox).SetFixedWidth();
+
+ maLayouter.GetCell(1,0).SetControl(*mpToolBoxFontBackground).SetFixedWidth();
+ maLayouter.GetCell(1,2).SetControl(*mpToolBoxIncDecBackground).SetFixedWidth();
+
+ maLayouter.GetColumn(0)
+ .SetWeight(1)
+ .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
+ maLayouter.GetColumn(1)
+ .SetWeight(0)
+ .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
+ maLayouter.GetColumn(2)
+ .SetWeight(0)
+ .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
}
@@ -1169,6 +1193,14 @@ void TextPropertyPanel::NotifyItemUpdate (
+void TextPropertyPanel::Resize (void)
+{
+ maLayouter.Layout();
+}
+
+
+
+
void TextPropertyPanel::UpdateItem (const sal_uInt16 nSlotId)
{
switch (nSlotId)
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hrc b/svx/source/sidebar/text/TextPropertyPanel.hrc
index f6ca48c..e07f6dd 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hrc
+++ b/svx/source/sidebar/text/TextPropertyPanel.hrc
@@ -28,6 +28,32 @@
#define CUSTOM_Y OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT
#define VS_UNDERLINE_WIDTH 57
#define VS_UNDERLINE_HEIGHT 12 * 10
+
+#define CONTROL_HEIGHT_FONT_NAME 250
+#define CONTROL_HEIGHT_FONT_SIZE 180
+#define FONTSIZE_WIDTH (TOOLBOX_ITEM_WIDTH * 2 - 1)
+#define FONTNAME_WIDTH (TOOLBOX_ITEM_WIDTH * 4)
+//PROPERTYPAGE_WIDTH - (FONTSIZE_WIDTH) - 6)
+
+#define TB_SPACE 18
+#define TB_SPACE_V 4
+#define TEXT_WIDTH TOOLBOX_42_42_ITEM_DD_WIDTH + TB_SPACE - 3
+
+#define FT_TB_SPACE 1
+#define BK_IMG 20
+
+#define X0 SECTIONPAGE_MARGIN_HORIZONTAL
+#define X1 SECTIONPAGE_MARGIN_HORIZONTAL + 1 + TOOLBOX_ITEM_WIDTH * 2 + 4
+#define X2 (PROPERTYPAGE_WIDTH - (FONTSIZE_WIDTH))
+#define X3 (X2 - (TOOLBOX_ITEM_DD_WIDTH) - 2)
+
+#define FIRST_LINE_Y SECTIONPAGE_MARGIN_VERTICAL_TOP
+#define SECOND_LINE_Y FIRST_LINE_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1
+#define THIRD_LINE_Y SECOND_LINE_Y + CONTROL_SPACING_VERTICAL + (TOOLBOX_ITEM_HEIGHT + 2)
+
+
+
+
//#define FT_TEST 1
#define CB_SBFONT_FONT 2
#define MB_SBFONT_FONTSIZE 3
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index 40c0aae..a985562 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -27,6 +27,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/EnumContext.hxx>
+#include <sfx2/sidebar/GridLayouter.hxx>
#include <svtools/ctrlbox.hxx>
#include <svx/tbxcolorupdate.hxx>
@@ -85,6 +86,9 @@ public:
const SfxPoolItem* pState,
const bool bIsEnabled);
+ // Inherited from vcl Window.
+ virtual void Resize (void);
+
private:
//ui controls
::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
@@ -148,6 +152,7 @@ private:
cssu::Reference<css::frame::XFrame> mxFrame;
::sfx2::sidebar::EnumContext maContext;
SfxBindings* mpBindings;
+ ::sfx2::sidebar::GridLayouter maLayouter;
TextPropertyPanel (
Window* pParent,
diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src
index d860d65..71940cb 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.src
+++ b/svx/source/sidebar/text/TextPropertyPanel.src
@@ -23,28 +23,6 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include "helpid.hrc"
-#define CONTROL_HEIGHT_FONT_NAME 250
-#define CONTROL_HEIGHT_FONT_SIZE 180
-#define FONTSIZE_WIDTH (TOOLBOX_ITEM_WIDTH * 2 - 1)
-#define FONTNAME_WIDTH (PROPERTYPAGE_WIDTH - (FONTSIZE_WIDTH) - 6)
-
-#define TB_SPACE 18
-#define TB_SPACE_V 4
-#define TEXT_WIDTH TOOLBOX_42_42_ITEM_DD_WIDTH + TB_SPACE - 3
-
-#define FT_TB_SPACE 1
-#define BK_IMG 20
-
-#define X0 SECTIONPAGE_MARGIN_HORIZONTAL
-#define X1 SECTIONPAGE_MARGIN_HORIZONTAL + 1 + TOOLBOX_ITEM_WIDTH * 2 + 4
-#define X2 (PROPERTYPAGE_WIDTH - (FONTSIZE_WIDTH))
-#define X3 (X2 - (TOOLBOX_ITEM_DD_WIDTH) - 2)
-
-#define FIRST_LINE_Y SECTIONPAGE_MARGIN_VERTICAL_TOP
-#define SECOND_LINE_Y FIRST_LINE_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1
-#define THIRD_LINE_Y SECOND_LINE_Y + CONTROL_SPACING_VERTICAL + (TOOLBOX_ITEM_HEIGHT + 2)
-
-
Control RID_SIDEBAR_TEXT_PANEL
{
OutputSize = TRUE;
diff --git a/sw/source/ui/sidebar/PagePropertyPanel.cxx b/sw/source/ui/sidebar/PagePropertyPanel.cxx
index d3822d3..4cbe7f2 100644
--- a/sw/source/ui/sidebar/PagePropertyPanel.cxx
+++ b/sw/source/ui/sidebar/PagePropertyPanel.cxx
@@ -44,6 +44,8 @@
#include <svx/rulritem.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Layouter.hxx>
+#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewsh.hxx>
@@ -55,6 +57,8 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+using namespace ::sfx2::sidebar;
+
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
#define SetFldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
@@ -199,13 +203,53 @@ PagePropertyPanel::PagePropertyPanel(
, mxUndoManager( getUndoManager( rxFrame ) )
- , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false )
+ , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false ),
+ maLayouter(*this)
{
Initialize();
mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify = true;
FreeResource();
+
+ // Setup the grid layouter.
+ maLayouter.GetCell(0,0).SetControl(maFtOrientation).SetGridWidth(2);
+ maLayouter.GetCell(1,0).SetControl(*mpToolBoxOrientationBackground).SetFixedWidth();
+
+ maLayouter.GetCell(0,3).SetControl(maFtMargin).SetGridWidth(2);
+ maLayouter.GetCell(1,3).SetControl(*mpToolBoxMarginBackground).SetFixedWidth();
+
+ maLayouter.GetCell(2,0).SetControl(maFtSize).SetGridWidth(2);
+ maLayouter.GetCell(3,0).SetControl(*mpToolBoxSizeBackground).SetFixedWidth();
+
+ maLayouter.GetCell(2,3).SetControl(maFtColumn).SetGridWidth(2);
+ maLayouter.GetCell(3,3).SetControl(*mpToolBoxColumnBackground).SetFixedWidth();
+
+ maLayouter.GetColumn(0)
+ .SetWeight(0)
+ .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL));
+ maLayouter.GetColumn(1)
+ .SetWeight(1)
+ .SetMinimumWidth(Layouter::MapWidth(*this,MBOX_WIDTH/2));
+ maLayouter.GetColumn(2)
+ .SetWeight(0)
+ .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
+ maLayouter.GetColumn(3)
+ .SetWeight(0);
+ maLayouter.GetColumn(4)
+ .SetWeight(1)
+ .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
+ .SetMinimumWidth(Layouter::MapWidth(*this,MBOX_WIDTH/2));
+
+ // Make controls that display text handle short widths more
+ // graceful.
+ Layouter::PrepareForLayouting(maFtOrientation);
+ Layouter::PrepareForLayouting(maFtMargin);
+ Layouter::PrepareForLayouting(maFtSize);
+ Layouter::PrepareForLayouting(maFtColumn);
}
+
+
+
PagePropertyPanel::~PagePropertyPanel()
{
delete[] maImgSize;
@@ -803,4 +847,16 @@ void PagePropertyPanel::EndUndo()
}
}
+
+
+
+void PagePropertyPanel::Resize (void)
+{
+ maLayouter.Layout();
+}
+
+
+
+
+
} } // end of namespace ::sw::sidebar
diff --git a/sw/source/ui/sidebar/PagePropertyPanel.hxx b/sw/source/ui/sidebar/PagePropertyPanel.hxx
index 3a0b66b..61543ec 100644
--- a/sw/source/ui/sidebar/PagePropertyPanel.hxx
+++ b/sw/source/ui/sidebar/PagePropertyPanel.hxx
@@ -28,6 +28,7 @@
#include <svx/sidebar/Popup.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/GridLayouter.hxx>
namespace svx { namespace sidebar {
class PopupControl;
@@ -103,6 +104,9 @@ namespace sw { namespace sidebar {
void StartUndo();
void EndUndo();
+ // Inherited from vcl Window.
+ virtual void Resize (void);
+
private:
PagePropertyPanel(
Window* pParent,
@@ -211,6 +215,7 @@ namespace sw { namespace sidebar {
const cssu::Reference< css::document::XUndoManager > mxUndoManager;
bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify;
+ ::sfx2::sidebar::GridLayouter maLayouter;
// handler for popup toolboxes to show the popups
DECL_LINK(ClickOrientationHdl, ToolBox* );
More information about the Libreoffice-commits
mailing list