summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r--svx/source/tbxctrls/SvxColorValueSet.cxx6
-rw-r--r--svx/source/tbxctrls/colrctrl.cxx10
-rw-r--r--svx/source/tbxctrls/formatpaintbrushctrl.cxx2
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx2
-rw-r--r--svx/source/tbxctrls/itemwin.cxx4
-rw-r--r--svx/source/tbxctrls/linectrl.cxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx221
-rw-r--r--svx/source/tbxctrls/tbunocontroller.cxx9
-rw-r--r--svx/source/tbxctrls/tbxcolorupdate.cxx2
9 files changed, 155 insertions, 103 deletions
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index e1bc89c12385..baecf497ec28 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -40,21 +40,21 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxColorValueSet(vcl::
return new SvxColorValueSet(pParent, nWinBits);
}
-sal_uInt32 SvxColorValueSet::getMaxRowCount() const
+sal_uInt32 SvxColorValueSet::getMaxRowCount()
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
return rStyleSettings.GetColorValueSetMaximumRowCount();
}
-sal_uInt32 SvxColorValueSet::getEntryEdgeLength() const
+sal_uInt32 SvxColorValueSet::getEntryEdgeLength()
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
return rStyleSettings.GetListBoxPreviewDefaultPixelSize().Height() + 1;
}
-sal_uInt32 SvxColorValueSet::getColumnCount() const
+sal_uInt32 SvxColorValueSet::getColumnCount()
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index c3a3402c4037..23c743ca9d4e 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -230,10 +230,10 @@ SvxColorDockingWindow::SvxColorDockingWindow
}
}
- aItemSize = aColorSet->CalcItemSizePixel(Size(aColorSet->getEntryEdgeLength(), aColorSet->getEntryEdgeLength()));
- aItemSize.Width() = aItemSize.Width() + aColorSet->getEntryEdgeLength();
+ aItemSize = aColorSet->CalcItemSizePixel(Size(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength()));
+ aItemSize.Width() = aItemSize.Width() + SvxColorValueSet::getEntryEdgeLength();
aItemSize.Width() /= 2;
- aItemSize.Height() = aItemSize.Height() + aColorSet->getEntryEdgeLength();
+ aItemSize.Height() = aItemSize.Height() + SvxColorValueSet::getEntryEdgeLength();
aItemSize.Height() /= 2;
SetSize();
@@ -274,7 +274,7 @@ void SvxColorDockingWindow::FillValueSet()
aColorSet->Clear();
// create the first entry for 'invisible/none'
- const Size aColorSize(aColorSet->getEntryEdgeLength(), aColorSet->getEntryEdgeLength());
+ const Size aColorSize(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength());
long nPtX = aColorSize.Width() - 1;
long nPtY = aColorSize.Height() - 1;
ScopedVclPtrInstance< VirtualDevice > pVD;
@@ -491,7 +491,7 @@ void SvxColorDockingWindow::Resize()
-void SvxColorDockingWindow::GetFocus (void)
+void SvxColorDockingWindow::GetFocus()
{
SfxDockingWindow::GetFocus();
// Grab the focus to the color value set so that it can be controlled
diff --git a/svx/source/tbxctrls/formatpaintbrushctrl.cxx b/svx/source/tbxctrls/formatpaintbrushctrl.cxx
index 2bcccfa2b978..4bea14d66947 100644
--- a/svx/source/tbxctrls/formatpaintbrushctrl.cxx
+++ b/svx/source/tbxctrls/formatpaintbrushctrl.cxx
@@ -40,7 +40,7 @@ FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl( sal_uInt16 nSlot
, m_bPersistentCopy(false)
, m_aDoubleClickTimer()
{
- sal_uIntPtr nDblClkTime = rTbx.GetSettings().GetMouseSettings().GetDoubleClickTime();
+ sal_uInt64 nDblClkTime = rTbx.GetSettings().GetMouseSettings().GetDoubleClickTime();
m_aDoubleClickTimer.SetTimeoutHdl( LINK(this, FormatPaintBrushToolBoxControl, WaitDoubleClickHdl) );
m_aDoubleClickTimer.SetTimeout(nDblClkTime);
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 26aebdeabf31..5cc2a78736a2 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -321,7 +321,7 @@ private:
virtual void Select() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
- void ImplReleaseFocus();
+ static void ImplReleaseFocus();
public:
ImplGrafModeControl( vcl::Window* pParent, const Reference< XFrame >& rFrame );
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 3b15a2a2877e..09008172a790 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -51,8 +51,6 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
-#define LOGICAL_EDIT_HEIGHT 12
-
SvxLineBox::SvxLineBox( vcl::Window* pParent, const Reference< XFrame >& rFrame, WinBits nBits ) :
LineLB( pParent, nBits ),
nCurPos ( 0 ),
@@ -229,8 +227,6 @@ void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt )
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{
SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
- Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
- SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
}
LineLB::DataChanged( rDCEvt );
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 82be0ad0e714..5f303bc76b98 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -599,7 +599,7 @@ void SvxLineEndWindow::SetSize()
//SetMinOutputSizePixel( aSize );
}
-void SvxLineEndWindow::GetFocus (void)
+void SvxLineEndWindow::GetFocus()
{
SfxPopupWindow::GetFocus();
// Grab the focus to the line ends value set so that it can be controlled
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 0e94807a483e..94dd822d5b1c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -93,7 +93,6 @@
#include <svx/xflclit.hxx>
#define MAX_MRU_FONTNAME_ENTRIES 5
-#define LOGICAL_EDIT_HEIGHT 12
// don't make more than 15 entries visible at once
#define MAX_STYLES_ENTRIES static_cast< sal_uInt16 >( 15 )
@@ -124,7 +123,7 @@ public:
virtual void dispose() SAL_OVERRIDE;
void SetFamily( SfxStyleFamily eNewFamily );
- inline bool IsVisible() { return bVisible; }
+ bool IsVisible() const { return bVisible; }
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -133,10 +132,12 @@ public:
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
- inline void SetVisibilityListener( const Link& aVisListener ) { aVisibilityListener = aVisListener; }
+ void SetVisibilityListener( const Link& aVisListener ) { aVisibilityListener = aVisListener; }
void SetDefaultStyle( const OUString& rDefault ) { sDefaultStyle = rDefault; }
+ void CalcOptimalExtraUserWidth();
+
protected:
virtual void Select() SAL_OVERRIDE;
@@ -158,7 +159,10 @@ private:
PopupMenu m_aMenu;
void ReleaseFocus();
- Color TestColorsVisible(const Color &FontCol, const Color &BackCol);
+ static Color TestColorsVisible(const Color &FontCol, const Color &BackCol);
+ void UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName);
+ void SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, OutputDevice *pDevice, const OUString &rStyleName, bool bIsNotSelected);
+ bool AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle& rTextRect, long nHeight);
DECL_LINK( MenuSelectHdl, Menu * );
};
@@ -189,6 +193,8 @@ private:
}
DECL_DLLPRIVATE_LINK( CheckAndMarkUnknownFont, VclWindowEvent* );
+ void SetOptimalSize();
+
protected:
virtual void Select() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
@@ -300,6 +306,9 @@ class SfxStyleControllerItem_Impl : public SfxStatusListener
SvxStyleToolBoxControl& rControl;
};
+#define BUTTON_WIDTH 20
+#define ITEM_HEIGHT 30
+
SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent,
const OUString& rCommand,
SfxStyleFamily eFamily,
@@ -327,7 +336,7 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent,
aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT );
EnableAutocomplete( true );
EnableUserDraw( true );
- SetUserItemSize( Size( 0, 30 ) );
+ SetUserItemSize( Size( 0, ITEM_HEIGHT ) );
}
SvxStyleBox_Impl::~SvxStyleBox_Impl()
@@ -534,8 +543,6 @@ void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{
SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
- Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
- SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
}
ComboBox::DataChanged( rDCEvt );
@@ -559,18 +566,51 @@ void SvxStyleBox_Impl::StateChanged( StateChangedType nStateChange )
}
}
-void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
+bool SvxStyleBox_Impl::AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle& rTextRect, long nHeight)
{
- sal_uInt16 nItem = rUDEvt.GetItemId();
+ if (rTextRect.Bottom() > nHeight)
+ {
+ // the text does not fit, adjust the font size
+ double ratio = static_cast< double >( nHeight ) / rTextRect.Bottom();
+ vcl::Font aFont(pDevice->GetFont());
+ Size aPixelSize(aFont.GetSize());
+ aPixelSize.Width() *= ratio;
+ aPixelSize.Height() *= ratio;
+ aFont.SetSize(aPixelSize);
+ pDevice->SetFont(aFont);
+ return true;
+ }
+ return false;
+}
- if ( nItem == 0 || nItem == GetEntryCount() - 1 )
+void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName)
+{
+ OutputDevice *pDevice = rUDEvt.GetDevice();
+
+ // IMG_TXT_DISTANCE in ilstbox.hxx is 6, then 1 is added as
+ // nBorder, and we are adding 1 in order to look better when
+ // italics is present
+ const int nLeftDistance = 8;
+
+ Rectangle aTextRect;
+ pDevice->GetTextBoundRect(aTextRect, rStyleName);
+
+ Point aPos( rUDEvt.GetRect().TopLeft() );
+ aPos.X() += nLeftDistance;
+
+ if (!AdjustFontForItemHeight(pDevice, aTextRect, rUDEvt.GetRect().GetHeight()))
+ aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aTextRect.Bottom() ) / 2;
+
+ pDevice->DrawText(aPos, rStyleName);
+}
+
+void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, OutputDevice* pDevice, const OUString& rStyleName, bool bIsNotSelected)
+{
+ if (nItem == 0 || nItem == GetEntryCount() - 1)
{
- Rectangle aRect(rUDEvt.GetRect());
- unsigned int nId = (aRect.getY() / aRect.GetSize().Height());
+ unsigned int nId = (rRect.getY() / rRect.GetSize().Height());
if(nId < MAX_STYLES_ENTRIES && m_pButtons[nId])
m_pButtons[nId]->Hide();
- // draw the non-style entries, ie. "Clear Formatting" or "More..."
- DrawEntry( rUDEvt, true, true );
}
else
{
@@ -578,23 +618,16 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
SfxStyleSheetBase* pStyle = NULL;
- OUString aStyleName( GetEntry( nItem ) );
-
if ( pPool )
{
pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
pStyle = pPool->First();
- while ( pStyle && OUString( pStyle->GetName() ) != aStyleName )
+ while (pStyle && pStyle->GetName() != rStyleName)
pStyle = pPool->Next();
}
- if ( !pStyle )
- {
- // cannot find the style for whatever reason
- DrawEntry( rUDEvt, true, true );
- }
- else
+ if (pStyle )
{
const SfxItemSet& aItemSet = pStyle->GetItemSet();
@@ -603,8 +636,6 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
if ( pFontItem && pFontHeightItem )
{
- OutputDevice *pDevice = rUDEvt.GetDevice();
-
Size aFontSize( 0, pFontHeightItem->GetHeight() );
Size aPixelSize( pDevice->LogicToPixel( aFontSize, pShell->GetMapUnit() ) );
@@ -656,25 +687,21 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
// setup the device & draw
vcl::Font aOldFont( pDevice->GetFont() );
- Color aOldColor( pDevice->GetTextColor() );
- Color aOldFillColor( pDevice->GetFillColor() );
Color aFontCol = COL_AUTO, aBackCol = COL_AUTO;
pDevice->SetFont( aFont );
- bool IsNotSelected = rUDEvt.GetItemId() != GetSelectEntryPos();
-
pItem = aItemSet.GetItem( SID_ATTR_CHAR_COLOR );
// text color, when nothing is selected
- if ( (NULL != pItem) && IsNotSelected)
+ if ( (NULL != pItem) && bIsNotSelected)
aFontCol = Color( static_cast< const SvxColorItem* >( pItem )->GetValue() );
sal_uInt16 style = drawing::FillStyle_NONE;
// which kind of Fill style is selected
pItem = aItemSet.GetItem( XATTR_FILLSTYLE );
// only when ok and not selected
- if ( (NULL != pItem) && IsNotSelected)
+ if ( (NULL != pItem) && bIsNotSelected)
style = static_cast< const XFillStyleItem* >( pItem )->GetValue();
switch(style)
@@ -689,13 +716,13 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
if ( aBackCol != COL_AUTO )
{
pDevice->SetFillColor( aBackCol );
- pDevice->DrawRect( rUDEvt.GetRect() );
+ pDevice->DrawRect(rRect);
}
}
break;
//TODO Draw the other background styles: gradient, hatching and bitmap
- }
+ }
// when the font and background color are too similar, adjust the Font-Color
if( (aFontCol != COL_AUTO) || (aBackCol != COL_AUTO) )
@@ -706,65 +733,89 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
pDevice->SetTextColor( aFontCol );
// handle the push-button
- if (IsNotSelected)
+ if (bIsNotSelected)
{
- Rectangle aRect(rUDEvt.GetRect());
- unsigned int nId = (aRect.getY() / aRect.GetSize().Height());
+ unsigned int nId = (rRect.getY() / rRect.GetSize().Height());
if(nId < MAX_STYLES_ENTRIES && m_pButtons[nId])
m_pButtons[nId]->Hide();
}
else
{
- Rectangle aRect(rUDEvt.GetRect());
- unsigned int nId = (aRect.getY() / aRect.GetSize().Height());
+ unsigned int nId = (rRect.getY() / rRect.GetSize().Height());
if(nId < MAX_STYLES_ENTRIES)
{
if(m_pButtons[nId] == nullptr)
{
m_pButtons[nId] = VclPtr<MenuButton>::Create(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS);
- m_pButtons[nId]->SetSizePixel(Size(20, aRect.GetSize().Height()));
+ m_pButtons[nId]->SetSizePixel(Size(BUTTON_WIDTH, rRect.GetSize().Height()));
m_pButtons[nId]->SetPopupMenu(&m_aMenu);
}
- m_pButtons[nId]->SetPosPixel(Point(aRect.GetWidth() - 20, aRect.getY()));
+ m_pButtons[nId]->SetPosPixel(Point(rRect.GetWidth() - BUTTON_WIDTH, rRect.getY()));
m_pButtons[nId]->Show();
}
}
+ }
+ }
+ }
+}
- // IMG_TXT_DISTANCE in ilstbox.hxx is 6, then 1 is added as
- // nBorder, and we are adding 1 in order to look better when
- // italics is present
- const int nLeftDistance = 8;
+void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ sal_uInt16 nItem = rUDEvt.GetItemId();
+ OUString aStyleName( GetEntry( nItem ) );
- Rectangle aTextRect;
- pDevice->GetTextBoundRect( aTextRect, aStyleName );
+ OutputDevice *pDevice = rUDEvt.GetDevice();
+ pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
- Point aPos( rUDEvt.GetRect().TopLeft() );
- aPos.X() += nLeftDistance;
- if ( aTextRect.Bottom() > rUDEvt.GetRect().GetHeight() )
- {
- // the text does not fit, adjust the font size
- double ratio = static_cast< double >( rUDEvt.GetRect().GetHeight() ) / aTextRect.Bottom();
- aPixelSize.Width() *= ratio;
- aPixelSize.Height() *= ratio;
- aFont.SetSize( aPixelSize );
- pDevice->SetFont( aFont );
- }
- else
- aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aTextRect.Bottom() ) / 2;
+ const Rectangle& rRect(rUDEvt.GetRect());
+ bool bIsNotSelected = rUDEvt.GetItemId() != GetSelectEntryPos();
- pDevice->DrawText( aPos, aStyleName );
+ SetupEntry(nItem, rRect, pDevice, aStyleName, bIsNotSelected);
- pDevice->SetFillColor( aOldFillColor );
- pDevice->SetTextColor( aOldColor );
- pDevice->SetFont( aOldFont );
+ UserDrawEntry(rUDEvt, aStyleName);
- // draw separator, if present
- DrawEntry( rUDEvt, false, false );
- }
- else
- DrawEntry( rUDEvt, true, true );
+ pDevice->Pop();
+ // draw separator, if present
+ DrawEntry( rUDEvt, false, false );
+}
+
+void SvxStyleBox_Impl::CalcOptimalExtraUserWidth()
+{
+ long nMaxNormalFontWidth = 0;
+ sal_Int32 nEntryCount = GetEntryCount();
+ for (sal_Int32 i = 0; i < nEntryCount; ++i)
+ {
+ OUString sStyleName(GetEntry(i));
+ Rectangle aTextRectForDefaultFont;
+ GetTextBoundRect(aTextRectForDefaultFont, sStyleName);
+
+ const long nWidth = aTextRectForDefaultFont.GetWidth();
+
+ nMaxNormalFontWidth = std::max(nWidth, nMaxNormalFontWidth);
+ }
+
+ long nMaxUserDrawFontWidth = nMaxNormalFontWidth;
+ for (sal_Int32 i = 1; i < nEntryCount-1; ++i)
+ {
+ OUString sStyleName(GetEntry(i));
+
+ Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
+ SetupEntry(i, Rectangle(0, 0, RECT_MAX, ITEM_HEIGHT), this, sStyleName, false);
+ Rectangle aTextRectForActualFont;
+ GetTextBoundRect(aTextRectForActualFont, sStyleName);
+ if (AdjustFontForItemHeight(this, aTextRectForActualFont, ITEM_HEIGHT))
+ {
+ //Font didn't fit, so it was changed, refetch with final font size
+ GetTextBoundRect(aTextRectForActualFont, sStyleName);
}
+ Pop();
+
+ const long nWidth = aTextRectForActualFont.GetWidth() + BUTTON_WIDTH;
+
+ nMaxUserDrawFontWidth = std::max(nWidth, nMaxUserDrawFontWidth);
}
+
+ SetUserItemSize(Size(nMaxUserDrawFontWidth - nMaxNormalFontWidth, ITEM_HEIGHT));
}
// test is the color between Font- and background-color to be identify
@@ -873,10 +924,7 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( vcl::Window* pParent, const Reference<
m_xFrame (_xFrame),
mbEndPreview(false)
{
- Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT));
- set_width_request(aSize.Width());
- set_height_request(aSize.Height());
- SetSizePixel(aSize);
+ SetOptimalSize();
EnableControls_Impl();
GetSubEdit()->AddEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont ));
}
@@ -1001,14 +1049,20 @@ bool SvxFontNameBox_Impl::Notify( NotifyEvent& rNEvt )
return nHandled || FontNameBox::Notify( rNEvt );
}
+void SvxFontNameBox_Impl::SetOptimalSize()
+{
+ Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT));
+ set_width_request(aSize.Width());
+ set_height_request(aSize.Height());
+ SetSizePixel(aSize);
+}
+
void SvxFontNameBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{
- SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
- Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
- SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
+ SetOptimalSize();
}
else if ( ( rDCEvt.GetType() == DataChangedEventType::FONTS ) ||
( rDCEvt.GetType() == DataChangedEventType::DISPLAY ) )
@@ -1059,8 +1113,17 @@ void SvxFontNameBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
// or select
if ( rUDEvt.GetItemId() == rUDEvt.GetStyle() )
{
+ OUString fontName(GetText());
+ if (IsInDropDown())
+ {
+ /*
+ * when in dropdown mode the selected item should be
+ * used and not the current selection
+ */
+ fontName = GetEntry(rUDEvt.GetItemId());
+ }
Sequence< PropertyValue > aArgs( 1 );
- vcl::FontInfo aInfo( pFontList->Get( GetEntry( rUDEvt.GetItemId() ),
+ vcl::FontInfo aInfo( pFontList->Get( fontName,
aCurFont.GetWeight(),
aCurFont.GetItalic() ) );
@@ -1917,7 +1980,7 @@ struct SvxStyleToolBoxControl::Impl
bool bSpecModeWriter;
bool bSpecModeCalc;
- inline Impl( void )
+ inline Impl()
:aClearForm ( SVX_RESSTR( RID_SVXSTR_CLEARFORM ) )
,aMore ( SVX_RESSTR( RID_SVXSTR_MORE_STYLES ) )
,bSpecModeWriter ( false )
@@ -2128,7 +2191,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
{
const SfxStyleFamily eFamily = GetActFamily();
- sal_uInt16 nCount = pStyleSheetPool->Count();
+ sal_uInt16 nCount = pStyleSheetPool->Count();
SfxStyleSheetBase* pStyle = NULL;
bool bDoFill = false;
@@ -2228,6 +2291,8 @@ void SvxStyleToolBoxControl::FillStyleBox()
sal_uInt16 nLines = static_cast<sal_uInt16>(
std::min( pBox->GetEntryCount(), static_cast<sal_Int32>(MAX_STYLES_ENTRIES)));
pBox->SetDropDownLineCount( nLines );
+
+ pBox->CalcOptimalExtraUserWidth();
}
}
}
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index 21b2e98fc30e..eb25ce945b3f 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -38,8 +38,6 @@
#include <boost/scoped_ptr.hpp>
-#define LOGICAL_EDIT_HEIGHT 12
-
using namespace ::com::sun::star;
namespace {
@@ -132,8 +130,6 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl(
SetText( "" );
}
-
-
void SvxFontSizeBox_Impl::ReleaseFocus_Impl()
{
if ( !m_bRelease )
@@ -263,13 +259,8 @@ void SvxFontSizeBox_Impl::SetOptimalSize()
Size aPrefSize(LogicToPixel(m_aLogicalSize, MAP_APPFONT));
aPrefSize.Width() = get_preferred_size().Width();
SetSizePixel(aPrefSize);
- Size aDropSize(LogicToPixel(Size(0, LOGICAL_EDIT_HEIGHT), MAP_APPFONT));
- aDropSize.Width() = aPrefSize.Width();
- SetDropDownSizePixel(aDropSize);
}
-
-
void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 13029b6f1b24..ff4dc5e53050 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -48,7 +48,7 @@ namespace svx
, maCurColor(COL_TRANSPARENT)
{
DBG_ASSERT(pToolBox, "ToolBox not found :-(");
- mbWasHiContrastMode = pToolBox ? pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode() : false;
+ mbWasHiContrastMode = pToolBox && pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode();
switch (mnSlotId)
{
case SID_ATTR_CHAR_COLOR: