summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schönheit <fs@openoffice.org>2002-09-13 11:19:45 +0000
committerFrank Schönheit <fs@openoffice.org>2002-09-13 11:19:45 +0000
commita7a2496d16717f418072751e67a024a0450e0fdc (patch)
tree7dd6339e99a1ed9c440f9829cc62f364cc7c74fa
parent2e9f0ca5819eac5111dc09e33a4dbfc59ac37fcc (diff)
#103250# +FillLayoutData/GetEntryCharacterBounds
-rw-r--r--svtools/inc/ivctrl.hxx7
-rw-r--r--svtools/source/contnr/ivctrl.cxx47
2 files changed, 50 insertions, 4 deletions
diff --git a/svtools/inc/ivctrl.hxx b/svtools/inc/ivctrl.hxx
index df08975f35cb..35bee1117578 100644
--- a/svtools/inc/ivctrl.hxx
+++ b/svtools/inc/ivctrl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ivctrl.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: pb $ $Date: 2002-08-13 07:22:15 $
+ * last change: $Author: fs $ $Date: 2002-09-13 12:19:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -319,6 +319,8 @@ protected:
SvxIconChoiceCtrlEntry* pEntry,
BOOL bInplaceEdit );
+ virtual void FillLayoutData() const;
+
public:
SvtIconChoiceCtrl( Window* pParent, WinBits nWinStyle = WB_ICON | WB_BORDER );
@@ -406,6 +408,7 @@ public:
BOOL HandleShortCutKey( const KeyEvent& rKeyEvent );
Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const;
+ Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const;
// ACCESSIBILITY ==========================================================
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index 7e7d8921b7ac..b47af50628a5 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ivctrl.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: pb $ $Date: 2002-08-13 07:25:03 $
+ * last change: $Author: fs $ $Date: 2002-09-13 12:19:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,9 @@
#ifndef _SV_BITMAPEX_HXX
#include <vcl/bitmapex.hxx>
#endif
+#ifndef _VCL_CONTROLLAYOUT_HXX
+#include <vcl/controllayout.hxx>
+#endif
using namespace ::drafts::com::sun::star::accessibility;
@@ -605,6 +608,46 @@ Rectangle SvtIconChoiceCtrl::GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) co
return _pImp->CalcFocusRect( pEntry );
}
+void SvtIconChoiceCtrl::FillLayoutData() const
+{
+ DBG_ASSERT( !mpLayoutData, "SvtIconChoiceCtrl::FillLayoutData: shouldn't this be called with non-existent layout data only?" );
+ mpLayoutData = new ::vcl::ControlLayoutData();
+
+ SvtIconChoiceCtrl* pNonConstMe = const_cast< SvtIconChoiceCtrl* >( this );
+
+ // loop through all entries
+ sal_uInt16 nCount = GetEntryCount();
+ sal_uInt16 nPos = 0;
+ while ( nPos < nCount )
+ {
+ SvxIconChoiceCtrlEntry* pEntry = GetEntry( nPos );
+
+ Point aPos = _pImp->GetEntryBoundRect( pEntry ).TopLeft();
+ String sEntryText = pEntry->GetDisplayText( );
+ Rectangle aTextRect = _pImp->CalcTextRect( pEntry, &aPos, sal_False, &sEntryText );
+
+ sal_Bool bLargeIconMode = WB_ICON == ( _pImp->GetStyle() & ( VIEWMODE_MASK ) );
+ sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED;
+
+ _pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, mpLayoutData );
+
+ ++nPos;
+ }
+}
+
+Rectangle SvtIconChoiceCtrl::GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const
+{
+ Rectangle aRect;
+
+ Pair aEntryCharacterRange = GetLineStartEnd( _nEntryPos );
+ if ( aEntryCharacterRange.A() + _nCharacterIndex < aEntryCharacterRange.B() )
+ {
+ aRect = GetCharacterBounds( aEntryCharacterRange.A() + _nCharacterIndex );
+ }
+
+ return aRect;
+}
+
void SvtIconChoiceCtrl::AddEventListener( const Link& rEventListener )
{
_pImp->AddEventListener( rEventListener );