1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
21 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <cppuhelper/basemutex.hxx>
24 #include <cppuhelper/compbase2.hxx>
25 #include <toolkit/helper/mutexandbroadcasthelper.hxx>
29 using namespace ::com::sun::star
;
30 using namespace ::com::sun::star::uno
;
31 using namespace ::com::sun::star::awt
;
32 using namespace ::com::sun::star::awt::grid
;
33 using namespace ::com::sun::star::lang
;
43 enum broadcast_type
{ row_added
, row_removed
, data_changed
};
45 typedef ::cppu::WeakComponentImplHelper2
< XMutableGridDataModel
47 > DefaultGridDataModel_Base
;
49 class DefaultGridDataModel
:public ::cppu::BaseMutex
50 ,public DefaultGridDataModel_Base
53 DefaultGridDataModel();
54 DefaultGridDataModel( DefaultGridDataModel
const & i_copySource
);
55 virtual ~DefaultGridDataModel();
57 // XMutableGridDataModel
58 virtual void SAL_CALL
addRow( const Any
& i_heading
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Data
) throw (::com::sun::star::uno::RuntimeException
);
59 virtual void SAL_CALL
addRows( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Headings
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> >& Data
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
60 virtual void SAL_CALL
insertRow( ::sal_Int32 i_index
, const ::com::sun::star::uno::Any
& i_heading
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Data
) throw (::com::sun::star::uno::RuntimeException
, ::com::sun::star::lang::IndexOutOfBoundsException
);
61 virtual void SAL_CALL
insertRows( ::sal_Int32 i_index
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Headings
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> >& Data
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
62 virtual void SAL_CALL
removeRow( ::sal_Int32 RowIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
63 virtual void SAL_CALL
removeAllRows( ) throw (::com::sun::star::uno::RuntimeException
);
64 virtual void SAL_CALL
updateCellData( ::sal_Int32 ColumnIndex
, ::sal_Int32 RowIndex
, const ::com::sun::star::uno::Any
& Value
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
65 virtual void SAL_CALL
updateRowData( const ::com::sun::star::uno::Sequence
< ::sal_Int32
>& ColumnIndexes
, ::sal_Int32 RowIndex
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Values
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
66 virtual void SAL_CALL
updateRowHeading( ::sal_Int32 RowIndex
, const ::com::sun::star::uno::Any
& Heading
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
67 virtual void SAL_CALL
updateCellToolTip( ::sal_Int32 ColumnIndex
, ::sal_Int32 RowIndex
, const ::com::sun::star::uno::Any
& Value
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
68 virtual void SAL_CALL
updateRowToolTip( ::sal_Int32 RowIndex
, const ::com::sun::star::uno::Any
& Value
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
69 virtual void SAL_CALL
addGridDataListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::grid::XGridDataListener
>& Listener
) throw (::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
removeGridDataListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::grid::XGridDataListener
>& Listener
) throw (::com::sun::star::uno::RuntimeException
);
73 virtual ::sal_Int32 SAL_CALL
getRowCount() throw (::com::sun::star::uno::RuntimeException
);
74 virtual ::sal_Int32 SAL_CALL
getColumnCount() throw (::com::sun::star::uno::RuntimeException
);
75 virtual ::com::sun::star::uno::Any SAL_CALL
getCellData( ::sal_Int32 Column
, ::sal_Int32 Row
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
76 virtual ::com::sun::star::uno::Any SAL_CALL
getCellToolTip( ::sal_Int32 Column
, ::sal_Int32 Row
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
77 virtual ::com::sun::star::uno::Any SAL_CALL
getRowHeading( ::sal_Int32 RowIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
78 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getRowData( ::sal_Int32 RowIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
81 virtual void SAL_CALL
disposing();
84 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
createClone( ) throw (::com::sun::star::uno::RuntimeException
);
87 virtual OUString SAL_CALL
getImplementationName( ) throw (RuntimeException
);
88 virtual ::sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw (RuntimeException
);
89 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw (RuntimeException
);
92 typedef ::std::pair
< Any
, Any
> CellData
;
93 typedef ::std::vector
< CellData
> RowData
;
94 typedef ::std::vector
< RowData
> GridData
;
97 GridDataEvent
const & i_event
,
98 void ( SAL_CALL ::com::sun::star::awt::grid::XGridDataListener::*i_listenerMethod
)( ::com::sun::star::awt::grid::GridDataEvent
const & ),
99 ::comphelper::ComponentGuard
& i_instanceLock
102 void impl_insertRow( sal_Int32
const i_position
, Any
const & i_heading
, Sequence
< Any
> const & i_rowData
, sal_Int32
const i_assumedColCount
= -1 );
104 ::sal_Int32
impl_getRowCount_nolck() const { return sal_Int32( m_aData
.size() ); }
106 CellData
const & impl_getCellData_throw( sal_Int32
const i_columnIndex
, sal_Int32
const i_rowIndex
) const;
107 CellData
& impl_getCellDataAccess_throw( sal_Int32
const i_columnIndex
, sal_Int32
const i_rowIndex
);
108 RowData
& impl_getRowDataAccess_throw( sal_Int32
const i_rowIndex
, size_t const i_requiredColumnCount
);
111 ::std::vector
< ::com::sun::star::uno::Any
> m_aRowHeaders
;
112 sal_Int32 m_nColumnCount
;
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */