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 .
22 #include <svtools/valueset.hxx>
23 #include <sfx2/sidebar/ILayoutableWindow.hxx>
24 #include <sfx2/sidebar/PanelLayout.hxx>
25 #include <vcl/weld.hxx>
27 namespace com::sun::star::beans
{ class XPropertySet
; }
28 namespace com::sun::star::container
{ class XIndexAccess
; class XNameContainer
; }
29 namespace com::sun::star::drawing
{ class XDrawView
; }
35 class EventMultiplexerEvent
;
41 enum TableCheckBox
: sal_uInt16
48 CB_BANDED_COLUMNS
= 5,
49 CB_COUNT
= CB_BANDED_COLUMNS
+ 1
52 class TableValueSet final
: public ValueSet
56 Link
<const Point
*, void> maContextMenuHandler
;
58 TableValueSet(std::unique_ptr
<weld::ScrolledWindow
> pScrolledWindow
);
59 virtual bool Command(const CommandEvent
& rEvent
) override
;
60 virtual void Resize() override
;
61 virtual void StyleUpdated() override
;
62 void updateSettings();
63 void setModal(bool bModal
) { m_bModal
= bModal
; }
64 void SetContextMenuHandler(const Link
<const Point
*, void>& rLink
) { maContextMenuHandler
= rLink
; }
65 static constexpr int getMaxRowCount() { return 3; }
68 class TableDesignWidget final
71 TableDesignWidget(weld::Builder
& rBuilder
, ViewShellBase
& rBase
);
75 void onSelectionChanged();
83 void EditStyle(const OUString
& rCommand
);
87 void removeListener();
88 void updateControls();
89 void selectStyle(std::u16string_view rStyle
);
90 void endTextEditForStyle(const css::uno::Reference
<css::uno::XInterface
>& rStyle
);
91 void setDocumentModified();
93 void FillDesignPreviewControl();
95 DECL_LINK(EventMultiplexerListener
, tools::EventMultiplexerEvent
&, void);
96 DECL_LINK(implContextMenuHandler
, const Point
*, void);
97 DECL_LINK(implValueSetHdl
, ValueSet
*, void);
98 DECL_LINK(implCheckBoxHdl
, weld::Toggleable
&, void);
100 ViewShellBase
& mrBase
;
102 std::unique_ptr
<weld::Menu
> m_xMenu
;
103 std::unique_ptr
<TableValueSet
> m_xValueSet
;
104 std::unique_ptr
<weld::CustomWeld
> m_xValueSetWin
;
105 std::unique_ptr
<weld::CheckButton
> m_aCheckBoxes
[CB_COUNT
];
107 css::uno::Reference
< css::beans::XPropertySet
> mxSelectedTable
;
108 rtl::Reference
< DrawController
> mxView
;
109 css::uno::Reference
< css::container::XIndexAccess
> mxTableFamily
;
110 css::uno::Reference
< css::container::XNameContainer
> mxCellFamily
;
113 class TableDesignPane final
: public PanelLayout
114 , public sfx2::sidebar::ILayoutableWindow
117 std::unique_ptr
<TableDesignWidget
> m_xImpl
;
119 TableDesignPane( weld::Widget
* pParent
, ViewShellBase
& rBase
)
120 : PanelLayout(pParent
, u
"TableDesignPanel"_ustr
,
121 u
"modules/simpress/ui/tabledesignpanel.ui"_ustr
)
122 , m_xImpl(new TableDesignWidget(*m_xBuilder
, rBase
))
125 virtual css::ui::LayoutSize
GetHeightForWidth(const sal_Int32
/*nWidth*/) override
127 sal_Int32 nMinimumHeight
= get_preferred_size().Height();
128 return css::ui::LayoutSize(nMinimumHeight
, -1, nMinimumHeight
);
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */