[Libreoffice-commits] .: 4 commits - dbaccess/source editeng/source sfx2/source svtools/inc svtools/source svx/inc svx/source sw/source toolkit/source vcl/generic vcl/inc vcl/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 14 08:04:42 PST 2013


 dbaccess/source/ui/control/FieldDescControl.cxx       |    2 
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx |    2 
 dbaccess/source/ui/tabledesign/TEditControl.cxx       |    2 
 editeng/source/editeng/impedit.hxx                    |    4 
 editeng/source/editeng/impedit2.cxx                   |    2 
 editeng/source/editeng/impedit3.cxx                   |  101 +++++++-----------
 sfx2/source/appl/appserv.cxx                          |    6 -
 sfx2/source/dialog/printopt.cxx                       |    4 
 svtools/inc/svtools/toolpanel/paneltabbar.hxx         |    2 
 svtools/inc/svtools/treelistbox.hxx                   |    2 
 svtools/source/contnr/treelistbox.cxx                 |   22 ---
 svtools/source/dialogs/PlaceEditDialog.cxx            |    2 
 svtools/source/toolpanel/paneltabbar.cxx              |    4 
 svtools/source/toolpanel/tabbargeometry.cxx           |    4 
 svtools/source/toolpanel/tabbargeometry.hxx           |    2 
 svtools/source/toolpanel/tablayouter.cxx              |   12 --
 svx/inc/svx/fntctrl.hxx                               |    2 
 svx/inc/svx/pagectrl.hxx                              |    2 
 svx/inc/svx/rubydialog.hxx                            |    2 
 svx/source/dialog/fntctrl.cxx                         |    5 
 svx/source/dialog/pagectrl.cxx                        |    8 -
 svx/source/dialog/rubydialog.cxx                      |    6 -
 sw/source/ui/dbui/dbtree.cxx                          |    6 -
 sw/source/ui/frmdlg/colex.cxx                         |    8 -
 sw/source/ui/inc/colex.hxx                            |    2 
 sw/source/ui/inc/dbtree.hxx                           |    2 
 sw/source/ui/inc/glossary.hxx                         |    2 
 sw/source/ui/inc/unotools.hxx                         |    2 
 sw/source/ui/misc/glossary.cxx                        |    6 -
 sw/source/ui/uiview/viewling.cxx                      |    2 
 sw/source/ui/utlui/unotools.cxx                       |    6 -
 toolkit/source/awt/vclxwindow.cxx                     |    2 
 vcl/generic/glyphs/gcach_layout.cxx                   |   14 ++
 vcl/inc/brdwin.hxx                                    |    2 
 vcl/inc/printdlg.hxx                                  |    2 
 vcl/inc/sallayout.hxx                                 |    3 
 vcl/inc/vcl/button.hxx                                |    6 -
 vcl/inc/vcl/combobox.hxx                              |    2 
 vcl/inc/vcl/ctrl.hxx                                  |    2 
 vcl/inc/vcl/dialog.hxx                                |    2 
 vcl/inc/vcl/edit.hxx                                  |    2 
 vcl/inc/vcl/fixed.hxx                                 |    6 -
 vcl/inc/vcl/layout.hxx                                |    4 
 vcl/inc/vcl/lstbox.hxx                                |    2 
 vcl/inc/vcl/msgbox.hxx                                |    2 
 vcl/inc/vcl/scrbar.hxx                                |    2 
 vcl/inc/vcl/spinfld.hxx                               |    2 
 vcl/inc/vcl/svapp.hxx                                 |    1 
 vcl/inc/vcl/tabctrl.hxx                               |    2 
 vcl/inc/vcl/tabpage.hxx                               |    2 
 vcl/inc/vcl/window.hxx                                |    9 -
 vcl/source/control/button.cxx                         |   28 +---
 vcl/source/control/combobox.cxx                       |    9 -
 vcl/source/control/ctrl.cxx                           |   16 --
 vcl/source/control/edit.cxx                           |    9 -
 vcl/source/control/fixed.cxx                          |   56 +++------
 vcl/source/control/lstbox.cxx                         |    9 -
 vcl/source/control/scrbar.cxx                         |    2 
 vcl/source/control/spinfld.cxx                        |    9 -
 vcl/source/control/tabctrl.cxx                        |    6 -
 vcl/source/gdi/sallayout.cxx                          |    2 
 vcl/source/window/brdwin.cxx                          |   12 --
 vcl/source/window/dialog.cxx                          |   32 ++++-
 vcl/source/window/layout.cxx                          |    4 
 vcl/source/window/msgbox.cxx                          |   11 -
 vcl/source/window/printdlg.cxx                        |    2 
 vcl/source/window/tabdlg.cxx                          |    4 
 vcl/source/window/tabpage.cxx                         |   11 -
 vcl/source/window/window2.cxx                         |    2 
 vcl/source/window/window3.cxx                         |   13 --
 vcl/unx/generic/window/salframe.cxx                   |   18 ---
 vcl/unx/gtk/window/gtkframe.cxx                       |   22 ---
 72 files changed, 225 insertions(+), 355 deletions(-)

New commits:
commit 0dd3b8b24364d31a00ef30b70dcc6fb63c5d96c9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 14 16:00:58 2013 +0000

    Resolves: fdo#58324 keep both halves of surrogate pairs if glyph isn't found
    
    Change-Id: I8fda443bb224a7a99b992611221a65e9869da8b9

diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index a8ddc49..a9f373e 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -299,6 +299,16 @@ static bool lcl_CharIsJoiner(sal_Unicode cChar)
     return ((cChar == 0x200C) || (cChar == 0x200D));
 }
 
+static bool needPreviousCode(sal_Unicode cChar)
+{
+    return lcl_CharIsJoiner(cChar) || U16_IS_LEAD(cChar);
+}
+
+static bool needNextCode(sal_Unicode cChar)
+{
+    return lcl_CharIsJoiner(cChar) || U16_IS_TRAIL(cChar);
+}
+
 //See https://bugs.freedesktop.org/show_bug.cgi?id=31016
 #define ARABIC_BANDAID
 
@@ -439,9 +449,9 @@ bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
                 if( nCharPos >= 0 )
                 {
                     rArgs.NeedFallback( nCharPos, bRightToLeft );
-                    if ( (nCharPos > 0) && lcl_CharIsJoiner(rArgs.mpStr[nCharPos-1]) )
+                    if ( (nCharPos > 0) && needPreviousCode(rArgs.mpStr[nCharPos-1]) )
                         rArgs.NeedFallback( nCharPos-1, bRightToLeft );
-                    else if ( (nCharPos + 1 < nEndRunPos) && lcl_CharIsJoiner(rArgs.mpStr[nCharPos+1]) )
+                    else if ( (nCharPos + 1 < nEndRunPos) && needNextCode(rArgs.mpStr[nCharPos+1]) )
                         rArgs.NeedFallback( nCharPos+1, bRightToLeft );
                 }
 
commit 830f44b1ca0e121d3e27a031054313e3f194ab1d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 14 10:40:11 2013 +0000

    we only ever want the preferred window size from GetOptimalSize
    
    so remove the MAX and MIN options and simplify the whole lot
    
    Change-Id: Iaaf350c37e01f7fce434af760bcddb9b7d7135ea

diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 2f9aa0d..aa4627b 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -470,7 +470,7 @@ sal_Int32 OFieldDescControl::GetMaxControlHeight() const
     {
         if ( ppAggregates[i] )
         {
-            const Size aTemp( ppAggregates[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) );
+            const Size aTemp(ppAggregates[i]->GetOptimalSize());
             if ( aTemp.Height() > aHeight.Height() )
                 aHeight.Height() = aTemp.Height();
         }
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 5544549..c0532dc 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -348,7 +348,7 @@ void OSelectionBrowseBox::Init()
 
     for (sal_Size i = 0; i < sizeof (pControls) / sizeof (pControls[0]); ++i)
     {
-        const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) );
+        const Size aTemp(pControls[i]->GetOptimalSize());
         if ( aTemp.Height() > aHeight.Height() )
             aHeight.Height() = aTemp.Height();
     }
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index e5fd251..6fd7c3e 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -295,7 +295,7 @@ void OTableEditorCtrl::InitCellController()
     const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell,pHelpTextCell};
     for(sal_Size i= 0; i < sizeof(pControls) / sizeof(pControls[0]);++i)
     {
-        const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) );
+        const Size aTemp(pControls[i]->GetOptimalSize());
         if ( aTemp.Height() > aHeight.Height() )
             aHeight.Height() = aTemp.Height();
     }
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 3d09aec..646291d 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -258,9 +258,9 @@ namespace
         aText.SetText( aLicensing );
 
         // positions and sizes are computed to always fit the language
