Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / table / sdrtableobjimpl.hxx
blob5d9ef6969fbde8574c1de2e7937ece304b02ec64
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
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 #pragma once
22 #include <sal/config.h>
24 #include <memory>
25 #include <vector>
27 #include <com/sun/star/container/XIndexAccess.hpp>
28 #include <com/sun/star/text/WritingMode.hpp>
29 #include <com/sun/star/uno/Reference.hxx>
30 #include <com/sun/star/util/XModifyListener.hpp>
31 #include <cppuhelper/implbase.hxx>
32 #include <sal/types.h>
33 #include <svx/svdotable.hxx>
34 #include <svx/svxdllapi.h>
36 #include <celltypes.hxx>
38 namespace sdr::table {
40 class SVXCORE_DLLPUBLIC SdrTableObjImpl : public ::cppu::WeakImplHelper< css::util::XModifyListener >
42 public:
43 CellRef mxActiveCell;
44 TableModelRef mxTable;
45 SdrTableObj* mpTableObj;
46 std::unique_ptr<TableLayouter> mpLayouter;
47 CellPos maEditPos;
48 TableStyleSettings maTableStyle;
49 css::uno::Reference< css::container::XIndexAccess > mxTableStyle;
50 std::vector<std::unique_ptr<SdrUndoAction>> maUndos;
51 bool mbSkipChangeLayout;
53 void CropTableModelToSelection(const CellPos& rStart, const CellPos& rEnd);
55 CellRef getCell( const CellPos& rPos ) const;
56 void LayoutTable( tools::Rectangle& rArea, bool bFitWidth, bool bFitHeight );
58 void ApplyCellStyles();
59 void UpdateCells( tools::Rectangle const & rArea );
61 SdrTableObjImpl();
62 virtual ~SdrTableObjImpl() override;
64 void init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 nRows );
65 void dispose();
67 sal_Int32 getColumnCount() const;
68 /// Get widths of the columns in the table.
69 std::vector<sal_Int32> getColumnWidths() const;
70 sal_Int32 getRowCount() const;
72 void DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset );
74 SdrTableObjImpl& operator=( const SdrTableObjImpl& rSource );
76 // XModifyListener
77 virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
79 // XEventListener
80 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
82 void update();
84 void connectTableStyle();
85 void disconnectTableStyle();
86 bool isInUse();
87 void dumpAsXml(xmlTextWriterPtr pWriter) const;
88 private:
89 static SdrTableObjImpl* lastLayoutTable;
90 static tools::Rectangle lastLayoutInputRectangle;
91 static tools::Rectangle lastLayoutResultRectangle;
92 static bool lastLayoutFitWidth;
93 static bool lastLayoutFitHeight;
94 static css::text::WritingMode lastLayoutMode;
95 static sal_Int32 lastRowCount;
96 static sal_Int32 lastColCount;
97 static std::vector<sal_Int32> lastColWidths;
98 static bool rowSizeChanged;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */