Skip to content

Commit

Permalink
vcl: remove boost/signal2/signal.hpp from header
Browse files Browse the repository at this point in the history
The most relevant signal member function appears to be connect(),
so let's create a wrapper function for that now, without the more
esoteric ordering features for now.

Move the signal member itself to a new pImpl.

The benefits are worth it: preprocessor input reduced by 2.8GB,
that's 9% of the total (excluding system headers which are not counted
because they don't generate dependencies).

Change-Id: I0aaeda51a5630a348bb12c81a83f67afbd508a14
  • Loading branch information
Michael Stahl committed Jul 10, 2015
1 parent ece8699 commit 20bd0a2
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 19 deletions.
2 changes: 2 additions & 0 deletions cui/source/options/optpath.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
#include "optHeaderTabListbox.hxx"
#include <vcl/help.hxx>

#include <boost/scoped_ptr.hpp>

using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
Expand Down
2 changes: 2 additions & 0 deletions cui/source/options/tsaurls.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>

#include <boost/scoped_ptr.hpp>

using namespace ::com::sun::star;

TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
Expand Down
2 changes: 2 additions & 0 deletions filter/source/svg/svgfilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include "svgfilter.hxx"
#include "svgwriter.hxx"

#include <boost/scoped_ptr.hpp>

using namespace ::com::sun::star;

namespace
Expand Down
2 changes: 2 additions & 0 deletions filter/source/svg/svgimport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#include <unotools/mediadescriptor.hxx>
#include <tools/zcodec.hxx>

#include <boost/scoped_ptr.hpp>

using namespace ::com::sun::star;
using namespace ::svgi;

Expand Down
2 changes: 2 additions & 0 deletions include/svtools/DocumentInfoPreview.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <tools/wintypes.hxx>
#include <vcl/window.hxx>

#include <boost/scoped_ptr.hpp>

class SvtDocInfoTable_Impl;

