| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | /* |
| 3 | * This file is part of the LibreOffice project. |
| 4 | * |
| 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/. |
| 8 | * |
| 9 | * This file incorporates work covered by the following license notice: |
| 10 | * |
| 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 . |
| 18 | */ |
| 19 | |
| 20 | #ifndef INCLUDED_SW_INC_UNOTBL_HXX |
| 21 | #define INCLUDED_SW_INC_UNOTBL_HXX |
| 22 | |
| 23 | #include <com/sun/star/lang/XUnoTunnel.hpp> |
| 24 | #include <com/sun/star/container/XNamed.hpp> |
| 25 | #include <com/sun/star/container/XEnumerationAccess.hpp> |
| 26 | #include <com/sun/star/util/XSortable.hpp> |
| 27 | #include <com/sun/star/chart/XChartDataArray.hpp> |
| 28 | #include <com/sun/star/text/XTextTableCursor.hpp> |
| 29 | #include <com/sun/star/text/XTextTable.hpp> |
| 30 | #include <com/sun/star/table/XCellRange.hpp> |
| 31 | #include <com/sun/star/sheet/XCellRangeData.hpp> |
| 32 | #include <com/sun/star/table/XAutoFormattable.hpp> |
| 33 | |
| 34 | #include <cppuhelper/implbase.hxx> |
| 35 | |
| 36 | #include <comphelper/uno3.hxx> |
| 37 | |
| 38 | #include <svl/listener.hxx> |
| 39 | |
| 40 | #include "TextCursorHelper.hxx" |
| 41 | #include "unotext.hxx" |
| 42 | #include "frmfmt.hxx" |
| 43 | #include "unocrsr.hxx" |
| 44 | |
| 45 | class SwTable; |
| 46 | class SwTableBox; |
| 47 | class SwTableLine; |
| 48 | class SwTableCursor; |
| 49 | class SwUnoInternalPaM; |
| 50 | struct SwXParagraphEnumeration; |
| 51 | class SwXTableRows; |
| 52 | class SfxItemPropertySet; |
| 53 | |
| 54 | typedef |
| 55 | cppu::WeakImplHelper |
| 56 | < |
| 57 | css::table::XCell, |
| 58 | css::lang::XServiceInfo, |
| 59 | css::beans::XPropertySet, |
| 60 | css::container::XEnumerationAccess |
| 61 | > |
| 62 | SwXCellBaseClass; |
| 63 | class SW_DLLPUBLIC SwXCell final : public SwXCellBaseClass, |
| 64 | public SwXText, |
| 65 | public SvtListener |
| 66 | { |
| 67 | friend void sw_setString( SwXCell &rCell, const OUString &rText, |
| 68 | bool bKeepNumberFormat ); |
| 69 | friend void sw_setValue( SwXCell &rCell, double nVal ); |
| 70 | |
| 71 | const SfxItemPropertySet* m_pPropSet; |
| 72 | SwTableBox* m_pBox; // only set in non-XML import |
| 73 | const SwStartNode* m_pStartNode; // only set in XML import |
| 74 | SwFrameFormat* m_pTableFormat; |
| 75 | |
| 76 | // table position where pBox was found last |
| 77 | size_t m_nFndPos; |
| 78 | css::uno::Reference<css::text::XText> m_xParentText; |
| 79 | static size_t const NOTFOUND = SAL_MAX_SIZE; |
| 80 | |
| 81 | virtual const SwStartNode *GetStartNode() const override; |
| 82 | |
| 83 | bool IsValid() const; |
| 84 | |
| 85 | virtual ~SwXCell() override; |
| 86 | |
| 87 | virtual void Notify(const SfxHint&) override; |
| 88 | |
| 89 | public: |
| 90 | SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, size_t nPos); |
| 91 | SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode); // XML import interface |
| 92 | |
| 93 | virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; |
| 94 | virtual void SAL_CALL acquire( ) noexcept override; |
| 95 | virtual void SAL_CALL release( ) noexcept override; |
| 96 | |
| 97 | //XTypeProvider |
| 98 | virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; |
| 99 | virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; |
| 100 | |
| 101 | //XCell |
| 102 | virtual OUString SAL_CALL getFormula( ) override; |
| 103 | virtual void SAL_CALL setFormula( const OUString& aFormula ) override; |
| 104 | virtual double SAL_CALL getValue( ) override; |
| 105 | /// @throws css::uno::RuntimeException |
| 106 | double getValue( ) const |
| 107 | { return const_cast<SwXCell*>(this)->getValue(); }; |
| 108 | virtual void SAL_CALL setValue( double nValue ) override; |
| 109 | virtual css::table::CellContentType SAL_CALL getType( ) override; |
| 110 | virtual sal_Int32 SAL_CALL getError( ) override; |
| 111 | |
| 112 | //XText |
| 113 | virtual rtl::Reference< SwXTextCursor > createXTextCursor() override; |
| 114 | virtual rtl::Reference< SwXTextCursor > createXTextCursorByRange( |
| 115 | const ::css::uno::Reference< ::css::text::XTextRange >& aTextPosition ) override; |
| 116 | virtual void SAL_CALL setString(const OUString& aString) override; |
| 117 | |
| 118 | //XPropertySet |
| 119 | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
| 120 | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; |
| 121 | virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; |
| 122 | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; |
| 123 | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; |
| 124 | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 125 | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 126 | |
| 127 | //XServiceInfo |
| 128 | virtual OUString SAL_CALL getImplementationName() override; |
| 129 | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
| 130 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 131 | |
| 132 | //XEnumerationAccess - was: XParagraphEnumerationAccess |
| 133 | virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override; |
| 134 | |
| 135 | //XElementAccess |
| 136 | virtual css::uno::Type SAL_CALL getElementType( ) override; |
| 137 | virtual sal_Bool SAL_CALL hasElements( ) override; |
| 138 | |
| 139 | rtl::Reference< SwXParagraphEnumeration > createSwEnumeration(); |
| 140 | SwTableBox* GetTableBox() const { return m_pBox; } |
| 141 | static rtl::Reference<SwXCell> CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr ); |
| 142 | SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox); |
| 143 | SwFrameFormat* GetFrameFormat() const { return m_pTableFormat; } |
| 144 | double GetForcedNumericalValue() const; |
| 145 | css::uno::Any GetAny() const; |
| 146 | private: |
| 147 | rtl::Reference< SwXTextCursor > createXTextCursorByRangeImpl(SwUnoInternalPaM& rPam); |
| 148 | }; |
| 149 | |
| 150 | class SwXTextTableRow final |
| 151 | : public cppu::WeakImplHelper<css::beans::XPropertySet, css::lang::XServiceInfo> |
| 152 | , public SvtListener |
| 153 | { |
| 154 | SwFrameFormat* m_pFormat; |
| 155 | SwTableLine* m_pLine; |
| 156 | const SfxItemPropertySet* m_pPropSet; |
| 157 | |
| 158 | SwFrameFormat* GetFrameFormat() { return m_pFormat; } |
| 159 | const SwFrameFormat* GetFrameFormat() const { return m_pFormat; } |
| 160 | virtual ~SwXTextTableRow() override; |
| 161 | |
| 162 | public: |
| 163 | SwXTextTableRow(SwFrameFormat* pFormat, SwTableLine* pLine); |
| 164 | |
| 165 | |
| 166 | //XPropertySet |
| 167 | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
| 168 | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; |
| 169 | virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; |
| 170 | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; |
| 171 | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; |
| 172 | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 173 | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 174 | |
| 175 | //XServiceInfo |
| 176 | virtual OUString SAL_CALL getImplementationName() override; |
| 177 | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
| 178 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 179 | |
| 180 | static SwTableLine* FindLine(SwTable* pTable, SwTableLine const * pLine); |
| 181 | |
| 182 | void Notify(const SfxHint&) override; |
| 183 | }; |
| 184 | |
| 185 | typedef cppu::WeakImplHelper< |
| 186 | css::text::XTextTableCursor, |
| 187 | css::lang::XServiceInfo, |
| 188 | css::beans::XPropertySet> SwXTextTableCursor_Base; |
| 189 | class SW_DLLPUBLIC SwXTextTableCursor final |
| 190 | : public SwXTextTableCursor_Base |
| 191 | , public SvtListener |
| 192 | , public OTextCursorHelper |
| 193 | { |
| 194 | SwFrameFormat* m_pFrameFormat; |
| 195 | const SfxItemPropertySet* m_pPropSet; |
| 196 | sw::UnoCursorPointer m_pUnoCursor; |
| 197 | |
| 198 | public: |
| 199 | SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const* pBox); |
| 200 | SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTableCursor* pTableSelection); |
| 201 | virtual void SAL_CALL release() noexcept override; |
| 202 | |
| 203 | //XTextTableCursor |
| 204 | virtual OUString SAL_CALL getRangeName() override; |
| 205 | virtual sal_Bool SAL_CALL gotoCellByName( const OUString& aCellName, sal_Bool bExpand ) override; |
| 206 | virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) override; |
| 207 | virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) override; |
| 208 | virtual sal_Bool SAL_CALL goUp( sal_Int16 nCount, sal_Bool bExpand ) override; |
| 209 | virtual sal_Bool SAL_CALL goDown( sal_Int16 nCount, sal_Bool bExpand ) override; |
| 210 | virtual void SAL_CALL gotoStart( sal_Bool bExpand ) override; |
| 211 | virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) override; |
| 212 | virtual sal_Bool SAL_CALL mergeRange() override; |
| 213 | virtual sal_Bool SAL_CALL splitRange( sal_Int16 Count, sal_Bool Horizontal ) override; |
| 214 | |
| 215 | //XPropertySet |
| 216 | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
| 217 | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; |
| 218 | virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; |
| 219 | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; |
| 220 | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; |
| 221 | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 222 | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 223 | |
| 224 | //XServiceInfo |
| 225 | virtual OUString SAL_CALL getImplementationName() override; |
| 226 | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
| 227 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 228 | |
| 229 | |
| 230 | // ITextCursorHelper |
| 231 | virtual const SwPaM* GetPaM() const override; |
| 232 | virtual SwPaM* GetPaM() override; |
| 233 | virtual const SwDoc* GetDoc() const override; |
| 234 | virtual SwDoc* GetDoc() override; |
| 235 | |
| 236 | virtual void Notify( const SfxHint& ) override; |
| 237 | |
| 238 | const SwUnoCursor& GetCursor() const; |
| 239 | SwUnoCursor& GetCursor(); |
| 240 | SwFrameFormat* GetFrameFormat() const { return m_pFrameFormat; } |
| 241 | }; |
| 242 | |
| 243 | struct SwRangeDescriptor |
| 244 | { |
| 245 | sal_Int32 nTop; |
| 246 | sal_Int32 nLeft; |
| 247 | sal_Int32 nBottom; |
| 248 | sal_Int32 nRight; |
| 249 | |
| 250 | void Normalize(); |
| 251 | }; |
| 252 | |
| 253 | class SW_DLLPUBLIC SwXTextTable final : public cppu::WeakImplHelper |
| 254 | < |
| 255 | css::text::XTextTable, |
| 256 | css::lang::XServiceInfo, |
| 257 | css::table::XCellRange, |
| 258 | css::chart::XChartDataArray, |
| 259 | css::beans::XPropertySet, |
| 260 | css::container::XNamed, |
| 261 | css::table::XAutoFormattable, |
| 262 | css::util::XSortable, |
| 263 | css::sheet::XCellRangeData |
| 264 | > |
| 265 | { |
| 266 | private: |
| 267 | class Impl; |
| 268 | ::sw::UnoImplPtr<Impl> m_pImpl; |
| 269 | |
| 270 | SwXTextTable(); |
| 271 | SwXTextTable(SwFrameFormat& rFrameFormat); |
| 272 | virtual ~SwXTextTable() override; |
| 273 | |
| 274 | public: |
| 275 | static rtl::Reference<SwXTextTable> |
| 276 | CreateXTextTable(SwFrameFormat * pFrameFormat); |
| 277 | |
| 278 | static void GetCellPosition(std::u16string_view aCellName, sal_Int32& o_rColumn, sal_Int32& o_rRow); |
| 279 | |
| 280 | SwFrameFormat* GetFrameFormat(); |
| 281 | |
| 282 | //XTextTable |
| 283 | virtual void SAL_CALL initialize( sal_Int32 nRows, sal_Int32 nColumns ) override; |
| 284 | virtual css::uno::Reference< css::table::XTableRows > SAL_CALL getRows( ) override; |
| 285 | virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL getColumns( ) override; |
| 286 | virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByName( const OUString& aCellName ) override; |
| 287 | virtual css::uno::Sequence< OUString > SAL_CALL getCellNames( ) override; |
| 288 | virtual css::uno::Reference< css::text::XTextTableCursor > SAL_CALL createCursorByCellName( const OUString& aCellName ) override; |
| 289 | |
| 290 | //XTextContent |
| 291 | virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) override; |
| 292 | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override; |
| 293 | |
| 294 | //XComponent |
| 295 | virtual void SAL_CALL dispose() override; |
| 296 | virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; |
| 297 | virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override; |
| 298 | |
| 299 | //XCellRange |
| 300 | virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override; |
| 301 | virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) override; |
| 302 | virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByName( const OUString& aRange ) override; |
| 303 | |
| 304 | //XChartDataArray |
| 305 | virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData( ) override; |
| 306 | virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override; |
| 307 | virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions( ) override; |
| 308 | virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override; |
| 309 | virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions( ) override; |
| 310 | virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override; |
| 311 | |
| 312 | //XChartData |
| 313 | virtual void SAL_CALL addChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; |
| 314 | virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; |
| 315 | virtual double SAL_CALL getNotANumber( ) override; |
| 316 | virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override; |
| 317 | |
| 318 | //XSortable |
| 319 | virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL createSortDescriptor() override; |
| 320 | virtual void SAL_CALL sort(const css::uno::Sequence< css::beans::PropertyValue >& xDescriptor) override; |
| 321 | |
| 322 | //XAutoFormattable |
| 323 | virtual void SAL_CALL autoFormat(const OUString& aName) override; |
| 324 | |
| 325 | //XPropertySet |
| 326 | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
| 327 | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; |
| 328 | virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; |
| 329 | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; |
| 330 | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; |
| 331 | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 332 | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 333 | |
| 334 | //XNamed |
| 335 | virtual OUString SAL_CALL getName() override; |
| 336 | virtual void SAL_CALL setName(const OUString& Name_) override; |
| 337 | |
| 338 | //XCellRangeData |
| 339 | virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray( ) override; |
| 340 | virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override; |
| 341 | |
| 342 | //XServiceInfo |
| 343 | virtual OUString SAL_CALL getImplementationName() override; |
| 344 | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
| 345 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 346 | |
| 347 | rtl::Reference< SwXTableRows > getSwRows(); |
| 348 | rtl::Reference< SwXCell > getSwCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ); |
| 349 | rtl::Reference< SwXCell > getSwCellByName( const OUString& aCellName ); |
| 350 | }; |
| 351 | |
| 352 | class SwXCellRange final : public cppu::WeakImplHelper |
| 353 | < |
| 354 | css::table::XCellRange, |
| 355 | css::lang::XServiceInfo, |
| 356 | css::beans::XPropertySet, |
| 357 | css::chart::XChartDataArray, |
| 358 | css::util::XSortable, |
| 359 | css::sheet::XCellRangeData |
| 360 | > |
| 361 | { |
| 362 | private: |
| 363 | class Impl; |
| 364 | ::sw::UnoImplPtr<Impl> m_pImpl; |
| 365 | |
| 366 | SwXCellRange(const sw::UnoCursorPointer& pCursor, SwFrameFormat& rFrameFormat, SwRangeDescriptor const & rDesc); |
| 367 | virtual ~SwXCellRange() override; |
| 368 | |
| 369 | public: |
| 370 | static ::rtl::Reference<SwXCellRange> CreateXCellRange( |
| 371 | const sw::UnoCursorPointer& pCursor, SwFrameFormat& rFrameFormat, |
| 372 | SwRangeDescriptor const & rDesc); |
| 373 | |
| 374 | void SetLabels(bool bFirstRowAsLabel, bool bFirstColumnAsLabel); |
| 375 | |
| 376 | std::vector<css::uno::Reference<css::table::XCell>> GetCells(); |
| 377 | |
| 378 | const SwUnoCursor* GetTableCursor() const; |
| 379 | |
| 380 | //XCellRange |
| 381 | virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override; |
| 382 | virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) override; |
| 383 | virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByName( const OUString& aRange ) override; |
| 384 | |
| 385 | //XPropertySet |
| 386 | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; |
| 387 | virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, const css::uno::Any& aValue) override; |
| 388 | virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override; |
| 389 | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; |
| 390 | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; |
| 391 | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 392 | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
| 393 | |
| 394 | //XChartData |
| 395 | virtual void SAL_CALL addChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; |
| 396 | virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; |
| 397 | virtual double SAL_CALL getNotANumber( ) override; |
| 398 | virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override; |
| 399 | |
| 400 | //XChartDataArray |
| 401 | virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData( ) override; |
| 402 | virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override; |
| 403 | virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions( ) override; |
| 404 | virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override; |
| 405 | virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions( ) override; |
| 406 | virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override; |
| 407 | |
| 408 | //XSortable |
| 409 | virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL createSortDescriptor() override; |
| 410 | virtual void SAL_CALL sort(const css::uno::Sequence< css::beans::PropertyValue >& xDescriptor) override; |
| 411 | |
| 412 | //XCellRangeData |
| 413 | virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray( ) override; |
| 414 | virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override; |
| 415 | |
| 416 | //XServiceInfo |
| 417 | virtual OUString SAL_CALL getImplementationName() override; |
| 418 | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
| 419 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 420 | |
| 421 | }; |
| 422 | |
| 423 | /// UNO API wrapper for SwTableLines. |
| 424 | class SAL_DLLPUBLIC_RTTI SwXTableRows final : public cppu::WeakImplHelper |
| 425 | < |
| 426 | css::table::XTableRows, |
| 427 | css::lang::XServiceInfo |
| 428 | > |
| 429 | { |
| 430 | class Impl; |
| 431 | ::sw::UnoImplPtr<Impl> m_pImpl; |
| 432 | SwFrameFormat* GetFrameFormat(); |
| 433 | const SwFrameFormat* GetFrameFormat() const { return const_cast<SwXTableRows*>(this)->GetFrameFormat(); } |
| 434 | virtual ~SwXTableRows() override; |
| 435 | |
| 436 | public: |
| 437 | SwXTableRows(SwFrameFormat& rFrameFormat); |
| 438 | |
| 439 | //XIndexAccess |
| 440 | SW_DLLPUBLIC virtual sal_Int32 SAL_CALL getCount() override; |
| 441 | virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; |
| 442 | |
| 443 | //XElementAccess |
| 444 | virtual css::uno::Type SAL_CALL getElementType( ) override; |
| 445 | virtual sal_Bool SAL_CALL hasElements( ) override; |
| 446 | |
| 447 | //XTableRows |
| 448 | virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; |
| 449 | virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; |
| 450 | |
| 451 | //XServiceInfo |
| 452 | virtual OUString SAL_CALL getImplementationName() override; |
| 453 | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
| 454 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 455 | }; |
| 456 | |
| 457 | class SwXTableColumns final : public cppu::WeakImplHelper |
| 458 | < |
| 459 | css::table::XTableColumns, |
| 460 | css::lang::XServiceInfo |
| 461 | > |
| 462 | { |
| 463 | private: |
| 464 | class Impl; |
| 465 | ::sw::UnoImplPtr<Impl> m_pImpl; |
| 466 | SwFrameFormat* GetFrameFormat() const; |
| 467 | |
| 468 | virtual ~SwXTableColumns() override; |
| 469 | public: |
| 470 | SwXTableColumns(SwFrameFormat& rFrameFormat); |
| 471 | |
| 472 | |
| 473 | //XIndexAccess |
| 474 | virtual sal_Int32 SAL_CALL getCount() override; |
| 475 | virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; |
| 476 | |
| 477 | //XElementAccess |
| 478 | virtual css::uno::Type SAL_CALL getElementType( ) override; |
| 479 | virtual sal_Bool SAL_CALL hasElements( ) override; |
| 480 | |
| 481 | //XTableColumns |
| 482 | virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; |
| 483 | virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) override; |
| 484 | |
| 485 | //XServiceInfo |
| 486 | virtual OUString SAL_CALL getImplementationName() override; |
| 487 | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
| 488 | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 489 | }; |
| 490 | |
| 491 | int sw_CompareCellRanges( |
| 492 | std::u16string_view aRange1StartCell, std::u16string_view aRange1EndCell, |
| 493 | std::u16string_view aRange2StartCell, std::u16string_view aRange2EndCell, |
| 494 | bool bCmpColsFirst ); |
| 495 | |
| 496 | void sw_NormalizeRange( OUString &rCell1, OUString &rCell2 ); |
| 497 | |
| 498 | OUString sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow ); |
| 499 | |
| 500 | int sw_CompareCellsByColFirst( std::u16string_view aCellName1, std::u16string_view aCellName2 ); |
| 501 | |
| 502 | int sw_CompareCellsByRowFirst( std::u16string_view aCellName1, std::u16string_view aCellName2 ); |
| 503 | |
| 504 | #endif |
| 505 | |
| 506 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |