diff options
author | Felix Zhang <fezhang@suse.com> | 2011-11-02 18:47:32 +0800 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-11-02 14:30:15 +0100 |
commit | 8c4b9f7c6bdecca8ec405272a23c7ca35ca0617e (patch) | |
tree | f25030a7de8b1f4fee387354d9ee232f9cb71974 /toolkit/source/layout/vcl | |
parent | f65946944eca8da10d1e54a78eb2537e205e855c (diff) |
remove unused methods in layout
Diffstat (limited to 'toolkit/source/layout/vcl')
-rw-r--r-- | toolkit/source/layout/vcl/wbutton.cxx | 447 | ||||
-rw-r--r-- | toolkit/source/layout/vcl/wcontainer.cxx | 135 | ||||
-rw-r--r-- | toolkit/source/layout/vcl/wfield.cxx | 407 | ||||
-rw-r--r-- | toolkit/source/layout/vcl/wrapper.cxx | 405 |
4 files changed, 42 insertions, 1352 deletions
diff --git a/toolkit/source/layout/vcl/wbutton.cxx b/toolkit/source/layout/vcl/wbutton.cxx index 5c72b1707f3d..f3272dcc1c85 100644 --- a/toolkit/source/layout/vcl/wbutton.cxx +++ b/toolkit/source/layout/vcl/wbutton.cxx @@ -31,8 +31,6 @@ #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/XActionListener.hpp> #include <com/sun/star/awt/XButton.hpp> -#include <com/sun/star/awt/XCheckBox.hpp> -#include <com/sun/star/awt/XRadioButton.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <cppuhelper/implbase1.hxx> #include <toolkit/awt/vclxwindow.hxx> @@ -69,16 +67,6 @@ class ImageImpl } }; -Image::Image( const char *pName ) - : pImpl( new ImageImpl( pName ) ) -{ -} - -Image::~Image() -{ - delete pImpl; -} - class ButtonImpl : public ControlImpl , public ::cppu::WeakImplHelper1< awt::XActionListener > { @@ -150,38 +138,11 @@ void Button::SetText( OUString const& rStr ) getImpl().mxButton->setLabel( rStr ); } -void Button::SetClickHdl( const Link& link ) -{ - if (&getImpl () && getImpl().mxButton.is ()) - getImpl().SetClickHdl( link ); -} - -Link& Button::GetClickHdl () -{ - return getImpl().GetClickHdl (); -} - -bool Button::SetModeImage (Image const& image) -{ - return getImpl().SetModeImage (image.getImpl().mxGraphic); -} - -bool Button::SetModeImage (::Image const& image) -{ - return GetButton ()->SetModeImage (image); -} - -void Button::SetImageAlign( ImageAlign eAlign ) -{ - getImpl().setProperty( "ImageAlign", uno::Any( (sal_Int16) eAlign ) ); -} - void Button::Click() { } IMPL_GET_IMPL( Button ); -IMPL_CONSTRUCTORS( Button, Control, "button" ); IMPL_GET_WINDOW (Button); class PushButtonImpl : public ButtonImpl @@ -239,16 +200,6 @@ void PushButton::Check( bool bCheck ) getImpl().fireToggle(); } -bool PushButton::IsChecked() const -{ - return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() ); -} - -void PushButton::Toggle() -{ - Check( true ); -} - void PushButton::SetToggleHdl( const Link& link ) { if (&getImpl () && getImpl().mxButton.is ()) @@ -256,173 +207,8 @@ void PushButton::SetToggleHdl( const Link& link ) } IMPL_GET_IMPL( PushButton ); -IMPL_CONSTRUCTORS( PushButton, Button, "pushbutton" ); IMPL_GET_WINDOW (PushButton); -class RadioButtonImpl : public ButtonImpl - , public ::cppu::WeakImplHelper1< awt::XItemListener > -{ - Link maToggleHdl; -public: - uno::Reference< awt::XRadioButton > mxRadioButton; - RadioButtonImpl( Context *context, const PeerHandle &peer, Window *window ) - : ButtonImpl( context, peer, window ) - , mxRadioButton( peer, uno::UNO_QUERY ) - { - } - - void Check( bool bCheck ) - { - if ( !mxRadioButton.is() ) - return; - - // Have setState fire item event for - // RadioGroups::RadioGroup::itemStateChanged () - ::RadioButton *r = static_cast<RadioButton*>(mpWindow)->GetRadioButton (); - bool state = r->IsRadioCheckEnabled (); - r->EnableRadioCheck(); - mxRadioButton->setState( !!bCheck ); - r->EnableRadioCheck (state); - fireToggle(); - } - - bool IsChecked() - { - if ( !mxRadioButton.is() ) - return false; - return mxRadioButton->getState(); - } - - void SetToggleHdl( const Link& link ) - { - if (!link && !!maToggleHdl) - mxRadioButton->removeItemListener( this ); - else if (!!link && !maToggleHdl) - mxRadioButton->addItemListener( this ); - maToggleHdl = link; - } - - inline void fireToggle() - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } - - virtual void SetClickHdl( const Link& link ) - { - // Keep RadioGroups::RadioGroup's actionListener at HEAD - // of list. This way, it can handle RadioGroup's button - // states before all other callbacks and make sure the - // client code has the right state. - - // IWBN to add an XRadioButton2 and layout::VCLXRadioButton - // with {get,set}RadioGroup() (and a "radiogroup" property - // even) and handle the grouping here in RadioButtonImpl. - uno::Reference< uno::XInterface > x = static_cast<VCLXRadioButton*> (mpWindow->GetVCLXWindow ())->getFirstActionListener (); - uno::Reference< awt::XActionListener > a = uno::Reference< awt::XActionListener> (x ,uno::UNO_QUERY ); - mxButton->removeActionListener (a); - ButtonImpl::SetClickHdl (link); - mxButton->addActionListener (a); - } - - void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) - { - ButtonImpl::disposing (e); - } - - virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& ) - throw (uno::RuntimeException) - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } -}; - -RadioButton::~RadioButton () -{ - SetToggleHdl (Link ()); -} - -void RadioButton::Check( bool bCheck ) -{ - getImpl().Check( bCheck ); -} - -bool RadioButton::IsChecked() const -{ - return getImpl().IsChecked(); -} - -void RadioButton::SetToggleHdl( const Link& link ) -{ - if (&getImpl () && getImpl().mxRadioButton.is ()) - getImpl().SetToggleHdl( link ); -} - -IMPL_GET_IMPL( RadioButton ); -IMPL_GET_WINDOW( RadioButton ); -IMPL_GET_VCLXWINDOW( RadioButton ); -IMPL_CONSTRUCTORS( RadioButton, Button, "radiobutton" ); - -class CheckBoxImpl : public ButtonImpl - , public ::cppu::WeakImplHelper1< awt::XItemListener > -{ - Link maToggleHdl; - public: - uno::Reference< awt::XCheckBox > mxCheckBox; - CheckBoxImpl( Context *context, const PeerHandle &peer, Window *window ) - : ButtonImpl( context, peer, window ) - , mxCheckBox( peer, uno::UNO_QUERY ) - { - } - - void SetToggleHdl( const Link& link ) - { - if (!link && !!maToggleHdl) - mxCheckBox->removeItemListener( this ); - else if (!!link && !maToggleHdl) - mxCheckBox->addItemListener( this ); - maToggleHdl = link; - } - void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) - { - ButtonImpl::disposing (e); - } - virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& ) - throw (uno::RuntimeException) - { - maToggleHdl.Call( static_cast<Window *>( mpWindow ) ); - } -}; - -CheckBox::~CheckBox () -{ - SetToggleHdl (Link ()); -} - -void CheckBox::Check( bool bCheck ) -{ - if ( !getImpl().mxCheckBox.is() ) - return; - getImpl().mxCheckBox->setState( !!bCheck ); -} - -bool CheckBox::IsChecked() const -{ - if ( !getImpl().mxCheckBox.is() ) - return false; - return getImpl().mxCheckBox->getState() != 0; -} - -void CheckBox::SetToggleHdl( const Link& link ) -{ - if (&getImpl () && getImpl().mxCheckBox.is ()) - getImpl().SetToggleHdl( link ); -} - -IMPL_GET_IMPL( CheckBox ); -IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" ); - #define BUTTON_IMPL(t, parent, response) \ class t##Impl : public parent##Impl \ { \ @@ -447,232 +233,59 @@ IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" ); #define BUTTONID_RESET RET_RESET #define BUTTONID_APPLY RET_APPLY -BUTTON_IMPL( OKButton, PushButton, BUTTONID_OK ); BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL ); BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES ); BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO ); BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY ); BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE ); -BUTTON_IMPL( ResetButton, PushButton, BUTTONID_RESET ); -BUTTON_IMPL( ApplyButton, PushButton, BUTTONID_APPLY ); /* Deprecated? */ BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP ); -IMPL_CONSTRUCTORS( OKButton, PushButton, "okbutton" ); -IMPL_CONSTRUCTORS( CancelButton, PushButton, "cancelbutton" ); -IMPL_CONSTRUCTORS( YesButton, PushButton, "yesbutton" ); -IMPL_CONSTRUCTORS( NoButton, PushButton, "nobutton" ); -IMPL_CONSTRUCTORS( RetryButton, PushButton, "retrybutton" ); -IMPL_CONSTRUCTORS( IgnoreButton, PushButton, "ignorebutton" ); -IMPL_CONSTRUCTORS( ResetButton, PushButton, "resetbutton" ); -IMPL_CONSTRUCTORS( ApplyButton, PushButton, "applybutton" ); /* Deprecated? */ -IMPL_CONSTRUCTORS( HelpButton, PushButton, "helpbutton" ); - -IMPL_IMPL (ImageButton, PushButton) - - -IMPL_CONSTRUCTORS( ImageButton, PushButton, "imagebutton" ); - -class AdvancedButtonImpl : public PushButtonImpl -{ -protected: - bool bAdvancedMode; - std::list< Window*> maAdvanced; - std::list< Window*> maSimple; - -public: - rtl::OUString mAdvancedLabel; - rtl::OUString mSimpleLabel; - -protected: - Window* Remove( std::list< Window*> lst, Window* w ) - { - for ( std::list< Window*>::iterator it = maAdvanced.begin(); - it != maAdvanced.end(); ++it ) - if ( *it == w ) - { - it = lst.erase( it ); - return *it; - } - return 0; - } - -public: - AdvancedButtonImpl( Context *context, PeerHandle const& peer, Window *window ) - : PushButtonImpl( context, peer, window ) - , bAdvancedMode( false ) - // TODO: i18n - // Button::GetStandardText( BUTTON_ADVANCED ); - // Button::GetStandardText( BUTTON_SIMPLE ); - , mAdvancedLabel( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Advanced...")) ) - , mSimpleLabel( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Simple...")) ) - { - } - void Click() - { - bAdvancedMode = !bAdvancedMode; - if ( bAdvancedMode ) - advancedMode(); - else - simpleMode(); - } - void setAlign () - { - ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton (); - b->SetSymbolAlign (SYMBOLALIGN_RIGHT); - b->SetSmallSymbol (); - //mpWindow->SetStyle (mpWindow->GetStyle() | WB_CENTER); - } - void advancedMode() - { - ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton (); - b->SetSymbol (SYMBOL_PAGEUP); - setAlign (); - if (mSimpleLabel.getLength ()) - b->SetText (mSimpleLabel); - for ( std::list< Window*>::iterator it = maAdvanced.begin(); - it != maAdvanced.end(); ++it ) - ( *it )->Show(); - for ( std::list< Window*>::iterator it = maSimple.begin(); - it != maSimple.end(); ++it ) - ( *it )->Hide(); - - redraw (); - } - void simpleMode() - { - //mxButton->setLabel( mSimpleLabel ); - ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton (); - b->SetSymbol (SYMBOL_PAGEDOWN); - if (mAdvancedLabel.getLength ()) - b->SetText (mAdvancedLabel); - setAlign (); - for ( std::list< Window*>::iterator it = maAdvanced.begin(); - it != maAdvanced.end(); ++it ) - ( *it )->Hide(); - for ( std::list< Window*>::iterator it = maSimple.begin(); - it != maSimple.end(); ++it ) - ( *it )->Show(); - - redraw (true); - } - void AddAdvanced( Window* w ) - { - maAdvanced.push_back( w ); - if ( !bAdvancedMode ) - w->Hide(); - } - void AddSimple( Window* w ) - { - maSimple.push_back( w ); - if ( bAdvancedMode ) - w->Hide(); - } - void RemoveAdvanced( Window* w ) - { - Remove( maAdvanced, w ); - } - void RemoveSimple( Window* w ) - { - Remove( maSimple, w ); - } -}; - -void AdvancedButton::AddAdvanced( Window* w ) -{ - getImpl().AddAdvanced( w ); -} - -void AdvancedButton::AddSimple( Window* w ) -{ - getImpl().AddSimple( w ); -} - -void AdvancedButton::RemoveAdvanced( Window* w ) -{ - getImpl().RemoveAdvanced( w ); -} - -void AdvancedButton::RemoveSimple( Window* w ) -{ - getImpl().RemoveSimple( w ); -} - -void AdvancedButton::SetAdvancedText (rtl::OUString const& text) -{ - if (text.getLength ()) - getImpl ().mAdvancedLabel = text; -} - -void AdvancedButton::SetSimpleText (rtl::OUString const& text) -{ - if (text.getLength ()) - getImpl ().mSimpleLabel = text; -} - -rtl::OUString AdvancedButton::GetAdvancedText () const -{ - return getImpl ().mAdvancedLabel; -} - -rtl::OUString AdvancedButton::GetSimpleText () const -{ - return getImpl ().mSimpleLabel; -} - -void AdvancedButton::SetDelta (int) -{ -} - -IMPL_CONSTRUCTORS_BODY( AdvancedButton, PushButton, "advancedbutton", getImpl().simpleMode () ); -IMPL_GET_IMPL( AdvancedButton ); - - -class MoreButtonImpl : public AdvancedButtonImpl -{ -public: - MoreButtonImpl( Context *context, PeerHandle const& peer, Window *window ) - : AdvancedButtonImpl( context, peer, window) - { - mSimpleLabel = Button::GetStandardText( BUTTON_MORE ); - mAdvancedLabel = Button::GetStandardText( BUTTON_LESS ); - } - void AddWindow( Window* w ) { AddAdvanced( w ); } - void RemoveWindow( Window* w ) { RemoveAdvanced( w ); } -}; - -// TODO -//BUTTON_IMPL( MoreButton, PushButton, 0 ); -IMPL_CONSTRUCTORS_BODY( MoreButton, AdvancedButton, "morebutton", getImpl().simpleMode () ); -IMPL_GET_IMPL( MoreButton ); - -void MoreButton::AddWindow( Window* w ) +CancelButton::CancelButton ( Context *context, char const* pId, sal_uInt32 nId ) + : PushButton( new CancelButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) { - getImpl().AddWindow( w ); + Window *parent = dynamic_cast<Window*> (context); + if (parent) + SetParent (parent); } -void MoreButton::RemoveWindow( Window* w ) +YesButton::YesButton ( Context *context, char const* pId, sal_uInt32 nId ) + : PushButton( new YesButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) { - getImpl().RemoveWindow( w ); + Window *parent = dynamic_cast<Window*> (context); + if (parent) + SetParent (parent); } -void MoreButton::SetMoreText (rtl::OUString const& text) +NoButton::NoButton ( Context *context, char const* pId, sal_uInt32 nId ) + : PushButton( new NoButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) { - SetAdvancedText (text); + Window *parent = dynamic_cast<Window*> (context); + if (parent) + SetParent (parent); } -void MoreButton::SetLessText (rtl::OUString const& text) +RetryButton::RetryButton ( Context *context, char const* pId, sal_uInt32 nId ) + : PushButton( new RetryButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) { - SetSimpleText (text); + Window *parent = dynamic_cast<Window*> (context); + if (parent) + SetParent (parent); } -rtl::OUString MoreButton::GetMoreText () const +IgnoreButton::IgnoreButton ( Context *context, char const* pId, sal_uInt32 nId ) + : PushButton( new IgnoreButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) { - return GetAdvancedText (); + Window *parent = dynamic_cast<Window*> (context); + if (parent) + SetParent (parent); } -rtl::OUString MoreButton::GetLessText () const +HelpButton::HelpButton ( Context *context, char const* pId, sal_uInt32 nId ) + : PushButton( new HelpButtonImpl( context, context->GetPeerHandle( pId, nId ), this ) ) { - return GetSimpleText (); + Window *parent = dynamic_cast<Window*> (context); + if (parent) + SetParent (parent); } } // namespace layout diff --git a/toolkit/source/layout/vcl/wcontainer.cxx b/toolkit/source/layout/vcl/wcontainer.cxx index 699a1af14761..868915b33f47 100644 --- a/toolkit/source/layout/vcl/wcontainer.cxx +++ b/toolkit/source/layout/vcl/wcontainer.cxx @@ -57,50 +57,6 @@ Container::Container( rtl::OUString const& rName, sal_Int32 nBorder ) uno::Any( nBorder ) ); } -void Container::Add( Window *pChild ) -{ - if ( pChild ) - { - uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY ); - mxContainer->addChild( xChild ); - } -} - -void Container::Add( Container *pChild ) -{ - if ( pChild ) - { - uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY ); - mxContainer->addChild( xChild ); - } -} - -void Container::Remove( Window *pChild ) -{ - if ( pChild ) - { - uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY ); - mxContainer->removeChild( xChild ); - } -} - -void Container::Remove( Container *pChild ) -{ - if ( pChild ) - { - uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY ); - mxContainer->removeChild( xChild ); - } -} - -void Container::Clear() -{ - css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > children; - children = mxContainer->getChildren(); - for (int i = 0; i < children.getLength(); i++) - mxContainer->removeChild( children[i] ); -} - void Container::ShowAll( bool bShow ) { struct inner @@ -131,47 +87,6 @@ void Container::ShowAll( bool bShow ) inner::setChildrenVisible( mxContainer, bShow ); } -void Container::Show() -{ - ShowAll( true ); -} - -void Container::Hide() -{ - ShowAll( false ); -} - -Table::Table( sal_Int32 nBorder, sal_Int32 nColumns ) - : Container( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "table" ) ), nBorder ) -{ - uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ) ), - uno::Any( nColumns ) ); -} - -void Table::Add( Window *window, bool bXExpand, bool bYExpand, - sal_Int32 nXSpan, sal_Int32 nYSpan ) -{ - if ( !window ) - return; - WindowImpl &rImpl = window->getImpl(); - uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow, - uno::UNO_QUERY ); - mxContainer->addChild( xChild ); - setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan ); -} - -void Table::Add( Container *pContainer, bool bXExpand, bool bYExpand, - sal_Int32 nXSpan, sal_Int32 nYSpan ) -{ - if ( !pContainer ) - return; - uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(), - uno::UNO_QUERY ); - mxContainer->addChild( xChild ); - setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan ); -} - void Table::setProps( uno::Reference< awt::XLayoutConstrains > xChild, bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan ) { @@ -195,29 +110,6 @@ Box::Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous ) uno::Any( bHomogeneous ) ); } -void Box::Add( Window *window, bool bExpand, bool bFill, sal_Int32 nPadding) -{ - if ( !window ) - return; - WindowImpl &rImpl = window->getImpl(); - uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow, - uno::UNO_QUERY ); - - mxContainer->addChild( xChild ); - setProps( xChild, bExpand, bFill, nPadding ); -} - -void Box::Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding) -{ - if ( !pContainer ) - return; - - uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(), - uno::UNO_QUERY ); - mxContainer->addChild( xChild ); - setProps( xChild, bExpand, bFill, nPadding ); -} - void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild, bool bExpand, bool bFill, sal_Int32 nPadding ) { @@ -232,38 +124,11 @@ void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild, uno::Any( nPadding ) ); } -Table::Table( Context const* context, char const* pId ) - : Container( context, pId ) -{ -} - Box::Box( Context const* context, char const* pId ) : Container( context, pId ) { } -HBox::HBox( sal_Int32 nBorder, bool bHomogeneous ) - : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hbox" ) ), - nBorder, bHomogeneous ) -{ -} - -HBox::HBox( Context const* context, char const* pId ) - : Box( context, pId ) -{ -} - -VBox::VBox( sal_Int32 nBorder, bool bHomogeneous ) - : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vbox" ) ), - nBorder, bHomogeneous ) -{ -} - -VBox::VBox( Context const* context, char const* pId ) - : Box( context, pId ) -{ -} - } // namespace layout /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/vcl/wfield.cxx b/toolkit/source/layout/vcl/wfield.cxx index ce8b59f6023f..04b0757ca999 100644 --- a/toolkit/source/layout/vcl/wfield.cxx +++ b/toolkit/source/layout/vcl/wfield.cxx @@ -33,7 +33,6 @@ #include <com/sun/star/awt/XNumericField.hpp> #include <com/sun/star/awt/XTextComponent.hpp> #include <com/sun/star/awt/XListBox.hpp> -#include <com/sun/star/awt/XComboBox.hpp> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/awt/XActionListener.hpp> #include <com/sun/star/awt/XItemListener.hpp> @@ -103,89 +102,15 @@ Edit::~Edit () SetModifyHdl (Link ()); } -void Edit::SetSelection( Selection const& rSelection ) -{ -#if LAYOUT_API_CALLS_HANDLER - if ( !getImpl().mxEdit.is() ) - getImpl().mxEdit->setSelection( awt::Selection( rSelection.Min(), rSelection.Max() ) ); -#else /* !LAYOUT_API_CALLS_HANDLER */ - GetEdit ()->SetSelection (rSelection); -#endif /* !LAYOUT_API_CALLS_HANDLER */ -} - -void Edit::SetText( OUString const& rStr ) -{ -#if LAYOUT_API_CALLS_HANDLER - if ( getImpl().mxEdit.is() ) - /// this calls handlers; endless loop in numfmt.cxx - getImpl().mxEdit->setText( rStr ); -#else /* !LAYOUT_API_CALLS_HANDLER */ - GetEdit ()->SetText (rStr); -#endif /* !LAYOUT_API_CALLS_HANDLER */ -} - -String Edit::GetText() const -{ - if ( !getImpl().mxEdit.is() ) - return getImpl().mxEdit->getText(); - return OUString(); -} - void Edit::SetModifyHdl( const Link& link ) { if (&getImpl () && getImpl().mxEdit.is ()) getImpl().SetModifyHdl( link ); } -IMPL_CONSTRUCTORS( Edit, Control, "edit" ); IMPL_GET_IMPL( Edit ); IMPL_GET_WINDOW (Edit); -class MultiLineEditImpl : public EditImpl -{ -public: - MultiLineEditImpl( Context *context, const PeerHandle &peer, Window *window ) - : EditImpl( context, peer, window ) - { - } -}; - -IMPL_CONSTRUCTORS( MultiLineEdit, Edit, "multilineedit" ); -IMPL_GET_IMPL( MultiLineEdit ); - -class SpinFieldImpl : public EditImpl -{ - public: - SpinFieldImpl( Context *context, const PeerHandle &peer, Window *window ) - : EditImpl( context, peer, window ) - { - } -}; - -IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" ); - -class NumericFieldImpl : public SpinFieldImpl -{ - public: - NumericFieldImpl( Context *context, const PeerHandle &peer, Window *window ) - : SpinFieldImpl( context, peer, window ) - { - } -}; - -class MetricFieldImpl : public SpinFieldImpl -{ - public: - MetricFieldImpl( Context *context, const PeerHandle &peer, Window *window ) - : SpinFieldImpl( context, peer, window ) - { - } -}; - -IMPL_GET_IMPL( SpinField ); -IMPL_GET_IMPL( NumericField ); -IMPL_GET_IMPL( MetricField ); - class FormatterBaseImpl { protected: @@ -252,32 +177,6 @@ NumericFormatterImpl& NumericFormatter::getFormatImpl() const return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) ); } -#define SET_IMPL(vclmethod, idlmethod) \ - void NumericFormatter::vclmethod( sal_Int64 nValue ) \ - { \ - if ( !getFormatImpl().mxField.is() ) \ - return; \ - getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \ - } - -SET_IMPL( SetMin, setMin ) -SET_IMPL( SetMax, setMax ) -SET_IMPL( SetLast, setLast ) -SET_IMPL( SetFirst, setFirst ) -SET_IMPL( SetValue, setValue ) -SET_IMPL( SetSpinSize, setSpinSize ) - -sal_Int64 NumericFormatter::GetValue() const -{ - if ( !getFormatImpl().mxField.is() ) - return 0; - return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() ); -} - -#undef SET_IMPL - -IMPL_CONSTRUCTORS_2( NumericField, SpinField, NumericFormatter, "numericfield" ); - MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl ) : FormatterBase( pImpl ) { @@ -285,225 +184,6 @@ MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl ) MetricFormatterImpl& MetricFormatter::getFormatImpl() const { return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); } -#define MetricUnitVclToUno(a) ((sal_uInt16)(a)) - -#define SET_IMPL(vclmethod, idlmethod) \ - void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \ - { \ - if ( !getFormatImpl().mxField.is() ) \ - return; \ - getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \ - } - -SET_IMPL( SetMin, setMin ) -SET_IMPL( SetMax, setMax ) -SET_IMPL( SetLast, setLast ) -SET_IMPL( SetFirst, setFirst ) -SET_IMPL( SetValue, setValue ) - -#undef SET_IMPL - -void MetricFormatter::SetSpinSize( sal_Int64 nValue ) -{ - if ( !getFormatImpl().mxField.is() ) - return; - getFormatImpl().mxField->setSpinSize( nValue ); -} - -sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const -{ - if ( !getFormatImpl().mxField.is() ) - return 0; - return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) ); -} - -IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" ); - -class ComboBoxImpl : public EditImpl - , public ::cppu::WeakImplHelper1< awt::XActionListener > - , public ::cppu::WeakImplHelper1< awt::XItemListener > -{ -public: - uno::Reference< awt::XComboBox > mxComboBox; - - Link maClickHdl; - Link maSelectHdl; - - Window *parent; - - ComboBoxImpl( Context *context, const PeerHandle &peer, Window *window ) - : EditImpl( context, peer, window ) - , mxComboBox( peer, uno::UNO_QUERY ) - { - } - - ~ComboBoxImpl (); - - sal_uInt16 InsertEntry( OUString const& rStr, sal_uInt16 nPos ) - { - if ( nPos == COMBOBOX_APPEND ) - nPos = GetEntryCount(); - mxComboBox->addItem( rtl::OUString( rStr ), nPos ); - return nPos; - } - - void RemoveEntry( sal_uInt16 nPos ) - { - mxComboBox->removeItems( nPos, 1 ); - } - - sal_uInt16 GetEntryPos( String const& rStr ) const - { - uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() ); - rtl::OUString rKey( rStr ); - sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength()); - for (sal_uInt16 i = 0; i < n; i++) - { - if ( aItems[ i ] == rKey ) - return i; - } - return COMBOBOX_ENTRY_NOTFOUND; - } - - OUString GetEntry( sal_uInt16 nPos ) const - { - return OUString( mxComboBox->getItem( nPos ) ); - } - - sal_uInt16 GetEntryCount() const - { - return mxComboBox->getItemCount(); - } - - void SetClickHdl( Link const& link ) - { - if (!link && !!maClickHdl) - mxComboBox->removeActionListener( this ); - else if (!!link && !maClickHdl) - mxComboBox->addActionListener( this ); - maClickHdl = link; - } - - void SetSelectHdl( Link const& link ) - { - if (!link && !!maSelectHdl) - mxComboBox->removeItemListener( this ); - else if (!!link && !maSelectHdl) - mxComboBox->addItemListener( this ); - maSelectHdl = link; - } - - void SAL_CALL disposing( lang::EventObject const& e ) - throw (uno::RuntimeException); - - void SAL_CALL actionPerformed (const awt::ActionEvent&) - throw (uno::RuntimeException) - { - ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow ); - if ( !pComboBox ) - return; - maClickHdl.Call( pComboBox ); - } - - void SAL_CALL itemStateChanged( awt::ItemEvent const&) - throw (uno::RuntimeException) - { - ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow ); - if ( !pComboBox ) - return; - maSelectHdl.Call( pComboBox ); - } -}; - -ComboBox::~ComboBox () -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("%s: deleting ComboBox for window: %p", __FUNCTION__, GetWindow ()); -#endif -} - -ComboBoxImpl::~ComboBoxImpl () -{ -#ifndef __SUNPRO_CC - OSL_TRACE ("%s: deleting ComboBoxImpl for window: %p", __FUNCTION__, mpWindow ? mpWindow->GetWindow () : 0); - OSL_TRACE ("%s: deleting ComboBoxImpl for listener: %p", __FUNCTION__, static_cast<XFocusListener*> (this)); -#endif -} - -void ComboBoxImpl::disposing( lang::EventObject const& e ) - throw (uno::RuntimeException) -{ - EditImpl::disposing (e); - mxComboBox.clear (); -} - -sal_uInt16 ComboBox::InsertEntry( String const& rStr, sal_uInt16 nPos ) -{ - return getImpl().InsertEntry( rStr, nPos ); -} - -void ComboBox::RemoveEntry( String const& rStr ) -{ - getImpl().RemoveEntry( GetEntryPos( rStr ) ); -} - -void ComboBox::RemoveEntry( sal_uInt16 nPos ) -{ - getImpl().RemoveEntry( nPos ); -} - -void ComboBox::Clear() -{ - uno::Sequence< rtl::OUString> aNoItems; - getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) ); -} - -sal_uInt16 ComboBox::GetEntryPos( String const& rStr ) const -{ - return getImpl().GetEntryPos( rStr ); -} - -String ComboBox::GetEntry( sal_uInt16 nPos ) const -{ - rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos ); - return OUString( rItem ); -} - -sal_uInt16 ComboBox::GetEntryCount() const -{ - return getImpl().GetEntryCount(); -} - -void ComboBox::SetClickHdl( const Link& link ) -{ - if (&getImpl () && getImpl().mxComboBox.is ()) - getImpl().SetClickHdl( link ); -} - -void ComboBox::SetSelectHdl( const Link& link ) -{ - if (&getImpl () && getImpl().mxComboBox.is ()) - getImpl().SetSelectHdl( link ); -} - -void ComboBox::EnableAutocomplete (bool enable, bool matchCase) -{ - GetComboBox ()->EnableAutocomplete (enable, matchCase); -} - -IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl().parent = parent; ); -IMPL_GET_WINDOW (ComboBox); -/// IMPL_GET_IMPL( ComboBox ); - -static ComboBoxImpl* null_combobox_impl = 0; - -ComboBoxImpl &ComboBox::getImpl () const -{ - if (ComboBoxImpl* c = static_cast<ComboBoxImpl *>(mpImpl)) - return *c; - return *null_combobox_impl; -} - class ListBoxImpl : public ControlImpl , public ::cppu::WeakImplHelper1< awt::XActionListener > , public ::cppu::WeakImplHelper1< awt::XItemListener > @@ -671,27 +351,6 @@ ListBox::~ListBox () { } -sal_uInt16 ListBox::InsertEntry (String const& rStr, sal_uInt16 nPos) -{ - return getImpl().InsertEntry(rStr, nPos); -} - -void ListBox::RemoveEntry( sal_uInt16 nPos ) -{ - return getImpl().RemoveEntry( nPos ); -} - -void ListBox::RemoveEntry( String const& rStr ) -{ - return getImpl().RemoveEntry( GetEntryPos( rStr ) ); -} - -void ListBox::Clear() -{ - uno::Sequence< rtl::OUString> aNoItems; - getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) ); -} - sal_uInt16 ListBox::GetEntryPos( String const& rStr ) const { return getImpl().GetEntryPos( rStr ); @@ -702,11 +361,6 @@ String ListBox::GetEntry( sal_uInt16 nPos ) const return getImpl().GetEntry( nPos ); } -sal_uInt16 ListBox::GetEntryCount() const -{ - return getImpl().GetEntryCount(); -} - void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect ) { #if LAYOUT_API_CALLS_HANDLER @@ -716,80 +370,19 @@ void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect ) #endif /* !LAYOUT_API_CALLS_HANDLER */ } -void ListBox::SelectEntry( String const& rStr, bool bSelect ) -{ - SelectEntryPos( GetEntryPos( rStr ), bSelect ); -} - -sal_uInt16 ListBox::GetSelectEntryCount() const -{ - return getImpl().GetSelectEntryCount(); -} - sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nSelIndex ) const { return getImpl().GetSelectEntryPos( nSelIndex ); } -String ListBox::GetSelectEntry( sal_uInt16 nSelIndex ) const -{ - return GetEntry( GetSelectEntryPos( nSelIndex ) ); -} - -Link& ListBox::GetSelectHdl () -{ - return getImpl ().GetSelectHdl (); -} - -void ListBox::SetSelectHdl( Link const& link ) -{ - getImpl().SetSelectHdl( link ); -} - -Link& ListBox::GetClickHdl () -{ - return getImpl ().GetSelectHdl (); -} - -void ListBox::SetClickHdl( Link const& link ) -{ - if (&getImpl () && getImpl().mxListBox.is ()) - getImpl().SetClickHdl( link ); -} - -Link& ListBox::GetDoubleClickHdl () -{ - return getImpl ().GetSelectHdl (); -} - -void ListBox::SetDoubleClickHdl( Link const& link ) -{ - getImpl().SetDoubleClickHdl( link ); -} - -void ListBox::SetEntryData( sal_uInt16 pos, void* data) -{ - GetListBox ()->SetEntryData (pos, data); -} - -void* ListBox::GetEntryData( sal_uInt16 pos) const -{ - return GetListBox ()->GetEntryData (pos); -} - void ListBox::SetNoSelection () { GetListBox ()->SetNoSelection (); } -IMPL_CONSTRUCTORS (ListBox, Control, "listbox"); IMPL_GET_IMPL (ListBox); IMPL_GET_WINDOW (ListBox); -IMPL_IMPL (MultiListBox, ListBox) -IMPL_CONSTRUCTORS_BODY( MultiListBox, ListBox, "multilistbox", GetMultiListBox()->EnableMultiSelection( true ); ); -IMPL_GET_IMPL( MultiListBox ); -IMPL_GET_WINDOW( MultiListBox ); } // namespace layout /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/layout/vcl/wrapper.cxx b/toolkit/source/layout/vcl/wrapper.cxx index 9713e04b3e40..b175ea2be0b9 100644 --- a/toolkit/source/layout/vcl/wrapper.cxx +++ b/toolkit/source/layout/vcl/wrapper.cxx @@ -115,10 +115,6 @@ public: { mxTopLevel = xToplevel; } - PeerHandle getRoot() - { - return mxRoot; - } }; Context::Context( const char *pPath ) @@ -131,20 +127,6 @@ Context::~Context() pImpl = NULL; } -void Context::setToplevel( PeerHandle xToplevel ) -{ - pImpl->setTopLevel( xToplevel ); -} - -PeerHandle Context::getToplevel() -{ - return pImpl->getTopLevel(); -} -PeerHandle Context::getRoot() -{ - return pImpl->getRoot(); -} - PeerHandle Context::GetPeerHandle( const char *id, sal_uInt32 nId ) const { PeerHandle xHandle; @@ -558,22 +540,12 @@ void SAL_CALL ControlImpl::focusLost (awt::FocusEvent const&) mLoseFocusHdl.Call (mpWindow); } -Link& Control::GetGetFocusHdl () -{ - return getImpl ().GetGetFocusHdl (); -} - void Control::SetGetFocusHdl (Link const& link) { if (&getImpl () && getImpl().mxWindow.is ()) getImpl ().SetGetFocusHdl (link); } -Link& Control::GetLoseFocusHdl () -{ - return getImpl ().GetLoseFocusHdl (); -} - void Control::SetLoseFocusHdl (Link const& link) { if (&getImpl () && getImpl().mxWindow.is ()) @@ -593,15 +565,6 @@ DialogImpl::DialogImpl( Context *context, const PeerHandle &peer, Window *window { } -Dialog::Dialog( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId ) - : Context( xml_file ) - , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) ) - , bConstruct (true) -{ - if ( parent ) - SetParent( parent ); -} - Dialog::Dialog( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId ) : Context( xml_file ) , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) ) @@ -631,31 +594,11 @@ void Dialog::EndDialog( long result ) MX_DIALOG->endDialog (result); } -void Dialog::SetText( OUString const& str ) -{ - SetTitle (str); -} - void Dialog::SetTitle( OUString const& str ) { MX_DIALOG->setTitle (str); } -bool Dialog::Close () -{ - EndDialog (false); - return true; -} - -long Dialog::Notify (NotifyEvent& event) -{ - return GetDialog ()->Notify (event); -} - -void Dialog::Initialize (SfxChildWinInfo*) -{ -} - #define MESSAGE_BOX_MEMBER_INIT\ Dialog (parent, xml_file, id)\ , imageError (this, "FI_ERROR")\ @@ -809,8 +752,6 @@ void MessageBox::init (OUString const& message, OUString const& yes, OUString co MESSAGE_BOX_IMPL (Error); MESSAGE_BOX_IMPL (Info); -MESSAGE_BOX_IMPL (Query); -MESSAGE_BOX_IMPL (Warning); class TabControlImpl : public ControlImpl @@ -834,11 +775,6 @@ public: mxTabControl.clear (); } - Link& GetActivatePageHdl () - { - return mActivatePageHdl; - } - void SetActivatePageHdl (Link const& link) { if (!mDeactivatePageHdl || !link) @@ -846,11 +782,6 @@ public: mActivatePageHdl = link; } - Link& GetDeactivatePageHdl () - { - return mDeactivatePageHdl; - } - void SetDeactivatePageHdl (Link const& link) { if (!mActivatePageHdl || !link) @@ -895,7 +826,6 @@ public: }; IMPL_GET_WINDOW (TabControl); -IMPL_GET_LAYOUT_VCLXWINDOW (TabControl); #define MX_TABCONTROL if (getImpl ().mxTabControl.is ()) getImpl ().mxTabControl #define RETURN_MX_TABCONTROL if (getImpl ().mxTabControl.is ()) return getImpl ().mxTabControl @@ -906,92 +836,22 @@ TabControl::~TabControl () SetDeactivatePageHdl (Link ()); } -void TabControl::InsertPage (sal_uInt16 id, OUString const& title, sal_uInt16 pos) -{ - (void) pos; - - MX_TABCONTROL->insertTab (); - SetCurPageId (id); - -#if 1 // colour me loc productive -- NOT -#define ADD_PROP( seq, i, name, val )\ - { \ - beans::NamedValue value; \ - value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \ - value.Value = uno::makeAny( val ); \ - seq[i] = value; \ - } - - uno::Sequence< beans::NamedValue > seq (1); - ADD_PROP ( seq, 0, "Title", OUString (title) ); - MX_TABCONTROL->setTabProps (id, seq); -#else - GetTabPage (id)->SetText (title); -#endif -} -void TabControl::RemovePage (sal_uInt16 id) -{ - GetTabControl ()->RemovePage (id); -} -sal_uInt16 TabControl::GetPageCount () const -{ - return GetTabControl ()->GetPageCount (); -} -sal_uInt16 TabControl::GetPageId (sal_uInt16 pos) const -{ - return GetTabControl ()->GetPageId (pos); -} -sal_uInt16 TabControl::GetPagePos (sal_uInt16 id) const -{ - getImpl ().redraw (); - return GetTabControl ()->GetPagePos (id); -} void TabControl::SetCurPageId (sal_uInt16 id) { getImpl ().redraw (); GetTabControl ()->SetCurPageId (id); } -sal_uInt16 TabControl::GetCurPageId () const -{ - return GetTabControl ()->GetCurPageId (); -} -void TabControl::SetTabPage (sal_uInt16 id, ::TabPage* page) -{ - GetTabControl ()->SetTabPage (id, page); - getImpl ().redraw (); -} -::TabPage* TabControl::GetTabPage (sal_uInt16 id) const -{ - return GetTabControl ()->GetTabPage (id); -} void TabControl::SetActivatePageHdl (Link const& link) { if (&getImpl () && getImpl().mxTabControl.is ()) getImpl ().SetActivatePageHdl (link); } -Link& TabControl::GetActivatePageHdl () const -{ - return getImpl ().GetActivatePageHdl (); -} void TabControl::SetDeactivatePageHdl (Link const& link) { if (&getImpl () && getImpl().mxTabControl.is ()) getImpl ().SetDeactivatePageHdl (link); } -Link& TabControl::GetDeactivatePageHdl () const -{ - return getImpl ().GetDeactivatePageHdl (); -} -void TabControl::SetTabPageSizePixel (Size const& size) -{ - GetTabControl ()->SetTabPageSizePixel (size); -} -Size TabControl::GetTabPageSizePixel () const -{ - return GetTabControl ()->GetTabPageSizePixel (); -} -IMPL_CONSTRUCTORS (TabControl, Control, "tabcontrol"); IMPL_GET_IMPL (TabControl); class TabPageImpl : public WindowImpl @@ -1010,22 +870,6 @@ TabControl* TabPage::global_tabcontrol = 0; IMPL_GET_IMPL( TabPage ); -TabPage::TabPage( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId) - : Context( xml_file ) - , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) ) -{ - if ( parent ) - SetParent( parent ); -} - -TabPage::TabPage( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId) - : Context( xml_file ) - , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) ) -{ - if ( parent ) - SetParent( parent ); -} - TabPage::~TabPage() { delete GetTabPage(); @@ -1041,24 +885,6 @@ void TabPage::DeactivatePage() { } -class FixedLineImpl : public ControlImpl -{ -public: - FixedLineImpl( Context *context, const PeerHandle &peer, Window *window ) - : ControlImpl( context, peer, window ) - { - } -}; - -IMPL_CONSTRUCTORS( FixedLine, Control, "hfixedline" ); -IMPL_GET_IMPL( FixedLine ); - -bool FixedLine::IsEnabled() const -{ - //FIXME - return true; -} - class FixedTextImpl : public ControlImpl { public: @@ -1086,11 +912,18 @@ void SAL_CALL FixedTextImpl::disposing( lang::EventObject const& e ) mxFixedText.clear (); } +FixedText::FixedText ( Context *context, char const* pId, sal_uInt32 nId ) + : Control( new FixedTextImpl( context, context->GetPeerHandle( pId, nId ), this ) ) +{ + Window *parent = dynamic_cast<Window*> (context); + if (parent) + SetParent (parent); +} + FixedText::~FixedText () { } -IMPL_CONSTRUCTORS( FixedText, Control, "fixedtext" ); IMPL_GET_IMPL( FixedText ); void FixedText::SetText( OUString const& rStr ) @@ -1100,18 +933,6 @@ void FixedText::SetText( OUString const& rStr ) getImpl().mxFixedText->setText( rStr ); } -class FixedInfoImpl : public FixedTextImpl -{ -public: - FixedInfoImpl( Context *context, const PeerHandle &peer, Window *window ) - : FixedTextImpl( context, peer, window ) - { - } -}; - -IMPL_CONSTRUCTORS( FixedInfo, FixedText, "fixedinfo" ); -IMPL_GET_IMPL( FixedInfo ); - class ProgressBarImpl : public ControlImpl { public: @@ -1146,217 +967,15 @@ public: } }; -IMPL_CONSTRUCTORS( FixedImage, Control, "fixedimage" ); -IMPL_GET_IMPL( FixedImage ) - -void FixedImage::setImage( ::Image const& i ) -{ - (void) i; - if ( !getImpl().mxGraphic.is() ) - return; - //FIXME: hack moved to proplist - //getImpl().mxGraphic = -} - - -IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" ); -IMPL_GET_IMPL( ProgressBar ); - -void ProgressBar::SetForegroundColor( util::Color color ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setForegroundColor( color ); -} - -void ProgressBar::SetBackgroundColor( util::Color color ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setBackgroundColor( color ); -} - -void ProgressBar::SetValue( sal_Int32 i ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setValue( i ); -} - -void ProgressBar::SetRange( sal_Int32 min, sal_Int32 max ) -{ - if ( !getImpl().mxProgressBar.is() ) - return; - getImpl().mxProgressBar->setRange( min, max ); -} - -sal_Int32 ProgressBar::GetValue() -{ - if ( !getImpl().mxProgressBar.is() ) - return 0; - return getImpl().mxProgressBar->getValue(); -} - -class PluginImpl: public ControlImpl -{ -public: - ::Control *mpPlugin; - - PluginImpl( Context *context, const PeerHandle &peer, Window *window, :: Control *plugin ) - : ControlImpl( context, peer, window ) - , mpPlugin( plugin ) - { - uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY ); - layoutimpl::VCLXPlugin *vcl - = static_cast<layoutimpl::VCLXPlugin*>( VCLXWindow::GetImplementation( ref ) ); - ::Window *parent = vcl->mpWindow->GetParent(); - vcl->SetWindow( plugin ); - vcl->SetPlugin( mpPlugin ); - plugin->SetParent( parent ); - plugin->SetStyle( vcl->mStyle ); - plugin->SetCreatedWithToolkit( true ); - plugin->SetComponentInterface( vcl ); - plugin->Show(); - } -}; - -Plugin::Plugin( Context *context, char const *id, ::Control *plugin ) - : Control( new PluginImpl( context, context->GetPeerHandle( id, 0 ), this, plugin ) ) - , mpPlugin( plugin ) -{ -} - -IMPL_GET_IMPL( Plugin ); - -class LocalizedStringImpl : public WindowImpl -{ -public: - layoutimpl::LocalizedString *mpString; - OUString maString; - LocalizedStringImpl( Context *context, const PeerHandle &peer, Window *window ) - : WindowImpl( context, peer, window ) - , mpString( static_cast<layoutimpl::LocalizedString*>( VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( mxWindow, uno::UNO_QUERY ) ) ) ) - , maString () - { - } - OUString getText() - { - if (mpString) - maString = mpString->getText (); - return maString; - } - void setText( OUString const& s ) - { - if (mpString) - mpString->setText( s ); - } -}; - -IMPL_GET_IMPL( LocalizedString ); - -LocalizedString::LocalizedString( Context *context, char const* id ) - : Window( new LocalizedStringImpl( context, context->GetPeerHandle( id, 0 ), this ) ) -{ -} - -String LocalizedString::getString () -{ - return getImpl ().getText (); -} - -OUString LocalizedString::getOUString () -{ - return getImpl ().getText (); -} - -LocalizedString::operator OUString () -{ - return getOUString (); -} - -LocalizedString::operator OUString const& () -{ - getOUString (); - return getImpl ().maString; -} - -LocalizedString::operator String() -{ - getOUString (); - return getImpl ().maString; -} - -String LocalizedString::GetToken (sal_uInt16 i, sal_Char c) -{ - return getString ().GetToken (i, c); -} - -OUString LocalizedString::operator= (OUString const& s) -{ - getImpl().setText( s ); - return getImpl().getText(); -} - -OUString LocalizedString::operator+= (OUString const& b) -{ - OUString a = getImpl ().getText (); - a += b; - getImpl ().setText (a); - return getImpl ().getText (); -} - -OUString LocalizedString::operator+= (sal_Unicode const b) -{ - String a = getImpl ().getText (); - a += b; - getImpl ().setText (a); - return getImpl ().getText (); -} - -class InPlugImpl : public WindowImpl -{ -public: - InPlugImpl (Context *context, const PeerHandle &peer, Window *window) - : WindowImpl (context, peer, window) - { - } -}; - -IMPL_GET_IMPL (InPlug); - -static char const *FIXME_set_parent (::Window *parent, char const *xml_file) -{ - layout::TabPage::global_parent = parent; - return xml_file; -} - -InPlug::InPlug (Window *parent, char const* xml_file, char const* id, sal_uInt32 nId) - : Context (FIXME_set_parent (parent ? parent->GetWindow () : 0, xml_file)) - , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this)) +FixedImage::FixedImage ( Context *context, char const* pId, sal_uInt32 nId ) + : Control( new FixedImageImpl( context, context->GetPeerHandle( pId, nId ), this ) ) { + Window *parent = dynamic_cast<Window*> (context); if (parent) SetParent (parent); - if (::Window *w = dynamic_cast< ::Window* > (this)) - w->SetComponentInterface (GetVCLXWindow ()); -} - -InPlug::InPlug (::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId) - : Context (FIXME_set_parent (parent, xml_file)) - , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this)) -{ - if (parent) - layout::Window::SetParent (parent); - if (::Window *w = dynamic_cast< ::Window* > (this)) - w->SetComponentInterface (GetVCLXWindow ()); } -void InPlug::ParentSet (Window *window) -{ - window->SetParent (dynamic_cast< ::Window* > (this)); - - /// FIXME: for standalone run of layout::SfxTabDialog - SetParent (window->GetParent ()); -} +IMPL_GET_IMPL( FixedImage ) } // namespace layout |