diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-15 21:34:39 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-16 12:45:55 +0000 |
commit | a0133459ada8bdc03fd6ae7e509a908ff9581793 (patch) | |
tree | 535b8209f46b0dec23d4e190fabc745966fa7ba4 /svx/source | |
parent | 60a96f41f0d050ec05bfcb337edf3717689adacb (diff) |
Merge sdr::table::TableDesignUser into sdr::table::SdrTableObjImpl
Change-Id: Ia7841447df4a7db1b5dd9fad93cab66fbca48981
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144316
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/inc/celltypes.hxx | 9 | ||||
-rw-r--r-- | svx/source/table/sdrtableobjimpl.hxx | 103 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 64 | ||||
-rw-r--r-- | svx/source/table/tabledesign.cxx | 4 |
4 files changed, 107 insertions, 73 deletions
diff --git a/svx/source/inc/celltypes.hxx b/svx/source/inc/celltypes.hxx index acc5bdec7caf..f70e386db8a4 100644 --- a/svx/source/inc/celltypes.hxx +++ b/svx/source/inc/celltypes.hxx @@ -39,15 +39,6 @@ typedef std::vector<CellRef> CellVector; typedef std::vector<TableRowRef> RowVector; typedef std::vector<TableColumnRef> ColumnVector; -class SAL_LOPLUGIN_ANNOTATE("crosscast") TableDesignUser -{ -public: - virtual bool isInUse() = 0; - -protected: - ~TableDesignUser() {} -}; - template <typename T> class RangeIterator { public: diff --git a/svx/source/table/sdrtableobjimpl.hxx b/svx/source/table/sdrtableobjimpl.hxx new file mode 100644 index 000000000000..5d9ef6969fbd --- /dev/null +++ b/svx/source/table/sdrtableobjimpl.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/config.h> + +#include <memory> +#include <vector> + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/util/XModifyListener.hpp> +#include <cppuhelper/implbase.hxx> +#include <sal/types.h> +#include <svx/svdotable.hxx> +#include <svx/svxdllapi.h> + +#include <celltypes.hxx> + +namespace sdr::table { + +class SVXCORE_DLLPUBLIC SdrTableObjImpl : public ::cppu::WeakImplHelper< css::util::XModifyListener > +{ +public: + CellRef mxActiveCell; + TableModelRef mxTable; + SdrTableObj* mpTableObj; + std::unique_ptr<TableLayouter> mpLayouter; + CellPos maEditPos; + TableStyleSettings maTableStyle; + css::uno::Reference< css::container::XIndexAccess > mxTableStyle; + std::vector<std::unique_ptr<SdrUndoAction>> maUndos; + bool mbSkipChangeLayout; + + void CropTableModelToSelection(const CellPos& rStart, const CellPos& rEnd); + + CellRef getCell( const CellPos& rPos ) const; + void LayoutTable( tools::Rectangle& rArea, bool bFitWidth, bool bFitHeight ); + + void ApplyCellStyles(); + void UpdateCells( tools::Rectangle const & rArea ); + + SdrTableObjImpl(); + virtual ~SdrTableObjImpl() override; + + void init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 nRows ); + void dispose(); + + sal_Int32 getColumnCount() const; + /// Get widths of the columns in the table. + std::vector<sal_Int32> getColumnWidths() const; + sal_Int32 getRowCount() const; + + void DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset ); + + SdrTableObjImpl& operator=( const SdrTableObjImpl& rSource ); + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + void update(); + + void connectTableStyle(); + void disconnectTableStyle(); + bool isInUse(); + void dumpAsXml(xmlTextWriterPtr pWriter) const; +private: + static SdrTableObjImpl* lastLayoutTable; + static tools::Rectangle lastLayoutInputRectangle; + static tools::Rectangle lastLayoutResultRectangle; + static bool lastLayoutFitWidth; + static bool lastLayoutFitHeight; + static css::text::WritingMode lastLayoutMode; + static sal_Int32 lastRowCount; + static sal_Int32 lastColCount; + static std::vector<sal_Int32> lastColWidths; + static bool rowSizeChanged; +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index c605bb8c2e8c..957aa62a190a 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -50,12 +50,13 @@ #include <svx/dialmgr.hxx> #include <editeng/writingmodeitem.hxx> #include <editeng/frmdiritem.hxx> -#include <cppuhelper/implbase.hxx> #include <libxml/xmlwriter.h> #include <comphelper/diagnose_ex.hxx> #include <boost/property_tree/ptree.hpp> +#include "sdrtableobjimpl.hxx" + using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY; @@ -188,67 +189,6 @@ bool TableStyleSettings::operator==( const TableStyleSettings& rStyle ) const } -class SdrTableObjImpl : public TableDesignUser, public ::cppu::WeakImplHelper< css::util::XModifyListener > -{ -public: - CellRef mxActiveCell; - TableModelRef mxTable; - SdrTableObj* mpTableObj; - std::unique_ptr<TableLayouter> mpLayouter; - CellPos maEditPos; - TableStyleSettings maTableStyle; - Reference< XIndexAccess > mxTableStyle; - std::vector<std::unique_ptr<SdrUndoAction>> maUndos; - bool mbSkipChangeLayout; - - void CropTableModelToSelection(const CellPos& rStart, const CellPos& rEnd); - - CellRef getCell( const CellPos& rPos ) const; - void LayoutTable( tools::Rectangle& rArea, bool bFitWidth, bool bFitHeight ); - - void ApplyCellStyles(); - void UpdateCells( tools::Rectangle const & rArea ); - - SdrTableObjImpl(); - virtual ~SdrTableObjImpl() override; - - void init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 nRows ); - void dispose(); - - sal_Int32 getColumnCount() const; - /// Get widths of the columns in the table. - std::vector<sal_Int32> getColumnWidths() const; - sal_Int32 getRowCount() const; - - void DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset ); - - SdrTableObjImpl& operator=( const SdrTableObjImpl& rSource ); - - // XModifyListener - virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; - - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - void update(); - - void connectTableStyle(); - void disconnectTableStyle(); - virtual bool isInUse() override; - void dumpAsXml(xmlTextWriterPtr pWriter) const; -private: - static SdrTableObjImpl* lastLayoutTable; - static tools::Rectangle lastLayoutInputRectangle; - static tools::Rectangle lastLayoutResultRectangle; - static bool lastLayoutFitWidth; - static bool lastLayoutFitHeight; - static WritingMode lastLayoutMode; - static sal_Int32 lastRowCount; - static sal_Int32 lastColCount; - static std::vector<sal_Int32> lastColWidths; - static bool rowSizeChanged; -}; - SdrTableObjImpl* SdrTableObjImpl::lastLayoutTable = nullptr; tools::Rectangle SdrTableObjImpl::lastLayoutInputRectangle; tools::Rectangle SdrTableObjImpl::lastLayoutResultRectangle; diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index d7ac0a474310..531b646431ea 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -42,7 +42,7 @@ #include <svx/dialmgr.hxx> #include <svx/strings.hrc> -#include <celltypes.hxx> +#include "sdrtableobjimpl.hxx" #include <vector> #include <map> @@ -264,7 +264,7 @@ sal_Bool SAL_CALL TableDesignStyle::isInUse() comphelper::OInterfaceIteratorHelper4 it(aGuard, maModifyListeners); while ( it.hasMoreElements() ) { - TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( it.next().get() ); + SdrTableObjImpl* pUser = dynamic_cast< SdrTableObjImpl* >( it.next().get() ); if( pUser && pUser->isInUse() ) return true; } |