diff options
28 files changed, 29 insertions, 1521 deletions
diff --git a/include/sfx2/sidebar/GridLayouter.hxx b/include/sfx2/sidebar/GridLayouter.hxx deleted file mode 100644 index 1bd3c85761d1..000000000000 --- a/include/sfx2/sidebar/GridLayouter.hxx +++ /dev/null @@ -1,203 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ -#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/include/sfx2/sidebar/Layouter.hxx b/include/sfx2/sidebar/Layouter.hxx deleted file mode 100644 index ba2943d73f3c..000000000000 --- a/include/sfx2/sidebar/Layouter.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ -#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/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx index b37c65c63ee2..ec63cc370909 100644 --- a/include/sfx2/sidebar/SidebarToolBox.hxx +++ b/include/sfx2/sidebar/SidebarToolBox.hxx @@ -103,10 +103,6 @@ private: DECL_LINK(ActivateToolBox, ToolBox*); DECL_LINK(DeactivateToolBox, 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/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index 99ecfb4e0bc7..d20a9060d77a 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -19,7 +19,6 @@ #include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ControlFactory.hxx> -#include <sfx2/sidebar/Layouter.hxx> #include <AlignmentPropertyPanel.hxx> #include <editeng/justifyitem.hxx> #include <svx/dialmgr.hxx> @@ -34,7 +33,6 @@ using namespace css; using namespace cssu; -using ::sfx2::sidebar::Layouter; using ::sfx2::sidebar::ControlFactory; const char UNO_ALIGNBLOCK[] = ".uno:AlignBlock"; @@ -88,13 +86,6 @@ AlignmentPropertyPanel::AlignmentPropertyPanel( mpFTLeftIndent->SetBackground(Wallpaper()); mpFtRotate->SetBackground(Wallpaper()); - - Layouter::PrepareForLayouting(*mpFTLeftIndent); - Layouter::PrepareForLayouting(*mpFtRotate); - Layouter::PrepareForLayouting(*mpCBXWrapText); - Layouter::PrepareForLayouting(*mpCBXMergeCell); - Layouter::PrepareForLayouting(*mpCbStacked); - } ////////////////////////////////////////////////////////////////////////////// @@ -620,17 +611,10 @@ void AlignmentPropertyPanel::UpdateVerAlign() } } - - - -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); -} - +////////////////////////////////////////////////////////////////////////////// +// namespace close }} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx index 4a90a87e2a98..476633e4cff9 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx @@ -58,8 +58,6 @@ public: SfxBindings* GetBindings(); - virtual void Resize (void); - private: //ui controls ToolBox* mpTBHorizontal; diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index fcf526424bfe..332b72d884c4 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -19,7 +19,6 @@ #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" @@ -45,8 +44,6 @@ using namespace css; using namespace cssu; -using ::sfx2::sidebar::Layouter; - const char UNO_BACKGROUNDCOLOR[] = ".uno:BackgroundColor"; const char UNO_SETBORDERSTYLE[] = ".uno:SetBorderStyle"; @@ -832,18 +829,8 @@ void CellAppearancePropertyPanel::UpdateControlState() } } - - - -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); -} - - +////////////////////////////////////////////////////////////////////////////// +// namespace close }} // end of namespace ::sc::sidebar diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx index a8dabba2bb2d..5791ba7ec7b9 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx @@ -66,8 +66,6 @@ public: SfxBindings* GetBindings(); - virtual void Resize (void); - private: //ui controls diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index de9c728442aa..7e9983ad8fec 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -18,7 +18,6 @@ #include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/Theme.hxx> -#include <sfx2/sidebar/Layouter.hxx> #include <sfx2/sidebar/ControlFactory.hxx> #include <NumberFormatPropertyPanel.hxx> #include "sc.hrc" @@ -35,7 +34,6 @@ using namespace css; using namespace cssu; -using ::sfx2::sidebar::Layouter; using ::sfx2::sidebar::Theme; const char UNO_NUMERICFIELD[] = ".uno:NumericField"; @@ -353,17 +351,8 @@ SfxBindings* NumberFormatPropertyPanel::GetBindings() return mpBindings; } - - - -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); -} +////////////////////////////////////////////////////////////////////////////// +// namespace close }} // end of namespace ::sc::sidebar diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx index 01bc074ae14b..6bc898f462b9 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx @@ -55,8 +55,6 @@ public: SfxBindings* GetBindings(); - virtual void Resize (void); - private: //ui controls ListBox* mpLbCategory; diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index c18230abe3c6..161a6f736698 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -252,11 +252,9 @@ $(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/source/sidebar/GridLayouter.cxx b/sfx2/source/sidebar/GridLayouter.cxx deleted file mode 100644 index 493a654247e6..000000000000 --- a/sfx2/source/sidebar/GridLayouter.cxx +++ /dev/null @@ -1,724 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ -#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 deleted file mode 100644 index 8f9bc36d61bc..000000000000 --- a/sfx2/source/sidebar/Layouter.cxx +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ -#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 fbdce4833c5f..c08963156c8f 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -21,7 +21,6 @@ #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> @@ -44,7 +43,6 @@ using namespace css; using namespace cssu; -using ::sfx2::sidebar::Layouter; using ::sfx2::sidebar::Theme; #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) @@ -121,41 +119,10 @@ AreaPropertyPanel::AreaPropertyPanel( mpTransparanceItem(), mxFrame(rxFrame), mpBindings(pBindings), - mbColorAvail(true), - maLayouter(*this) + mbColorAvail(true) { 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); } @@ -445,8 +412,6 @@ IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) mpLbFillType->Selected(); } } - - maLayouter.Layout(); } return 0; @@ -1132,8 +1097,6 @@ void AreaPropertyPanel::NotifyItemUpdate( break; } } - - maLayouter.Layout(); } @@ -1464,16 +1427,6 @@ 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 55284a6f1b3d..caf005a8fd27 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.hxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -23,7 +23,6 @@ #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> @@ -82,8 +81,6 @@ public: void SetGradient (const XGradient& rGradient); sal_Int32 GetSelectedTransparencyTypeIndex (void) const; - virtual void Resize (void); - private: sal_uInt16 meLastXFS; Color maLastColor; @@ -155,8 +152,6 @@ 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 25207dc029ae..04bdbf5d6add 100644 --- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx @@ -18,7 +18,6 @@ #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> @@ -32,13 +31,12 @@ 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 { @@ -76,58 +74,10 @@ GraphicPropertyPanel::GraphicPropertyPanel( maImgBlue(this, SVX_RES(IMG_BLUE)), maImgGamma(this, SVX_RES(IMG_GAMMA)), mxFrame(rxFrame), - mpBindings(pBindings), - maLayouter(*this) + mpBindings(pBindings) { 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); } ////////////////////////////////////////////////////////////////////////////// @@ -532,19 +482,17 @@ void GraphicPropertyPanel::NotifyItemUpdate( +////////////////////////////////////////////////////////////////////////////// + SfxBindings* GraphicPropertyPanel::GetBindings() { return mpBindings; } - - - -void GraphicPropertyPanel::Resize (void) -{ - maLayouter.Layout(); -} - - +////////////////////////////////////////////////////////////////////////////// +// namespace close }} // end of namespace ::svx::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx index bca9b9cdddb6..d5e0c093c9c8 100644 --- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx @@ -21,7 +21,6 @@ #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> @@ -54,8 +53,6 @@ public: SfxBindings* GetBindings(); - virtual void Resize (void); - private: //ui controls ::boost::scoped_ptr< FixedText > mpFtBrightness; @@ -97,7 +94,6 @@ 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 4b2b85218c00..1330f4636fb9 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -18,7 +18,6 @@ #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> @@ -56,10 +55,8 @@ using namespace css; using namespace cssu; -using ::sfx2::sidebar::Layouter; using ::sfx2::sidebar::Theme; - #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) namespace { @@ -204,58 +201,10 @@ LinePropertyPanel::LinePropertyPanel( mxFrame(rxFrame), mpBindings(pBindings), mbColorAvailable(true), - mbWidthValuable(true), - maLayouter(*this) + mbWidthValuable(true) { 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); } @@ -992,14 +941,6 @@ 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 1d0812143d02..13c446e4372b 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hrc +++ b/svx/source/sidebar/line/LinePropertyPanel.hrc @@ -21,10 +21,6 @@ #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 31f43c7583d6..b2f97bd1c067 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hxx +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -22,7 +22,6 @@ #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> @@ -88,8 +87,6 @@ public: void EndLineWidthPopupMode (void); - virtual void Resize (void); - private: //ui controls ::boost::scoped_ptr< FixedText > mpFTWidth; @@ -153,8 +150,6 @@ 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 075c0c62cb02..e90495877675 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.src +++ b/svx/source/sidebar/line/LinePropertyPanel.src @@ -20,6 +20,10 @@ #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 4bf82278efc1..83e2a609a9ba 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -29,7 +29,6 @@ #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> @@ -46,10 +45,8 @@ #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; @@ -247,28 +244,6 @@ void ParaPropertyPanel::ReSize(bool /* bSize */) 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(); @@ -1538,8 +1513,7 @@ 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), - maLayouter(*this) + mxSidebar(rxSidebar) { //Alignment get(mpAlignToolBox, "horizontalalignment"); diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx index 559d93ab5f77..054485046037 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -21,7 +21,6 @@ #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/sidebar/PanelLayout.hxx> @@ -186,7 +185,7 @@ private: ParaNumberingPopup maNumberingPopup; ColorPopup maBGColorPopup; cssu::Reference<css::ui::XSidebar> mxSidebar; - ::sfx2::sidebar::GridLayouter maLayouter; + ParaPropertyPanel ( Window* pParent, @@ -224,8 +223,6 @@ 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 c4a0dc1ec339..20879f1b3d0e 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -18,7 +18,6 @@ #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> @@ -41,7 +40,6 @@ using namespace css; using namespace cssu; -using ::sfx2::sidebar::Layouter; using ::sfx2::sidebar::Theme; #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) @@ -118,8 +116,7 @@ PosSizePropertyPanel::PosSizePropertyPanel( mbAutoHeight(false), mbAdjustEnabled(false), mbIsFlip(false), - mxSidebar(rxSidebar), - maLayouter(*this) + mxSidebar(rxSidebar) { Initialize(); FreeResource(); @@ -128,47 +125,6 @@ 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); - } @@ -222,15 +178,6 @@ 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 cb030752eef2..29d9289542cb 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -22,7 +22,6 @@ #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> @@ -68,8 +67,6 @@ public: SfxBindings* GetBindings(); void ShowMenu (void); - virtual void Resize (void); - private: //Position ::boost::scoped_ptr< FixedText > mpFtPosX; @@ -150,7 +147,6 @@ 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 3b36f9009c71..68382b14acd9 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -40,7 +40,6 @@ #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" @@ -61,10 +60,8 @@ using namespace css; using namespace cssu; -using namespace ::sfx2::sidebar; using ::sfx2::sidebar::Theme; using ::sfx2::sidebar::ControlFactory; -using ::sfx2::sidebar::Layouter; const char UNO_BACKCOLOR[] = ".uno:BackColor"; const char UNO_BOLD[] = ".uno:Bold"; @@ -82,9 +79,6 @@ const char UNO_UNDERLINE[] = ".uno:Underline"; #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) - - - namespace svx { namespace sidebar { #undef HAS_IA2 @@ -159,8 +153,7 @@ TextPropertyPanel::TextPropertyPanel ( Window* pParent, const cssu::Reference<cs maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), maContext(), - mpBindings(pBindings), - maLayouter(*this) + mpBindings(pBindings) { get(mpFontNameBox, "font"); get(mpFontSizeBox, "fontsize"); @@ -173,23 +166,6 @@ TextPropertyPanel::TextPropertyPanel ( Window* pParent, const cssu::Reference<cs Initialize(); 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)); } @@ -1115,14 +1091,6 @@ 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.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index 92d0b4e3a408..342b9a970c5b 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -23,7 +23,6 @@ #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> @@ -83,9 +82,6 @@ public: const SfxPoolItem* pState, const bool bIsEnabled); - // Inherited from vcl Window. - virtual void Resize (void); - private: //ui controls SvxSBFontNameBox* mpFontNameBox; @@ -135,7 +131,6 @@ private: ::sfx2::sidebar::EnumContext maContext; SfxBindings* mpBindings; - ::sfx2::sidebar::GridLayouter maLayouter; TextPropertyPanel ( Window* pParent, diff --git a/sw/source/ui/sidebar/PagePropertyPanel.cxx b/sw/source/ui/sidebar/PagePropertyPanel.cxx index d66920ab8c7b..5c14cf92409e 100644 --- a/sw/source/ui/sidebar/PagePropertyPanel.cxx +++ b/sw/source/ui/sidebar/PagePropertyPanel.cxx @@ -38,8 +38,6 @@ #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> @@ -56,8 +54,6 @@ const char UNO_MARGIN[] = ".uno:Margin"; const char UNO_SIZE[] = ".uno:Size"; const char UNO_COLUMN[] = ".uno:Column"; -using namespace ::sfx2::sidebar; - #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) namespace { @@ -188,8 +184,7 @@ PagePropertyPanel::PagePropertyPanel( , mxUndoManager( getUndoManager( rxFrame ) ) - , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false ), - maLayouter(*this) + , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false ) { // visible controls get(mpToolBoxOrientation, "selectorientation"); @@ -201,9 +196,6 @@ PagePropertyPanel::PagePropertyPanel( mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify = true; } - - - PagePropertyPanel::~PagePropertyPanel() { delete[] maImgSize; @@ -777,16 +769,4 @@ 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 db4487fda329..c1f34af84756 100644 --- a/sw/source/ui/sidebar/PagePropertyPanel.hxx +++ b/sw/source/ui/sidebar/PagePropertyPanel.hxx @@ -25,7 +25,6 @@ #include <svx/sidebar/PanelLayout.hxx> #include <sfx2/sidebar/ControllerItem.hxx> -#include <sfx2/sidebar/GridLayouter.hxx> namespace svx { namespace sidebar { class PopupControl; @@ -101,9 +100,6 @@ namespace sw { namespace sidebar { void StartUndo(); void EndUndo(); - // Inherited from vcl Window. - virtual void Resize (void); - private: PagePropertyPanel( Window* pParent, @@ -204,7 +200,6 @@ 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* ); |