summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/roadmap.hxx82
-rw-r--r--svtools/inc/svtools/accessiblefactory.hxx6
-rwxr-xr-xsvtools/inc/svtools/accessibletable.hxx185
-rw-r--r--svtools/inc/svtools/hyperlabel.hxx11
-rw-r--r--svtools/inc/svtools/solar.hrc15
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx86
-rw-r--r--svtools/inc/svtools/table/tablemodel.hxx4
-rw-r--r--svtools/prj/d.lst3
-rw-r--r--svtools/source/control/hyperlabel.cxx43
-rw-r--r--svtools/source/control/roadmap.cxx687
-rw-r--r--svtools/source/misc/svtaccessiblefactory.cxx9
-rw-r--r--svtools/source/passwordcontainer/passwordcontainer.cxx13
-rw-r--r--svtools/source/table/tablecontrol.cxx372
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx25
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx20
-rw-r--r--svtools/source/uno/makefile.mk1
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.cxx458
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.hxx106
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx481
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx96
-rw-r--r--svtools/source/uno/unoiface.cxx9
21 files changed, 1711 insertions, 1001 deletions
diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx
index 8a6f75eb1428..14ed6abceed6 100644
--- a/svtools/inc/roadmap.hxx
+++ b/svtools/inc/roadmap.hxx
@@ -54,64 +54,8 @@ namespace svt
typedef sal_Int32 ItemIndex;
};
-
class RoadmapImpl;
-
-
- class ORoadmapIDHyperLabel : public FixedText
- {
- public:
- ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId );
- ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
- ~ORoadmapIDHyperLabel( );
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
- };
-
- class ORoadmapHyperLabel : public RoadmapTypes
- {
- private:
- ORoadmapIDHyperLabel* mpIDLabel;
- HyperLabel* mpDescHyperLabel;
-
-
- public:
-
- ORoadmapHyperLabel( Window* _pParent, const ResId& _rId );
- ORoadmapHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
- ~ORoadmapHyperLabel( );
-
- void SetID( sal_Int16 _ID );
- sal_Int16 GetID() const;
-
- void SetIndex( sal_Int32 _Index );
- sal_Int32 GetIndex() const;
-
- void SetLabel( ::rtl::OUString _rText );
- ::rtl::OUString GetLabel( );
-
- void SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& rNewSize);
-
- void SetPosition( ORoadmapHyperLabel* OldHyperLabel );
- Point GetLogicalPosition();
-
- void ToggleBackgroundColor( const Color& _rGBColor );
- void SetInteractive( sal_Bool _bInteractive );
-
- void SetClickHdl( const Link& rLink );
- const Link& GetClickHdl() const;
- void SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags );
- void Enable( BOOL bEnable = TRUE);
- BOOL IsEnabled() const;
- void GrabFocus();
-
- void SetIDLabel(ORoadmapIDHyperLabel* _pIDLabel){mpIDLabel = _pIDLabel;};
- ORoadmapIDHyperLabel* GetIDLabel() const { return mpIDLabel;};
-
- HyperLabel* GetDescriptionHyperLabel() const { return mpDescHyperLabel;};
- void SetDescriptionHyperLabel(HyperLabel* _pDescriptionHyperLabel){mpDescHyperLabel = _pDescriptionHyperLabel;};
- };
-
-
+ class RoadmapItem;
//=====================================================================
//= Roadmap
@@ -135,7 +79,7 @@ namespace svt
void EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex = 0 );
sal_Bool IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex = 0 ) const;
- void ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString sLabel, ItemIndex _nStartIndex = 0 );
+ void ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& sLabel, ItemIndex _nStartIndex = 0 );
::rtl::OUString GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex = 0 );
void ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0 );
@@ -149,8 +93,8 @@ namespace svt
ItemId GetItemID( ItemIndex _nIndex ) const;
ItemIndex GetItemIndex( ItemId _nID ) const;
- void InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True );
- void ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled );
+ void InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True );
+ void ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled );
void DeleteRoadmapItem( ItemIndex _nIndex );
ItemId GetCurrentRoadmapItemID() const;
@@ -172,22 +116,20 @@ namespace svt
private:
DECL_LINK(ImplClickHdl, HyperLabel*);
- ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex );
- const ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex ) const;
+ RoadmapItem* GetByIndex( ItemIndex _nItemIndex );
+ const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const;
- ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 );
- const ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const;
- ORoadmapHyperLabel* GetPreviousHyperLabel( ItemIndex _Index);
+ RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 );
+ const RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const;
+ RoadmapItem* GetPreviousHyperLabel( ItemIndex _Index);
void DrawHeadline();
void DeselectOldRoadmapItems();
ItemId GetNextAvailableItemId( ItemIndex _NewIndex );
ItemId GetPreviousAvailableItemId( ItemIndex _NewIndex );
- ORoadmapHyperLabel* GetByPointer(Window* pWindow);
- void InitializeHyperLabelSize();
- ORoadmapHyperLabel* InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True );
- void UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 _nadd = 1);
- void SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription);
+ RoadmapItem* GetByPointer(Window* pWindow);
+ RoadmapItem* InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True );
+ void UpdatefollowingHyperLabels( ItemIndex _Index );
};
//.........................................................................
diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx
index f7cad847edda..f4d8a03ef872 100644
--- a/svtools/inc/svtools/accessiblefactory.hxx
+++ b/svtools/inc/svtools/accessiblefactory.hxx
@@ -40,6 +40,7 @@
#endif
#include "AccessibleBrowseBoxObjType.hxx"
#include "accessibletableprovider.hxx"
+#include "accessibletable.hxx"
namespace com { namespace sun { namespace star {
namespace accessibility {
@@ -89,6 +90,11 @@ namespace svt
const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
IAccessibleTableProvider& _rBrowseBox
) const = 0;
+ virtual table::IAccessibleTableControl*
+ createAccessibleTableControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ table::IAccessibleTable& _rTable
+ ) const = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
createAccessibleIconChoiceCtrl(
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx
new file mode 100755
index 000000000000..0e3f08bfc568
--- /dev/null
+++ b/svtools/inc/svtools/accessibletable.hxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: accessibletable.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_ACCESSIBLETABLE_HXX
+#define _SVTOOLS_ACCESSIBLETABLE_HXX
+
+#include <vcl/window.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+// ============================================================================
+
+namespace svt{ namespace table
+{
+
+typedef sal_Int32 RowPos;
+
+// ============================================================================
+
+enum AccessibleTableType
+{
+ /** Child index of the column header bar (first row). */
+ TCINDEX_COLUMNHEADERBAR = 0,
+ /** Child index of the row header bar ("handle column"). */
+ TCINDEX_ROWHEADERBAR = 1,
+ /** Child index of the data table. */
+ TCINDEX_TABLE = 2
+};
+
+enum AccessibleTableControlObjType
+{
+ TCTYPE_GRIDCONTROL, /// The GridControl itself.
+ TCTYPE_TABLE, /// The data table.
+ TCTYPE_ROWHEADERBAR, /// The row header bar.
+ TCTYPE_COLUMNHEADERBAR, /// The horizontal column header bar.
+ TCTYPE_TABLECELL, /// A cell of the data table.
+ TCTYPE_ROWHEADERCELL, /// A cell of the row header bar.
+ TCTYPE_COLUMNHEADERCELL, /// A cell of the column header bar.
+};
+
+// ============================================================================
+
+#define XACC ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+
+/** This abstract class provides methods to implement an accessible table object.
+*/
+class IAccessibleTable
+{
+public:
+ /** @return The position of the current row. */
+ virtual sal_Int32 GetCurrentRow() const = 0;
+ /** @return The position of the current column. */
+ virtual sal_Int32 GetCurrentColumn() const = 0;
+ /** Creates and returns the accessible object of the whole GridControl. */
+ virtual XACC CreateAccessible()= 0;
+ virtual XACC CreateAccessibleControl( sal_Int32 _nIndex )= 0;
+ virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0;
+ virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0;
+ virtual sal_Bool HasColHeader() = 0;
+ virtual sal_Bool HasRowHeader() = 0;
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar colum/row cell
+ @return
+ The description of the specified object.
+ */
+ virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0;
+
+ /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const= 0;
+
+ // Window
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0;
+ virtual void GrabFocus()= 0;
+ virtual XACC GetAccessible( BOOL bCreate = TRUE )= 0;
+ virtual Window* GetAccessibleParentWindow() const= 0;
+ virtual Window* GetWindowInstance()= 0;
+ virtual sal_Int32 GetAccessibleControlCount() const = 0;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )= 0;
+ virtual long GetRowCount() const= 0;
+ virtual long GetColumnCount() const= 0;
+ virtual sal_Bool HasRowHeader() const= 0;
+ virtual sal_Int32 GetSelectedRowCount() const= 0;
+ virtual bool IsRowSelected( long _nRow ) const= 0;
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0;
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE ) = 0;
+ virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE ) = 0;
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0;
+ virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const = 0;
+ virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0;
+ virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
+ virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
+ virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
+ virtual std::vector<sal_Int32>& GetSelectedRows() = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+/** interface for an implementation of a table control's Accesible component
+*/
+class IAccessibleTableControl
+{
+public:
+ /** returns the XAccessible object itself
+
+ The reference returned here can be used to control the life time of the
+ IAccessibleTableImplementation object.
+
+ The returned reference is guaranteed to not be <NULL/>.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getMyself() = 0;
+
+ /** disposes the accessible implementation, so that it becomes defunc
+ */
+ virtual void dispose() = 0;
+
+ /** checks whether the accessible implementation, and its context, are still alive
+ @return <TRUE/>, if the object is not disposed or disposing.
+ */
+ virtual sal_Bool isAlive() const = 0;
+
+ /** returns the accessible object for the row or the column header bar
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) = 0;
+
+ /** returns the accessible object for the table representation
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getTable() = 0;
+
+ ///** Commits an event to all listeners. */
+ virtual void commitEvent(
+ sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue,
+ const ::com::sun::star::uno::Any& rOldValue
+ ) = 0;
+};
+
+// ----------------------------------------------------------------------------
+
+// ============================================================================
+} // namespace table
+} // namespace svt
+
+// ============================================================================
+
+#endif // _SVTOOLS_ACCESSIBLETABLE_HXX
+
diff --git a/svtools/inc/svtools/hyperlabel.hxx b/svtools/inc/svtools/hyperlabel.hxx
index c11568816158..939b1799c0de 100644
--- a/svtools/inc/svtools/hyperlabel.hxx
+++ b/svtools/inc/svtools/hyperlabel.hxx
@@ -75,26 +75,25 @@ namespace svt
void SetIndex( sal_Int32 _Index );
sal_Int32 GetIndex() const;
- void SetLabelAndSize( ::rtl::OUString _rText, const Size& rNewSize);
- void SetLabel( ::rtl::OUString _rText );
+ void SetLabel( const ::rtl::OUString& _rText );
sal_Int32 GetLogicWidth();
::rtl::OUString GetLabel( );
- void SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos);
- Point GetLogicalPosition();
-
void ToggleBackgroundColor( const Color& _rGBColor );
void SetInteractive( sal_Bool _bInteractive );
void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
const Link& GetClickHdl() const { return maClickHdl; }
+ Size CalcMinimumSize( long nMaxWidth = 0 ) const;
+
private:
DECL_LINK(ImplClickHdl, HyperLabel*);
- sal_Bool ImplCalcMinimumSize(const Size& _rCompSize );
+ private:
+ using FixedText::CalcMinimumSize;
};
}
diff --git a/svtools/inc/svtools/solar.hrc b/svtools/inc/svtools/solar.hrc
index 348422ef6477..00211573f876 100644
--- a/svtools/inc/svtools/solar.hrc
+++ b/svtools/inc/svtools/solar.hrc
@@ -132,6 +132,8 @@
#define RID_FILTER_START (RID_LIB_START+10200)
#define RID_FILTER_END (RID_LIB_START+10299)
+// do *NOT* add more ranges here, RID_LIB_END is (RID_LIB_START + 10000)
+
#define RID_APP_START 20000
#define RID_APP_END 31999
@@ -144,12 +146,6 @@
#define RID_SD_START (27000)
#define RID_SD_END (27999)
-#define RID_Sa_START (28000)
-#define RID_Sa_END (28999)
-
-#define RID_Sb_START (29000)
-#define RID_Sb_END (29999)
-
#define RID_OBJ_START (30000)
#define RID_OBJ_END (32767)
@@ -191,8 +187,7 @@
#define HID_WIZARD_END (HID_LIB_START+999)
//please note: There is also HID_WIZARD2 below
-#define HID_EXTENSIONS_START (HID_LIB_START+1000)
-#define HID_EXTENSIONS_END (HID_LIB_START+1099)
+// FREE
#define HID_SO2_START (HID_LIB_START+1100)
#define HID_SO2_END (HID_LIB_START+1149)
@@ -308,5 +303,9 @@
#define HID_FORMULA_START (HID_OBJ_START+2081)
#define HID_FORMULA_END (HID_OBJ_START+2280)
+#define HID_EXTENSIONS_START (HID_OBJ_START+2281)
+#define HID_EXTENSIONS_END (HID_OBJ_START+2800)
+
+
#endif
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index 98fddcb7d9e1..e3edd0b681ae 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -30,6 +30,8 @@
#include <vcl/ctrl.hxx>
#include <vcl/seleng.hxx>
#include <svtools/table/tabledatawindow.hxx>
+#include <svtools/accessibletable.hxx>
+#include "svtaccessiblefactory.hxx"
//........................................................................
namespace svt { namespace table
@@ -38,6 +40,8 @@ namespace svt { namespace table
class TableControl_Impl;
class TableDataWindow;
+ class AccessibleTableControl_Impl;
+
//====================================================================
//= TableControl
//====================================================================
@@ -55,10 +59,11 @@ namespace svt { namespace table
The control supports the concept of a <em>current</em> (or <em>active</em>
cell).
+ The control supports accessibility, this is encapsulated in IAccessibleTable
// TODO: scrolling?
*/
- class TableControl : public Control
+ class TableControl : public Control, public IAccessibleTable
{
private:
DECL_LINK( ImplMouseButtonDownHdl, MouseEvent* );
@@ -66,6 +71,8 @@ namespace svt { namespace table
TableControl_Impl* m_pImpl;
public:
+ ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable;
+
TableControl( Window* _pParent, WinBits _nStyle );
~TableControl();
@@ -88,11 +95,11 @@ namespace svt { namespace table
if there is no active cell, e.g. because the table does
not contain any rows or columns.
*/
- RowPos GetCurrentRow() const;
+ sal_Int32 GetCurrentRow() const;
/** returns the row, which contains the input point*/
- RowPos GetCurrentRow (const Point& rPoint);
+ ColPos GetCurrentRow (const Point& rPoint);
/** retrieves the current column
@@ -103,7 +110,7 @@ namespace svt { namespace table
if there is no active cell, e.g. because the table does
not contain any rows or columns.
*/
- ColPos GetCurrentColumn() const;
+ sal_Int32 GetCurrentColumn() const;
/** activates the cell at the given position
@@ -113,7 +120,7 @@ namespace svt { namespace table
or impossibility to execute the move at all (for instance because
of invalid coordinates).
*/
- bool GoTo( ColPos _nColumn, RowPos _nRow );
+ bool GoTo( ColPos _nColumnPos, RowPos _nRow);
/** moves the active cell to the given column, by keeping the active row
@@ -147,26 +154,91 @@ namespace svt { namespace table
void InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved);
/**gets the vector, which contains the selected rows
*/
- std::vector<RowPos> getSelectedRows();
+ std::vector<sal_Int32>& GetSelectedRows();
/**after removing a row, updates the vector which contains the selected rows
if the row, which should be removed, is selected, it will be erased from the vector
*/
void removeSelectedRow(RowPos _nRowPos);
SelectionEngine* getSelEngine();
TableDataWindow* getDataWindow();
- // protected:
+
// Window overridables
virtual void GetFocus();
virtual void LoseFocus();
virtual void KeyInput( const KeyEvent& rKEvt );
//virtual long Notify(NotifyEvent& rNEvt);
+ /** Creates and returns the accessible object of the whole BrowseBox. */
+ virtual XACC CreateAccessible();
+ virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
+ virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
+ virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
+ virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
+ virtual void FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const;
+
+ //// Window
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual void GrabFocus();
+ virtual XACC GetAccessible( BOOL bCreate = TRUE );
+ virtual Window* GetAccessibleParentWindow() const;
+ virtual Window* GetWindowInstance();
+ virtual sal_Int32 GetAccessibleControlCount() const;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
+ virtual long GetRowCount() const;
+ virtual long GetColumnCount() const;
+ virtual sal_Bool HasRowHeader() const;
+ virtual sal_Int32 GetSelectedRowCount() const;
+ virtual bool IsRowSelected( long _nRow ) const;
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE );
+ virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE );
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const;
+ virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const;
+ virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const;
+ virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
+ virtual sal_Bool HasRowHeader();
+ virtual sal_Bool HasColHeader();
+ virtual sal_Bool isAccessibleAlive( ) const;
+ virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue );
+
+
+ protected:
+ /// retrieves the XAccessible implementation associated with the GridControl instance
+ ::svt::IAccessibleFactory& getAccessibleFactory();
+
private:
TableControl(); // never implemented
TableControl( const TableControl& ); // never implemented
TableControl& operator=( const TableControl& ); // never implemented
};
+ class AccessibleTableControl_Impl
+ {
+ public:
+ AccessibleFactoryAccess m_aFactoryAccess;
+ IAccessibleTableControl* m_pAccessible;
+
+ public:
+ AccessibleTableControl_Impl() : m_pAccessible(NULL)
+ {
+ }
+
+
+ /// @see AccessibleTableControl::getTableRowHeader
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleTableHeader( AccessibleTableControlObjType _eObjType );
+ /// @see AccessibleTableControl::getTable
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleTable( );
+
+ };
+
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx
index a1af1e1750ed..6e74d35b8586 100644
--- a/svtools/inc/svtools/table/tablemodel.hxx
+++ b/svtools/inc/svtools/table/tablemodel.hxx
@@ -434,13 +434,13 @@ namespace svt { namespace table
virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)=0;
/** gets the content of the cells
*/
- virtual std::vector<std::vector<rtl::OUString> > getCellContent() = 0;
+ virtual std::vector<std::vector<rtl::OUString> >& getCellContent() = 0;
/**sets title of header rows
*/
virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)=0;
/** gets title of header rows
*/
- virtual std::vector<rtl::OUString> getRowHeaderName() = 0;
+ virtual std::vector<rtl::OUString>& getRowHeaderName() = 0;
/// destroys the table model instance
virtual ~ITableModel() { }
diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst
index aebe1dabc908..9a8a60262990 100644
--- a/svtools/prj/d.lst
+++ b/svtools/prj/d.lst
@@ -76,6 +76,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools
..\inc\svtools\accessibletableprovider.hxx %_DEST%\inc%_EXT%\svtools\accessibletableprovider.hxx
..\inc\svtools\AccessibleBrowseBoxObjType.hxx %_DEST%\inc%_EXT%\svtools\AccessibleBrowseBoxObjType.hxx
..\inc\svtools\accessiblefactory.hxx %_DEST%\inc%_EXT%\svtools\accessiblefactory.hxx
+..\inc\svtools\accessibletable.hxx %_DEST%\inc%_EXT%\svtools\accessibletable.hxx
..\inc\svtools\textwindowpeer.hxx %_DEST%\inc%_EXT%\svtools\textwindowpeer.hxx
..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx
..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx
@@ -308,6 +309,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools
..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx
+..\inc\docpasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docpasswdrequest.hxx
+..\inc\docmspasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docmspasswdrequest.hxx
..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx
..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx
..\inc\fltrcfg.hxx %_DEST%\inc%_EXT%\svtools\fltrcfg.hxx
diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx
index ec8387ecb662..7d7477130e0d 100644
--- a/svtools/source/control/hyperlabel.cxx
+++ b/svtools/source/control/hyperlabel.cxx
@@ -107,35 +107,16 @@ namespace svt
}
- void HyperLabel::SetLabelAndSize(::rtl::OUString _rText, const Size& _rNewSize )
+ Size HyperLabel::CalcMinimumSize( long nMaxWidth ) const
{
- Size rLocSize = _rNewSize;
- Size rLogicLocSize = PixelToLogic( _rNewSize, MAP_APPFONT );
- SetLabel( _rText );
- ImplCalcMinimumSize( rLocSize );
- rLocSize.Height() = ( m_pImpl->m_aMinSize.Height());
-// else
-// rLocSize = LogicToPixel( Size( rLogicLocSize.Width(), LABELBASEMAPHEIGHT ), MAP_APPFONT );
- SetSizePixel( rLocSize );
- Show();
- }
-
- sal_Bool HyperLabel::ImplCalcMinimumSize(const Size& _rCompSize )
- {
- sal_Bool b_AdjustMinWidth = sal_False;
- m_pImpl->m_aMinSize = CalcMinimumSize( );
- if ( m_pImpl->m_aMinSize.Width() >= _rCompSize.Width() ) // the MinimumSize is used to size the FocusRectangle
- {
- m_pImpl->m_aMinSize.Width() = _rCompSize.Width(); // and for the MouseMove method
- m_pImpl->m_aMinSize = CalcMinimumSize(_rCompSize.Width() );
- b_AdjustMinWidth = sal_True;
- }
+ m_pImpl->m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth );
+ // the MinimumSize is used to size the FocusRectangle
+ // and for the MouseMove method
m_pImpl->m_aMinSize.Height() += 2;
m_pImpl->m_aMinSize.Width() += 1;
- return b_AdjustMinWidth;
+ return m_pImpl->m_aMinSize;
}
-
void HyperLabel::implInit()
{
ToggleBackgroundColor( COL_TRANSPARENT );
@@ -234,17 +215,6 @@ namespace svt
m_pImpl->bInteractive = ( _bInteractive && IsEnabled() );
}
- void HyperLabel::SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos)
- {
- SetPosPixel( LogicToPixel( Point( XPos, YPos ), MAP_APPFONT ) );
- }
-
- Point HyperLabel::GetLogicalPosition()
- {
- Point aPoint = GetPosPixel( );
- return PixelToLogic( aPoint, MAP_APPFONT );
- }
-
sal_Int16 HyperLabel::GetID() const
{
return m_pImpl->ID;
@@ -270,10 +240,9 @@ namespace svt
return GetText();
}
- void HyperLabel::SetLabel( ::rtl::OUString _rText )
+ void HyperLabel::SetLabel( const ::rtl::OUString& _rText )
{
SetText(_rText);
- Show();
}
diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index b0e178e631d9..693bca733813 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -49,11 +49,10 @@
#endif
#include <memory>
-#define RMENTRYPOINT_X 4
-#define RMENTRYPOINT_Y 27
-#define RMITEMDISTANCE_Y 6
+#define ROADMAP_INDENT_X 4
+#define ROADMAP_INDENT_Y 27
+#define ROADMAP_ITEM_DISTANCE_Y 6
#define RMINCOMPLETE -1
-#define NREMOVERMITEM -1
#define NADDITEM 1
#define INCOMPLETELABEL ::String::CreateFromAscii("...") // TODO: Cast to String
@@ -63,30 +62,18 @@ namespace svt
//.........................................................................
typedef std::vector< ::rtl::OUString > S_Vector;
- typedef std::vector< ORoadmapHyperLabel* > HL_Vector;
+ typedef std::vector< RoadmapItem* > HL_Vector;
//=====================================================================
- //= FontChanger
+ //= ColorChanger
//=====================================================================
-// class FontChanger
-// {
-// protected:
-// OutputDevice* m_pDev;
-//
-// public:
-// FontChanger( OutputDevice* _pDev, const Font& _rNewFont )
-// :m_pDev( _pDev )
-// {
-// m_pDev->Push( PUSH_FONT );
-// m_pDev->SetFont( _rNewFont );
-// }
-//
-// ~FontChanger()
-// {
-// m_pDev->Pop( );
-// }
-// };
-
+ class IDLabel : public FixedText
+ {
+ public:
+ IDLabel( Window* _pParent, WinBits _nWinStyle = 0 );
+ ~IDLabel( );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ };
//=====================================================================
//= ColorChanger
@@ -111,6 +98,51 @@ namespace svt
}
};
+ //=====================================================================
+ //= RoadmapItem
+ //=====================================================================
+ class RoadmapItem : public RoadmapTypes
+ {
+ private:
+ IDLabel* mpID;
+ HyperLabel* mpDescription;
+ const Size m_aItemPlayground;
+
+ public:
+ RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground );
+ ~RoadmapItem( );
+
+ void SetID( sal_Int16 _ID );
+ sal_Int16 GetID() const;
+
+ void SetIndex( ItemIndex _Index );
+ ItemIndex GetIndex() const;
+
+ void SetLabel( const ::rtl::OUString& _rText );
+ ::rtl::OUString GetLabel( );
+
+ void Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText );
+
+ void SetPosition( RoadmapItem* OldHyperLabel );
+
+ void ToggleBackgroundColor( const Color& _rGBColor );
+ void SetInteractive( sal_Bool _bInteractive );
+
+ void SetClickHdl( const Link& rLink );
+ const Link& GetClickHdl() const;
+ void SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags );
+ void Enable( BOOL bEnable = TRUE);
+ BOOL IsEnabled() const;
+ void GrabFocus();
+
+ bool Contains( const Window* _pWindow ) const;
+
+ HyperLabel* GetDescriptionHyperLabel() const { return mpDescription; }
+
+ private:
+ void ImplUpdateIndex( const ItemIndex _nIndex );
+ void ImplUpdatePosSize();
+ };
//=====================================================================
//= RoadmapImpl
@@ -118,27 +150,32 @@ namespace svt
class RoadmapImpl : public RoadmapTypes
{
protected:
+ const ORoadmap& m_rAntiImpl;
Link m_aSelectHdl;
BitmapEx m_aPicture;
HL_Vector m_aRoadmapSteps;
ItemId m_iCurItemID;
sal_Bool m_bInteractive;
sal_Bool m_bComplete;
+ Size m_aItemSizePixel;
public:
- RoadmapImpl() :
- m_bInteractive( sal_True ),
- m_bComplete( sal_True ) {}
+ RoadmapImpl( const ORoadmap& _rAntiImpl )
+ :m_rAntiImpl( _rAntiImpl )
+ ,m_iCurItemID( -1 )
+ ,m_bInteractive( sal_True )
+ ,m_bComplete( sal_True )
+ {
+ }
- Size aHyperLabelPixelSize;
- ORoadmapHyperLabel* InCompleteHyperLabel;
+ RoadmapItem* InCompleteHyperLabel;
- void addHyperLabel( ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); }
+ void addHyperLabel( RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); }
HL_Vector& getHyperLabels() { return m_aRoadmapSteps; }
const HL_Vector& getHyperLabels() const { return m_aRoadmapSteps; }
- void insertHyperLabel( ItemIndex _Index, ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); }
+ void insertHyperLabel( ItemIndex _Index, RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); }
ItemIndex getItemCount() const { return m_aRoadmapSteps.size();}
@@ -157,6 +194,9 @@ namespace svt
void setSelectHdl( const Link& _rHdl ) { m_aSelectHdl = _rHdl; }
const Link& getSelectHdl( ) const { return m_aSelectHdl; }
+ void initItemSize();
+ const Size& getItemSize() const { return m_aItemSizePixel; }
+
void removeHyperLabel( ItemIndex _Index )
{
if ( ( _Index > -1 ) && ( _Index < getItemCount() ) )
@@ -172,8 +212,21 @@ namespace svt
//= Roadmap
//=====================================================================
//---------------------------------------------------------------------
- ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId ):Control( _pParent, _rId )
- ,m_pImpl( new RoadmapImpl() )
+ void RoadmapImpl::initItemSize()
+ {
+ Size aLabelSize( m_rAntiImpl.GetOutputSizePixel() );
+ aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MAP_APPFONT ).Height();
+ aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MAP_APPFONT ).Width();
+ m_aItemSizePixel = aLabelSize;
+ }
+
+ //=====================================================================
+ //= Roadmap
+ //=====================================================================
+ //---------------------------------------------------------------------
+ ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId )
+ :Control( _pParent, _rId )
+ ,m_pImpl( new RoadmapImpl( *this ) )
{
implInit();
}
@@ -181,7 +234,7 @@ namespace svt
//---------------------------------------------------------------------
ORoadmap::ORoadmap( Window* _pParent, WinBits _nWinStyle )
:Control( _pParent, _nWinStyle )
- , m_pImpl( new RoadmapImpl() )
+ ,m_pImpl( new RoadmapImpl( *this ) )
{
implInit();
@@ -216,14 +269,15 @@ namespace svt
// on this with calculating a new bold font.
// Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font.
// So settings the font from outside is simply a forbidded scenario at the moment
+ EnableMapMode( sal_False );
}
//---------------------------------------------------------------------
ORoadmap::~ORoadmap( )
{
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
+ HL_Vector aItemsCopy = m_pImpl->getHyperLabels();
m_pImpl->getHyperLabels().clear();
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+ for ( HL_Vector::iterator i = aItemsCopy.begin(); i< aItemsCopy.end(); ++i )
{
delete *i;
}
@@ -240,54 +294,43 @@ namespace svt
}
- void ORoadmap::InitializeHyperLabelSize()
+ RoadmapItem* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index)
{
- Size aSize = GetSizePixel();
- Size aLogicSize = PixelToLogic( aSize, MAP_APPFONT );
- aLogicSize.Height() = LABELBASEMAPHEIGHT;
- aLogicSize.Width() -= (2*RMENTRYPOINT_X);
- m_pImpl->aHyperLabelPixelSize = LogicToPixel( aLogicSize, MAP_APPFONT );
- EnableMapMode( sal_False );
- }
-
-
- ORoadmapHyperLabel* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index)
- {
- ORoadmapHyperLabel* OldHyperLabel = NULL;
- if (_Index > 0)
- OldHyperLabel = m_pImpl->getHyperLabels().at( _Index - 1 );
- return OldHyperLabel;
+ RoadmapItem* pOldItem = NULL;
+ if ( _Index > 0 )
+ pOldItem = m_pImpl->getHyperLabels().at( _Index - 1 );
+ return pOldItem;
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _sLabel, ItemId _RMID, sal_Bool _bEnabled)
+ RoadmapItem* ORoadmap::InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _sLabel, ItemId _RMID, sal_Bool _bEnabled)
{
- if (m_pImpl->getItemCount() == 0 )
- InitializeHyperLabelSize();
- ORoadmapHyperLabel* CurHyperLabel;
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( _Index);
+ if ( m_pImpl->getItemCount() == 0 )
+ m_pImpl->initItemSize();
+
+ RoadmapItem* pItem = NULL;
+ RoadmapItem* pOldItem = GetPreviousHyperLabel( _Index );
- if (_RMID != RMINCOMPLETE )
+ pItem = new RoadmapItem( *this, m_pImpl->getItemSize() );
+ if ( _RMID != RMINCOMPLETE )
{
- CurHyperLabel = new ORoadmapHyperLabel(this, WB_WORDBREAK);
- CurHyperLabel->SetInteractive( m_pImpl->isInteractive() );
- m_pImpl->insertHyperLabel(_Index, CurHyperLabel );
+ pItem->SetInteractive( m_pImpl->isInteractive() );
+ m_pImpl->insertHyperLabel( _Index, pItem );
}
else
{
- CurHyperLabel = new ORoadmapHyperLabel(this);
- CurHyperLabel->SetInteractive( sal_False );
+ pItem->SetInteractive( sal_False );
}
- CurHyperLabel->SetPosition( OldHyperLabel );
- CurHyperLabel->SetLabelAndSize( _Index, _sLabel, m_pImpl->aHyperLabelPixelSize );
- CurHyperLabel->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) );
- CurHyperLabel->SetID( _RMID );
- CurHyperLabel->SetIndex( _Index );
+ pItem->SetPosition( pOldItem );
+ pItem->Update( _Index, _sLabel );
+ pItem->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) );
+ pItem->SetID( _RMID );
+ pItem->SetIndex( _Index );
if (!_bEnabled)
- CurHyperLabel->Enable( _bEnabled );
- return CurHyperLabel;
+ pItem->Enable( _bEnabled );
+ return pItem;
}
//---------------------------------------------------------------------
@@ -308,12 +351,14 @@ namespace svt
void ORoadmap::SetRoadmapInteractive( sal_Bool _bInteractive )
{
m_pImpl->setInteractive( _bInteractive );
- ORoadmapHyperLabel* CurHyperLabel;
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- CurHyperLabel->SetInteractive( _bInteractive );
+ (*i)->SetInteractive( _bInteractive );
}
}
@@ -326,76 +371,55 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::SetRoadmapComplete( sal_Bool _bComplete )
{
- sal_Bool OldbComplete = m_pImpl->isComplete();
- m_pImpl->setComplete( _bComplete);
- if (_bComplete)
+ sal_Bool bWasComplete = m_pImpl->isComplete();
+ m_pImpl->setComplete( _bComplete );
+ if ( _bComplete )
{
if ( m_pImpl->InCompleteHyperLabel != NULL)
{
- if (m_pImpl->getItemCount() > 0)
- {
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- pLocRoadmapItems.pop_back();
- delete m_pImpl->InCompleteHyperLabel;
- }
+ delete m_pImpl->InCompleteHyperLabel;
m_pImpl->InCompleteHyperLabel = NULL;
}
}
- else if (OldbComplete)
- m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), RMINCOMPLETE );
+ else if ( bWasComplete )
+ m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii( "..." ), RMINCOMPLETE );
}
//---------------------------------------------------------------------
- void ORoadmap::SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription)
+ void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _nIndex )
{
- const xub_StrLen n_Pos = _sDescription.Search( String::CreateFromAscii(".") );
- if ( n_Pos != STRING_NOTFOUND )
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ if ( _nIndex < (ItemIndex)rItems.size() )
{
- const String sID = ::String::CreateFromInt32( _nPrefix );
- _sDescription.Replace(0 , n_Pos, sID );
- }
- CurHyperLabel->SetLabelAndSize( _nPrefix, _sDescription, m_pImpl->aHyperLabelPixelSize );
- }
-
- //---------------------------------------------------------------------
- void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 )
- {
- if ( _Index < ( m_pImpl->getItemCount() ) )
- {
- Point aPos;
- String sLabel;
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ORoadmapHyperLabel* CurHyperLabel = NULL;
- ItemIndex n_CurPrefix = _Index + 1 ;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ _Index; i< pLocRoadmapItems.end(); i++)
+ RoadmapItem* pItem = NULL;
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nIndex;
+ i< rItems.end();
+ ++i, ++_nIndex
+ )
{
- CurHyperLabel = *i;
- aPos = CurHyperLabel->GetLogicalPosition();
- CurHyperLabel->SetIndex( n_CurPrefix - 1);
- sLabel = CurHyperLabel->GetLabel();
- SetRoadmapLabel(CurHyperLabel, n_CurPrefix, sLabel);
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( n_CurPrefix-1);
- CurHyperLabel->SetPosition( OldHyperLabel);
- n_CurPrefix++;
+ pItem = *i;
+
+ pItem->SetIndex( _nIndex );
+ pItem->SetPosition( GetPreviousHyperLabel( _nIndex ) );
}
}
if ( ! m_pImpl->isComplete() )
{
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( m_pImpl->getItemCount());
- m_pImpl->InCompleteHyperLabel->SetPosition( OldHyperLabel );
- m_pImpl->InCompleteHyperLabel->SetLabelAndSize( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), m_pImpl->aHyperLabelPixelSize );
+ RoadmapItem* pOldItem = GetPreviousHyperLabel( m_pImpl->getItemCount() );
+ m_pImpl->InCompleteHyperLabel->SetPosition( pOldItem );
+ m_pImpl->InCompleteHyperLabel->Update( m_pImpl->getItemCount(), ::String::CreateFromAscii("...") );
}
}
//---------------------------------------------------------------------
- void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled )
+ void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByIndex( _Index);
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByIndex( _Index);
+ if ( pItem != NULL )
{
- CurHyperLabel->SetLabelAndSize( _Index, _RoadmapItem, m_pImpl->aHyperLabelPixelSize );
- CurHyperLabel->SetID( _RMID );
- CurHyperLabel->Enable( _bEnabled );
+ pItem->Update( _Index, _RoadmapItem );
+ pItem->SetID( _RMID );
+ pItem->Enable( _bEnabled );
}
}
@@ -408,7 +432,7 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetItemID( ItemIndex _nIndex ) const
{
- const ORoadmapHyperLabel* pHyperLabel = GetByIndex( _nIndex );
+ const RoadmapItem* pHyperLabel = GetByIndex( _nIndex );
if ( pHyperLabel )
return pHyperLabel->GetID();
return -1;
@@ -417,28 +441,26 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemIndex ORoadmap::GetItemIndex( ItemId _nID ) const
{
- ORoadmapHyperLabel* CurHyperLabel;
ItemId nLocID = 0;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- ItemIndex nResult = 0;
- for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- nLocID = CurHyperLabel->GetID();
+ nLocID = (*i)->GetID();
if ( nLocID == _nID )
- return nResult;
- nResult++;
+ return ItemIndex( i - rItems.begin() );
}
return -1;
}
//---------------------------------------------------------------------
- void ORoadmap::InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled )
+ void ORoadmap::InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled )
{
- ORoadmapHyperLabel* CurHyperLabel;
- CurHyperLabel = InsertHyperLabel(_Index, _RoadmapItem, _nUniqueId, _bEnabled);
+ InsertHyperLabel( _Index, _RoadmapItem, _nUniqueId, _bEnabled );
// Todo: YPos is superfluous, if items are always appended
- UpdatefollowingHyperLabels( _Index + 1);
+ UpdatefollowingHyperLabels( _Index + 1 );
}
//---------------------------------------------------------------------
@@ -447,7 +469,7 @@ namespace svt
if ( m_pImpl->getItemCount() > 0 && ( _Index > -1) && ( _Index < m_pImpl->getItemCount() ) )
{
m_pImpl->removeHyperLabel( _Index );
- UpdatefollowingHyperLabels( _Index, NREMOVERMITEM);
+ UpdatefollowingHyperLabels( _Index );
}
}
@@ -460,33 +482,33 @@ namespace svt
//---------------------------------------------------------------------
sal_Bool ORoadmap::IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex ) const
{
- const ORoadmapHyperLabel* _pLabelItem = GetByID( _nItemId, _nStartIndex );
+ const RoadmapItem* _pLabelItem = GetByID( _nItemId, _nStartIndex );
return _pLabelItem ? _pLabelItem->IsEnabled() : sal_False;
}
//---------------------------------------------------------------------
void ORoadmap::EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nItemId, _nStartIndex );
- if ( CurHyperLabel != NULL )
- CurHyperLabel->Enable( _bEnable );
+ RoadmapItem* pItem = GetByID( _nItemId, _nStartIndex );
+ if ( pItem != NULL )
+ pItem->Enable( _bEnable );
}
//---------------------------------------------------------------------
- void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString _sLabel, ItemIndex _nStartIndex )
+ void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& _sLabel, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
{
- CurHyperLabel->SetLabelAndSize( CurHyperLabel->GetIndex(), _sLabel, m_pImpl->aHyperLabelPixelSize );
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ItemIndex Index = _nStartIndex;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ Index; i< pLocRoadmapItems.end(); i++)
+ pItem->Update( pItem->GetIndex(), _sLabel );
+
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( Index );
- CurHyperLabel->SetPosition( OldHyperLabel);
- Index++;
+ (*i)->SetPosition( GetPreviousHyperLabel( i - rItems.begin() ) );
}
}
}
@@ -495,9 +517,9 @@ namespace svt
::rtl::OUString ORoadmap::GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
- return CurHyperLabel->GetLabel();
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
+ return pItem->GetLabel();
else
return ::rtl::OUString();
}
@@ -505,47 +527,47 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
- CurHyperLabel->SetID( _NewID );
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
+ pItem->SetID( _NewID );
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex)
+ RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex)
{
- ORoadmapHyperLabel* CurHyperLabel;
ItemId nLocID = 0;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = LocHyperLabels.begin()+ _nStartIndex; i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- nLocID = CurHyperLabel->GetID();
+ nLocID = (*i)->GetID();
if ( nLocID == _nID )
- return CurHyperLabel;
+ return *i;
}
return NULL;
}
//---------------------------------------------------------------------
- const ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const
+ const RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const
{
return const_cast< ORoadmap* >( this )->GetByID( _nID, _nStartIndex );
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex)
+ RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex)
{
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- if ((_nItemIndex > -1) && (_nItemIndex < m_pImpl->getItemCount( ) ) )
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ if ( ( _nItemIndex > -1 ) && ( _nItemIndex < (ItemIndex)rItems.size() ) )
{
- ORoadmapHyperLabel* CurHyperLabel = LocHyperLabels.at(_nItemIndex); // Vectors are one-based
- return CurHyperLabel;
+ return rItems.at( _nItemIndex );
}
return NULL;
}
//---------------------------------------------------------------------
- const ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const
+ const RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const
{
return const_cast< ORoadmap* >( this )->GetByIndex( _nItemIndex );
}
@@ -553,14 +575,14 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetNextAvailableItemId( ItemIndex _nNewIndex )
{
- ORoadmapHyperLabel* CurHyperLabel;
+ RoadmapItem* pItem = NULL;
ItemIndex searchIndex = ++_nNewIndex;
while ( searchIndex < m_pImpl->getItemCount() )
{
- CurHyperLabel = GetByIndex( searchIndex );
- if ( CurHyperLabel->IsEnabled() )
- return CurHyperLabel->GetID( );
+ pItem = GetByIndex( searchIndex );
+ if ( pItem->IsEnabled() )
+ return pItem->GetID( );
++searchIndex;
}
@@ -570,13 +592,13 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetPreviousAvailableItemId( ItemIndex _nNewIndex )
{
- ORoadmapHyperLabel* CurHyperLabel;
+ RoadmapItem* pItem = NULL;
ItemIndex searchIndex = --_nNewIndex;
while ( searchIndex > -1 )
{
- CurHyperLabel = GetByIndex( searchIndex );
- if ( CurHyperLabel->IsEnabled() )
- return CurHyperLabel->GetID( );
+ pItem = GetByIndex( searchIndex );
+ if ( pItem->IsEnabled() )
+ return pItem->GetID( );
searchIndex--;
}
@@ -586,12 +608,13 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::DeselectOldRoadmapItems()
{
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ORoadmapHyperLabel* CurHyperLabel = NULL;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- CurHyperLabel->ToggleBackgroundColor( COL_TRANSPARENT );
+ (*i)->ToggleBackgroundColor( COL_TRANSPARENT );
}
}
@@ -617,7 +640,7 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::GetFocus()
{
- ORoadmapHyperLabel* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() );
+ RoadmapItem* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() );
if ( pCurHyperLabel != NULL )
pCurHyperLabel->GrabFocus();
}
@@ -626,15 +649,15 @@ namespace svt
sal_Bool ORoadmap::SelectRoadmapItemByID( ItemId _nNewID )
{
DeselectOldRoadmapItems();
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nNewID );
- if (CurHyperLabel != NULL)
+ RoadmapItem* pItem = GetByID( _nNewID );
+ if ( pItem != NULL )
{
- if (CurHyperLabel->IsEnabled())
+ if ( pItem->IsEnabled() )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- CurHyperLabel->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor
+ pItem->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor
- CurHyperLabel->GrabFocus();
+ pItem->GrabFocus();
m_pImpl->setCurItemID(_nNewID);
Select();
@@ -670,7 +693,7 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::DrawHeadline()
{
- Point aTextPos = LogicToPixel( Point( RMENTRYPOINT_X, 8 ), MAP_APPFONT );
+ Point aTextPos = LogicToPixel( Point( ROADMAP_INDENT_X, 8 ), MAP_APPFONT );
Size aOutputSize( GetOutputSizePixel() );
@@ -683,15 +706,16 @@ namespace svt
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByPointer(Window* pWindow)
+ RoadmapItem* ORoadmap::GetByPointer(Window* pWindow)
{
- ORoadmapHyperLabel* CurHyperLabel;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- if ( (CurHyperLabel->GetIDLabel() == pWindow) || (CurHyperLabel->GetDescriptionHyperLabel() == pWindow) )
- return CurHyperLabel;
+ if ( (*i)->Contains( pWindow ) )
+ return *i;
}
return NULL;
}
@@ -703,30 +727,30 @@ namespace svt
if ( _rNEvt.GetType() == EVENT_KEYINPUT )
{
Window* pWindow = _rNEvt.GetWindow();
- ORoadmapHyperLabel* CurHyperLabel = GetByPointer( pWindow );
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByPointer( pWindow );
+ if ( pItem != NULL )
{
sal_Int16 nKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
switch( nKeyCode )
{
case KEY_UP:
- { // Note: Performancewhise this is not optimal, because we search for an ID in the labels
+ { // Note: Performancewise this is not optimal, because we search for an ID in the labels
// and afterwards we search again for a label with the appropriate ID ->
// unnecessarily we search twice!!!
- ItemId nPrevItemID = GetPreviousAvailableItemId( CurHyperLabel->GetIndex() );
+ ItemId nPrevItemID = GetPreviousAvailableItemId( pItem->GetIndex() );
if ( nPrevItemID != -1 )
return SelectRoadmapItemByID( nPrevItemID );
}
break;
case KEY_DOWN:
{
- ItemId nNextItemID = GetNextAvailableItemId( CurHyperLabel->GetIndex() );
+ ItemId nNextItemID = GetNextAvailableItemId( pItem->GetIndex() );
if ( nNextItemID != -1 )
return SelectRoadmapItemByID( nNextItemID );
}
break;
case KEY_SPACE:
- return SelectRoadmapItemByID( CurHyperLabel->GetID() );
+ return SelectRoadmapItemByID( pItem->GetID() );
}
}
}
@@ -736,9 +760,12 @@ namespace svt
//---------------------------------------------------------------------
IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel)
{
- return SelectRoadmapItemByID( _CurHyperLabel->GetID() );
+ return SelectRoadmapItemByID( _CurHyperLabel->GetID() );
}
+
+
+ //---------------------------------------------------------------------
void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt )
{
if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) ||
@@ -752,216 +779,228 @@ namespace svt
aFont.SetColor( aTextColor );
SetFont( aFont );
RoadmapTypes::ItemId curItemID = GetCurrentRoadmapItemID();
- ORoadmapHyperLabel* pLabelItem = GetByID( curItemID );
+ RoadmapItem* pLabelItem = GetByID( curItemID );
pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor());
Invalidate();
}
}
- ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& )
+ //---------------------------------------------------------------------
+ RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground )
+ :m_aItemPlayground( _rItemPlayground )
{
- mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK);
- mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK);
+ mpID = new IDLabel( &_rParent, WB_WORDBREAK );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
+ mpID->Show();
+ mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
+ mpDescription->Show();
}
-
- ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, WinBits )
+ //---------------------------------------------------------------------
+ bool RoadmapItem::Contains( const Window* _pWindow ) const
{
- mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK);
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
- mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK);
+ return ( mpID == _pWindow ) || ( mpDescription == _pWindow );
}
//---------------------------------------------------------------------
- void ORoadmapHyperLabel::GrabFocus()
+ void RoadmapItem::GrabFocus()
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->GrabFocus();
+ if ( mpDescription )
+ mpDescription->GrabFocus();
}
-
- void ORoadmapHyperLabel::SetInteractive( sal_Bool _bInteractive )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetInteractive( sal_Bool _bInteractive )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetInteractive(_bInteractive);
+ if ( mpDescription )
+ mpDescription->SetInteractive(_bInteractive);
}
- void ORoadmapHyperLabel::SetID( sal_Int16 _ID )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetID( sal_Int16 _ID )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetID(_ID);
+ if ( mpDescription )
+ mpDescription->SetID(_ID);
}
- sal_Int16 ORoadmapHyperLabel::GetID() const
+ //---------------------------------------------------------------------
+ sal_Int16 RoadmapItem::GetID() const
{
- return mpDescHyperLabel ? mpDescHyperLabel->GetID() : sal_Int16(-1);
+ return mpDescription ? mpDescription->GetID() : sal_Int16(-1);
}
- void ORoadmapHyperLabel::SetIndex( sal_Int32 _Index )
+ //---------------------------------------------------------------------
+ void RoadmapItem::ImplUpdateIndex( const ItemIndex _nIndex )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetIndex(_Index);
- }
+ if ( mpDescription )
+ mpDescription->SetIndex( _nIndex );
+ if ( mpID )
+ {
+ ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." );
+ mpID->SetText( aIDText );
+ }
- sal_Int32 ORoadmapHyperLabel::GetIndex() const
- {
- return mpDescHyperLabel ? mpDescHyperLabel->GetIndex() : sal_Int32(-1);
+ // update the geometry of both controls
+ ImplUpdatePosSize();
}
-
- void ORoadmapHyperLabel::SetLabel( ::rtl::OUString _rText )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetIndex( ItemIndex _Index )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetText(_rText);
+ ImplUpdateIndex( _Index );
}
+ //---------------------------------------------------------------------
+ RoadmapTypes::ItemIndex RoadmapItem::GetIndex() const
+ {
+ return mpDescription ? mpDescription->GetIndex() : ItemIndex(-1);
+ }
- ::rtl::OUString ORoadmapHyperLabel::GetLabel( )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetLabel( const ::rtl::OUString& _rText )
{
- return mpDescHyperLabel ? mpDescHyperLabel->GetText() : String();
+ if ( mpDescription )
+ mpDescription->SetText(_rText);
}
+ //---------------------------------------------------------------------
+ ::rtl::OUString RoadmapItem::GetLabel( )
+ {
+ return mpDescription ? mpDescription->GetText() : String();
+ }
- void ORoadmapHyperLabel::SetPosition(ORoadmapHyperLabel* OldHyperLabel)
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetPosition( RoadmapItem* _pOldItem )
{
- Point aNewLogicalPoint;
- Point aNewPoint;
- if (OldHyperLabel == NULL)
+ Point aIDPos;
+ if ( _pOldItem == NULL )
{
- aNewLogicalPoint = Point( RMENTRYPOINT_X, RMENTRYPOINT_Y);
- aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT );
+ aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MAP_APPFONT );
}
else
{
- Size aOldSize = OldHyperLabel->GetDescriptionHyperLabel()->GetSizePixel();
- Point aOldLogicalPoint = OldHyperLabel->GetLogicalPosition();
- aNewLogicalPoint = Point(aOldLogicalPoint.X(), (aOldLogicalPoint.Y() + RMITEMDISTANCE_Y));
- aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT );
- aNewPoint = Point(aNewPoint.X(),aNewPoint.Y() + aOldSize.Height());
+ Size aOldSize = _pOldItem->GetDescriptionHyperLabel()->GetSizePixel();
+
+ aIDPos = _pOldItem->mpID->GetPosPixel();
+ aIDPos.Y() += aOldSize.Height();
+ aIDPos.Y() += mpID->GetParent()->LogicToPixel( Size( 0, ROADMAP_ITEM_DISTANCE_Y ) ).Height();
}
- mpIDLabel->SetPosPixel( aNewPoint );
- sal_Int32 xDescPos = aNewPoint.X() + mpIDLabel->GetSizePixel().Width();
- mpDescHyperLabel->SetPosPixel( Point(xDescPos, aNewPoint.Y()) );
- }
+ mpID->SetPosPixel( aIDPos );
+ sal_Int32 nDescPos = aIDPos.X() + mpID->GetSizePixel().Width();
+ mpDescription->SetPosPixel( Point( nDescPos, aIDPos.Y() ) );
+ }
- void ORoadmapHyperLabel::SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags )
{
if (pRefRoadmapHyperLabel == NULL)
- mpDescHyperLabel->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST );
+ mpDescription->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST );
else
- mpDescHyperLabel->SetZOrder( pRefRoadmapHyperLabel->mpDescHyperLabel, nFlags); //, WINDOW_ZORDER_BEHIND );
+ mpDescription->SetZOrder( pRefRoadmapHyperLabel->mpDescription, nFlags); //, WINDOW_ZORDER_BEHIND );
}
-
- void ORoadmapHyperLabel::Enable( BOOL _bEnable)
+ //---------------------------------------------------------------------
+ void RoadmapItem::Enable( BOOL _bEnable)
{
- mpIDLabel->Enable(_bEnable);
- mpDescHyperLabel->Enable(_bEnable);
+ mpID->Enable(_bEnable);
+ mpDescription->Enable(_bEnable);
}
- BOOL ORoadmapHyperLabel::IsEnabled() const
+ //---------------------------------------------------------------------
+ BOOL RoadmapItem::IsEnabled() const
{
- return mpIDLabel->IsEnabled();
+ return mpID->IsEnabled();
}
-// void ORoadmapHyperLabel::GrabFocus()
-// {
-// mpDescHyperLabel->GrabFocus();
-//
-// }
-
- void ORoadmapHyperLabel::ToggleBackgroundColor( const Color& _rGBColor )
+ //---------------------------------------------------------------------
+ void RoadmapItem::ToggleBackgroundColor( const Color& _rGBColor )
{
if (_rGBColor == COL_TRANSPARENT)
{
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
- mpIDLabel->SetControlBackground( COL_TRANSPARENT );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
+ mpID->SetControlBackground( COL_TRANSPARENT );
}
else
{
- mpIDLabel->SetControlBackground( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightColor() );
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
+ mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
}
- mpDescHyperLabel->ToggleBackgroundColor(_rGBColor);
+ mpDescription->ToggleBackgroundColor(_rGBColor);
}
-
- Point ORoadmapHyperLabel::GetLogicalPosition()
+ //---------------------------------------------------------------------
+ void RoadmapItem::ImplUpdatePosSize()
{
- Point aPoint = mpIDLabel->GetPosPixel( );
- Size aSize = Size(aPoint.X(), aPoint.Y());
- aSize = mpIDLabel->PixelToLogic( aSize, MAP_APPFONT );
- aPoint = Point(aSize.Width(), aSize.Height());
- return aPoint;
- }
+ // calculate widths
+ long nIDWidth = mpID->GetTextWidth( mpID->GetText() );
+ long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString::createFromAscii( "100." ) );
+ nIDWidth = ::std::min( nIDWidth, nMaxIDWidth );
+
+ // check how many space the description would need
+ Size aDescriptionSize = mpDescription->CalcMinimumSize( m_aItemPlayground.Width() - nIDWidth );
+
+ // position and size both controls
+ Size aIDSize( nIDWidth, aDescriptionSize.Height() );
+ mpID->SetSizePixel( aIDSize );
+ Point aIDPos = mpID->GetPosPixel();
+ mpDescription->SetPosPixel( Point( aIDPos.X() + nIDWidth, aIDPos.Y() ) );
+ mpDescription->SetSizePixel( aDescriptionSize );
+ }
- void ORoadmapHyperLabel::SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& _rNewSize)
+ //---------------------------------------------------------------------
+ void RoadmapItem::Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText )
{
- Size rIDSize = _rNewSize;
- ::rtl::OUString aStr = ::rtl::OUString::valueOf( (sal_Int32)( _RMIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." );
- rIDSize.Width() = (sal_Int32) mpIDLabel->GetTextWidth( aStr );
- long nMaxWidth = mpIDLabel->GetTextWidth( ::rtl::OUString::createFromAscii("100.") );
- rIDSize.Width() = ::std::min( rIDSize.getWidth(),nMaxWidth );
- mpIDLabel->SetSizePixel(mpIDLabel->LogicToPixel( rIDSize));
- mpIDLabel->SetText( aStr);
- mpIDLabel->Show();
- Size rDescSize = _rNewSize;
- rDescSize.Width() -= rIDSize.Width();
- sal_Int32 xDescPos = mpIDLabel->GetPosPixel().X() + mpIDLabel->GetSizePixel().Width();
- sal_Int32 yDescPos = mpIDLabel->GetPosPixel().Y();
- Point aPoint = Point(xDescPos, yDescPos);
- mpDescHyperLabel->SetPosPixel( aPoint );
- mpDescHyperLabel->SetLabelAndSize(_rText, rDescSize);
- mpIDLabel->SetSizePixel( Size( mpIDLabel->GetSizePixel().Width(), mpDescHyperLabel->GetSizePixel().Height() ) );
+ // update description label
+ mpDescription->SetLabel( _rText );
+
+ // update the index in both controls, which triggers updating the geometry of both
+ ImplUpdateIndex( _RMIndex );
}
- ORoadmapHyperLabel::~ORoadmapHyperLabel( )
+ //---------------------------------------------------------------------
+ RoadmapItem::~RoadmapItem( )
{
{
- ::std::auto_ptr<Control> aTemp(mpIDLabel);
- mpIDLabel = NULL;
+ ::std::auto_ptr<Control> aTemp(mpID);
+ mpID = NULL;
}
{
- ::std::auto_ptr<Control> aTemp(mpDescHyperLabel);
- mpDescHyperLabel = NULL;
+ ::std::auto_ptr<Control> aTemp(mpDescription);
+ mpDescription = NULL;
}
}
-
- void ORoadmapHyperLabel::SetClickHdl( const Link& rLink )
- {
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetClickHdl( rLink);
- }
-
- const Link& ORoadmapHyperLabel::GetClickHdl( ) const
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetClickHdl( const Link& rLink )
{
- return mpDescHyperLabel->GetClickHdl();
+ if ( mpDescription )
+ mpDescription->SetClickHdl( rLink);
}
-
- ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId )
- :FixedText( _pParent, _rId )
+ //---------------------------------------------------------------------
+ const Link& RoadmapItem::GetClickHdl( ) const
{
+ return mpDescription->GetClickHdl();
}
- ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle )
+ //---------------------------------------------------------------------
+ IDLabel::IDLabel( Window* _pParent, WinBits _nWinStyle )
:FixedText( _pParent, _nWinStyle )
{
}
-
- ORoadmapIDHyperLabel::~ORoadmapIDHyperLabel( )
+ //---------------------------------------------------------------------
+ IDLabel::~IDLabel( )
{
}
-
- void ORoadmapIDHyperLabel::DataChanged( const DataChangedEvent& rDCEvt )
+ //---------------------------------------------------------------------
+ void IDLabel::DataChanged( const DataChangedEvent& rDCEvt )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
FixedText::DataChanged( rDCEvt );
diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx
index b2d57c250d32..a4b3cc1e8ecc 100644
--- a/svtools/source/misc/svtaccessiblefactory.cxx
+++ b/svtools/source/misc/svtaccessiblefactory.cxx
@@ -107,6 +107,15 @@ namespace svt
return NULL;
}
+ virtual table::IAccessibleTableControl*
+ createAccessibleTableControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
+ table::IAccessibleTable& /*_rTable*/
+ ) const
+ {
+ return NULL;
+ }
+
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
createAccessibleIconChoiceCtrl(
SvtIconChoiceCtrl& /*_rIconCtrl*/,
diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx
index cebde0705f12..2349a9f9a3da 100644
--- a/svtools/source/passwordcontainer/passwordcontainer.cxx
+++ b/svtools/source/passwordcontainer/passwordcontainer.cxx
@@ -152,17 +152,10 @@ static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd )
static sal_Bool shorterUrl( ::rtl::OUString& aURL )
{
sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) );
-
- if( aInd > 0 )
+ if( aInd > 0 && aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) != aInd-2 )
{
- sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd );
- if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) )
- != aPrevInd - 2 ||
- aInd != aURL.getLength() - 1 )
- {
- aURL = aURL.copy( 0, aInd );
- return sal_True;
- }
+ aURL = aURL.copy( 0, aInd );
+ return sal_True;
}
return sal_False;
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index c8895a19408d..1d7b046ae94b 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -30,10 +30,35 @@
#include "tablegeometry.hxx"
#include "tablecontrol_impl.hxx"
#include "svtools/table/tabledatawindow.hxx"
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+using namespace ::com::sun::star::uno;
+using ::com::sun::star::accessibility::XAccessible;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::lang;
+using namespace utl;
+//using namespace rtl;
//........................................................................
namespace svt { namespace table
{
-//........................................................................
+ //====================================================================
+ //= AccessibleTableControl_Impl
+ //====================================================================
+ // ----------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTableHeader( AccessibleTableControlObjType _eObjType )
+ {
+ if ( m_pAccessible && m_pAccessible->isAlive() )
+ return m_pAccessible->getTableHeader( _eObjType );
+ return NULL;
+ }
+ // ----------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTable( )
+ {
+ if ( m_pAccessible && m_pAccessible->isAlive() )
+ return m_pAccessible->getTable( );
+ return NULL;
+ }
//====================================================================
//= TableControl
@@ -45,12 +70,17 @@ namespace svt { namespace table
{
m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl());
}
//--------------------------------------------------------------------
TableControl::~TableControl()
{
DELETEZ( m_pImpl );
+ if ( m_pAccessTable->m_pAccessible )
+ {
+ m_pAccessTable->m_pAccessible->dispose();
+ }
}
//--------------------------------------------------------------------
@@ -59,7 +89,7 @@ namespace svt { namespace table
if ( !m_pImpl->getInputHandler()->GetFocus( *m_pImpl ) )
{
Control::GetFocus();
- GrabFocus();
+ Control::GrabFocus();
}
}
@@ -109,13 +139,13 @@ namespace svt { namespace table
}
//--------------------------------------------------------------------
- RowPos TableControl::GetCurrentRow() const
+ sal_Int32 TableControl::GetCurrentRow() const
{
return m_pImpl->getCurRow();
}
//--------------------------------------------------------------------
- ColPos TableControl::GetCurrentColumn() const
+ sal_Int32 TableControl::GetCurrentColumn() const
{
return m_pImpl->getCurColumn();
}
@@ -126,6 +156,11 @@ namespace svt { namespace table
return m_pImpl->goTo( _nColumn, _nRow );
}
//--------------------------------------------------------------------
+ sal_Bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
+ {
+ return m_pImpl->goTo( _nColPos, _nRowPos );
+ }
+ //--------------------------------------------------------------------
void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved)
{
Rectangle _rRect;
@@ -135,7 +170,7 @@ namespace svt { namespace table
return m_pImpl->invalidateRow(_nRowStart, _rRect);
}
//--------------------------------------------------------------------
- std::vector<RowPos> TableControl::getSelectedRows()
+ std::vector<sal_Int32>& TableControl::GetSelectedRows()
{
return m_pImpl->getSelectedRows();
}
@@ -174,6 +209,331 @@ namespace svt { namespace table
{
return m_pImpl->getDataWindow();
}
+
+ Reference< XAccessible > TableControl::CreateAccessible()
+ {
+ Window* pParent = GetAccessibleParentWindow();
+ DBG_ASSERT( pParent, "TableControl::CreateAccessible - parent not found" );
+
+ if( pParent && !m_pAccessTable->m_pAccessible)
+ {
+ Reference< XAccessible > xAccParent = pParent->GetAccessible();
+ if( xAccParent.is() )
+ {
+ m_pAccessTable->m_pAccessible = getAccessibleFactory().createAccessibleTableControl(
+ xAccParent, *this
+ );
+ }
+ }
+ Reference< XAccessible > xAccessible;
+ if ( m_pAccessTable->m_pAccessible )
+ xAccessible = m_pAccessTable->m_pAccessible->getMyself();
+ return xAccessible;
+ }
+ Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 _nIndex )
+ {
+ (void)_nIndex;
+ DBG_ASSERT( FALSE, "TableControl::CreateAccessibleControl: to be overwritten!" );
+ return NULL;
+ }
+ ::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
+ {
+ ::rtl::OUString aRetText;
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl" ) );
+ break;
+ case TCTYPE_TABLE:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) );
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
+ break;
+ case TCTYPE_TABLECELL:
+ aRetText = GetCellContent(_nRow, _nCol);
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ aRetText = GetRowName(_nRow);
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ aRetText = GetColumnName(_nCol);
+ break;
+ default:
+ OSL_ENSURE(0,"GridControl::GetAccessibleName: invalid enum!");
+ }
+ return aRetText;
+ }
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const
+{
+ ::rtl::OUString aRetText;
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) );
+ break;
+ case TCTYPE_TABLE:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
+ break;
+ case TCTYPE_TABLECELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) );
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
+ break;
+ }
+ return aRetText;
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const
+{
+ (void)_nRow;
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) );
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const
+{
+ return GetModel()->getRowHeaderName()[_nIndex];
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const
+{
+ (void)_nColumn;
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) );
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
+{
+ return GetModel()->getColumnModel(_nIndex)->getName();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
+{
+ ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii("");
+ std::vector<std::vector<rtl::OUString> >& aTableContent = GetModel()->getCellContent();
+ if(&aTableContent)
+ {
+ std::vector<rtl::OUString>& aRowContent = aTableContent[_nRowPos];
+ if(&aRowContent)
+ cellContent = aRowContent[_nColPos];
+ }
+ return cellContent;
+}
+// -----------------------------------------------------------------------------
+
+void TableControl::FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const
+{
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ case TCTYPE_TABLE:
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
+ if ( HasFocus() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+ if ( IsActive() )
+ rStateSet.AddState( AccessibleStateType::ACTIVE );
+ if ( IsEnabled() )
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ if ( IsReallyVisible() )
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ break;
+ case TCTYPE_TABLECELL:
+ {
+ //sal_Int32 nRow = GetCurRow();
+ //sal_uInt16 nColumn = GetCurColumnId();
+ //if ( IsFieldVisible(nRow,nColumn) )
+ // rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ rStateSet.AddState( AccessibleStateType::SELECTABLE);
+ if( GetSelectedRowCount()>0)
+ rStateSet.AddState( AccessibleStateType::SELECTED);
+ }
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ break;
+ }
+}
+
+Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow )
+{
+ return Control::GetWindowExtentsRelative( pRelativeWindow );
+}
+//-----------------------------------------------------------------------------
+void TableControl::GrabFocus()
+{
+ Control::GrabFocus();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > TableControl::GetAccessible( BOOL bCreate )
+{
+ return Control::GetAccessible( bCreate );
+}
+// -----------------------------------------------------------------------------
+Window* TableControl::GetAccessibleParentWindow() const
+{
+ return Control::GetAccessibleParentWindow();
+}
+// -----------------------------------------------------------------------------
+Window* TableControl::GetWindowInstance()
+{
+ return this;
+}
+
+sal_Bool TableControl::HasRowHeader()
+{
+ return GetModel()->hasRowHeaders();
+}
+//--------------------------------------------------------------------------------
+sal_Bool TableControl::HasColHeader()
+{
+ return GetModel()->hasColumnHeaders();
+}
+//--------------------------------------------------------------------------------
+sal_Int32 TableControl::GetAccessibleControlCount() const
+{
+ sal_Int32 count = 0;
+ if(GetRowCount()>0)
+ count+=1;
+ if(GetModel()->hasRowHeaders())
+ count+=1;
+ if(GetModel()->hasColumnHeaders())
+ count+=1;
+ return count;
+}
+sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
+{
+ sal_Int32 nRow = m_pImpl->getCurrentRow(_rPoint);
+ sal_Int32 nCol = GetCurrentColumn();
+ _rnIndex = nRow * GetColumnCount() + nCol;
+ return nRow>=0 ? sal_True : sal_False;
+}
+
+long TableControl::GetRowCount() const
+{
+ return m_pImpl->getRowCount();
+}
+long TableControl::GetColumnCount() const
+{
+ return m_pImpl->getColumnCount();
+}
+sal_Bool TableControl::HasRowHeader() const
+{
+ PTableModel pModel = GetModel();
+ return pModel->hasRowHeaders();
+}
+sal_Int32 TableControl::GetSelectedRowCount() const
+{
+ return m_pImpl->getSelectedRows().size();
+}
+bool TableControl::IsRowSelected( long _nRow ) const
+{
+ return m_pImpl->isRowSelected(m_pImpl->getSelectedRows(), _nRow);
+}
+sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
+{
+ _rnRow = m_pImpl->getCurrentRow(_rPoint);
+ _rnColPos = GetCurrentColumn();
+ return _rnRow>=0 ? sal_True : sal_False;
+}
+void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
+{
+ if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos )
+ _rStateSet.AddState( AccessibleStateType::FOCUSED );
+ else // only transient when column is not focused
+ _rStateSet.AddState( AccessibleStateType::TRANSIENT );
+}
+Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
+{
+ (void)_nRow;
+ (void)_nColumnPos;
+ return GetCharacterBounds(nIndex);
+}
+sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
+{
+ (void)_nRow;
+ (void)_nColumnPos;
+ return GetIndexForPoint(_rPoint);
+;
+}
+ // -----------------------------------------------------------------------------
+sal_Bool TableControl::isAccessibleAlive( ) const
+{
+ return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive();
+}
+
+// -----------------------------------------------------------------------------
+::svt::IAccessibleFactory& TableControl::getAccessibleFactory()
+{
+ return m_pAccessTable->m_aFactoryAccess.getFactory();
+}
+// -----------------------------------------------------------------------------
+void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
+{
+ if ( isAccessibleAlive() )
+ m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue);
+}
+// -----------------------------------------------------------------------------
+Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen)
+{
+ (void)_bOnScreen;
+ Rectangle aRectTable, aRectTableWithHeaders;
+ m_pImpl->impl_getAllVisibleDataCellArea(aRectTable);
+ m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders);
+ Size aSizeTable(aRectTable.GetSize());
+ Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
+ if(_bIsColumnBar)
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
+ else
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+}
+// -----------------------------------------------------------------------------
+Rectangle TableControl::calcTableRect(BOOL _bOnScreen)
+{
+ (void)_bOnScreen;
+ Rectangle aRect;
+ m_pImpl->impl_getAllVisibleDataCellArea(aRect);
+ return aRect;
+}
+
//........................................................................
-} } // namespace svt::table
+}} // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index e1ff3aeb7f2a..89c0eed4229a 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -181,24 +181,23 @@ namespace svt { namespace table
{
(void)pCellEntryType;
}
- virtual std::vector<std::vector<rtl::OUString> > getCellContent()
+ virtual std::vector<std::vector<rtl::OUString> >& getCellContent()
{
- std::vector<rtl::OUString> cCC;
- cCC.push_back(rtl::OUString::createFromAscii(""));
- std::vector<std::vector<rtl::OUString> > cC;
- cC.push_back(cCC);
- return cC;
+ return *( new std::vector<std::vector<rtl::OUString> >);
}
virtual void setRowHeaderName(std::vector<rtl::OUString> pCellEntryType)
{
(void)pCellEntryType;
}
- virtual std::vector<rtl::OUString> getRowHeaderName()
+ virtual std::vector<rtl::OUString>& getRowHeaderName()
{
- std::vector<rtl::OUString> cCC;
- cCC.push_back(rtl::OUString::createFromAscii(""));
- return cCC;
+ aRowHeaderNames.clear();
+ aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
+ return aRowHeaderNames;
}
+
+ private:
+ std::vector<rtl::OUString> aRowHeaderNames;
};
@@ -882,7 +881,7 @@ namespace svt { namespace table
impl_getAllVisibleDataCellArea( aAllDataCellsArea );
//get the vector, which contains row vectors, each containing the data for the cells in this row
- std::vector<std::vector<rtl::OUString> > aCellContent = m_pModel->getCellContent();
+ std::vector<std::vector<rtl::OUString> >& aCellContent = m_pModel->getCellContent();
//if the vector is empty, fill it with empty data, so the table can be painted
if(aCellContent.empty())
{
@@ -895,7 +894,7 @@ namespace svt { namespace table
}
std::vector<std::vector<rtl::OUString> >::iterator it = aCellContent.begin()+m_nTopRow;
//get the vector, which contains the row header titles
- std::vector<rtl::OUString> aRowHeaderContent;
+ std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName();
::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin();
if(m_pModel->hasRowHeaders())
@@ -1525,7 +1524,7 @@ namespace svt { namespace table
}
//-------------------------------------------------------------------------------
- std::vector<RowPos> TableControl_Impl::getSelectedRows()
+ std::vector<RowPos>& TableControl_Impl::getSelectedRows()
{
return m_nRowSelected;
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 410bc8b4c3a1..0a25e82e4502 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -138,6 +138,8 @@ namespace svt { namespace table
inline RowPos getCurRow() const { return m_nCurRow; }
inline void setCurRow(RowPos curRow){ m_nCurRow = curRow; }
inline RowPos getTopRow() const { return m_nTopRow; }
+ inline long getRowCount() const { return m_nRowCount; }
+ inline long getColumnCount() const { return m_nColumnCount; }
inline long getColHeaderHightPixel() const { return m_nColHeaderHeightPixel; }
@@ -194,7 +196,7 @@ namespace svt { namespace table
/** to be called when a new row is added to the control*/
void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect );
/** returns the vector, which contains the selected rows*/
- std::vector<RowPos> getSelectedRows();
+ std::vector<RowPos>& getSelectedRows();
/** updates the vector, which contains the selected rows after removing the row nRowPos*/
void removeSelectedRow(RowPos _nRowPos);
void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect );
@@ -208,15 +210,6 @@ namespace svt { namespace table
virtual SelectionEngine* getSelEngine();
TableDataWindow* getDataWindow();
-
- private:
- /** toggles the cursor visibility
-
- The method is not bound to the classes public invariants, as it's used in
- situations where the they must not necessarily be fullfilled.
- */
- void impl_ni_doSwitchCursor( bool _bOn );
-
/** retrieves the area occupied by the totality of (at least partially) visible cells
The returned area includes row and column headers. Also, it takes into
@@ -234,6 +227,13 @@ namespace svt { namespace table
minus the row and column header areas.
*/
void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const;
+ private:
+ /** toggles the cursor visibility
+
+ The method is not bound to the classes public invariants, as it's used in
+ situations where the they must not necessarily be fullfilled.
+ */
+ void impl_ni_doSwitchCursor( bool _bOn );
/** returns the number of visible rows.
diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk
index 51e55a1f9123..8af6b2ae7467 100644
--- a/svtools/source/uno/makefile.mk
+++ b/svtools/source/uno/makefile.mk
@@ -56,6 +56,7 @@ SLOFILES= \
$(SLO)$/generictoolboxcontroller.obj \
$(SLO)$/treecontrolpeer.obj \
$(SLO)$/unocontroltablemodel.obj \
+ $(SLO)$/svtxgridcontrol.obj \
$(SLO)$/registerservices.obj\
$(SLO)$/contextmenuhelper.obj
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
new file mode 100755
index 000000000000..2f2c896ee6a8
--- /dev/null
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -0,0 +1,458 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SVTXGridControl.cxx,v $
+ * $Revision: 1.32 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#include "svtxgridcontrol.hxx"
+#include <com/sun/star/view/SelectionType.hpp>
+#include "svtools/table/gridtablerenderer.hxx"
+#include "svtools/table/defaultinputhandler.hxx"
+#include "svtools/table/tablecontrol.hxx"
+#include "unocontroltablemodel.hxx"
+#include <comphelper/sequence.hxx>
+#include <rtl/ref.hxx>
+#include <tools/debug.hxx>
+#include <toolkit/helper/property.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+
+using ::rtl::OUString;
+using namespace ::svt::table;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::view;
+using namespace ::toolkit;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::accessibility::AccessibleEventId;
+using namespace ::com::sun::star::accessibility::AccessibleTableModelChangeType;
+using ::com::sun::star::accessibility::AccessibleTableModelChange;
+
+
+SVTXGridControl::SVTXGridControl()
+ :m_pTableModel (new UnoControlTableModel()),
+ m_xDataModel(0),
+ m_xColumnModel(0),
+ m_bHasColumnHeaders(false),
+ m_bHasRowHeaders(false),
+ m_bVScroll(false),
+ m_bHScroll(false)
+{
+}
+
+//--------------------------------------------------------------------
+SVTXGridControl::~SVTXGridControl()
+{
+ DELETEZ(m_pTableModel);
+}
+
+::com::sun::star::uno::Any SVTXGridControl::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::grid::XGridControl*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( SVTXGridControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return NULL;
+}
+void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)model;
+}
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return NULL;
+}
+void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)model;
+}
+sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ return pTable->GetCurrentRow( Point(x,y) );
+}
+
+void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)listener;
+}
+
+void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void) listener;
+}
+
+void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = (TableControl*)GetWindow();
+
+ switch( GetPropertyId( PropertyName ) )
+ {
+ case BASEPROPERTY_GRID_SELECTIONMODE:
+ {
+ SelectionType eSelectionType;
+ if( aValue >>= eSelectionType )
+ {
+ SelectionMode eSelMode;
+ switch( eSelectionType )
+ {
+ case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break;
+ case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break;
+ case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break;
+ // case SelectionType_NONE:
+ default: eSelMode = NO_SELECTION; break;
+ }
+ if( pTable->getSelEngine()->GetSelectionMode() != eSelMode )
+ pTable->getSelEngine()->SetSelectionMode( eSelMode );
+ }
+ break;
+ }
+ case BASEPROPERTY_HSCROLL:
+ {
+ sal_Bool bHScroll = true;
+ if( aValue >>= bHScroll )
+ {
+ m_bHScroll = bHScroll;
+ }
+ break;
+ }
+ case BASEPROPERTY_VSCROLL:
+ {
+ sal_Bool bVScroll = true;
+ if( aValue >>= bVScroll )
+ {
+ m_bVScroll = bVScroll;
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ {
+ sal_Bool rowHeader = true;
+ if( aValue >>= rowHeader )
+ {
+ m_pTableModel->setRowHeaders(rowHeader);
+ }
+ break;
+ }
+
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ {
+ sal_Bool colHeader = true;
+ if( aValue >>= colHeader )
+ {
+ m_pTableModel->setColumnHeaders(colHeader);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_DATAMODEL:
+ {
+ m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
+ Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData();
+ Sequence<rtl::OUString> rowData(0);
+ std::vector< std::vector< rtl::OUString > > aCellContent(0);
+ for(int i = 0; i< m_xDataModel->getRowCount();++i)
+ {
+ rowData = cellData[i];
+ std::vector<rtl::OUString> newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData));
+ if(newRow.size() < (unsigned)m_pTableModel->getColumnCount())
+ newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
+ aCellContent.push_back(newRow);
+ }
+ m_pTableModel->setCellContent(aCellContent);
+ Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
+ std::vector< rtl::OUString > newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
+ m_pTableModel->setRowCount(m_xDataModel->getRowCount());
+ m_pTableModel->setRowHeaderName(newRow);
+ break;
+ }
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ {
+ m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
+ Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
+ std::vector<Reference< XGridColumn > > aNewColumns(
+ comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
+ /* if(m_pTable->GetColumnCount().size()>0)
+ m_pTable->GetColumnName.clear();*/
+ for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ }
+ break;
+ }
+ default:
+ VCLXWindow::setProperty( PropertyName, aValue );
+ break;
+ }
+}
+
+Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ const sal_uInt16 nPropId = GetPropertyId( PropertyName );
+ TableControl* pTable = (TableControl*)GetWindow();
+ if(pTable)
+ {
+ switch(nPropId)
+ {
+ case BASEPROPERTY_GRID_SELECTIONMODE:
+ {
+ SelectionType eSelectionType;
+
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ switch( eSelMode )
+ {
+ case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break;
+ case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break;
+ case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break;
+// case NO_SELECTION:
+ default: eSelectionType = SelectionType_NONE; break;
+ }
+ return Any( eSelectionType );
+ }
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ {
+ return Any ((sal_Bool) m_pTableModel->hasRowHeaders());
+ }
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ return Any ((sal_Bool) m_pTableModel->hasColumnHeaders());
+ case BASEPROPERTY_GRID_DATAMODEL:
+ return Any ( m_xDataModel );
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ return Any ( m_xColumnModel);
+ case BASEPROPERTY_HSCROLL:
+ return Any ( m_bHScroll);
+ case BASEPROPERTY_VSCROLL:
+ return Any ( m_bVScroll);
+ }
+ }
+ return VCLXWindow::getProperty( PropertyName );
+}
+
+void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_GRID_SHOWROWHEADER,
+ BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
+ BASEPROPERTY_GRID_DATAMODEL,
+ BASEPROPERTY_GRID_COLUMNMODEL,
+ BASEPROPERTY_GRID_SELECTIONMODE,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds, true );
+}
+void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ if ( pTable )
+ {
+ pTable->SetModel(PTableModel(m_pTableModel));
+ //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) );
+ pTable->Show( bVisible );
+ }
+}
+void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if ( GetWindow())
+ GetWindow()->GrabFocus();
+}
+void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ std::vector<OUString> aNewRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData));
+ if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount())
+ aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
+ m_pTableModel->getCellContent().push_back(aNewRow);
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().push_back(Event.headerName);
+ m_pTableModel->setRowCount(m_pTableModel->getRowHeaderName().size());
+ TableControl* pTable = (TableControl*)GetWindow();
+ pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false);
+ //pTable->GrabFocus();
+ if(pTable->isAccessibleAlive())
+ {
+ pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(INSERT, m_pTableModel->getRowCount()-1, m_pTableModel->getRowCount(), 0, m_pTableModel->getColumnCount())),
+ Any());
+ pTable->commitGridControlEvent(CHILD,
+ makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
+ Any());
+ for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i)
+ {
+ pTable->commitGridControlEvent(
+ CHILD,
+ makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ),
+ Any());
+ }
+ }
+}
+
+void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ //unsigned int rows =m_pImpl->aCellContent.size()-1;
+ if(Event.index == -1)
+ {
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().clear();
+ m_pTableModel->getCellContent().clear();
+ if(pTable->isAccessibleAlive())
+ {
+ pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())),
+ Any());
+ }
+ }
+ else
+ {
+ pTable->removeSelectedRow(Event.index);
+ if(m_pTableModel->getCellContent().size()>1)
+ {
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
+ m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index);
+
+ }
+ else
+ {
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().clear();
+ m_pTableModel->getCellContent().clear();
+ //m_pImpl->nRowCount=0;
+ }
+ }
+ //pTable->InvalidateDataWindow(Event.index, true);
+ m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
+ pTable->InvalidateDataWindow(Event.index, true);
+ if(pTable->isAccessibleAlive())
+ {
+ pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())),
+ Any());
+ //pTable->commitGridControlEvent(CHILD,
+ // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
+ // Any());
+ //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i)
+ //{
+ // pTable->commitGridControlEvent(
+ // CHILD,
+ // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ),
+ // Any());
+ //}
+ }
+ //pTable->Invalidate();
+}
+
+void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void) Event;
+}
+
+ void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ VCLXWindow::disposing( Source );
+ }
+
+::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)length;
+ (void)start;
+}
+
+void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)end;
+ (void)start;
+}
+
+::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows));
+ return selectedRowsToSequence;
+}
+
+::sal_Bool SAL_CALL SVTXGridControl::isCellEditable() throw (::com::sun::star::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)index;
+ return sal_False;
+}
+
+void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)y;
+}
+
+void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)x;
+}
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
new file mode 100755
index 000000000000..9ca6901681c9
--- /dev/null
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: SVTXGridControl.hxx,v $
+ * $Revision: 1.32 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVT_GRIDCONTROL_HXX_
+#define _SVT_GRIDCONTROL_HXX_
+
+#include <unocontroltablemodel.hxx>
+#include <svtools/table/tablecontrol.hxx>
+#include <com/sun/star/awt/grid/XGridControl.hpp>
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/grid/GridDataEvent.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/implbase2.hxx>
+//#include <toolkit/helper/listenermultiplexer.hxx>
+
+
+using namespace ::svt::table;
+
+class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
+ ::com::sun::star::awt::grid::XGridDataListener>
+{
+private:
+ UnoControlTableModel* m_pTableModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel;
+ bool m_bHasColumnHeaders;
+ bool m_bHasRowHeaders;
+ bool m_bVScroll;
+ bool m_bHScroll;
+
+public:
+ SVTXGridControl();
+ ~SVTXGridControl();
+ //XGridDataListener overridables
+ virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
+ void SAL_CALL release() throw() { VCLXWindow::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ //::com::sun::star::awt::grid::XGridControl
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException);
+ };
+ #endif // _SVT_GRIDCONTROL_HXX_
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index e322dbb8f96e..b4ddc2cc472d 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -47,38 +47,6 @@ using namespace ::svt::table;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt::grid;
-using namespace ::svt::table;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::view;
-using namespace ::toolkit;
-
-class UnoControlTableColumn : public IColumnModel
- {
- private:
- ColumnID m_nID;
- String m_sName;
- bool m_bIsResizable;
- TableMetrics m_nWidth;
- TableMetrics m_nMinWidth;
- TableMetrics m_nMaxWidth;
-
- public:
- UnoControlTableColumn(Reference<XGridColumn>);
-
- // IColumnModel overridables
- virtual ColumnID getID() const;
- virtual bool setID( const ColumnID _nID );
- virtual String getName() const;
- virtual void setName( const String& _rName );
- virtual bool isResizable() const;
- virtual void setResizable( bool _bResizable );
- virtual TableMetrics getWidth() const;
- virtual void setWidth( TableMetrics _nWidth );
- virtual TableMetrics getMinWidth() const;
- virtual void setMinWidth( TableMetrics _nMinWidth );
- virtual TableMetrics getMaxWidth() const;
- virtual void setMaxWidth( TableMetrics _nMaxWidth );
- };
//--------------------------------------------------------------------
UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn)
@@ -181,7 +149,7 @@ class UnoControlTableColumn : public IColumnModel
//====================================================================
struct UnoControlTableModel_Impl
{
- ::std::vector< PColumnModel > aColumns;
+ ::std::vector< PColumnModel >& aColumns;
TableSize nRowCount;
bool bHasColumnHeaders;
bool bHasRowHeaders;
@@ -190,11 +158,12 @@ class UnoControlTableColumn : public IColumnModel
TableMetrics nRowHeight;
TableMetrics nColumnHeaderHeight;
TableMetrics nRowHeaderWidth;
- std::vector<rtl::OUString> aRowHeadersTitle;
- std::vector<std::vector<rtl::OUString> > aCellContent;
+ std::vector<rtl::OUString>& aRowHeadersTitle;
+ std::vector<std::vector<rtl::OUString> >& aCellContent;
UnoControlTableModel_Impl()
- :nRowCount ( 0 )
+ :aColumns ( *(new std::vector< PColumnModel> (0)))
+ ,nRowCount ( 0 )
,bHasColumnHeaders ( false )
,bHasRowHeaders ( false )
,pRenderer ( )
@@ -202,8 +171,8 @@ class UnoControlTableColumn : public IColumnModel
,nRowHeight ( 4 * 100 ) // 40 mm
,nColumnHeaderHeight( 5 * 100 ) // 50 mm
,nRowHeaderWidth ( 10 * 100 ) // 50 mm
- ,aRowHeadersTitle ( 0 )
- ,aCellContent ( 0 )
+ ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0)))
+ ,aCellContent ( *(new std::vector<std::vector<OUString> >(0)))
{
}
};
@@ -213,16 +182,10 @@ class UnoControlTableColumn : public IColumnModel
//====================================================================
//--------------------------------------------------------------------
UnoControlTableModel::UnoControlTableModel()
- :m_pImpl( new UnoControlTableModel_Impl ),
- m_xDataModel(0),
- m_xColumnModel(0),
- m_bHasColumnHeaders(false),
- m_bHasRowHeaders(false),
- m_bVScroll(false),
- m_bHScroll(false)
- {
- m_pImpl->bHasColumnHeaders = m_bHasColumnHeaders;
- m_pImpl->bHasRowHeaders = m_bHasRowHeaders;
+ :m_pImpl( new UnoControlTableModel_Impl )
+ {
+ m_pImpl->bHasColumnHeaders = false;
+ m_pImpl->bHasRowHeaders = false;
m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) );
m_pImpl->pInputHandler.reset( new DefaultInputHandler );
}
@@ -236,7 +199,7 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
TableSize UnoControlTableModel::getColumnCount() const
{
- m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount());
+ //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount());
return (TableSize)m_pImpl->aColumns.size();
}
@@ -312,6 +275,11 @@ class UnoControlTableColumn : public IColumnModel
}
//--------------------------------------------------------------------
+ std::vector<PColumnModel>& UnoControlTableModel::getColumnModel()
+ {
+ return m_pImpl->aColumns;
+ }
+ //--------------------------------------------------------------------
PColumnModel UnoControlTableModel::getColumnModelByID( ColumnID id )
{
(void)id;
@@ -376,7 +344,7 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
{
- if(overAllHeight>=actHeight && !m_bVScroll)
+ if(overAllHeight>=actHeight)// && !m_bVScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
@@ -385,7 +353,7 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
{
- if(overAllWidth>=actWidth && !m_bHScroll)
+ if(overAllWidth>=actWidth)// && !m_bHScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
@@ -393,25 +361,26 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
void UnoControlTableModel::setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)
{
- if(cellContent.empty())
- {
- unsigned int i = m_pImpl->aColumns.size();
- std::vector<rtl::OUString> emptyCells;
- while(i!=0)
- {
- cellContent.push_back(emptyCells);
- --i;
- }
- }
- std::vector<rtl::OUString> cCC;
- for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter)
- {
- cCC = *iter;
- m_pImpl->aCellContent.push_back(cCC);
- }
- }
-
- std::vector<std::vector<rtl::OUString> > UnoControlTableModel::getCellContent()
+ //if(cellContent.empty())
+ //{
+ // unsigned int i = m_pImpl->aColumns.size();
+ // std::vector<rtl::OUString>& emptyCells;
+ // while(i!=0)
+ // {
+ // cellContent.push_back(emptyCells);
+ // --i;
+ // }
+ //}
+ //std::vector<rtl::OUString> cCC;
+ //for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter)
+ //{
+ // cCC = *iter;
+ // m_pImpl->aCellContent.push_back(cCC);
+ //}
+ m_pImpl->aCellContent.swap( cellContent );
+ }
+
+ std::vector<std::vector<rtl::OUString> >& UnoControlTableModel::getCellContent()
{
return m_pImpl->aCellContent;
}
@@ -435,378 +404,8 @@ class UnoControlTableColumn : public IColumnModel
}
}
- std::vector<rtl::OUString> UnoControlTableModel::getRowHeaderName()
+ std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName()
{
return m_pImpl->aRowHeadersTitle;
}
-::com::sun::star::uno::Any UnoControlTableModel::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::grid::XGridControl*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
- //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ),
- //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoControlTableModel )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ),
- VCLXWindow::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
-sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTableControl = (TableControl*)GetWindow();
- return pTableControl->GetCurrentRow( Point(x,y) );
-}
-
-/*
-void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException)
-{
- VCLXWindow::addMouseListener( listener );
-}
-
-void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException)
-{
- VCLXWindow::removeMouseListener( listener );
-}
-*/
-/*
-void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void)rEvent;
-}
-void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void)rEvent;
-}
-void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void) rEvent;
-}
-void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void) rEvent;
-}
-*/
-void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)listener;
-}
-
-void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- (void) listener;
-}
-
-void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- TableControl* pTableControl = (TableControl*)GetWindow();
-
- switch( GetPropertyId( PropertyName ) )
- {
- case BASEPROPERTY_GRID_SELECTIONMODE:
- {
- SelectionType eSelectionType;
- if( aValue >>= eSelectionType )
- {
- SelectionMode eSelMode;
- switch( eSelectionType )
- {
- case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break;
- case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break;
- case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break;
- // case SelectionType_NONE:
- default: eSelMode = NO_SELECTION; break;
- }
- if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode )
- pTableControl->getSelEngine()->SetSelectionMode( eSelMode );
- }
- break;
- }
- case BASEPROPERTY_HSCROLL:
- {
- sal_Bool bHScroll = true;
- if( aValue >>= bHScroll )
- {
- m_bHScroll = bHScroll;
- }
- break;
- }
- case BASEPROPERTY_VSCROLL:
- {
- sal_Bool bVScroll = true;
- if( aValue >>= bVScroll )
- {
- m_bVScroll = bVScroll;
- }
- break;
- }
- case BASEPROPERTY_GRID_SHOWROWHEADER:
- {
- sal_Bool rowHeader = true;
- if( aValue >>= rowHeader )
- {
- setRowHeaders(rowHeader);
- }
- break;
- }
-
- case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- {
- sal_Bool colHeader = true;
- if( aValue >>= colHeader )
- {
- setColumnHeaders(colHeader);
- }
- break;
- }
- case BASEPROPERTY_GRID_DATAMODEL:
- {
- m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
- Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData();
- Sequence<rtl::OUString> rowData(0);
- for(int i = 0; i< m_xDataModel->getRowCount();++i)
- {
- rowData = cellData[i];
- std::vector<rtl::OUString> newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData));
- if(newRow.size()<m_pImpl->aColumns.size())
- newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii(""));
- m_pImpl->aCellContent.push_back(newRow);
- }
- Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
- m_pImpl->nRowCount = m_xDataModel->getRowCount();
- setRowHeaderName(newRow);
- break;
- }
- case BASEPROPERTY_GRID_COLUMNMODEL:
- {
- m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
- Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
- std::vector<Reference< XGridColumn > > aNewColumns(
- comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
- if(!m_pImpl->aColumns.empty())
- m_pImpl->aColumns.clear();
- for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
- {
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
- m_pImpl->aColumns.push_back((PColumnModel)tableColumn);
- }
- break;
- }
- default:
- VCLXWindow::setProperty( PropertyName, aValue );
- break;
- }
-}
-
-Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- const sal_uInt16 nPropId = GetPropertyId( PropertyName );
- TableControl* pTableControl = (TableControl*)GetWindow();
- if(pTableControl)
- {
- switch(nPropId)
- {
- case BASEPROPERTY_GRID_SELECTIONMODE:
- {
- SelectionType eSelectionType;
-
- SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode();
- switch( eSelMode )
- {
- case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break;
- case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break;
- case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break;
-// case NO_SELECTION:
- default: eSelectionType = SelectionType_NONE; break;
- }
- return Any( eSelectionType );
- }
- case BASEPROPERTY_GRID_SHOWROWHEADER:
- {
- return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders());
- }
- case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders());
- case BASEPROPERTY_GRID_DATAMODEL:
- return Any ( m_xDataModel );
- case BASEPROPERTY_GRID_COLUMNMODEL:
- return Any ( m_xColumnModel);
- case BASEPROPERTY_HSCROLL:
- return Any ( m_bHScroll);
- case BASEPROPERTY_VSCROLL:
- return Any ( m_bVScroll);
- }
- }
- return VCLXWindow::getProperty( PropertyName );
-}
-
-void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
-{
- PushPropertyIds( rIds,
- BASEPROPERTY_GRID_SHOWROWHEADER,
- BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
- BASEPROPERTY_GRID_DATAMODEL,
- BASEPROPERTY_GRID_COLUMNMODEL,
- BASEPROPERTY_GRID_SELECTIONMODE,
- 0);
- VCLXWindow::ImplGetPropertyIds( rIds, true );
-}
-void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- if ( pTable )
- {
- pTable->SetModel(PTableModel(this));
- pTable->Show( bVisible );
- }
-}
-void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException)
-{
- ::vos::OGuard aGuard( GetMutex() );
- if ( GetWindow())
- GetWindow()->GrabFocus();
-}
-void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
-{
- std::vector<OUString> aNewRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData));
- if(aNewRow.size()<m_pImpl->aColumns.size())
- aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii(""));
- m_pImpl->aCellContent.push_back(aNewRow);
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.push_back(Event.headerName);
- m_pImpl->nRowCount=m_pImpl->aCellContent.size();
- TableControl* pTable = (TableControl*)GetWindow();
- pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false);
- //pTable->GrabFocus();
-}
-
-void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- //unsigned int rows =m_pImpl->aCellContent.size()-1;
- if(Event.index == -1)
- {
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.clear();
- m_pImpl->aCellContent.clear();
- }
- else
- {
- pTable->removeSelectedRow(Event.index);
- if(m_pImpl->aCellContent.size()>1)
- {
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index);
- m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index);
-
- }
- else
- {
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.clear();
- m_pImpl->aCellContent.clear();
- //m_pImpl->nRowCount=0;
- }
- }
- //pTable->InvalidateDataWindow(Event.index, true);
- setRowCount(m_pImpl->aCellContent.size());
- pTable->InvalidateDataWindow(Event.index, true);
- //pTable->Invalidate();
-}
-
-void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void) Event;
-}
-
- void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
- {
- VCLXWindow::disposing( Source );
- }
-
-::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-
-::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-
-void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)length;
- (void)start;
-}
-
-void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)end;
- (void)start;
-}
-
-::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos> selectedRows = pTable->getSelectedRows();
- Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows));
- return selectedRowsToSequence;
-}
-
-::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException)
-{
- return sal_False;
-}
-
-::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
-{
- return sal_False;
-}
-
-::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)index;
- return sal_False;
-}
-
-void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)y;
-}
-
-void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)x;
-}
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index 5da9cc871756..fe3d1f28e9ed 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -43,25 +43,48 @@
#include <toolkit/awt/vclxwindows.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
//#include <toolkit/helper/listenermultiplexer.hxx>
using namespace ::svt::table;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt::grid;
+
+class UnoControlTableColumn : public IColumnModel
+ {
+ private:
+ ColumnID m_nID;
+ String m_sName;
+ bool m_bIsResizable;
+ TableMetrics m_nWidth;
+ TableMetrics m_nMinWidth;
+ TableMetrics m_nMaxWidth;
+
+ public:
+ UnoControlTableColumn(Reference<XGridColumn>);
+
+ // IColumnModel overridables
+ virtual ColumnID getID() const;
+ virtual bool setID( const ColumnID _nID );
+ virtual String getName() const;
+ virtual void setName( const String& _rName );
+ virtual bool isResizable() const;
+ virtual void setResizable( bool _bResizable );
+ virtual TableMetrics getWidth() const;
+ virtual void setWidth( TableMetrics _nWidth );
+ virtual TableMetrics getMinWidth() const;
+ virtual void setMinWidth( TableMetrics _nMinWidth );
+ virtual TableMetrics getMaxWidth() const;
+ virtual void setMaxWidth( TableMetrics _nMaxWidth );
+ };
struct UnoControlTableModel_Impl;
- class UnoControlTableModel : public ITableModel, public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
- ::com::sun::star::awt::grid::XGridDataListener>
+ class UnoControlTableModel : public ITableModel
{
private:
UnoControlTableModel_Impl* m_pImpl;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel;
- bool m_bHasColumnHeaders;
- bool m_bHasRowHeaders;
- bool m_bVScroll;
- bool m_bHScroll;
- //MouseListenerMultiplexer m_aMouseListeners;
public:
UnoControlTableModel();
@@ -103,6 +126,7 @@ using namespace ::svt::table;
virtual void addTableModelListener( const PTableModelListener& listener );
virtual void removeTableModelListener( const PTableModelListener& listener );
virtual PColumnModel getColumnModel( ColPos column );
+ virtual std::vector<PColumnModel>& getColumnModel();
virtual PColumnModel getColumnModelByID( ColumnID id );
virtual PTableRenderer getRenderer() const;
virtual PTableInputHandler getInputHandler() const;
@@ -112,59 +136,9 @@ using namespace ::svt::table;
virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const;
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const;
virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent);
- virtual std::vector<std::vector<rtl::OUString> > getCellContent();
+ virtual std::vector<std::vector<rtl::OUString> >& getCellContent();
virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent);
- virtual std::vector<rtl::OUString> getRowHeaderName();
-
- //XGridDataListener overridables
- virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
- void SAL_CALL release() throw() { VCLXWindow::release(); }
-
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
- //::com::sun::star::awt::grid::XGridControl
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
-
- //void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException);
- //void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException);
- //::com::sun::star::awt::XMouseListener
- /*
- virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- */
-
- void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
- static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
- void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException);
+ virtual std::vector<rtl::OUString>& getRowHeaderName();
};
inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 54cc448ff89e..a4e003b69682 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -54,8 +54,7 @@
#include <svtools/svtreebx.hxx>
#include "treecontrolpeer.hxx"
-//#include "vclxgridcontrol.hxx"
-#include "unocontroltablemodel.hxx"
+#include "svtxgridcontrol.hxx"
#include <svtools/table/tablecontrol.hxx>
namespace
@@ -172,10 +171,8 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com::
{
if ( pParent )
{
- ::svt::table::TableControl* m_pTable = new ::svt::table::TableControl(pParent, nWinBits);
- UnoControlTableModel* pModel = new UnoControlTableModel();
- *ppNewComp = pModel;
- pWindow = m_pTable;
+ pWindow = new ::svt::table::TableControl(pParent, nWinBits);
+ *ppNewComp = new SVTXGridControl;
}
else
{