openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1499949 - in /openoffice/trunk/main: sc/source/ui/sidebar/ sfx2/ sfx2/inc/sfx2/sidebar/ sfx2/source/sidebar/ svx/source/sidebar/area/ svx/source/sidebar/graphic/ svx/source/sidebar/line/ svx/source/sidebar/paragraph/ svx/source/sidebar/pos...
Date Fri, 05 Jul 2013 08:53:12 GMT
Author: af
Date: Fri Jul  5 08:53:11 2013
New Revision: 1499949

URL: http://svn.apache.org/r1499949
Log:
122635: Add layouting to some sidebar panels.

Added:
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/GridLayouter.hxx
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/Layouter.hxx
    openoffice/trunk/main/sfx2/source/sidebar/GridLayouter.cxx
    openoffice/trunk/main/sfx2/source/sidebar/Layouter.cxx
Modified:
    openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
    openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
    openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
    openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
    openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
    openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
    openoffice/trunk/main/sfx2/Library_sfx.mk
    openoffice/trunk/main/sfx2/Package_inc.mk
    openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
    openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hrc
    openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.src
    openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx
    openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src
    openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.cxx
    openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.hxx

Modified: openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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::AlignmentPropert
 
     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::UpdateVerAl
 	}
 }
 
-//////////////////////////////////////////////////////////////////////////////
-// 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

Modified: openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx (original)
+++ openoffice/trunk/main/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -61,6 +61,8 @@ public:
 
     SfxBindings* GetBindings();
 
+    virtual void Resize (void);
+
 private:
     //ui controls
 	::boost::scoped_ptr<Window> 			    mpTBHorizontalBackground;

Modified: openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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::CellAppeara
 {
     Initialize();
     FreeResource();
+
+    Layouter::PrepareForLayouting(*mpFTFillColor);
+    Layouter::PrepareForLayouting(*mpFTCellBorder);
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -873,8 +879,18 @@ void CellAppearancePropertyPanel::Update
 	}
 }
 
-//////////////////////////////////////////////////////////////////////////////
-// 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
 

Modified: openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx (original)
+++ openoffice/trunk/main/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -69,6 +69,8 @@ public:
 
     SfxBindings* GetBindings();
 
+    virtual void Resize (void);
+
 private:
     //ui controls
     ::boost::scoped_ptr< FixedText >        mpFTFillColor;

Modified: openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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::NumberFormatP
 {
     Initialize();
     FreeResource();
+
+    Layouter::PrepareForLayouting(*mpFtCategory);
+    Layouter::PrepareForLayouting(*mpFtDecimals);
+    Layouter::PrepareForLayouting(*mpFtLeadZeroes);
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -393,8 +399,17 @@ SfxBindings* NumberFormatPropertyPanel::
     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
 

Modified: openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx (original)
+++ openoffice/trunk/main/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -58,6 +58,8 @@ public:
 
     SfxBindings* GetBindings();
 
+    virtual void Resize (void);
+
 private:
     //ui controls
     ::boost::scoped_ptr< FixedText >        mpFtCategory;

Modified: openoffice/trunk/main/sfx2/Library_sfx.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/Library_sfx.mk?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/Library_sfx.mk (original)
+++ openoffice/trunk/main/sfx2/Library_sfx.mk Fri Jul  5 08:53:11 2013
@@ -237,9 +237,11 @@ $(eval $(call gb_Library_add_exception_o
 	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 \

Modified: openoffice/trunk/main/sfx2/Package_inc.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/Package_inc.mk?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/Package_inc.mk (original)
+++ openoffice/trunk/main/sfx2/Package_inc.mk Fri Jul  5 08:53:11 2013
@@ -136,8 +136,10 @@ $(eval $(call gb_Package_add_file,sfx2_i
 $(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))

Added: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/GridLayouter.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/GridLayouter.hxx?rev=1499949&view=auto
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/GridLayouter.hxx (added)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/GridLayouter.hxx Fri Jul  5 08:53:11 2013
@@ -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

Added: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/Layouter.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/Layouter.hxx?rev=1499949&view=auto
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/Layouter.hxx (added)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/Layouter.hxx Fri Jul  5 08:53:11 2013
@@ -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

Modified: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx Fri Jul  5 08:53:11 2013
@@ -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,

Added: openoffice/trunk/main/sfx2/source/sidebar/GridLayouter.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/GridLayouter.cxx?rev=1499949&view=auto
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/GridLayouter.cxx (added)
+++ openoffice/trunk/main/sfx2/source/sidebar/GridLayouter.cxx Fri Jul  5 08:53:11 2013
@@ -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

Added: openoffice/trunk/main/sfx2/source/sidebar/Layouter.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/Layouter.cxx?rev=1499949&view=auto
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/Layouter.cxx (added)
+++ openoffice/trunk/main/sfx2/source/sidebar/Layouter.cxx Fri Jul  5 08:53:11 2013
@@ -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

Modified: openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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, SelectFill
                 mpLbFillType->Selected();
             }
         }
+
+        maLayouter.Layout();
     }
 
     return 0;
@@ -1109,6 +1144,8 @@ void AreaPropertyPanel::NotifyItemUpdate
             break;
         }
     }
+
+    maLayouter.Layout();
 }
 
 
@@ -1439,6 +1476,16 @@ sal_Int32 AreaPropertyPanel::GetSelected
     return mpLBTransType->GetSelectEntryPos();
 }
 
+
+
+
+void AreaPropertyPanel::Resize (void)
+{
+    maLayouter.Layout();
+}
+
+
+
 } } // end of namespace svx::sidebar
 
 // eof

Modified: openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/area/AreaPropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -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*);

Modified: openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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::GraphicPropertyPan
     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::NotifyItemUpd
 
 
 
-//////////////////////////////////////////////////////////////////////////////
-
 SfxBindings* GraphicPropertyPanel::GetBindings() 
 { 
     return mpBindings; 
 }
 
-//////////////////////////////////////////////////////////////////////////////
-// namespace close
 
-}} // end of namespace ::svx::sidebar
 
-//////////////////////////////////////////////////////////////////////////////
-// eof
+
+void GraphicPropertyPanel::Resize (void)
+{
+    maLayouter.Layout();
+}
+
+
+
+}} // end of namespace ::svx::sidebar

Modified: openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -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,7 +101,8 @@ private:
 
     cssu::Reference<css::frame::XFrame>                 mxFrame;
     SfxBindings*                                        mpBindings;
-
+    ::sfx2::sidebar::GridLayouter maLayouter;
+    
     DECL_LINK( ModifyBrightnessHdl, void * );
     DECL_LINK( ModifyContrastHdl, void * );
     DECL_LINK( ModifyTransHdl, void * );

Modified: openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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::EndLineWidthPopu
 
 
 
+void LinePropertyPanel::Resize (void)
+{
+    maLayouter.Layout();
+}
+
+
+
+
 void LinePropertyPanel::SetWidthIcon(int n)
 {
     if(n==0)

Modified: openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hrc
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hrc?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hrc (original)
+++ openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hrc Fri Jul  5 08:53:11 2013
@@ -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

Modified: openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -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();

Modified: openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.src
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.src?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.src (original)
+++ openoffice/trunk/main/svx/source/sidebar/line/LinePropertyPanel.src Fri Jul  5 08:53:11 2013
@@ -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;

Modified: openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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,
@@ -311,7 +315,7 @@ void ParaPropertyPanel::ReSize(bool bSiz
 		mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST);
 		//Indent
 		mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT);
-		mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
+        mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
 		mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
 		mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST);
 		mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST);
@@ -338,7 +342,7 @@ void ParaPropertyPanel::ReSize(bool bSiz
 		mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST2);
 		//Indent
 		mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT2);
-		mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
+        mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
 		mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
 		mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2);
 		mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2);
@@ -357,10 +361,34 @@ void ParaPropertyPanel::ReSize(bool bSiz
 		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(Win
       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

Modified: openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -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);

Modified: openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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::PosSizePropertyPan
     mbAutoHeight(false),
     mbAdjustEnabled(false),
     mbIsFlip(false),
-    mxSidebar(rxSidebar)
+    mxSidebar(rxSidebar),
+    maLayouter(*this)
 {
     Initialize();
     FreeResource();
@@ -131,6 +134,47 @@ PosSizePropertyPanel::PosSizePropertyPan
     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());

Modified: openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -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 * );

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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)

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hrc Fri Jul  5 08:53:11 2013
@@ -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

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -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,7 +152,8 @@ private:
     cssu::Reference<css::frame::XFrame> mxFrame;
     ::sfx2::sidebar::EnumContext maContext;
     SfxBindings* mpBindings;
-        
+    ::sfx2::sidebar::GridLayouter maLayouter;
+
     TextPropertyPanel (
         Window* pParent,
         const cssu::Reference<css::frame::XFrame>& rxFrame,

Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src Fri Jul  5 08:53:11 2013
@@ -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;

Modified: openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.cxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.cxx Fri Jul  5 08:53:11 2013
@@ -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

Modified: openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.hxx?rev=1499949&r1=1499948&r2=1499949&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.hxx (original)
+++ openoffice/trunk/main/sw/source/ui/sidebar/PagePropertyPanel.hxx Fri Jul  5 08:53:11 2013
@@ -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* );



Mime
View raw message