namespace com { namespace sun { namespace star {
Expand Down
16 changes: 13 additions & 3 deletions include/vcl/edit.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@
#ifndef INCLUDED_VCL_EDIT_HXX
#define INCLUDED_VCL_EDIT_HXX

#include <boost/signals2/signal.hpp>
#include <vcl/ctrl.hxx>

#include <functional>
#include <memory>

#include <tools/solar.h>
#include <vcl/dllapi.h>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/menu.hxx>
#include <vcl/dndhelp.hxx>
#include <vcl/vclptr.hxx>
#include <com/sun/star/uno/Reference.h>

// forward declare signals stuff - those headers are staggeringly expensive
namespace boost { namespace signals2 { class connection; } }

namespace com {
namespace sun {
namespace star {
Expand Down Expand Up @@ -68,6 +74,9 @@ enum AutocompleteAction{ AUTOCOMPLETE_KEYINPUT, AUTOCOMPLETE_TABFORWARD, AUTOCOM
class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient
{
private:
struct Impl;
::std::unique_ptr<Impl> m_pImpl;

VclPtr<Edit> mpSubEdit;
Timer* mpUpdateDataTimer;
TextFilter* mpFilterText;
Expand Down Expand Up @@ -244,7 +253,8 @@ public:
void SetSubEdit( Edit* pEdit );
Edit* GetSubEdit() const { return mpSubEdit; }

boost::signals2::signal< void ( Edit* ) > autocompleteSignal;
void SignalConnectAutocomplete(::boost::signals2::connection * pConnection,
::std::function<void (Edit *)>);
AutocompleteAction GetAutocompleteAction() const { return meAutocompleteAction; }

virtual Size CalcMinimumSize() const;
Expand Down
3 changes: 3 additions & 0 deletions sd/source/filter/ppt/pptinanimations.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
#include <pptatom.hxx>
#include "pptin.hxx"
#include "randomnode.hxx"

#include <boost/scoped_ptr.hpp>

#include <algorithm>

using ::std::map;
Expand Down
2 changes: 2 additions & 0 deletions sd/source/ui/func/fuoltext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "ViewShell.hxx"
#include "OutlineViewShell.hxx"

#include <boost/scoped_ptr.hpp>

#include <stdio.h>

namespace sd {
Expand Down
3 changes: 3 additions & 0 deletions sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include <osl/mutex.hxx>
#include <svx/sdrpageuser.hxx>

#include <boost/scoped_ptr.hpp>


namespace sd { namespace slidesorter { namespace cache {

class RequestData;
Expand Down
2 changes: 2 additions & 0 deletions sd/source/ui/slidesorter/controller/SlideSorterController.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>

#include <boost/scoped_ptr.hpp>

using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::sd::slidesorter::model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <tools/link.hxx>
#include <tools/gen.hxx>

#include <boost/scoped_ptr.hpp>

namespace sd { namespace slidesorter {
class SlideSorter;
} }
Expand Down
2 changes: 2 additions & 0 deletions sd/source/ui/tools/PreviewRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/viewcontact.hxx>

#include <boost/scoped_ptr.hpp>

using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;

Expand Down
1 change: 1 addition & 0 deletions sfx2/source/dialog/templdlg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>

#include <vcl/menu.hxx>
#include <vcl/settings.hxx>
Expand Down
2 changes: 2 additions & 0 deletions sfx2/source/doc/graphhelp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#include "graphhelp.hxx"
#include "doc.hrc"

#include <boost/scoped_ptr.hpp>

using namespace css;

SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat )
Expand Down
3 changes: 2 additions & 1 deletion svtools/source/control/inettbc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ void SvtURLBox::Init(bool bSetDefaultHelpID)

SetText( OUString() );

GetSubEdit()->autocompleteSignal.connect( boost::bind( &SvtURLBox::AutoCompleteHandler, this, _1 ) );
GetSubEdit()->SignalConnectAutocomplete(nullptr,
[this] (Edit *const pEdit) { this->AutoCompleteHandler(pEdit); } );
UpdatePicklistForSmartProtocol_Impl();

EnableAutoSize(GetStyle() & WB_AUTOSIZE);
Expand Down
2 changes: 2 additions & 0 deletions svtools/source/control/ruler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <svtools/svtools.hrc>
#include <svtools/colorcfg.hxx>

#include <boost/scoped_ptr.hpp>

#include <vector>

using namespace std;
Expand Down
2 changes: 2 additions & 0 deletions svx/source/fmcomp/gridctrl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

#include <comphelper/property.hxx>

#include <boost/scoped_ptr.hpp>

#include <algorithm>
#include <cstdlib>
#include <map>
Expand Down
2 changes: 2 additions & 0 deletions svx/source/form/fmtextcontrolshell.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
#include <vcl/outdev.hxx>
#include <osl/mutex.hxx>

#include <boost/scoped_ptr.hpp>


namespace svx
{
Expand Down
3 changes: 3 additions & 0 deletions svx/source/svdraw/svdedxv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
#include <sdr/overlay/overlaytools.hxx>
#include <svx/sdr/table/tablecontroller.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>

#include <boost/scoped_ptr.hpp>

#include <memory>


Expand Down
2 changes: 2 additions & 0 deletions sw/source/core/text/pormulti.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include <swtable.hxx>
#include <fmtfsize.hxx>

#include <boost/scoped_ptr.hpp>

using namespace ::com::sun::star;

// A SwMultiPortion is not a simple portion,
Expand Down
2 changes: 2 additions & 0 deletions sw/source/filter/ww8/docxtablestyleexport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <comphelper/sequenceashashmap.hxx>
#include <o3tl/make_unique.hxx>

#include <boost/optional.hpp>

using namespace com::sun::star;
using namespace oox;

Expand Down
8 changes: 6 additions & 2 deletions vcl/source/control/combobox.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,12 @@ void ComboBox::EnableAutocomplete( bool bEnable, bool bMatchCase )
if ( bEnable )
{
if( !m_pImpl->m_AutocompleteConnection.connected())
m_pImpl->m_AutocompleteConnection = m_pImpl->m_pSubEdit->autocompleteSignal.connect(
boost::bind( &ComboBox::Impl::ImplAutocompleteHandler, m_pImpl.get(), _1 ) );
{
m_pImpl->m_pSubEdit->SignalConnectAutocomplete(
&m_pImpl->m_AutocompleteConnection,
[this] (Edit *const pEdit) { m_pImpl->ImplAutocompleteHandler(pEdit); }
);
}
}
else
m_pImpl->m_AutocompleteConnection.disconnect();
Expand Down
47 changes: 34 additions & 13 deletions vcl/source/control/edit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
#include <vcl/unohelp2.hxx>

#include <officecfg/Office/Common.hxx>

#include <boost/signals2/signal.hpp>

#include <memory>

using namespace ::com::sun::star;
Expand Down Expand Up @@ -154,21 +157,29 @@ void Impl_IMEInfos::DestroyAttribs()
nLen = 0;
}

Edit::Edit( WindowType nType ) :
Control( nType )
struct Edit::Impl
{
boost::signals2::signal< void (Edit *) > m_AutocompleteSignal;
};

Edit::Edit( WindowType nType )
: Control( nType )
, m_pImpl(new Impl)
{
ImplInitEditData();
}

Edit::Edit( vcl::Window* pParent, WinBits nStyle ) :
Control( WINDOW_EDIT )
Edit::Edit( vcl::Window* pParent, WinBits nStyle )
: Control( WINDOW_EDIT )
, m_pImpl(new Impl)
{
ImplInitEditData();
ImplInit( pParent, nStyle );
}

Edit::Edit( vcl::Window* pParent, const ResId& rResId ) :
Control( WINDOW_EDIT )
Edit::Edit( vcl::Window* pParent, const ResId& rResId )
: Control( WINDOW_EDIT )
, m_pImpl(new Impl)
{
rResId.SetRT( RSC_EDIT );
WinBits nStyle = ImplInitRes( rResId );
Expand Down Expand Up @@ -1639,12 +1650,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
ImplCopyToSelectionClipboard();
}

if ( bGoEnd && !autocompleteSignal.empty() && !rKEvt.GetKeyCode().GetModifier() )
if (bGoEnd && !m_pImpl->m_AutocompleteSignal.empty() && !rKEvt.GetKeyCode().GetModifier())
{
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
{
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
autocompleteSignal( this );
m_pImpl->m_AutocompleteSignal( this );
}
}

Expand Down Expand Up @@ -1739,12 +1750,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
if ( !mbReadOnly )
{
ImplInsertText(OUString(rKEvt.GetCharCode()), 0, true);
if ( !autocompleteSignal.empty() )
if (!m_pImpl->m_AutocompleteSignal.empty())
{
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
{
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
autocompleteSignal( this );
m_pImpl->m_AutocompleteSignal( this );
}
}
}
Expand Down Expand Up @@ -2103,12 +2114,12 @@ void Edit::Command( const CommandEvent& rCEvt )
Invalidate();

// #i25161# call auto complete handler for ext text commit also
if ( autocompleteSignal.empty() )
if (m_pImpl->m_AutocompleteSignal.empty())
{
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
{
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
autocompleteSignal( this );
m_pImpl->m_AutocompleteSignal( this );
}
}
}
Expand Down Expand Up @@ -2720,7 +2731,7 @@ void Edit::SetSubEdit(Edit* pEdit)
mpSubEdit->mbIsSubEdit = true;

mpSubEdit->SetReadOnly(mbReadOnly);
mpSubEdit->autocompleteSignal.connect(autocompleteSignal);
mpSubEdit->m_pImpl->m_AutocompleteSignal.connect(m_pImpl->m_AutocompleteSignal);
}
}

Expand Down Expand Up @@ -3047,4 +3058,14 @@ Selection Edit::GetSurroundingTextSelection() const
return GetSelection();
}

void Edit::SignalConnectAutocomplete(
boost::signals2::connection *const pConnection,
std::function<void (Edit *)> slot)
{
boost::signals2::connection const& rConnection(
m_pImpl->m_AutocompleteSignal.connect(slot));
if (pConnection)
*pConnection = rConnection;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
2 changes: 2 additions & 0 deletions vcl/source/filter/wmf/wmf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <vcl/gdimetafiletools.hxx>
#include <comphelper/scopeguard.hxx>

#include <boost/bind.hpp>

bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_EXTERNALHEADER *pExtHeader )
{
sal_uInt32 nMetaType;
Expand Down
2 changes: 2 additions & 0 deletions vcl/unx/generic/window/salframe.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
#include "svids.hrc"
#include "impbmp.hxx"

#include <boost/optional.hpp>

#include <algorithm>

#ifndef Button6
Expand Down

0 comments on commit 20bd0a2

Please sign in to comment.