-        Size aTextSize( aText.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
-        Size aShowSize( aShow.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
-        Size aCloseSize( aClose.GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+        Size aTextSize(aText.GetOptimalSize());
+        Size aShowSize(aShow.GetOptimalSize());
+        Size aCloseSize(aClose.GetOptimalSize());
 
         long nDelimX = 12;
         long nDelimY = 12;
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index 4183eef..7e3f847 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -118,7 +118,7 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, con
     // #i89164# calculate dynamically the width of radiobutton and listbox
     const long nOffset = 10;
     Size aOldSize = aReduceBitmapsResolutionRB.GetSizePixel();
-    Size aNewSize = aReduceBitmapsResolutionRB.GetOptimalSize( WINDOWSIZE_PREFERRED );
+    Size aNewSize = aReduceBitmapsResolutionRB.GetOptimalSize();
     aNewSize.Width() += nOffset;
     aNewSize.Height() = aOldSize.Height();
     long nDelta = aOldSize.Width() - aNewSize.Width();
@@ -126,7 +126,7 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( Window* pParent, con
     Point aPos = aReduceBitmapsResolutionLB.GetPosPixel();
     aPos.X() -= nDelta;
     aOldSize = aReduceBitmapsResolutionLB.GetSizePixel();
-    aNewSize = aReduceBitmapsResolutionLB.GetOptimalSize( WINDOWSIZE_PREFERRED );
+    aNewSize = aReduceBitmapsResolutionLB.GetOptimalSize();
     aNewSize.Width() += nOffset;
     aNewSize.Height() = aOldSize.Height();
     aReduceBitmapsResolutionLB.SetPosSizePixel( aPos, aNewSize );
diff --git a/svtools/inc/svtools/toolpanel/paneltabbar.hxx b/svtools/inc/svtools/toolpanel/paneltabbar.hxx
index 278ef34..0b534f8 100644
--- a/svtools/inc/svtools/toolpanel/paneltabbar.hxx
+++ b/svtools/inc/svtools/toolpanel/paneltabbar.hxx
@@ -65,7 +65,7 @@ namespace svt
         PushButton&                 GetScrollButton( const bool i_bForward );
 
         // Window overridables
-        virtual Size    GetOptimalSize( WindowSizeType i_eType ) const;
+        virtual Size    GetOptimalSize() const;
 
     protected:
         // Window overridables
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index ba678ae..c448c78 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -762,7 +762,7 @@ public:
 
     long getPreferredDimensions(std::vector<long> &rWidths) const;
 
-    virtual Size GetOptimalSize(WindowSizeType i_eType) const;
+    virtual Size GetOptimalSize() const;
 };
 
 #define SV_LBOX_DD_FORMAT "SV_LBOX_DD_FORMAT"
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index b6c9613..eddb602 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3408,24 +3408,12 @@ long SvTreeListBox::getPreferredDimensions(std::vector<long> &rWidths) const
     return nHeight;
 }
 
-Size SvTreeListBox::GetOptimalSize(WindowSizeType eType) const
+Size SvTreeListBox::GetOptimalSize() const
 {
-    Size aRet;
-    switch (eType)
-    {
-        case WINDOWSIZE_MINIMUM:
-        case WINDOWSIZE_PREFERRED:
-        {
-            std::vector<long> aWidths;
-            aRet.Height() = getPreferredDimensions(aWidths);
-            for (size_t i = 0; i < aWidths.size(); ++i)
-                aRet.Width() += aWidths[i];
-            break;
-        }
-        default:
-            aRet = Control::GetOptimalSize(eType);
-            break;
-    }
+    std::vector<long> aWidths;
+    Size aRet(0, getPreferredDimensions(aWidths));
+    for (size_t i = 0; i < aWidths.size(); ++i)
+        aRet.Width() += aWidths[i];
     return aRet;
 }
 
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index ca391d4..55e208d 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -197,7 +197,7 @@ IMPL_LINK( PlaceEditDialog, SelectTypeHdl, void*, EMPTYARG )
 
     m_pCurrentDetails->show( true );
 
-    SetSizePixel( GetOptimalSize( WINDOWSIZE_MINIMUM ) );
+    SetSizePixel(GetOptimalSize());
     return 0;
 }
 
diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
index d1dd6ee..1c08d59 100644
--- a/svtools/source/toolpanel/paneltabbar.cxx
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -1020,10 +1020,10 @@ namespace svt
     }
 
     //------------------------------------------------------------------------------------------------------------------
-    Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const
+    Size PanelTabBar::GetOptimalSize() const
     {
         m_pImpl->EnsureItemsCache();
-        Size aOptimalSize( m_pImpl->m_aGeometry.getOptimalSize( m_pImpl->m_aItems, i_eType == WINDOWSIZE_MINIMUM ) );
+        Size aOptimalSize(m_pImpl->m_aGeometry.getOptimalSize(m_pImpl->m_aItems));
         if ( m_pImpl->IsVertical() )
             ::std::swap( aOptimalSize.Width(), aOptimalSize.Height() );
         return aOptimalSize;
diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx
index 97b2900..0eb4fddd 100644
--- a/svtools/source/toolpanel/tabbargeometry.cxx
+++ b/svtools/source/toolpanel/tabbargeometry.cxx
@@ -256,7 +256,7 @@ namespace svt
     }
 
     //------------------------------------------------------------------------------------------------------------------
-    Size TabBarGeometry::getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const
+    Size TabBarGeometry::getOptimalSize(ItemDescriptors& io_rItems) const
     {
         if ( io_rItems.empty() )
             return Size(
@@ -265,7 +265,7 @@ namespace svt
             );
 
         // the rect of the last item
-        const Rectangle& rLastItemRect( i_bMinimalSize ? io_rItems.rbegin()->aIconOnlyArea : io_rItems.rbegin()->aCompleteArea );
+        const Rectangle& rLastItemRect(io_rItems.rbegin()->aCompleteArea);
         return Size(
                     rLastItemRect.Left() + 1 + m_aItemsInset.Right(),
                     rLastItemRect.Top() + 1 + rLastItemRect.Bottom() + m_aItemsInset.Bottom()
diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx
index 0439023..38750a1 100644
--- a/svtools/source/toolpanel/tabbargeometry.hxx
+++ b/svtools/source/toolpanel/tabbargeometry.hxx
@@ -100,7 +100,7 @@ namespace svt
 
         /** calculates the optimal size of the tab bar, depending on the item's sizes
         */
-        Size    getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const;
+        Size    getOptimalSize(ItemDescriptors& io_rItems) const;
 
         /** retrieves the position where the first item should start, relative to the item rect
         */
diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx
index 8c44531..bd38da4 100644
--- a/svtools/source/toolpanel/tablayouter.cxx
+++ b/svtools/source/toolpanel/tablayouter.cxx
@@ -124,13 +124,10 @@ namespace svt
         if ( lcl_checkDisposed( *m_pData ) )
             return i_rDeckPlayground;
 
-        const Size aPreferredSize( m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+        const Size aPreferredSize(m_pData->pTabBar->GetOptimalSize());
         if ( lcl_isVerticalTabBar( m_pData->eAlignment ) )
         {
-            Size aTabBarSize =  ( aPreferredSize.Width() < i_rDeckPlayground.GetWidth() )
-                            ?   aPreferredSize
-                            :   m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM );
-            aTabBarSize.Height() = i_rDeckPlayground.GetHeight();
+            Size aTabBarSize(aPreferredSize.Width(), i_rDeckPlayground.GetHeight());
 
             Rectangle aPanelRect( i_rDeckPlayground );
             if ( m_pData->eAlignment == TABS_RIGHT )
@@ -151,10 +148,7 @@ namespace svt
             return aPanelRect;
         }
 
-        Size aTabBarSize =  ( aPreferredSize.Height() < i_rDeckPlayground.GetHeight() )
-                        ?   aPreferredSize
-                        :   m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM );
-        aTabBarSize.Width() = i_rDeckPlayground.GetWidth();
+        Size aTabBarSize(i_rDeckPlayground.GetWidth(), aPreferredSize.Height());
 
         Rectangle aPanelRect( i_rDeckPlayground );
         if ( m_pData->eAlignment == TABS_TOP )
diff --git a/svx/inc/svx/fntctrl.hxx b/svx/inc/svx/fntctrl.hxx
index 3df73a8..e801eeb 100644
--- a/svx/inc/svx/fntctrl.hxx
+++ b/svx/inc/svx/fntctrl.hxx
@@ -89,7 +89,7 @@ public:
     void                SetFromItemSet( const SfxItemSet &rSet,
                                         bool bPreviewBackgroundToCharacter = false );
 
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
 };
 
 #endif // #ifndef _SVX_FNTCTRL_HXX
diff --git a/svx/inc/svx/pagectrl.hxx b/svx/inc/svx/pagectrl.hxx
index 252d3ae..9a6e2ca 100644
--- a/svx/inc/svx/pagectrl.hxx
+++ b/svx/inc/svx/pagectrl.hxx
@@ -155,7 +155,7 @@ public:
 
     void        ResetBackground();
 
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
 };
 
 #endif // #ifndef _SVX_PAGECTRL_HXX
diff --git a/svx/inc/svx/rubydialog.hxx b/svx/inc/svx/rubydialog.hxx
index ea7b313..f1538a3 100644
--- a/svx/inc/svx/rubydialog.hxx
+++ b/svx/inc/svx/rubydialog.hxx
@@ -52,7 +52,7 @@ public:
     {
         m_pParentDlg = pParentDlg;
     }
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
 };
 
 class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index d32ef0a..d40ecb0 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -1489,11 +1489,8 @@ void SvxFontPrevWindow::SetFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp,
     Invalidate();
 }
 
-Size SvxFontPrevWindow::GetOptimalSize(WindowSizeType eType) const
+Size SvxFontPrevWindow::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_MAXIMUM)
-        return Window::GetOptimalSize(eType);
-
     return m_aInitialSize;
 }
 
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index 0fadd16..3dba3d4 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -129,7 +129,7 @@ SvxPageWindow::SvxPageWindow( Window* pParent ) :
 
     // Count in Twips by default
     SetMapMode( MapMode( MAP_TWIP ) );
-    aWinSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+    aWinSize = GetOptimalSize();
     aWinSize.Height() -= 4;
     aWinSize.Width() -= 4;
 
@@ -437,11 +437,9 @@ void SvxPageWindow::ResetBackground()
     pImpl->bResetBackground = sal_True;
 }
 
-Size SvxPageWindow::GetOptimalSize(WindowSizeType eType) const
+Size SvxPageWindow::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_PREFERRED)
-        return LogicToPixel(Size(75, 46), MapMode(MAP_APPFONT));
-    return Window::GetOptimalSize(eType);
+    return LogicToPixel(Size(75, 46), MapMode(MAP_APPFONT));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
index 8f049b5..00d0ff0 100644
--- a/svx/source/dialog/rubydialog.cxx
+++ b/svx/source/dialog/rubydialog.cxx
@@ -878,11 +878,9 @@ void RubyPreview::Paint( const Rectangle& /* rRect */ )
     SetFont(aSaveFont);
 }
 
-Size RubyPreview::GetOptimalSize(WindowSizeType eType) const
+Size RubyPreview::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_PREFERRED)
-        return LogicToPixel(Size(215, 50), MapMode(MAP_APPFONT));
-    return Window::GetOptimalSize(eType);
+    return LogicToPixel(Size(215, 50), MapMode(MAP_APPFONT));
 }
 
 void RubyEdit::GetFocus()
diff --git a/sw/source/ui/dbui/dbtree.cxx b/sw/source/ui/dbui/dbtree.cxx
index fe695aa..add0827 100644
--- a/sw/source/ui/dbui/dbtree.cxx
+++ b/sw/source/ui/dbui/dbtree.cxx
@@ -208,11 +208,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwDBTreeList(Window *pParen
     return new SwDBTreeList(pParent);
 }
 
-Size SwDBTreeList::GetOptimalSize(WindowSizeType eType) const
+Size SwDBTreeList::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_PREFERRED)
-        return LogicToPixel(Size(100, 62), MapMode(MAP_APPFONT));
-    return SvTreeListBox::GetOptimalSize(eType);
+    return LogicToPixel(Size(100, 62), MapMode(MAP_APPFONT));
 }
 
 SwDBTreeList::~SwDBTreeList()
diff --git a/sw/source/ui/frmdlg/colex.cxx b/sw/source/ui/frmdlg/colex.cxx
index 147e45f..a520433 100644
--- a/sw/source/ui/frmdlg/colex.cxx
+++ b/sw/source/ui/frmdlg/colex.cxx
@@ -300,7 +300,7 @@ SwColumnOnlyExample::SwColumnOnlyExample(Window* pParent)
     , m_aFrmSize(1,1)
 {
     SetMapMode( MapMode( MAP_TWIP ) );
-    m_aWinSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+    m_aWinSize = GetOptimalSize();
     m_aWinSize.Height() -= 4;
     m_aWinSize.Width() -= 4;
 
@@ -456,11 +456,9 @@ void  SwColumnOnlyExample::SetColumns(const SwFmtCol& rCol)
     }
 }
 
-Size SwColumnOnlyExample::GetOptimalSize(WindowSizeType eType) const
+Size SwColumnOnlyExample::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_PREFERRED)
-        return LogicToPixel(Size(75, 46), MapMode(MAP_APPFONT));
-    return Window::GetOptimalSize(eType);
+    return LogicToPixel(Size(75, 46), MapMode(MAP_APPFONT));
 }
 
 SwPageGridExample::~SwPageGridExample()
diff --git a/sw/source/ui/inc/colex.hxx b/sw/source/ui/inc/colex.hxx
index d326313..d9be70b 100644
--- a/sw/source/ui/inc/colex.hxx
+++ b/sw/source/ui/inc/colex.hxx
@@ -112,7 +112,7 @@ public:
 
     void        SetColumns(const SwFmtCol& rCol);
 
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
 };
 
 #endif // _COLEX_HXX
diff --git a/sw/source/ui/inc/dbtree.hxx b/sw/source/ui/inc/dbtree.hxx
index fc27c48..dba79bc 100644
--- a/sw/source/ui/inc/dbtree.hxx
+++ b/sw/source/ui/inc/dbtree.hxx
@@ -58,7 +58,7 @@ public:
                     const sal_Bool bShowCol = sal_False );
     SwDBTreeList(Window* pParent);
     virtual ~SwDBTreeList();
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
 
     String  GetDBName( String& rTableName, String& rColumnName, sal_Bool* pbIsTable = 0);
 
diff --git a/sw/source/ui/inc/glossary.hxx b/sw/source/ui/inc/glossary.hxx
index a200b55..afd47aa 100644
--- a/sw/source/ui/inc/glossary.hxx
+++ b/sw/source/ui/inc/glossary.hxx
@@ -73,7 +73,7 @@ public:
     SwGlTreeListBox(Window* pParent, WinBits nBits);
 
     virtual void RequestHelp( const HelpEvent& rHEvt );
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
     void Clear();
 };
 
diff --git a/sw/source/ui/inc/unotools.hxx b/sw/source/ui/inc/unotools.hxx
index 8d4e31a..658a77e 100644
--- a/sw/source/ui/inc/unotools.hxx
+++ b/sw/source/ui/inc/unotools.hxx
@@ -43,7 +43,7 @@ public:
     SwFrmCtrlWindow(Window* pParent, SwOneExampleFrame* pFrame);
 
     virtual void Command( const CommandEvent& rCEvt );
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
     virtual void Resize();
 };
 
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 975281f..ecec7b1 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -850,11 +850,9 @@ SwGlTreeListBox::SwGlTreeListBox(Window* pParent, WinBits nBits)
     SetDragDropMode( SV_DRAGDROP_CTRL_MOVE|SV_DRAGDROP_CTRL_COPY );
 }
 
-Size SwGlTreeListBox::GetOptimalSize(WindowSizeType eType) const
+Size SwGlTreeListBox::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_PREFERRED)
-        return LogicToPixel(Size(212, 84), MapMode(MAP_APPFONT));
-    return SvTreeListBox::GetOptimalSize(eType);
+    return LogicToPixel(Size(212, 84), MapMode(MAP_APPFONT));
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwGlTreeListBox(Window *pParent, VclBuilder::stringmap &)
diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx
index e9e89df..76f6991 100644
--- a/sw/source/ui/uiview/viewling.cxx
+++ b/sw/source/ui/uiview/viewling.cxx
@@ -861,7 +861,7 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) :
         }
     }
 
-    Size lbSize=aListBox.GetOptimalSize(WINDOWSIZE_PREFERRED);
+    Size lbSize(aListBox.GetOptimalSize());
     lbSize.Width()+=50;
     lbSize.Height()+=20;
     aListBox.SetSizePixel(lbSize);
diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx
index 19933c3..f5b1444 100644
--- a/sw/source/ui/utlui/unotools.cxx
+++ b/sw/source/ui/utlui/unotools.cxx
@@ -542,11 +542,9 @@ void SwFrmCtrlWindow::Command( const CommandEvent& rCEvt )
     }
 }
 
-Size SwFrmCtrlWindow::GetOptimalSize(WindowSizeType eType) const
+Size SwFrmCtrlWindow::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_PREFERRED)
-        return LogicToPixel(Size(82, 124), MapMode(MAP_APPFONT));
-    return VclEventBox::GetOptimalSize(eType);
+    return LogicToPixel(Size(82, 124), MapMode(MAP_APPFONT));
 }
 
 void SwFrmCtrlWindow::Resize()
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 5609ea7..b97a6bd 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -2194,7 +2194,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com::
             case WINDOW_SCROLLBARBOX:
                 return VCLXScrollBar::implGetMinimumSize( GetWindow() );
             default:
-                aSz = GetWindow()->GetOptimalSize( WINDOWSIZE_MINIMUM );
+                aSz = GetWindow()->GetOptimalSize();
         }
     }
 
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx
index d0e9764..55da223 100644
--- a/vcl/inc/brdwin.hxx
+++ b/vcl/inc/brdwin.hxx
@@ -178,7 +178,7 @@ public:
 
     Rectangle               GetMenuRect() const;
 
-    virtual Size            GetOptimalSize(WindowSizeType eType) const;
+    virtual Size            GetOptimalSize() const;
 };
 
 // =======================================================================
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 3a0cbb7..d57218e 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -82,7 +82,7 @@ namespace vcl
             ShowNupOrderWindow( Window* pParent );
             virtual ~ShowNupOrderWindow();
 
-            virtual Size GetOptimalSize(WindowSizeType eType) const;
+            virtual Size GetOptimalSize() const;
 
             virtual void Paint( const Rectangle& );
 
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index 46be285..47a4401 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -186,7 +186,7 @@ public:
     TriState        GetSavedValue() const { return meSaveValue; }
 
     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 
     void            SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
     const Link&     GetToggleHdl() const { return maToggleHdl; }
@@ -379,7 +379,7 @@ public:
     static Image    GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlags );
 
     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 
     void            SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
     const Link&     GetToggleHdl() const { return maToggleHdl; }
@@ -493,7 +493,7 @@ public:
     static Image    GetCheckImage( const AllSettings& rSettings, sal_uInt16 nFlags );
 
     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 
     void            SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
     const Link&     GetToggleHdl() const { return maToggleHdl; }
diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx
index 72478c5..d036410 100644
--- a/vcl/inc/vcl/combobox.hxx
+++ b/vcl/inc/vcl/combobox.hxx
@@ -167,7 +167,7 @@ public:
     const Link&     GetDoubleClickHdl() const               { return maDoubleClickHdl; }
 
     Size            CalcMinimumSize() const;
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
     Size            CalcAdjustedSize( const Size& rPrefSize ) const;
     using Edit::CalcSize;
     Size            CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx
index 6820386..bd178f0 100644
--- a/vcl/inc/vcl/ctrl.hxx
+++ b/vcl/inc/vcl/ctrl.hxx
@@ -173,7 +173,7 @@ public:
 
     void            SetLayoutDataParent( const Control* pParent ) const;
 
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 
     /** sets a reference device used for rendering control text
         @seealso DrawControlText
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index 6f5b0c0..7f16d07 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -91,7 +91,7 @@ public:
     virtual void    StateChanged( StateChangedType nStateChange );
     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
 
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
     virtual void    Resize();
     bool            isLayoutEnabled() const;
     void            setInitialLayoutSize();
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index 3957f69..10d3fe4 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -230,7 +230,7 @@ public:
 
     virtual Size        CalcMinimumSize() const;
     virtual Size        CalcMinimumSizeForText(const rtl::OUString &rString) const;
-    virtual Size        GetOptimalSize(WindowSizeType eType) const;
+    virtual Size        GetOptimalSize() const;
     virtual Size        CalcSize( sal_uInt16 nChars ) const;
     virtual xub_StrLen  GetMaxVisChars() const;
 
diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx
index 22ed857..7e15025 100644
--- a/vcl/inc/vcl/fixed.hxx
+++ b/vcl/inc/vcl/fixed.hxx
@@ -73,7 +73,7 @@ public:
     static Size     CalcMinimumTextSize(Control const* pControl, long nMaxWidth = 0x7fffffff);
     static Size     getTextDimensions(Control const *pControl, const OUString &rTxt, long nMaxWidth);
     Size            CalcMinimumSize(long nMaxWidth = 0x7fffffff) const;
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
     virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
 };
 
@@ -116,7 +116,7 @@ public:
     virtual void    StateChanged( StateChangedType nType );
     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
 
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 };
 
 // ---------------
@@ -188,7 +188,7 @@ public:
     virtual void    StateChanged( StateChangedType nType );
     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
     virtual void    UserDraw( const UserDrawEvent& rUDEvt );
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 
     void            SetImage( const Image& rImage );
     const Image&    GetImage() const { return maImage; }
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 7c71d9c..073433f 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -21,7 +21,7 @@ class VCL_DLLPUBLIC VclContainer : public Window
 {
 public:
     VclContainer(Window *pParent, WinBits nStyle = WB_HIDE);
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
     virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize);
     virtual void SetPosPixel(const Point& rAllocPos);
     virtual void SetSizePixel(const Size& rAllocation);
diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx
index cabc30b..694f45c 100644
--- a/vcl/inc/vcl/lstbox.hxx
+++ b/vcl/inc/vcl/lstbox.hxx
@@ -189,7 +189,7 @@ public:
 
     Size            CalcSubEditSize() const;    //size of area inside lstbox, i.e. no scrollbar/dropdown
     Size            CalcMinimumSize() const;    //size of lstbox area, i.e. including scrollbar/dropdown
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
     Size            CalcAdjustedSize( const Size& rPrefSize ) const;
     Size            CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
     void            GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
diff --git a/vcl/inc/vcl/msgbox.hxx b/vcl/inc/vcl/msgbox.hxx
index cd9e860..8f0336d 100644
--- a/vcl/inc/vcl/msgbox.hxx
+++ b/vcl/inc/vcl/msgbox.hxx
@@ -93,7 +93,7 @@ public:
     void                SetCheckBoxState( sal_Bool bCheck );
     sal_Bool                GetCheckBoxState() const;
 
-    virtual Size        GetOptimalSize(WindowSizeType eType) const;
+    virtual Size        GetOptimalSize() const;
 };
 
 // -----------
diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx
index 7c62d94..4a1a164 100644
--- a/vcl/inc/vcl/scrbar.hxx
+++ b/vcl/inc/vcl/scrbar.hxx
@@ -140,7 +140,7 @@ public:
     void            SetEndScrollHdl( const Link& rLink ) { maEndScrollHdl = rLink; }
     const Link&     GetEndScrollHdl() const { return maEndScrollHdl; }
 
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 };
 
 // ----------------
diff --git a/vcl/inc/vcl/spinfld.hxx b/vcl/inc/vcl/spinfld.hxx
index 578aebb..4d38a2e 100644
--- a/vcl/inc/vcl/spinfld.hxx
+++ b/vcl/inc/vcl/spinfld.hxx
@@ -102,7 +102,7 @@ public:
 
     virtual Size    CalcMinimumSize() const;
     virtual Size    CalcMinimumSizeForText(const rtl::OUString &rString) const;
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
     virtual Size    CalcSize( sal_uInt16 nChars ) const;
 };
 
diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
index 39cbad3..f2928d9 100644
--- a/vcl/inc/vcl/tabctrl.hxx
+++ b/vcl/inc/vcl/tabctrl.hxx
@@ -111,7 +111,7 @@ public:
     virtual void        ActivatePage();
     virtual long        DeactivatePage();
 
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
 
     void                SetTabPageSizePixel( const Size& rSize );
     Size                GetTabPageSizePixel() const;
diff --git a/vcl/inc/vcl/tabpage.hxx b/vcl/inc/vcl/tabpage.hxx
index 1aa4b91..769003d 100644
--- a/vcl/inc/vcl/tabpage.hxx
+++ b/vcl/inc/vcl/tabpage.hxx
@@ -59,7 +59,7 @@ public:
     virtual void    SetPosSizePixel(const Point& rNewPos, const Size& rNewSize);
     virtual void    SetPosPixel(const Point& rNewPos);
     virtual void    SetSizePixel(const Size& rNewSize);
-    virtual Size    GetOptimalSize(WindowSizeType eType) const;
+    virtual Size    GetOptimalSize() const;
 };
 
 #endif  // _SV_TABPAGE_HXX
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index f0ceb9a..66c0cfa 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -316,13 +316,6 @@ typedef sal_uInt16 StateChangedType;
 #define DLGWINDOW_NEXT                  1
 #define DLGWINDOW_FIRST                 2
 
-enum WindowSizeType
-{
-    WINDOWSIZE_MINIMUM,
-    WINDOWSIZE_PREFERRED,
-    WINDOWSIZE_MAXIMUM
-};
-
 // ----------
 // - Window -
 // ----------
@@ -1064,7 +1057,7 @@ public:
      * Implement this in sub-classes to tell layout
      * the preferred widget size.
      */
-    virtual Size GetOptimalSize(WindowSizeType eType) const;
+    virtual Size GetOptimalSize() const;
 
     /*
      * Widgets call this to inform their owner container that the widget wants
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 8ad4c6c..16190b4 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1707,15 +1707,9 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const
     return CalcWindowSize( aSize );
 }
 
-Size PushButton::GetOptimalSize(WindowSizeType eType) const
+Size PushButton::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM: {
-        return CalcMinimumSize();
-    }
-    default:
-        return Button::GetOptimalSize( eType );
-    }
+    return CalcMinimumSize();
 }
 
 bool PushButton::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
@@ -3077,14 +3071,9 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const
 
 // -----------------------------------------------------------------------
 
-Size RadioButton::GetOptimalSize(WindowSizeType eType) const
+Size RadioButton::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return CalcMinimumSize();
-    default:
-        return Button::GetOptimalSize( eType );
-    }
+    return CalcMinimumSize();
 }
 
 // =======================================================================
@@ -3992,14 +3981,9 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
 
 // -----------------------------------------------------------------------
 
-Size CheckBox::GetOptimalSize(WindowSizeType eType) const
+Size CheckBox::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return CalcMinimumSize();
-    default:
-        return Button::GetOptimalSize( eType );
-    }
+    return CalcMinimumSize();
 }
 
 // =======================================================================
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 389929c3..75f4e30 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1016,14 +1016,9 @@ long ComboBox::CalcWindowSizePixel( sal_uInt16 nLines ) const
 
 // -----------------------------------------------------------------------
 
-Size ComboBox::GetOptimalSize(WindowSizeType eType) const
+Size ComboBox::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return CalcMinimumSize();
-    default:
-        return Edit::GetOptimalSize( eType );
-    }
+    return CalcMinimumSize();
 }
 
 // -----------------------------------------------------------------------
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 8ebd3eb..debdc4f 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -455,18 +455,10 @@ ControlLayoutData::~ControlLayoutData()
 
 // -----------------------------------------------------------------
 
-Size Control::GetOptimalSize(WindowSizeType eType) const
-{
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return Size( GetTextWidth( GetText() ) + 2 * 12,
-                     GetTextHeight() + 2 * 6 );
-    case WINDOWSIZE_PREFERRED:
-        return GetOptimalSize( WINDOWSIZE_MINIMUM );
-    case WINDOWSIZE_MAXIMUM:
-    default:
-        return Size( LONG_MAX, LONG_MAX );
-    }
+Size Control::GetOptimalSize() const
+{
+    return Size( GetTextWidth( GetText() ) + 2 * 12,
+                 GetTextHeight() + 2 * 6 );
 }
 
 // -----------------------------------------------------------------
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 513fd51..3e177d0 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2954,14 +2954,9 @@ Size Edit::GetMinimumEditSize()
 
 // -----------------------------------------------------------------------
 
-Size Edit::GetOptimalSize(WindowSizeType eType) const
+Size Edit::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return CalcMinimumSize();
-    default:
-        return Control::GetOptimalSize( eType );
-    }
+    return CalcMinimumSize();
 }
 
 // -----------------------------------------------------------------------
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 4646f3b..42b150c 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -417,34 +417,26 @@ Size FixedText::CalcMinimumSize( long nMaxWidth ) const
 }
 // -----------------------------------------------------------------------
 
-Size FixedText::GetOptimalSize(WindowSizeType eType) const
+Size FixedText::GetOptimalSize() const
 {
-    switch (eType)
+    sal_Int32 nMaxAvailWidth = 0x7fffffff;
+    const OUString &rTxt = GetText();
+    if (m_nMaxWidthChars != -1 && m_nMaxWidthChars < rTxt.getLength())
     {
-        case WINDOWSIZE_MINIMUM:
-        {
-            sal_Int32 nMaxAvailWidth = 0x7fffffff;
-            const OUString &rTxt = GetText();
-            if (m_nMaxWidthChars != -1 && m_nMaxWidthChars < rTxt.getLength())
-            {
-                nMaxAvailWidth = getTextDimensions(this,
-                    rTxt.copy(0, m_nMaxWidthChars), 0x7fffffff).Width();
-            }
-            Size aRet = CalcMinimumSize(nMaxAvailWidth);
-            if (m_nMinWidthChars != -1)
-            {
-                OUStringBuffer aBuf;
-                comphelper::string::padToLength(aBuf, m_nMinWidthChars, 'x');
-                Size aMinAllowed = getTextDimensions(this,
-                    aBuf.makeStringAndClear(), 0x7fffffff);
-                if (aMinAllowed.Width() > aRet.Width())
-                    aRet = aMinAllowed;
-            }
-            return aRet;
-        }
-        default:
-            return Control::GetOptimalSize( eType );
+        nMaxAvailWidth = getTextDimensions(this,
+            rTxt.copy(0, m_nMaxWidthChars), 0x7fffffff).Width();
+    }
+    Size aRet = CalcMinimumSize(nMaxAvailWidth);
+    if (m_nMinWidthChars != -1)
+    {
+        OUStringBuffer aBuf;
+        comphelper::string::padToLength(aBuf, m_nMinWidthChars, 'x');
+        Size aMinAllowed = getTextDimensions(this,
+            aBuf.makeStringAndClear(), 0x7fffffff);
+        if (aMinAllowed.Width() > aRet.Width())
+            aRet = aMinAllowed;
     }
+    return aRet;
 }
 
 // -----------------------------------------------------------------------
@@ -753,14 +745,9 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt )
 
 // -----------------------------------------------------------------------
 
-Size FixedLine::GetOptimalSize(WindowSizeType eType) const
+Size FixedLine::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return CalcWindowSize( FixedText::CalcMinimumTextSize ( this, 0x7fffffff ) );
-    default:
-        return Control::GetOptimalSize( eType );
-    }
+    return CalcWindowSize( FixedText::CalcMinimumTextSize ( this, 0x7fffffff ) );
 }
 
 // =======================================================================
@@ -1106,10 +1093,9 @@ void FixedImage::Paint( const Rectangle& )
 
 // -----------------------------------------------------------------------
 
-Size FixedImage::GetOptimalSize( WindowSizeType ) const
+Size FixedImage::GetOptimalSize() const
 {
-    const Image* pImage = &maImage;
-    return pImage->GetSizePixel();
+    return maImage.GetSizePixel();
 }
 
 // -----------------------------------------------------------------------
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index f36204b..beb216d 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1354,14 +1354,9 @@ Size ListBox::CalcSubEditSize() const
 
 // -----------------------------------------------------------------------
 
-Size ListBox::GetOptimalSize(WindowSizeType eType) const
+Size ListBox::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return CalcMinimumSize();
-    default:
-        return Control::GetOptimalSize( eType );
-    }
+    return CalcMinimumSize();
 }
 
 // -----------------------------------------------------------------------
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index b99ff26..b2ffb7f 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1507,7 +1507,7 @@ void ScrollBar::SetVisibleSize( long nNewSize )
     }
 }
 
-Size ScrollBar::GetOptimalSize(WindowSizeType) const
+Size ScrollBar::GetOptimalSize() const
 {
     if (mbCalcSize)
         const_cast<ScrollBar*>(this)->ImplCalc(sal_False);
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index cba366d..604c386 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -995,14 +995,9 @@ Size SpinField::CalcMinimumSize() const
 
 // -----------------------------------------------------------------------
 
-Size SpinField::GetOptimalSize(WindowSizeType eType) const
+Size SpinField::GetOptimalSize() const
 {
-    switch (eType) {
-    case WINDOWSIZE_MINIMUM:
-        return CalcMinimumSize();
-    default:
-        return Edit::GetOptimalSize( eType );
-    }
+    return CalcMinimumSize();
 }
 
 // -----------------------------------------------------------------------
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index e2fecc2..02ac533 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2219,7 +2219,7 @@ Size TabControl::calculateRequisition() const
         if (!pPage)
             continue;
 
-        Size aPageSize(pPage->GetOptimalSize(WINDOWSIZE_PREFERRED));
+        Size aPageSize(pPage->GetOptimalSize());
 
         if (aPageSize.Width() > aOptimalPageSize.Width())
             aOptimalPageSize.Width() = aPageSize.Width();
@@ -2251,10 +2251,8 @@ Size TabControl::calculateRequisition() const
     return aOptimalSize;
 }
 
-Size TabControl::GetOptimalSize(WindowSizeType eType) const
+Size TabControl::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_MINIMUM)
-        return Size();
     return calculateRequisition();
 }
 
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 9fea710..60b20a6 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -2360,16 +2360,12 @@ Rectangle ImplBorderWindow::GetMenuRect() const
     return mpBorderView->GetMenuRect();
 }
 
-Size ImplBorderWindow::GetOptimalSize(WindowSizeType eType) const
+Size ImplBorderWindow::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_MAXIMUM)
-        return Size(mnMaxWidth, mnMaxHeight);
-    if (eType == WINDOWSIZE_MINIMUM)
-        return Size(mnMinWidth, mnMinHeight);
-    Window* pClientWindow = ImplGetClientWindow();
+    const Window* pClientWindow = ImplGetClientWindow();
     if (pClientWindow)
-        return pClientWindow->GetOptimalSize(eType);
-    return Size(0, 0);
+        return pClientWindow->GetOptimalSize();
+    return Size(mnMinWidth, mnMinHeight);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 53eafdf..1aef3e6 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1188,10 +1188,10 @@ bool Dialog::isLayoutEnabled() const
     return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT);
 }
 
-Size Dialog::GetOptimalSize(WindowSizeType eType) const
+Size Dialog::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_MAXIMUM || !isLayoutEnabled())
-        return SystemWindow::GetOptimalSize(eType);
+    if (!isLayoutEnabled())
+        return SystemWindow::GetOptimalSize();
 
     Size aSize = VclContainer::getLayoutRequisition(*GetWindow(WINDOW_FIRSTCHILD));
 
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 7364b11..a6d9d40 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -21,10 +21,8 @@ VclContainer::VclContainer(Window *pParent, WinBits nStyle)
     SetBackground();
 }
 
-Size VclContainer::GetOptimalSize(WindowSizeType eType) const
+Size VclContainer::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_MAXIMUM)
-        return Window::GetOptimalSize(eType);
     return calculateRequisition();
 }
 
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 86dd223..6aca66e 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -426,15 +426,10 @@ void MessBox::SetCheckBoxState( sal_Bool bCheck )
 
 // -----------------------------------------------------------------------
 
-Size MessBox::GetOptimalSize(WindowSizeType eType) const
+Size MessBox::GetOptimalSize() const
 {
-    switch( eType ) {
-    case WINDOWSIZE_MINIMUM:
-        // FIXME: base me on the font size ?
-        return Size( 250, 100 );
-    default:
-        return Window::GetOptimalSize( eType );
-    }
+    // FIXME: base me on the font size ?
+    return Size( 250, 100 );
 }
 
 // ============================================================================
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 97614b2..2222eb8 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -301,7 +301,7 @@ void PrintDialog::ShowNupOrderWindow::ImplInitSettings()
     SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
 }
 
-Size PrintDialog::ShowNupOrderWindow::GetOptimalSize(WindowSizeType) const
+Size PrintDialog::ShowNupOrderWindow::GetOptimalSize() const
 {
     return Size(70, 70);
 }
diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx
index d6dbcd3..7dfeb14 100644
--- a/vcl/source/window/tabdlg.cxx
+++ b/vcl/source/window/tabdlg.cxx
@@ -56,7 +56,7 @@ void TabDialog::ImplPosControls()
                 pTabControl = pChild;
             else if ( pTabControl )
             {
-                Size aOptimalSize( pChild->GetOptimalSize( WINDOWSIZE_PREFERRED ) );
+                Size aOptimalSize(pChild->GetOptimalSize());
                 long nTxtWidth = aOptimalSize.Width();
                 if ( nTxtWidth > aCtrlSize.Width() )
                     aCtrlSize.Width() = nTxtWidth;
@@ -86,7 +86,7 @@ void TabDialog::ImplPosControls()
         Point   aTabOffset( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+nOffY );
 
         if (isContainerWindow(*pTabControl))
-            pTabControl->SetSizePixel(pTabControl->GetOptimalSize(WINDOWSIZE_PREFERRED));
+            pTabControl->SetSizePixel(pTabControl->GetOptimalSize());
 
         Size    aTabSize = pTabControl->GetSizePixel();
 
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index 5f04373..b15d9c1 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -207,16 +207,11 @@ bool TabPage::isLayoutEnabled() const
     return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT);
 }
 
-Size TabPage::GetOptimalSize(WindowSizeType eType) const
+Size TabPage::GetOptimalSize() const
 {
-    if (eType == WINDOWSIZE_MAXIMUM)
-        return Window::GetOptimalSize(eType);
-    Size aSize;
     if (isLayoutEnabled())
-        aSize = GetWindow(WINDOW_FIRSTCHILD)->GetOptimalSize(eType);
-    else
-        aSize = getLegacyBestSizeForChildren(*this);
-    return Window::CalcWindowSize(aSize);
+        return GetWindow(WINDOW_FIRSTCHILD)->GetOptimalSize();
+    return getLegacyBestSizeForChildren(*this);
 }
 
 void TabPage::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation)
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 72d117d..acf9aad 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -2014,7 +2014,7 @@ namespace
         Size aRet(rWindow.get_width_request(), rWindow.get_height_request());
         if (aRet.Width() == -1 || aRet.Height() == -1)
         {
-            Size aOptimal = rWindow.GetOptimalSize(WINDOWSIZE_PREFERRED);
+            Size aOptimal = rWindow.GetOptimalSize();
             if (aRet.Width() == -1)
                 aRet.Width() = aOptimal.Width();
             if (aRet.Height() == -1)
diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx
index b901276..00919ac 100644
--- a/vcl/source/window/window3.cxx
+++ b/vcl/source/window/window3.cxx
@@ -32,18 +32,9 @@ WaitObject::~WaitObject()
 
 // -----------------------------------------------------------------------
 
-Size Window::GetOptimalSize(WindowSizeType eType) const
+Size Window::GetOptimalSize() const
 {
-    switch (eType)
-    {
-        case WINDOWSIZE_MINIMUM:
-            return Size();
-        case WINDOWSIZE_PREFERRED:
-            return GetOptimalSize( WINDOWSIZE_MINIMUM );
-        case WINDOWSIZE_MAXIMUM:
-        default:
-            return Size( LONG_MAX, LONG_MAX );
-    }
+    return Size();
 }
 
 // -----------------------------------------------------------------------
commit d652af7d071bb5e5c3f7592d6dc7e7c400e711d3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 14 10:29:35 2013 +0000

    merge the 'holy default' default window sizes to a single place
    
    Change-Id: I247a52cf547da268e5aa6f7c9fef000c598b661b

diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 5173687..7c71d9c 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -625,6 +625,8 @@ public:
     bool set_property(const OString &rKey, const OString &rValue);
 };
 
+VCL_DLLPUBLIC Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize);
+
 // retro-fitting utilities //
 
 //Get a Size which is large enough to contain all children with
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index ce98b75..53eafdf 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -637,6 +637,29 @@ long Dialog::Notify( NotifyEvent& rNEvt )
     return nRet;
 }
 
+Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
+{
+    long w = rScreenSize.Width();
+    long h = rScreenSize.Height();
+
+    // fill in holy default values brought to us by product management
+    if (rScreenSize.Width() >= 800)
+        w = 785;
+    if (rScreenSize.Width() >= 1024)
+        w = 920;
+    if (rScreenSize.Width() >= 1280)
+        w = 1050;
+
+    if (rScreenSize.Height() >= 600)
+        h = 550;
+    if (rScreenSize.Height() >= 768)
+        h = 630;
+    if (rScreenSize.Height() >= 1024)
+        h = 875;
+
+    return Size(w, h);
+}
+
 void Dialog::setInitialLayoutSize()
 {
     maLayoutTimer.Stop();
@@ -658,7 +681,8 @@ void Dialog::setInitialLayoutSize()
 
     Size aSize = get_preferred_size();
 
-    Size aMax = GetOptimalSize(WINDOWSIZE_MAXIMUM);
+    Size aMax(bestmaxFrameSizeForScreenSize(GetDesktopRectPixel().GetSize()));
+
     aSize.Width() = std::min(aMax.Width(), aSize.Width());
     aSize.Height() = std::min(aMax.Height(), aSize.Height());
 
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 67ce56e..a30c32f 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -31,6 +31,7 @@
 #include "vcl/floatwin.hxx"
 #include "vcl/svapp.hxx"
 #include "vcl/keycodes.hxx"
+#include "vcl/layout.hxx"
 #include "vcl/printerinfomanager.hxx"
 #include "vcl/settings.hxx"
 
@@ -331,20 +332,9 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, SalX11Screen nXScreen, SystemP
             if( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE &&
                 nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE )
             {
-                // fill in holy default values brought to us by product management
-                if( aScreenSize.Width() >= 800 )
-                    w = 785;
-                if( aScreenSize.Width() >= 1024 )
-                    w = 920;
-                if( aScreenSize.Width() >= 1280 )
-                    w = 1050;
-
-                if( aScreenSize.Height() >= 600 )
-                    h = 550;
-                if( aScreenSize.Height() >= 768 )
-                    h = 630;
-                if( aScreenSize.Height() >= 1024 )
-                    h = 875;
+                Size aBestFitSize(bestmaxFrameSizeForScreenSize(aScreenSize));
+                w = aBestFitSize.Width();
+                h = aBestFitSize.Height();
             }
             if( ! mpParent )
             {
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 398ece4..6343f5b 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -22,6 +22,7 @@
 #include <unx/gtk/gtkinst.hxx>
 #include <unx/gtk/gtkgdi.hxx>
 #include <vcl/keycodes.hxx>
+#include <vcl/layout.hxx>
 #include <unx/wmadaptor.hxx>
 #include <unx/sm.hxx>
 #include <unx/salbmp.h>
@@ -1534,26 +1535,7 @@ void GtkSalFrame::Center()
 
 Size GtkSalFrame::calcDefaultSize()
 {
-    Size aScreenSize = getDisplay()->GetScreenSize( GetDisplayScreen() );
-    long w = aScreenSize.Width();
-    long h = aScreenSize.Height();
-
-    // fill in holy default values brought to us by product management
-    if( aScreenSize.Width() >= 800 )
-        w = 785;
-    if( aScreenSize.Width() >= 1024 )
-        w = 920;
-    if( aScreenSize.Width() >= 1280 )
-        w = 1050;
-
-    if( aScreenSize.Height() >= 600 )
-        h = 550;
-    if( aScreenSize.Height() >= 768 )
-        h = 630;
-    if( aScreenSize.Height() >= 1024 )
-        h = 875;
-
-    return Size( w, h );
+    return bestmaxFrameSizeForScreenSize(getDisplay()->GetScreenSize(GetDisplayScreen()));
 }
 
 void GtkSalFrame::SetDefaultSize()
commit 02d4f6a2494621a17bb59d743ed499cce555839a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 14 09:53:29 2013 +0000

    split confused ImplInitDigitMode method into seperate functions
    
    a) ImplCalcDigitLang that determines the digit language
    b) ImplInitDigitMode that just sets the outputdevice according to that lang
    c) and convertDigits that physically converts the digits in a string
    from one language to another
    
    then change the body of convertDigits to use GetLocalizedChar from vcl rather
    than its outdated copy of the method, which teachs editeng all the digit modes
    that were added since the method was originally copy and pasted.
    
    Change-Id: I2ef7d5d3396c106d4f8fd90142c9d9cf99064bee

diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 58c72b5..dcb7ad0 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -598,7 +598,9 @@ private:
     void                ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth );
 
     void                ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex );
-    void                ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eLang );
+    LanguageType        ImplCalcDigitLang(LanguageType eCurLang) const;
+    void                ImplInitDigitMode(OutputDevice* pOutDev, LanguageType eLang);
+    OUString            convertDigits(const OUString &rString, sal_Int32 nStt, sal_Int32 nLen, LanguageType eDigitLang) const;
 
     EditPaM             ReadText( SvStream& rInput, EditSelection aSel );
     EditPaM             ReadRTF( SvStream& rInput, EditSelection aSel );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 1c3e658..3269fc6 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3197,7 +3197,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine,
                     SvxFont aTmpFont( pPortion->GetNode()->GetCharAttribs().GetDefFont() );
                     SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont );
                     aTmpFont.SetPhysFont( GetRefDevice() );
-                    ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
+                    ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
                     nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nPos, pTextPortion->GetLen(), NULL ).Width();
                 }
             }
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 964579c..74f6f9e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -811,7 +811,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
             {
                 SeekCursor( pNode, nTmpPos+1, aTmpFont );
                 aTmpFont.SetPhysFont( GetRefDevice() );
-                ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
+                ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
 
                 if ( IsFixedCellHeight() )
                     nTextLineHeight = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() );
@@ -994,7 +994,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
                         SeekCursor( pNode, nTmpPos+1, aTmpFont );
                         sal_Unicode cChar = 0;  // later: NBS?
                         aTmpFont.SetPhysFont( GetRefDevice() );
-                        ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
+                        ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
 
                         rtl::OUString aFieldValue = cChar ? rtl::OUString(cChar) : ((EditCharAttribField*)pNextFeature)->GetFieldValue();
                         if ( bCalcCharPositions || !pPortion->HasValidSize() )
@@ -1056,7 +1056,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
                 (void)bProcessingEmptyLine;
                 SeekCursor( pNode, nTmpPos+1, aTmpFont );
                 aTmpFont.SetPhysFont( GetRefDevice() );
-                ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
+                ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
 
                 if ( bCalcCharPositions || !pPortion->HasValidSize() )
                 {
@@ -1280,7 +1280,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
         {
             SeekCursor( pNode, pLine->GetStart()+1, aTmpFont );
             aTmpFont.SetPhysFont( pRefDev );
-            ImplInitDigitMode( pRefDev, 0, 0, 0, aTmpFont.GetLanguage() );
+            ImplInitDigitMode(pRefDev, aTmpFont.GetLanguage());
 
             if ( IsFixedCellHeight() )
                 aTextSize.Height() = ImplCalculateFontIndependentLineSpacing( aTmpFont.GetHeight() );
@@ -1302,7 +1302,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
             {
                 SeekCursor( pNode, nTPos+1, aTmpFont );
                 aTmpFont.SetPhysFont( GetRefDevice() );
-                ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
+                ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
                 RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont );
             }
             nTPos = nTPos + pTP->GetLen();
@@ -2264,7 +2264,7 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP
             SeekCursor( pPortion->GetNode(), nTxtPortionStart+1, aTmpFont );
             aTmpFont.SetPhysFont( GetRefDevice() );
             GetRefDevice()->Push( PUSH_TEXTLANGUAGE );
-            ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
+            ImplInitDigitMode(GetRefDevice(), aTmpFont.GetLanguage());
             Size aSz = aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nTxtPortionStart, pTextPortion->GetLen(), NULL );
             GetRefDevice()->Pop();
             pTextPortion->GetExtraInfos()->nOrgWidth = aSz.Width();
@@ -3033,9 +3033,9 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                                 // potentially changing both)
                                 pOutDev->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE );
                                 ImplInitLayoutMode( pOutDev, n, nIndex );
-                                ImplInitDigitMode( pOutDev, 0, 0, 0, aTmpFont.GetLanguage() );
+                                ImplInitDigitMode(pOutDev, aTmpFont.GetLanguage());
 
-                                XubString aText;
+                                OUString aText;
                                 sal_uInt16 nTextStart = 0;
                                 sal_uInt16 nTextLen = 0;
                                 const sal_Int32* pDXArray = 0;
@@ -3057,8 +3057,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
 
                                         for ( nTmpIdx = nTextStart; nTmpIdx <= nTmpEnd ; ++nTmpIdx )
                                         {
-                                            const sal_Unicode cChar = ( nTmpIdx != aText.Len() && ( nTmpIdx != nTextStart || 0 == nTextStart ) ) ?
-                                                                        aText.GetChar( nTmpIdx ) :
+                                            const sal_Unicode cChar = ( nTmpIdx != aText.getLength() && ( nTmpIdx != nTextStart || 0 == nTextStart ) ) ?
+                                                                        aText[nTmpIdx] :
                                                                         0;
 
                                             if ( 0x200B == cChar || 0x2060 == cChar )
@@ -3145,7 +3145,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                                     DBG_ASSERT( pAttr && pAttr->GetItem()->ISA( SvxFieldItem ), "Field of the wrong type! ");
                                     aText = ((EditCharAttribField*)pAttr)->GetFieldValue();
                                     nTextStart = 0;
-                                    nTextLen = aText.Len();
+                                    nTextLen = aText.getLength();
                                     ExtraPortionInfo *pExtraInfo = pTextPortion->GetExtraInfos();
                                     // Do not split the Fields into different lines while editing
                                     if( bStripOnly && !bParsingFields && pExtraInfo && pExtraInfo->lineBreaksList.size() )
@@ -3183,7 +3183,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                                         }
                                     }
 
-                                    pTmpDXArray = new sal_Int32[ aText.Len() ];
+                                    pTmpDXArray = new sal_Int32[ aText.getLength() ];
                                     pDXArray = pTmpDXArray;
                                     Font _aOldFont( GetRefDevice()->GetFont() );
                                     aTmpFont.SetPhysFont( GetRefDevice() );
@@ -3207,17 +3207,17 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                                 else if ( pTextPortion->GetKind() == PORTIONKIND_HYPHENATOR )
                                 {
                                     if ( pTextPortion->GetExtraValue() )
-                                        aText = pTextPortion->GetExtraValue();
-                                    aText += CH_HYPH;
+                                        aText = OUString(pTextPortion->GetExtraValue());
+                                    aText += OUString(CH_HYPH);
                                     nTextStart = 0;
-                                    nTextLen = aText.Len();
+                                    nTextLen = aText.getLength();
 
                                     // crash when accessing 0 pointer in pDXArray
-                                    pTmpDXArray = new sal_Int32[ aText.Len() ];
+                                    pTmpDXArray = new sal_Int32[ aText.getLength() ];
                                     pDXArray = pTmpDXArray;
                                     Font _aOldFont( GetRefDevice()->GetFont() );
                                     aTmpFont.SetPhysFont( GetRefDevice() );
-                                    aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.Len(), pTmpDXArray );
+                                    aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.getLength(), pTmpDXArray );
                                     if ( aStatus.DoRestoreFont() )
                                         GetRefDevice()->SetFont( _aOldFont );
                                 }
@@ -3312,7 +3312,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                                     const Color aTextLineColor(pOutDev->GetTextLineColor());
 
                                     // Unicode code points conversion according to ctl text numeral setting
-                                    ImplInitDigitMode( 0, &aText, nTextStart, nTextLen, aTmpFont.GetLanguage() );
+                                    aText = convertDigits(aText, nTextStart, nTextLen,
+                                        ImplCalcDigitLang(aTmpFont.GetLanguage()));
 
                                     // StripPortions() data callback
                                     GetEditEnginePtr()->DrawingText( aOutPos, aText, nTextStart, nTextLen, pDXArray,
@@ -3412,7 +3413,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                                         if ( pTextPortion->IsRightToLeft() && nTextLen >= 2 &&
                                              pDXArray[ nTextLen - 1 ] ==
                                              pDXArray[ nTextLen - 2 ] &&
-                                             ' ' == aText.GetChar( nTextStart + nTextLen - 1 ) )
+                                             ' ' == aText[nTextStart + nTextLen - 1] )
                                             --nTextLen;
 
                                         // output directly
@@ -3523,8 +3524,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
 
                                     rtl::OUStringBuffer aBuf;
                                     comphelper::string::padToLength(aBuf, nChars, pTextPortion->GetExtraValue());
-                                    String aText(aBuf.makeStringAndClear());
-                                    aTmpFont.QuickDrawText( pOutDev, aTmpPos, aText, 0, aText.Len(), NULL );
+                                    OUString aText(aBuf.makeStringAndClear());
+                                    aTmpFont.QuickDrawText( pOutDev, aTmpPos, aText, 0, aText.getLength(), NULL );
                                     pOutDev->DrawStretchText( aTmpPos, pTextPortion->GetSize().Width(), aText );
 
                                     if ( bStripOnly )
@@ -4229,9 +4230,9 @@ const SvxLRSpaceItem& ImpEditEngine::GetLRSpaceItem( ContentNode* pNode )
     return (const SvxLRSpaceItem&)pNode->GetContentAttribs().GetItem( aStatus.IsOutliner() ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE );
 }
 
-// Either sets the digit mode at the output device or
-// modifies the passed string according to the text numeral setting:
-void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, xub_StrLen nStt, xub_StrLen nLen, LanguageType eCurLang )
+// select a representative text language for the digit type according to the
+// text numeral setting:
+LanguageType ImpEditEngine::ImplCalcDigitLang(LanguageType eCurLang) const
 {
     // #114278# Also setting up digit language from Svt options
     // (cannot reliably inherit the outdev's setting)
@@ -4248,41 +4249,27 @@ void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, x
     else if ( SvtCTLOptions::NUMERALS_SYSTEM == nCTLTextNumerals )
         eLang = (LanguageType) Application::GetSettings().GetLanguageTag().getLanguageType();
 
-    if(pOutDev)
-    {
-        pOutDev->SetDigitLanguage( eLang );
-    }
-    else if (pString)
+    return eLang;
+}
+
+OUString ImpEditEngine::convertDigits(const OUString &rString, sal_Int32 nStt, sal_Int32 nLen, LanguageType eDigitLang) const
+{
+    OUStringBuffer aBuf(rString);
+    for (sal_Int32 nIdx = nStt, nEnd = nStt + nLen; nIdx < nEnd; ++nIdx)
     {
-        // see sallayout.cxx in vcl
-        int nOffset;
-        switch( eLang & LANGUAGE_MASK_PRIMARY )
-        {
-            default:
-                nOffset = 0;
-                break;
-            case LANGUAGE_ARABIC_SAUDI_ARABIA  & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x0660 - '0';  // arabic-indic digits
-                break;
-            case LANGUAGE_URDU          & LANGUAGE_MASK_PRIMARY:
-            case LANGUAGE_PUNJABI       & LANGUAGE_MASK_PRIMARY: //???
-            case LANGUAGE_SINDHI        & LANGUAGE_MASK_PRIMARY:
-                nOffset = 0x06F0 - '0';  // eastern arabic-indic digits
-                break;
-        }
-        if (nOffset)
-        {
-            const xub_StrLen nEnd = nStt + nLen;
-            for( xub_StrLen nIdx = nStt; nIdx < nEnd; ++nIdx )
-            {
-                sal_Unicode nChar = pString->GetChar( nIdx );
-                if( (nChar < '0') || ('9' < nChar) )
-                    continue;
-                nChar = (sal_Unicode)(nChar + nOffset);
-                pString->SetChar( nIdx, nChar );
-            }
-        }
+        sal_Unicode cChar = aBuf[nIdx];
+        if (cChar >= '0' && cChar <= '9')
+            aBuf[nIdx] = GetLocalizedChar(cChar, eDigitLang);
     }
+    return aBuf.makeStringAndClear();
+}
+
+// Either sets the digit mode at the output device
+void ImpEditEngine::ImplInitDigitMode(OutputDevice* pOutDev, LanguageType eCurLang)
+{
+    assert(pOutDev); //persumably there isn't any case where pOutDev should be NULL ?
+    if (pOutDev)
+        pOutDev->SetDigitLanguage(ImplCalcDigitLang(eCurLang));
 }
 
 void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex )
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index bef64af..c430097 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -132,9 +132,6 @@ protected:
 bool IsDiacritic( sal_UCS4 );
 int GetVerticalFlags( sal_UCS4 );
 sal_UCS4 GetVerticalChar( sal_UCS4 );
-// #i80090# GetMirroredChar also needed outside vcl, moved to svapp.hxx
-// VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
-sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
 
 // -------------
 // - SalLayout -
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index 48b87d15..1c741d2 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -74,6 +74,7 @@ namespace awt {
 
 // helper needed by SalLayout implementations as well as svx/source/dialog/svxbmpnumbalueset.cxx
 VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
+VCL_DLLPUBLIC sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
 
 // --------------------
 // - SystemWindowMode -
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index ff56f2c..d9c921d 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -148,7 +148,7 @@ VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 nChar )
 
 // -----------------------------------------------------------------------
 
-sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang )
+VCL_DLLPUBLIC sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang )
 {
     // currently only conversion from ASCII digits is interesting
     if( (nChar < '0') || ('9' < nChar) )


More information about the Libreoffice-commits mailing list