summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schönheit <frank.schoenheit@sun.com>2009-10-23 12:10:07 +0200
committerFrank Schönheit <frank.schoenheit@sun.com>2009-10-23 12:10:07 +0200
commitb14f33317528b0d3b44f5d24fbfb15a26cebb531 (patch)
tree41b2427caa7f0bddf3ea1548e33da035edd9da84
parent9b9d44ee50a38180c2451ca527bf7b9f6f46f0fe (diff)
#i106184# introduce a 'VerticalAlign' property for edit-like form controls
-rw-r--r--svtools/source/control/filectrl.cxx3
-rw-r--r--svtools/source/uno/unoiface.cxx80
-rw-r--r--toolkit/source/awt/vclxwindows.cxx6
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx1
-rw-r--r--toolkit/source/controls/unocontrols.cxx2
-rw-r--r--vcl/inc/vcl/edit.hxx1
-rw-r--r--vcl/source/control/edit.cxx21
7 files changed, 28 insertions, 86 deletions
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index d820dce097ed..f00cf45be0e6 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -78,6 +78,9 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
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;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 54cc448ff89e..b4772f755452 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -552,86 +552,6 @@ void VCLXMultiLineEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
}
// ----------------------------------------------------
-// class VCLXFileDialog
-// ----------------------------------------------------
-/*
-VCLXFileDialog::VCLXFileDialog()
-{
-}
-
-VCLXFileDialog::~VCLXFileDialog()
-{
-}
-
-::com::sun::star::uno::Any VCLXFileDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XXX*, this ) );
- return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( VCLXFileDialog )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XXX>* ) NULL )
-IMPL_XTYPEPROVIDER_END
-
-void VCLXFileDialog::setPath( const ::rtl::OUString& rPath )
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- pDlg->SetPath( ::rtl::OUStringToOString( rPath, CHARSET_SYSTEM ) );
-}
-
-::rtl::OUString VCLXFileDialog::getPath()
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- ::rtl::OUString aPath;
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- aPath = StringToOUString( pDlg->GetPath(), CHARSET_SYSTEM );
- return aPath;
-}
-
-void VCLXFileDialog::setFilters( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rFilterNames, const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rMasks )
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- {
- sal_uInt32 nFlts = rFilterNames.getLength();
- for ( sal_uInt32 n = 0; n < nFlts; n++ )
- pDlg->AddFilter(
- ::rtl::OUStringToOString( rFilterNames.getConstArray()[n], CHARSET_SYSTEM ),
- ::rtl::OUStringToOString( rMasks.getConstArray()[n], CHARSET_SYSTEM ) );
- }
-}
-
-void VCLXFileDialog::setCurrentFilter( const ::rtl::OUString& rFilterName )
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- pDlg->SetCurFilter( ::rtl::OUStringToOString( rFilterName, CHARSET_SYSTEM ) );
-}
-
-::rtl::OUString VCLXFileDialog::getCurrentFilter()
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- ::rtl::OUString aFilter;
- FileDialog* pDlg = (FileDialog*)GetWindow();
- if ( pDlg )
- aFilter = StringToOUString( pDlg->GetCurFilter(), CHARSET_SYSTEM );
- return aFilter;
-}
-*/
-
-// ----------------------------------------------------
// class VCLXFileControl
// ----------------------------------------------------
VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index b49fa1a621d6..c44745c4c2de 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -3388,6 +3388,7 @@ void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_PAINTTRANSPARENT,
BASEPROPERTY_AUTOHSCROLL,
BASEPROPERTY_AUTOVSCROLL,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
0);
@@ -4280,6 +4281,7 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_TEXT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -4621,6 +4623,7 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_TEXT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -4924,6 +4927,7 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_VALUE_DOUBLE,
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -5518,6 +5522,7 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_VALUE_DOUBLE,
BASEPROPERTY_ENFORCE_FORMAT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
@@ -5865,6 +5870,7 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_TABSTOP,
BASEPROPERTY_TEXT,
BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
BASEPROPERTY_WRITING_MODE,
BASEPROPERTY_CONTEXT_WRITING_MODE,
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
index 6171067f1185..5ac7a0237479 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -160,6 +160,7 @@ namespace toolkit
ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR );
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index 3abacef7b67f..9e508c884f59 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -476,6 +476,7 @@ void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) t
// ----------------------------------------------------
UnoControlFileControlModel::UnoControlFileControlModel()
{
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_BORDER );
ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
@@ -489,6 +490,7 @@ UnoControlFileControlModel::UnoControlFileControlModel()
ImplRegisterProperty( BASEPROPERTY_READONLY );
ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index 534d63b3427c..bb7d965503d2 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -120,6 +120,7 @@ private:
SAL_DLLPRIVATE void ImplCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
SAL_DLLPRIVATE void ImplPaste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
SAL_DLLPRIVATE long ImplGetExtraOffset() const;
+ SAL_DLLPRIVATE long ImplGetTextYPosition() const;
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const;
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 5f41a441c6a1..3a5f9014e27a 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -492,6 +492,17 @@ void Edit::ImplInvalidateOrRepaint( xub_StrLen nStart, xub_StrLen nEnd )
// -----------------------------------------------------------------------
+long Edit::ImplGetTextYPosition() const
+{
+ if ( GetStyle() & WB_TOP )
+ return ImplGetExtraOffset();
+ else if ( GetStyle() & WB_BOTTOM )
+ return GetOutputSizePixel().Height() - GetTextHeight() - ImplGetExtraOffset();
+ return ( GetOutputSizePixel().Height() - GetTextHeight() ) / 2;
+}
+
+// -----------------------------------------------------------------------
+
void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
{
if ( !IsReallyVisible() )
@@ -516,10 +527,8 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
GetCaretPositions( aText, pDX, nStart, nEnd );
}
- // center vertically
- long nH = GetOutputSize().Height();
long nTH = GetTextHeight();
- Point aPos( mnXOffset, (nH-nTH)/2 );
+ Point aPos( mnXOffset, ImplGetTextYPosition() );
if( bLayout )
{
@@ -1193,7 +1202,7 @@ void Edit::ImplShowCursor( BOOL bOnlyIfVisible )
long nCursorPosX = nTextPos + mnXOffset + ImplGetExtraOffset();
// Cursor muss im sichtbaren Bereich landen:
- Size aOutSize = GetOutputSizePixel();
+ const Size aOutSize = GetOutputSizePixel();
if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.Width()) )
{
long nOldXOffset = mnXOffset;
@@ -1227,8 +1236,8 @@ void Edit::ImplShowCursor( BOOL bOnlyIfVisible )
ImplInvalidateOrRepaint();
}
- long nTextHeight = GetTextHeight();
- long nCursorPosY = (aOutSize.Height()-nTextHeight) / 2;
+ const long nTextHeight = GetTextHeight();
+ const long nCursorPosY = ImplGetTextYPosition();
pCursor->SetPos( Point( nCursorPosX, nCursorPosY ) );
pCursor->SetSize( Size( nCursorWidth, nTextHeight ) );
pCursor->Show();