compilerplugins/clang/mergeclasses.results | 1 solenv/clang-format/excludelist | 1 svx/source/inc/celltypes.hxx | 9 -- svx/source/table/sdrtableobjimpl.hxx | 103 +++++++++++++++++++++++++++++ svx/source/table/svdotable.cxx | 64 ------------------ svx/source/table/tabledesign.cxx | 4 - 6 files changed, 108 insertions(+), 74 deletions(-)
New commits: commit a0133459ada8bdc03fd6ae7e509a908ff9581793 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Dec 15 21:34:39 2022 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Dec 16 12:45:55 2022 +0000 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 <sberg...@redhat.com> diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 6757b4070506..793b6f10bef8 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -400,7 +400,6 @@ merge sdext::presenter::PresenterScrollBar with sdext::presenter::PresenterVerti merge sdext::presenter::PresenterSlidePreview with sdext::presenter::(anonymous namespace)::NextSlidePreview merge sdr::SelectionController with sdr::table::SvxTableController merge sdr::contact::ObjectContactOfPagePainter with sdr::contact::PagePrimitiveExtractor -merge sdr::table::TableDesignUser with sdr::table::SdrTableObjImpl merge sfx2::IXmlIdRegistry with sfx2::XmlIdRegistry merge slideshow::internal::(anonymous namespace)::EventContainer with slideshow::internal::ClickEventHandler merge slideshow::internal::AnimationFunction with slideshow::internal::ExpressionNode diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 2a2788ce34c1..e3079aec34e9 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -11845,6 +11845,7 @@ svx/source/table/cellrange.cxx svx/source/table/cellrange.hxx svx/source/table/propertyset.cxx svx/source/table/propertyset.hxx +svx/source/table/sdrtableobjimpl.hxx svx/source/table/svdotable.cxx svx/source/table/tablecolumn.cxx svx/source/table/tablecolumn.hxx 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; }