summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-04 15:31:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-05 09:05:32 +0200
commit83c00b33594a59157ed483eb11c3c5022c978939 (patch)
tree88cdb6525b70722ac572c61ec550aee69ef1a32f
parentb93ae66b210f98c193263c4c1cd26d896bbf8e83 (diff)
loplugin:mergerclass merge FillAttrLB with SvxFillAttrBox
Change-Id: I5dfa7689eb219548bde7ce181a0a453c84b0f066 Reviewed-on: https://gerrit.libreoffice.org/43136 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/mergeclasses.results1
-rw-r--r--include/svx/dlgctrl.hxx16
-rw-r--r--include/svx/itemwin.hxx9
-rw-r--r--svx/source/dialog/dlgctrl.cxx143
-rw-r--r--svx/source/tbxctrls/itemwin.cxx145
5 files changed, 147 insertions, 167 deletions
diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results
index 51388db5a6a5..c2527800b025 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -31,7 +31,6 @@ merge EscherPersistTable with EscherEx
merge ExcBoolRecord with Exc1904
merge ExportTyp with ExportBiff5
merge FailTest with testMathMalformedXml
-merge FillAttrLB with SvxFillAttrBox
merge FillTypeLB with SvxFillTypeBox
merge FmGridListener with FmXGridPeer::GridListenerDelegator
merge FmXDisposeListener with DisposeListenerGridBridge
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 0f2bc33f0e18..13387f123317 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -229,22 +229,6 @@ public:
/************************************************************************/
-class SAL_WARN_UNUSED SVX_DLLPUBLIC FillAttrLB : public ListBox
-{
-private:
- BitmapEx maBitmapEx;
-
-public:
- FillAttrLB( vcl::Window* pParent, WinBits aWB );
-
- void Fill( const XHatchListRef &pList );
- void Fill( const XGradientListRef &pList );
- void Fill( const XBitmapListRef &pList );
- void Fill( const XPatternListRef &pList );
-};
-
-/************************************************************************/
-
class SAL_WARN_UNUSED SVX_DLLPUBLIC FillTypeLB : public ListBox
{
diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx
index d0dd8826bc3e..e82c3ca944b9 100644
--- a/include/svx/itemwin.hxx
+++ b/include/svx/itemwin.hxx
@@ -108,19 +108,22 @@ private:
static void ReleaseFocus_Impl();
};
-// class SvxFillAttrBox --------------------------------------------------
-
-class SVX_DLLPUBLIC SvxFillAttrBox : public FillAttrLB
+class SVX_DLLPUBLIC SvxFillAttrBox : public ListBox
{
public:
SvxFillAttrBox( vcl::Window* pParent );
+ void Fill( const XHatchListRef &pList );
+ void Fill( const XGradientListRef &pList );
+ void Fill( const XBitmapListRef &pList );
+ void Fill( const XPatternListRef &pList );
protected:
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
private:
sal_uInt16 nCurPos;
+ BitmapEx maBitmapEx;
static void ReleaseFocus_Impl();
};
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index e031b940a0b8..3a109baa72d1 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1044,27 +1044,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL makeHatchingLB(VclPtr<vcl::Window>
// Fills the listbox (provisional) with strings
-void FillAttrLB::Fill( const XHatchListRef &pList )
-{
- long nCount = pList->Count();
- ListBox::SetUpdateMode( false );
-
- for( long i = 0; i < nCount; i++ )
- {
- const XHatchEntry* pEntry = pList->GetHatch(i);
- const Bitmap aBitmap = pList->GetUiBitmap( i );
- if( !aBitmap.IsEmpty() )
- ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
- else
- InsertEntry( pEntry->GetName() );
- }
-
- AdaptDropDownLineCountToMaximum();
- ListBox::SetUpdateMode( true );
-}
-
-// Fills the listbox (provisional) with strings
-
GradientLB::GradientLB( vcl::Window* pParent, WinBits aWB)
: ListBox( pParent, aWB )
{
@@ -1082,27 +1061,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL makeGradientLB(VclPtr<vcl::Window>
rRet = pListBox;
}
-// Fills the listbox (provisional) with strings
-
-void FillAttrLB::Fill( const XGradientListRef &pList )
-{
- long nCount = pList->Count();
- ListBox::SetUpdateMode( false );
-
- for( long i = 0; i < nCount; i++ )
- {
- const XGradientEntry* pEntry = pList->GetGradient(i);
- const Bitmap aBitmap = pList->GetUiBitmap( i );
- if( !aBitmap.IsEmpty() )
- ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
- else
- InsertEntry( pEntry->GetName() );
- }
-
- AdaptDropDownLineCountToMaximum();
- ListBox::SetUpdateMode( true );
-}
-
// BitmapLB Constructor
BitmapLB::BitmapLB( vcl::Window* pParent, WinBits aWB)
@@ -1122,107 +1080,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL makeBitmapLB(VclPtr<vcl::Window> &
rRet = pListBox;
}
-namespace
-{
- void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize)
- {
- if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0)
- {
- ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
- pVirtualDevice->SetOutputSizePixel(rSize);
-
- if(rBitmapEx.IsTransparent())
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
- if(rStyleSettings.GetPreviewUsesCheckeredBackground())
- {
- const Point aNull(0, 0);
- static const sal_uInt32 nLen(8);
- static const Color aW(COL_WHITE);
- static const Color aG(0xef, 0xef, 0xef);
-
- pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
- }
- else
- {
- pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
- pVirtualDevice->Erase();
- }
- }
-
- if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height())
- {
- rBitmapEx.Scale(rSize);
- pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx);
- }
- else
- {
- const Size aBitmapSize(rBitmapEx.GetSizePixel());
-
- for(long y(0); y < rSize.Height(); y += aBitmapSize.Height())
- {
- for(long x(0); x < rSize.Width(); x += aBitmapSize.Width())
- {
- pVirtualDevice->DrawBitmapEx(
- Point(x, y),
- rBitmapEx);
- }
- }
- }
-
- rBitmapEx = pVirtualDevice->GetBitmap(Point(0, 0), rSize);
- }
- }
-} // end of anonymous namespace
-
-FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB)
- : ListBox(pParent, aWB)
-{
-}
-
-void FillAttrLB::Fill( const XBitmapListRef &pList )
-{
- const long nCount(pList->Count());
- const XBitmapEntry* pEntry;
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
-
- ListBox::SetUpdateMode(false);
-
- for(long i(0); i < nCount; i++)
- {
- pEntry = pList->GetBitmap( i );
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
- formatBitmapExToSize(maBitmapEx, aSize);
- ListBox::InsertEntry(pEntry->GetName(), Image(maBitmapEx));
- }
-
- AdaptDropDownLineCountToMaximum();
- ListBox::SetUpdateMode(true);
-}
-
-void FillAttrLB::Fill( const XPatternListRef &pList )
-{
- const long nCount(pList->Count());
- const XBitmapEntry* pEntry;
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
-
- ListBox::SetUpdateMode(false);
-
- for(long i(0); i < nCount; i++)
- {
- pEntry = pList->GetBitmap( i );
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
- formatBitmapExToSize(maBitmapEx, aSize);
- ListBox::InsertEntry(pEntry->GetName(), Image(maBitmapEx));
- }
-
- AdaptDropDownLineCountToMaximum();
- ListBox::SetUpdateMode(true);
-}
-
void FillTypeLB::Fill()
{
SetUpdateMode( false );
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index b76fbebc7b73..01a189ec6ba5 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -49,7 +49,6 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
@@ -461,7 +460,7 @@ void SvxFillTypeBox::ReleaseFocus_Impl()
}
SvxFillAttrBox::SvxFillAttrBox( vcl::Window* pParent ) :
- FillAttrLB( pParent, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_TABSTOP ),
+ ListBox(pParent, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_TABSTOP),
nCurPos( 0 )
{
SetPosPixel( Point( 90, 0 ) );
@@ -478,13 +477,13 @@ bool SvxFillAttrBox::PreNotify( NotifyEvent& rNEvt )
if ( MouseNotifyEvent::MOUSEBUTTONDOWN == nType || MouseNotifyEvent::GETFOCUS == nType )
nCurPos = GetSelectedEntryPos();
- return FillAttrLB::PreNotify( rNEvt );
+ return ListBox::PreNotify( rNEvt );
}
bool SvxFillAttrBox::EventNotify( NotifyEvent& rNEvt )
{
- bool bHandled = FillAttrLB::EventNotify( rNEvt );
+ bool bHandled = ListBox::EventNotify( rNEvt );
if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
@@ -521,4 +520,142 @@ void SvxFillAttrBox::ReleaseFocus_Impl()
}
}
+// Fills the listbox (provisional) with strings
+
+void SvxFillAttrBox::Fill( const XHatchListRef &pList )
+{
+ long nCount = pList->Count();
+ ListBox::SetUpdateMode( false );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ const XHatchEntry* pEntry = pList->GetHatch(i);
+ const Bitmap aBitmap = pList->GetUiBitmap( i );
+ if( !aBitmap.IsEmpty() )
+ ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+
+ AdaptDropDownLineCountToMaximum();
+ ListBox::SetUpdateMode( true );
+}
+
+// Fills the listbox (provisional) with strings
+
+void SvxFillAttrBox::Fill( const XGradientListRef &pList )
+{
+ long nCount = pList->Count();
+ ListBox::SetUpdateMode( false );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ const XGradientEntry* pEntry = pList->GetGradient(i);
+ const Bitmap aBitmap = pList->GetUiBitmap( i );
+ if( !aBitmap.IsEmpty() )
+ ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+
+ AdaptDropDownLineCountToMaximum();
+ ListBox::SetUpdateMode( true );
+}
+
+namespace
+{
+ void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize)
+ {
+ if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0)
+ {
+ ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
+ pVirtualDevice->SetOutputSizePixel(rSize);
+
+ if(rBitmapEx.IsTransparent())
+ {
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if(rStyleSettings.GetPreviewUsesCheckeredBackground())
+ {
+ const Point aNull(0, 0);
+ static const sal_uInt32 nLen(8);
+ static const Color aW(COL_WHITE);
+ static const Color aG(0xef, 0xef, 0xef);
+
+ pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
+ }
+ else
+ {
+ pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
+ pVirtualDevice->Erase();
+ }
+ }
+
+ if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height())
+ {
+ rBitmapEx.Scale(rSize);
+ pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx);
+ }
+ else
+ {
+ const Size aBitmapSize(rBitmapEx.GetSizePixel());
+
+ for(long y(0); y < rSize.Height(); y += aBitmapSize.Height())
+ {
+ for(long x(0); x < rSize.Width(); x += aBitmapSize.Width())
+ {
+ pVirtualDevice->DrawBitmapEx(
+ Point(x, y),
+ rBitmapEx);
+ }
+ }
+ }
+
+ rBitmapEx = pVirtualDevice->GetBitmap(Point(0, 0), rSize);
+ }
+ }
+} // end of anonymous namespace
+
+void SvxFillAttrBox::Fill( const XBitmapListRef &pList )
+{
+ const long nCount(pList->Count());
+ const XBitmapEntry* pEntry;
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
+
+ ListBox::SetUpdateMode(false);
+
+ for(long i(0); i < nCount; i++)
+ {
+ pEntry = pList->GetBitmap( i );
+ maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+ formatBitmapExToSize(maBitmapEx, aSize);
+ ListBox::InsertEntry(pEntry->GetName(), Image(maBitmapEx));
+ }
+
+ AdaptDropDownLineCountToMaximum();
+ ListBox::SetUpdateMode(true);
+}
+
+void SvxFillAttrBox::Fill( const XPatternListRef &pList )
+{
+ const long nCount(pList->Count());
+ const XBitmapEntry* pEntry;
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
+
+ ListBox::SetUpdateMode(false);
+
+ for(long i(0); i < nCount; i++)
+ {
+ pEntry = pList->GetBitmap( i );
+ maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+ formatBitmapExToSize(maBitmapEx, aSize);
+ ListBox::InsertEntry(pEntry->GetName(), Image(maBitmapEx));
+ }
+
+ AdaptDropDownLineCountToMaximum();
+ ListBox::SetUpdateMode(true);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */