summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-13 15:51:44 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-14 09:56:31 +0100
commit91cc66dfa77cb0130d0bc99875275f7267b7f95a (patch)
treee0d2841ea721fc4bdf0ff4e1fd125a73e438baef /svtools
parent26df9f97bfcd3cbc071dde1dc5cba1703c04f1f9 (diff)
move VCLXFileControl to toolkit
Change-Id: I39bb417fe7e033a8f368fa04d4a30b2388bcddfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88615 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/inc/pch/precompiled_svt.hxx5
-rw-r--r--svtools/source/control/filectrl.cxx241
-rw-r--r--svtools/source/inc/filectrl.hxx70
-rw-r--r--svtools/source/inc/unoiface.hxx57
-rw-r--r--svtools/source/uno/unoiface.cxx293
6 files changed, 1 insertions, 666 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index ab191699615b..759b880600f9 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -96,7 +96,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/control/collatorres \
svtools/source/control/ctrlbox \
svtools/source/control/ctrltool \
- svtools/source/control/filectrl \
svtools/source/control/indexentryres \
svtools/source/control/inettbc \
svtools/source/control/managedmenubutton \
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index 632affc2a513..a26b21753606 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-02-01 10:58:20 using:
+ Generated on 2020-02-13 16:04:02 using:
./bin/update_pch svtools svt --cutoff=4 --exclude:system --include:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -54,7 +54,6 @@
#if PCH_LEVEL >= 2
#include <osl/diagnose.h>
#include <osl/endian.h>
-#include <osl/file.h>
#include <osl/file.hxx>
#include <osl/interlck.h>
#include <osl/mutex.hxx>
@@ -102,7 +101,6 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/builder.hxx>
-#include <vcl/button.hxx>
#include <vcl/checksum.hxx>
#include <vcl/combobox.hxx>
#include <vcl/commandevent.hxx>
@@ -392,7 +390,6 @@
#include <svtools/htmltokn.h>
#include <svtools/svtdllapi.h>
#include <svtools/svtresid.hxx>
-#include <table/tabletypes.hxx>
#include <svtools/valueset.hxx>
#endif // PCH_LEVEL >= 4
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
deleted file mode 100644
index 6f3704d9d3bb..000000000000
--- a/svtools/source/control/filectrl.cxx
+++ /dev/null
@@ -1,241 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <filectrl.hxx>
-
-#include <com/sun/star/ui/dialogs/FilePicker.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <comphelper/processfactory.hxx>
-#include <osl/file.h>
-#include <osl/diagnose.h>
-#include <svtools/svtresid.hxx>
-#include <tools/urlobj.hxx>
-#include <vcl/edit.hxx>
-#include <svtools/strings.hrc>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ui;
-
-
-FileControl::FileControl( vcl::Window* pParent, WinBits nStyle ) :
- Window( pParent, nStyle|WB_DIALOGCONTROL ),
- maEdit( VclPtr<Edit>::Create(this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP) ),
- maButton( VclPtr<PushButton>::Create( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ) ),
- maButtonText( SvtResId(STR_FILECTRL_BUTTONTEXT) ),
- mnInternalFlags( FileControlMode_Internal::ORIGINALBUTTONTEXT )
-{
- maButton->SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
-
- maButton->Show();
- maEdit->Show();
-
- SetCompoundControl( true );
-
- SetStyle( ImplInitStyle( GetStyle() ) );
-}
-
-
-WinBits FileControl::ImplInitStyle( WinBits nStyle )
-{
- if ( !( nStyle & WB_NOTABSTOP ) )
- {
- maEdit->SetStyle( (maEdit->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
- maButton->SetStyle( (maButton->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
- }
- else
- {
- maEdit->SetStyle( (maEdit->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
- maButton->SetStyle( (maButton->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
- }
-
- const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM );
- maEdit->SetStyle( ( maEdit->GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
-
- if ( !(nStyle & WB_NOGROUP) )
- nStyle |= WB_GROUP;
-
- if ( !(nStyle & WB_NOBORDER ) )
- nStyle |= WB_BORDER;
-
- nStyle &= ~WB_TABSTOP;
-
- return nStyle;
-}
-
-
-FileControl::~FileControl()
-{
- disposeOnce();
-}
-
-void FileControl::dispose()
-{
- maEdit.disposeAndClear();
- maButton.disposeAndClear();
- Window::dispose();
-}
-
-void FileControl::SetText( const OUString& rStr )
-{
- maEdit->SetText( rStr );
-}
-
-
-OUString FileControl::GetText() const
-{
- return maEdit->GetText();
-}
-
-
-void FileControl::StateChanged( StateChangedType nType )
-{
- if ( nType == StateChangedType::Enable )
- {
- maEdit->Enable( IsEnabled() );
- maButton->Enable( IsEnabled() );
- }
- else if ( nType == StateChangedType::Zoom )
- {
- GetEdit().SetZoom( GetZoom() );
- GetButton().SetZoom( GetZoom() );
- }
- else if ( nType == StateChangedType::Style )
- {
- SetStyle( ImplInitStyle( GetStyle() ) );
- }
- else if ( nType == StateChangedType::ControlFont )
- {
- GetEdit().SetControlFont( GetControlFont() );
- // Only use height of the button, as in HTML
- // always Courier is used
- vcl::Font aFont = GetButton().GetControlFont();
- aFont.SetFontSize( GetControlFont().GetFontSize() );
- GetButton().SetControlFont( aFont );
- }
- else if ( nType == StateChangedType::ControlForeground )
- {
- GetEdit().SetControlForeground( GetControlForeground() );
- GetButton().SetControlForeground( GetControlForeground() );
- }
- else if ( nType == StateChangedType::ControlBackground )
- {
- GetEdit().SetControlBackground( GetControlBackground() );
- GetButton().SetControlBackground( GetControlBackground() );
- }
- Window::StateChanged( nType );
-}
-
-
-void FileControl::Resize()
-{
- static const long ButtonBorder = 10;
-
- if( mnInternalFlags & FileControlMode_Internal::INRESIZE )
- return;
- mnInternalFlags |= FileControlMode_Internal::INRESIZE;//InResize = sal_True
-
- Size aOutSz = GetOutputSizePixel();
- long nButtonTextWidth = maButton->GetTextWidth( maButtonText );
- if ( !(mnInternalFlags & FileControlMode_Internal::ORIGINALBUTTONTEXT) ||
- ( nButtonTextWidth < aOutSz.Width()/3 ) )
- {
- maButton->SetText( maButtonText );
- }
- else
- {
- OUString aSmallText( "..." );
- maButton->SetText( aSmallText );
- nButtonTextWidth = maButton->GetTextWidth( aSmallText );
- }
-
- long nButtonWidth = nButtonTextWidth+ButtonBorder;
- maEdit->setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() );
- maButton->setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() );
-
- mnInternalFlags &= ~FileControlMode_Internal::INRESIZE; //InResize = sal_False
-}
-
-
-void FileControl::GetFocus()
-{
- if (!maEdit || maEdit->IsDisposed())
- return;
- maEdit->GrabFocus();
-}
-
-void FileControl::SetEditModifyHdl( const Link<Edit&,void>& rLink )
-{
- if (!maEdit || maEdit->IsDisposed())
- return;
- maEdit->SetModifyHdl(rLink);
-}
-
-void FileControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags )
-{
- WinBits nOldEditStyle = GetEdit().GetStyle();
- if ( GetStyle() & WB_BORDER )
- GetEdit().SetStyle( nOldEditStyle|WB_BORDER );
- GetEdit().Draw( pDev, rPos, rSize, nFlags );
- if ( GetStyle() & WB_BORDER )
- GetEdit().SetStyle( nOldEditStyle );
-}
-
-IMPL_LINK_NOARG(FileControl, ButtonHdl, Button*, void)
-{
- try
- {
- Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
- Reference < dialogs::XFilePicker3 > xFilePicker = dialogs::FilePicker::createWithMode( xContext, dialogs::TemplateDescription::FILEOPEN_SIMPLE );
- // transform the system notation text into a file URL
- OUString sSystemNotation = GetText(), sFileURL;
- oslFileError nError = osl_getFileURLFromSystemPath( sSystemNotation.pData, &sFileURL.pData );
- if ( nError == osl_File_E_INVAL )
- sFileURL = GetText(); // #97709# Maybe URL is already a file URL...
-
- //#90430# Check if URL is really a file URL
- OUString aTmp;
- if ( osl_getSystemPathFromFileURL( sFileURL.pData, &aTmp.pData ) == osl_File_E_None )
- {
- // initially set this directory
- xFilePicker->setDisplayDirectory( sFileURL );
- }
-
- if ( xFilePicker->execute() )
- {
- Sequence < OUString > aPathSeq = xFilePicker->getSelectedFiles();
-
- if ( aPathSeq.hasElements() )
- {
- OUString aNewText = aPathSeq[0];
- INetURLObject aObj( aNewText );
- if ( aObj.GetProtocol() == INetProtocol::File )
- aNewText = aObj.PathToFileName();
- SetText( aNewText );
- maEdit->GetModifyHdl().Call( *maEdit );
- }
- }
- }
- catch( const Exception& )
- {
- OSL_FAIL( "FileControl::ImplBrowseFile: caught an exception while executing the file picker!" );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/inc/filectrl.hxx b/svtools/source/inc/filectrl.hxx
deleted file mode 100644
index cb01ff29b0fe..000000000000
--- a/svtools/source/inc/filectrl.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <vcl/window.hxx>
-#include <vcl/button.hxx>
-
-class Edit;
-
-// Flags for internal use of FileControl
-enum class FileControlMode_Internal
-{
- INRESIZE = 0x0001,
- ORIGINALBUTTONTEXT = 0x0002,
-};
-
-namespace o3tl
-{
- template<> struct typed_flags<FileControlMode_Internal> : is_typed_flags<FileControlMode_Internal, 0x03> {};
-}
-
-
-class FileControl final : public vcl::Window
-{
- VclPtr<Edit> maEdit;
- VclPtr<PushButton> maButton;
- OUString const maButtonText;
- FileControlMode_Internal mnInternalFlags;
-
- void Resize() override;
- void GetFocus() override;
- void StateChanged( StateChangedType nType ) override;
- WinBits ImplInitStyle( WinBits nStyle );
- DECL_LINK( ButtonHdl, Button*, void );
-
-public:
- FileControl( vcl::Window* pParent, WinBits nStyle );
- virtual ~FileControl() override;
- virtual void dispose() override;
-
- Edit& GetEdit() { return *maEdit; }
- PushButton& GetButton() { return *maButton; }
-
- void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
-
- void SetText( const OUString& rStr ) override;
- OUString GetText() const override;
-
- void SetEditModifyHdl( const Link<Edit&,void>& rLink );
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx
index 11613d3c9852..7696d32fd5b9 100644
--- a/svtools/source/inc/unoiface.hxx
+++ b/svtools/source/inc/unoiface.hxx
@@ -27,8 +27,6 @@
#include <com/sun/star/awt/XTextComponent.hpp>
#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
#include <tools/lineend.hxx>
-#include <vcl/edit.hxx>
-
namespace com { namespace sun { namespace star { namespace util {
class XNumberFormatsSupplier;
@@ -100,61 +98,6 @@ public:
virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
};
-
-
-class VCLXFileControl final : public css::awt::XTextComponent, public css::awt::XTextLayoutConstrains, public VCLXWindow
-{
- DECL_LINK(ModifyHdl, Edit&, void);
- void ModifyHdl();
- TextListenerMultiplexer maTextListeners;
-
-public:
- VCLXFileControl();
- virtual ~VCLXFileControl() override;
-
- virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) override;
-
- // css::uno::XInterface
- css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- void SAL_CALL acquire() throw() override { VCLXWindow::acquire(); }
- void SAL_CALL release() throw() override { VCLXWindow::release(); }
-
- // css::lang::XTypeProvider
- css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
- css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
-
- // css::awt::XTextComponent
- void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override;
- void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override;
- void SAL_CALL setText( const OUString& aText ) override;
- void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override;
- OUString SAL_CALL getText( ) override;
- OUString SAL_CALL getSelectedText( ) override;
- void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override;
- css::awt::Selection SAL_CALL getSelection( ) override;
- sal_Bool SAL_CALL isEditable( ) override;
- void SAL_CALL setEditable( sal_Bool bEditable ) override;
- void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override;
- sal_Int16 SAL_CALL getMaxTextLen( ) override;
-
- // css::awt::XLayoutConstrains
- css::awt::Size SAL_CALL getMinimumSize( ) override;
- css::awt::Size SAL_CALL getPreferredSize( ) override;
- css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
-
- // css::awt::XTextLayoutConstrains
- css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override;
- void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override;
-
- void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value) override;
-
- static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
- virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
-};
-
-
-
-
class SVTXFormattedField : public VCLXSpinField
{
protected:
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index d4ffbfe4f2e6..6f0550135725 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -22,7 +22,6 @@
#include <vcl/svapp.hxx>
#include <svl/zforlist.hxx>
#include <svtools/svmedit.hxx>
-#include <filectrl.hxx>
#include <unoiface.hxx>
#include <com/sun/star/awt/LineEndFormat.hpp>
#include <cppuhelper/queryinterface.hxx>
@@ -73,19 +72,6 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const cs
return nullptr;
}
}
- else if ( aServiceName.equalsIgnoreAsciiCase( "FileControl" ) )
- {
- if ( pParent )
- {
- pWindow = VclPtr<FileControl>::Create( pParent, nWinBits );
- *ppNewComp = new VCLXFileControl;
- }
- else
- {
- *ppNewComp = nullptr;
- return nullptr;
- }
- }
else if (aServiceName.equalsIgnoreAsciiCase("FormattedField") )
{
pWindow = VclPtr<FormattedField>::Create( pParent, nWinBits );
@@ -504,285 +490,6 @@ void VCLXMultiLineEdit::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
-
-VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
-{
-}
-
-VCLXFileControl::~VCLXFileControl()
-{
- VclPtr< FileControl > pControl = GetAs< FileControl >();
- if ( pControl )
- pControl->GetEdit().SetModifyHdl( Link<Edit&,void>() );
-}
-
-css::uno::Any VCLXFileControl::queryInterface( const css::uno::Type & rType )
-{
- css::uno::Any aRet = ::cppu::queryInterface( rType,
- static_cast< css::awt::XTextComponent* >(this),
- static_cast< css::awt::XTextLayoutConstrains* >(this),
- static_cast< css::lang::XTypeProvider* >(this) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
-}
-
-IMPL_IMPLEMENTATION_ID( VCLXFileControl )
-
-// css::lang::XTypeProvider
-css::uno::Sequence< css::uno::Type > VCLXFileControl::getTypes()
-{
- static const ::cppu::OTypeCollection aTypeList(
- cppu::UnoType<css::lang::XTypeProvider>::get(),
- cppu::UnoType<css::awt::XTextComponent>::get(),
- cppu::UnoType<css::awt::XTextLayoutConstrains>::get(),
- VCLXWindow::getTypes()
- );
- return aTypeList.getTypes();
-}
-
-void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const css::uno::Any& Value)
-{
- SolarMutexGuard aGuard;
-
- VclPtr< FileControl > pControl = GetAs< FileControl >();
- if ( !pControl )
- return;
-
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
- {
- case BASEPROPERTY_HIDEINACTIVESELECTION:
- {
- bool bValue(false);
- OSL_VERIFY( Value >>= bValue );
-
- lcl_setWinBits( pControl, WB_NOHIDESELECTION, !bValue );
- lcl_setWinBits( &pControl->GetEdit(), WB_NOHIDESELECTION, !bValue );
- }
- break;
-
- default:
- VCLXWindow::setProperty( PropertyName, Value );
- break;
- }
-}
-
-void VCLXFileControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
-{
- VclPtr< FileControl > pPrevFileControl = GetAsDynamic< FileControl >();
- if ( pPrevFileControl )
- pPrevFileControl->SetEditModifyHdl( Link<Edit&,void>() );
-
- FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow.get() );
- if ( pNewFileControl )
- pNewFileControl->SetEditModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
-
- VCLXWindow::SetWindow( pWindow );
-}
-
-void VCLXFileControl::addTextListener( const css::uno::Reference< css::awt::XTextListener > & l )
-{
- maTextListeners.addInterface( l );
-}
-
-void VCLXFileControl::removeTextListener( const css::uno::Reference< css::awt::XTextListener > & l )
-{
- maTextListeners.removeInterface( l );
-}
-
-void VCLXFileControl::setText( const OUString& aText )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<vcl::Window> pWindow = GetWindow();
- if ( pWindow )
- {
- pWindow->SetText( aText );
-
- // also in Java a textChanged is triggered, not in VCL.
- // css::awt::Toolkit should be JAVA-compliant...
- ModifyHdl();
- }
-}
-
-void VCLXFileControl::insertText( const css::awt::Selection& rSel, const OUString& aText )
-{
- SolarMutexGuard aGuard;
-
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- if ( pFileControl )
- {
- pFileControl->GetEdit().SetSelection( Selection( rSel.Min, rSel.Max ) );
- pFileControl->GetEdit().ReplaceSelected( aText );
- }
-}
-
-OUString VCLXFileControl::getText()
-{
- SolarMutexGuard aGuard;
-
- OUString aText;
- VclPtr<vcl::Window> pWindow = GetWindow();
- if ( pWindow )
- aText = pWindow->GetText();
- return aText;
-}
-
-OUString VCLXFileControl::getSelectedText()
-{
- SolarMutexGuard aGuard;
-
- OUString aText;
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- if ( pFileControl)
- aText = pFileControl->GetEdit().GetSelected();
- return aText;
-
-}
-
-void VCLXFileControl::setSelection( const css::awt::Selection& aSelection )
-{
- SolarMutexGuard aGuard;
-
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- if ( pFileControl )
- pFileControl->GetEdit().SetSelection( Selection( aSelection.Min, aSelection.Max ) );
-}
-
-css::awt::Selection VCLXFileControl::getSelection()
-{
- SolarMutexGuard aGuard;
-
- css::awt::Selection aSel;
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- if ( pFileControl )
- {
- aSel.Min = pFileControl->GetEdit().GetSelection().Min();
- aSel.Max = pFileControl->GetEdit().GetSelection().Max();
- }
- return aSel;
-}
-
-sal_Bool VCLXFileControl::isEditable()
-{
- SolarMutexGuard aGuard;
-
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- return pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled();
-}
-
-void VCLXFileControl::setEditable( sal_Bool bEditable )
-{
- SolarMutexGuard aGuard;
-
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- if ( pFileControl )
- pFileControl->GetEdit().SetReadOnly( !bEditable );
-}
-
-void VCLXFileControl::setMaxTextLen( sal_Int16 nLen )
-{
- SolarMutexGuard aGuard;
-
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- if ( pFileControl )
- pFileControl->GetEdit().SetMaxTextLen( nLen );
-}
-
-sal_Int16 VCLXFileControl::getMaxTextLen()
-{
- SolarMutexGuard aGuard;
-
- VclPtr< FileControl > pFileControl = GetAs< FileControl >();
- return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0;
-}
-
-
-IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl, Edit&, void)
-{
- ModifyHdl();
-}
-
-void VCLXFileControl::ModifyHdl()
-{
- css::awt::TextEvent aEvent;
- aEvent.Source = static_cast<cppu::OWeakObject*>(this);
- maTextListeners.textChanged( aEvent );
-}
-
-css::awt::Size VCLXFileControl::getMinimumSize()
-{
- SolarMutexGuard aGuard;
-
- css::awt::Size aSz;
- VclPtr< FileControl > pControl = GetAs< FileControl >();
- if ( pControl )
- {
- Size aTmpSize = pControl->GetEdit().CalcMinimumSize();
- aTmpSize.AdjustWidth(pControl->GetButton().CalcMinimumSize().Width() );
- aSz = AWTSize(pControl->CalcWindowSize( aTmpSize ));
- }
- return aSz;
-}
-
-css::awt::Size VCLXFileControl::getPreferredSize()
-{
- css::awt::Size aSz = getMinimumSize();
- aSz.Height += 4;
- return aSz;
-}
-
-css::awt::Size VCLXFileControl::calcAdjustedSize( const css::awt::Size& rNewSize )
-{
- SolarMutexGuard aGuard;
-
- css::awt::Size aSz =rNewSize;
- VclPtr< FileControl > pControl = GetAs< FileControl >();
- if ( pControl )
- {
- css::awt::Size aMinSz = getMinimumSize();
- if ( aSz.Height != aMinSz.Height )
- aSz.Height = aMinSz.Height;
- }
- return aSz;
-}
-
-css::awt::Size VCLXFileControl::getMinimumSize( sal_Int16 nCols, sal_Int16 )
-{
- SolarMutexGuard aGuard;
-
- css::awt::Size aSz;
- VclPtr< FileControl > pControl = GetAs< FileControl >();
- if ( pControl )
- {
- aSz = AWTSize(pControl->GetEdit().CalcSize( nCols ));
- aSz.Width += pControl->GetButton().CalcMinimumSize().Width();
- }
- return aSz;
-}
-
-void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
-{
- SolarMutexGuard aGuard;
-
- nCols = 0;
- nLines = 1;
- VclPtr< FileControl > pControl = GetAs< FileControl >();
- if ( pControl )
- nCols = pControl->GetEdit().GetMaxVisChars();
-}
-
-void VCLXFileControl::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
-{
- PushPropertyIds( rIds,
- // FIXME: elide duplication ?
- BASEPROPERTY_HIDEINACTIVESELECTION,
- 0);
- VCLXWindow::ImplGetPropertyIds( rIds, true );
-}
-
-
-
-
SVTXFormattedField::SVTXFormattedField()
:bIsStandardSupplier(true)
,nKeyToSetDelayed(-1)