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 .
21 #include <vcl/customweld.hxx>
22 #include <vcl/event.hxx>
23 #include <vcl/settings.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/toolbox.hxx>
27 #include <svx/strings.hrc>
28 #include <layctrl.hxx>
29 #include <svx/dialmgr.hxx>
30 #include <comphelper/processfactory.hxx>
31 #include <comphelper/propertyvalue.hxx>
32 #include <svtools/colorcfg.hxx>
33 #include <svtools/toolbarmenu.hxx>
34 #include <com/sun/star/util/URLTransformer.hpp>
35 #include <com/sun/star/frame/XDispatchProvider.hpp>
38 using namespace ::com::sun::star::uno
;
39 using namespace ::com::sun::star::beans
;
40 using namespace ::com::sun::star::util
;
41 using namespace ::com::sun::star::frame
;
45 class TableWidget final
: public weld::CustomWidgetController
48 rtl::Reference
<SvxTableToolBoxControl
> mxControl
;
54 static const tools::Long TABLE_CELLS_HORIZ
;
55 static const tools::Long TABLE_CELLS_VERT
;
57 tools::Long mnTableCellWidth
;
58 tools::Long mnTableCellHeight
;
60 tools::Long mnTableWidth
;
61 tools::Long mnTableHeight
;
66 ::Color aHighlightFillColor
;
67 ::Color aBackgroundColor
;
69 void Update(tools::Long nNewCol
, tools::Long nNewLine
);
73 TableWidget(SvxTableToolBoxControl
* pControl
, OUString aCommand
);
75 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
77 virtual bool KeyInput(const KeyEvent
&) override
;
78 virtual bool MouseButtonDown(const MouseEvent
&) override
;
79 virtual bool MouseMove(const MouseEvent
&) override
;
80 virtual bool MouseButtonUp(const MouseEvent
&) override
;
81 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
84 class TableWindow final
: public WeldToolbarPopup
87 std::unique_ptr
<weld::Button
> mxTableButton
;
88 std::unique_ptr
<TableWidget
> mxTableWidget
;
89 std::unique_ptr
<weld::CustomWeld
> mxTableWidgetWin
;
90 rtl::Reference
<SvxTableToolBoxControl
> mxControl
;
92 DECL_LINK(SelectHdl
, weld::Button
&, void);
95 TableWindow( SvxTableToolBoxControl
* pControl
, weld::Widget
* pParent
,
96 const OUString
& rCmd
);
97 virtual void GrabFocus() override
99 mxTableWidget
->GrabFocus();
105 const tools::Long
TableWidget::TABLE_CELLS_HORIZ
= 10;
106 const tools::Long
TableWidget::TABLE_CELLS_VERT
= 15;
108 IMPL_LINK_NOARG(TableWindow
, SelectHdl
, weld::Button
&, void)
110 mxControl
->CloseAndShowTableDialog();
113 TableWindow::TableWindow(SvxTableToolBoxControl
* pControl
, weld::Widget
* pParent
, const OUString
& rCmd
)
114 : WeldToolbarPopup(pControl
->getFrameInterface(), pParent
, "svx/ui/tablewindow.ui", "TableWindow")
115 , mxTableButton(m_xBuilder
->weld_button("moreoptions"))
116 , mxTableWidget(new TableWidget(pControl
, rCmd
))
117 , mxTableWidgetWin(new weld::CustomWeld(*m_xBuilder
, "table", *mxTableWidget
))
118 , mxControl(pControl
)
120 mxTableButton
->set_label( SvxResId( RID_SVXSTR_MORE
) );
121 mxTableButton
->connect_clicked( LINK( this, TableWindow
, SelectHdl
) );
122 mxTableButton
->show();
125 TableWidget::TableWidget(SvxTableToolBoxControl
* pControl
, OUString aCommand
)
126 : mxControl(pControl
)
127 , maCommand(std::move(aCommand
))
130 , mnTableCellWidth(0)
131 , mnTableCellHeight(0)
135 const StyleSettings
& rStyles
= Application::GetSettings().GetStyleSettings();
136 aFontColor
= rStyles
.GetLabelTextColor();
137 aLineColor
= rStyles
.GetShadowColor();
138 aFillColor
= rStyles
.GetWindowColor();
139 aHighlightFillColor
= rStyles
.GetHighlightColor();
140 aBackgroundColor
= rStyles
.GetFaceColor();
143 void TableWidget::SetDrawingArea(weld::DrawingArea
* pDrawingArea
)
145 float fScaleFactor
= pDrawingArea
->get_ref_device().GetDPIScaleFactor();
147 mnTableCellWidth
= 15 * fScaleFactor
;
148 mnTableCellHeight
= 15 * fScaleFactor
;
150 mnTableWidth
= TABLE_CELLS_HORIZ
*mnTableCellWidth
;
151 mnTableHeight
= TABLE_CELLS_VERT
*mnTableCellHeight
;
153 // + 1 to leave space to draw the right/bottom borders
154 Size
aSize(mnTableWidth
+ 1, mnTableHeight
+ 1);
155 pDrawingArea
->set_size_request(aSize
.Width(), aSize
.Height());
156 CustomWidgetController::SetDrawingArea(pDrawingArea
);
157 SetOutputSizePixel(aSize
);
160 bool TableWidget::MouseMove(const MouseEvent
& rMEvt
)
162 Point aPos
= rMEvt
.GetPosPixel();
163 Point
aMousePos( aPos
);
165 tools::Long nNewCol
= ( aMousePos
.X() + mnTableCellWidth
) / mnTableCellWidth
;
166 tools::Long nNewLine
= ( aMousePos
.Y() + mnTableCellHeight
) / mnTableCellHeight
;
168 Update( nNewCol
, nNewLine
);
173 bool TableWidget::KeyInput(const KeyEvent
& rKEvt
)
175 bool bHandled
= false;
176 sal_uInt16 nModifier
= rKEvt
.GetKeyCode().GetModifier();
177 sal_uInt16 nKey
= rKEvt
.GetKeyCode().GetCode();
181 tools::Long nNewCol
= nCol
;
182 tools::Long nNewLine
= nLine
;
189 mxControl
->EndPopupMode();
192 if ( nNewLine
< TABLE_CELLS_VERT
)
199 mxControl
->CloseAndShowTableDialog();
205 mxControl
->EndPopupMode();
208 if ( nNewCol
< TABLE_CELLS_HORIZ
)
215 mxControl
->CloseAndShowTableDialog();
218 mxControl
->EndPopupMode();
222 mxControl
->EndPopupMode();
229 Update( nNewCol
, nNewLine
);
232 else if (KEY_MOD1
== nModifier
&& KEY_RETURN
== nKey
)
235 mxControl
->EndPopupMode();
242 bool TableWidget::MouseButtonUp(const MouseEvent
&)
245 mxControl
->EndPopupMode();
249 bool TableWidget::MouseButtonDown(const MouseEvent
&)
254 void TableWidget::Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&)
256 rRenderContext
.Push(vcl::PushFlags::FONT
);
258 rRenderContext
.SetBackground( aBackgroundColor
);
259 vcl::Font aFont
= rRenderContext
.GetFont();
260 aFont
.SetColor( aFontColor
);
261 aFont
.SetFillColor( aBackgroundColor
);
262 aFont
.SetTransparent( false );
263 rRenderContext
.SetFont( aFont
);
265 const tools::Long nSelectionWidth
= nCol
* mnTableCellWidth
;
266 const tools::Long nSelectionHeight
= nLine
* mnTableCellHeight
;
268 // the non-selected parts of the table
269 rRenderContext
.SetLineColor(aLineColor
);
270 rRenderContext
.SetFillColor(aFillColor
);
271 rRenderContext
.DrawRect(tools::Rectangle(nSelectionWidth
, 0, mnTableWidth
, nSelectionHeight
));
272 rRenderContext
.DrawRect(tools::Rectangle(0, nSelectionHeight
, nSelectionWidth
, mnTableHeight
));
273 rRenderContext
.DrawRect(tools::Rectangle(nSelectionWidth
, nSelectionHeight
, mnTableWidth
, mnTableHeight
));
276 if (nCol
> 0 && nLine
> 0)
278 rRenderContext
.SetFillColor(aHighlightFillColor
);
279 rRenderContext
.DrawRect(tools::Rectangle(0, 0, nSelectionWidth
, nSelectionHeight
));
282 // lines inside of the table
283 rRenderContext
.SetLineColor(aLineColor
);
284 for (tools::Long i
= 1; i
< TABLE_CELLS_VERT
; ++i
)
286 rRenderContext
.DrawLine(Point(0, i
*mnTableCellHeight
),
287 Point(mnTableWidth
, i
*mnTableCellHeight
));
290 for (tools::Long i
= 1; i
< TABLE_CELLS_HORIZ
; ++i
)
292 rRenderContext
.DrawLine(Point( i
*mnTableCellWidth
, 0),
293 Point( i
*mnTableCellWidth
, mnTableHeight
));
296 // the text near the mouse cursor telling the table dimensions
299 rRenderContext
.Pop();
303 OUString aText
= OUString::number( nCol
) + " x " + OUString::number( nLine
);
304 if (maCommand
== ".uno:ShowMultiplePages")
306 aText
+= " " + SvxResId(RID_SVXSTR_PAGES
);
309 Size
aTextSize(rRenderContext
.GetTextWidth(aText
), rRenderContext
.GetTextHeight());
311 tools::Long nTextX
= nSelectionWidth
+ mnTableCellWidth
;
312 tools::Long nTextY
= nSelectionHeight
+ mnTableCellHeight
;
313 const tools::Long nTipBorder
= 2;
315 if (aTextSize
.Width() + mnTableCellWidth
+ 2 * nTipBorder
< nSelectionWidth
)
316 nTextX
= nSelectionWidth
- mnTableCellWidth
- aTextSize
.Width();
318 if (aTextSize
.Height() + mnTableCellHeight
+ 2 * nTipBorder
< nSelectionHeight
)
319 nTextY
= nSelectionHeight
- mnTableCellHeight
- aTextSize
.Height();
321 rRenderContext
.SetLineColor(aLineColor
);
322 rRenderContext
.SetFillColor(aBackgroundColor
);
323 rRenderContext
.DrawRect(tools::Rectangle(nTextX
- 2 * nTipBorder
,
324 nTextY
- 2 * nTipBorder
,
325 nTextX
+ aTextSize
.Width() + nTipBorder
,
326 nTextY
+ aTextSize
.Height() + nTipBorder
));
328 // #i95350# force RTL output
330 aText
= u
"\u202D" + aText
;
332 rRenderContext
.DrawText(Point(nTextX
, nTextY
), aText
);
334 rRenderContext
.Pop();
337 void TableWidget::InsertTable()
341 Sequence
< PropertyValue
> aArgs
{ comphelper::makePropertyValue("Columns", sal_Int16( nCol
)),
342 comphelper::makePropertyValue("Rows", sal_Int16( nLine
)) };
344 mxControl
->TableDialog( aArgs
);
348 void TableWidget::Update( tools::Long nNewCol
, tools::Long nNewLine
)
350 if ( nNewCol
< 0 || nNewCol
> TABLE_CELLS_HORIZ
)
353 if ( nNewLine
< 0 || nNewLine
> TABLE_CELLS_VERT
)
356 if ( nNewCol
!= nCol
|| nNewLine
!= nLine
)
360 Invalidate(tools::Rectangle(0, 0, mnTableWidth
, mnTableHeight
));
364 void SvxTableToolBoxControl::TableDialog( const Sequence
< PropertyValue
>& rArgs
)
366 Reference
< XDispatchProvider
> xDispatchProvider( m_xFrame
, UNO_QUERY
);
367 if ( xDispatchProvider
.is() )
369 css::util::URL aTargetURL
;
370 Reference
< XURLTransformer
> xTrans( URLTransformer::create(::comphelper::getProcessComponentContext()) );
371 aTargetURL
.Complete
= m_aCommandURL
;
372 xTrans
->parseStrict( aTargetURL
);
374 Reference
< XDispatch
> xDispatch
= xDispatchProvider
->queryDispatch( aTargetURL
, OUString(), 0 );
375 if ( xDispatch
.is() )
376 xDispatch
->dispatch( aTargetURL
, rArgs
);
380 void SvxTableToolBoxControl::CloseAndShowTableDialog()
382 // close the toolbar tool
385 // and open the table dialog instead
386 TableDialog( Sequence
< PropertyValue
>() );
391 class ColumnsWidget final
: public weld::CustomWidgetController
394 static constexpr tools::Long WIDTH
= 5;
396 rtl::Reference
<SvxColumnsToolBoxControl
> mxControl
;
397 weld::SpinButton
& mrSpinButton
;
400 ::Color aHighlightLineColor
;
402 ::Color aHighlightFillColor
;
408 DECL_LINK(ValueChangedHdl
, weld::SpinButton
&, void);
409 DECL_LINK(ActivateHdl
, weld::Entry
&, bool);
411 void InsertColumns();
412 void UpdateSize_Impl( tools::Long nNewCol
);
414 ColumnsWidget(SvxColumnsToolBoxControl
* pControl
, weld::SpinButton
& rSpinButton
);
416 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
418 virtual bool KeyInput(const KeyEvent
&) override
;
419 virtual bool MouseButtonDown(const MouseEvent
&) override
;
420 virtual bool MouseMove(const MouseEvent
&) override
;
421 virtual bool MouseButtonUp(const MouseEvent
&) override
;
422 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
426 class ColumnsWindow final
: public WeldToolbarPopup
429 std::unique_ptr
<weld::SpinButton
> mxSpinButton
;
430 std::unique_ptr
<ColumnsWidget
> mxColumnsWidget
;
431 std::unique_ptr
<weld::CustomWeld
> mxColumnsWidgetWin
;
432 rtl::Reference
<SvxColumnsToolBoxControl
> mxControl
;
435 ColumnsWindow(SvxColumnsToolBoxControl
* pControl
, weld::Widget
* pParent
);
437 virtual void GrabFocus() override
439 mxColumnsWidget
->GrabFocus();
445 ColumnsWindow::ColumnsWindow(SvxColumnsToolBoxControl
* pControl
, weld::Widget
* pParent
)
446 : WeldToolbarPopup(pControl
->getFrameInterface(), pParent
, "svx/ui/columnswindow.ui", "ColumnsWindow")
447 , mxSpinButton(m_xBuilder
->weld_spin_button("spinbutton"))
448 , mxColumnsWidget(new ColumnsWidget(pControl
, *mxSpinButton
))
449 , mxColumnsWidgetWin(new weld::CustomWeld(*m_xBuilder
, "columns", *mxColumnsWidget
))
450 , mxControl(pControl
)
454 ColumnsWidget::ColumnsWidget(SvxColumnsToolBoxControl
* pControl
, weld::SpinButton
& rSpinButton
)
455 : mxControl(pControl
)
456 , mrSpinButton(rSpinButton
)
461 mrSpinButton
.connect_value_changed(LINK(this, ColumnsWidget
, ValueChangedHdl
));
462 mrSpinButton
.connect_activate(LINK(this, ColumnsWidget
, ActivateHdl
));
464 const StyleSettings
& rStyles
= Application::GetSettings().GetStyleSettings();
465 aLineColor
= rStyles
.GetLabelTextColor();
466 aHighlightLineColor
= rStyles
.GetHighlightTextColor();
467 aFillColor
= rStyles
.GetWindowColor();
468 aHighlightFillColor
= rStyles
.GetHighlightColor();
469 aFaceColor
= rStyles
.GetFaceColor();
472 IMPL_LINK_NOARG(ColumnsWidget
, ValueChangedHdl
, weld::SpinButton
&, void)
474 UpdateSize_Impl(mrSpinButton
.get_value());
477 IMPL_LINK_NOARG(ColumnsWidget
, ActivateHdl
, weld::Entry
&, bool)
480 mxControl
->EndPopupMode();
484 void ColumnsWidget::SetDrawingArea(weld::DrawingArea
* pDrawingArea
)
486 OutputDevice
& rDevice
= pDrawingArea
->get_ref_device();
487 Size aLogicSize
= rDevice
.LogicToPixel( Size( 95, 155 ), MapMode( MapUnit::Map10thMM
) );
488 nMX
= aLogicSize
.Width();
489 Size
aSize(nMX
*WIDTH
-1, aLogicSize
.Height());
490 pDrawingArea
->set_size_request(aSize
.Width(), aSize
.Height());
491 CustomWidgetController::SetDrawingArea(pDrawingArea
);
492 SetOutputSizePixel(aSize
);
495 bool ColumnsWidget::MouseMove(const MouseEvent
& rMEvt
)
497 Point aPos
= rMEvt
.GetPosPixel();
499 tools::Long nNewCol
= 1;
501 nNewCol
= aPos
.X() / nMX
+ 1;
504 UpdateSize_Impl( nNewCol
);
509 void ColumnsWidget::UpdateSize_Impl( tools::Long nNewCol
)
511 if ( nNewCol
== nCol
)
514 Size aWinSize
= GetOutputSizePixel();
516 Invalidate( tools::Rectangle( 0, aWinSize
.Height() - 2,
517 aWinSize
.Width(), aWinSize
.Height() ) );
519 tools::Long nMinCol
= 0, nMaxCol
= 0;
521 if ( nNewCol
< nCol
)
532 Invalidate( tools::Rectangle( nMinCol
*nMX
-1, 0,
533 nMaxCol
*nMX
+1, aWinSize
.Height() - 2 ) );
535 mrSpinButton
.set_value(nCol
);
538 bool ColumnsWidget::MouseButtonDown(const MouseEvent
&)
543 bool ColumnsWidget::KeyInput(const KeyEvent
& rKEvt
)
545 bool bHandled
= false;
546 sal_uInt16 nModifier
= rKEvt
.GetKeyCode().GetModifier();
547 sal_uInt16 nKey
= rKEvt
.GetKeyCode().GetCode();
550 if( KEY_LEFT
== nKey
|| KEY_RIGHT
== nKey
||
551 KEY_RETURN
== nKey
||KEY_ESCAPE
== nKey
||
555 tools::Long nNewCol
= nCol
;
567 mxControl
->EndPopupMode();
571 mxControl
->EndPopupMode();
574 UpdateSize_Impl( nNewCol
);
577 else if(KEY_MOD1
== nModifier
&& KEY_RETURN
== nKey
)
581 mxControl
->EndPopupMode();
586 bool ColumnsWidget::MouseButtonUp(const MouseEvent
&)
589 mxControl
->EndPopupMode();
593 void ColumnsWidget::Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&)
595 rRenderContext
.Push(vcl::PushFlags::FONT
);
597 rRenderContext
.SetBackground();
598 vcl::Font
aFont( rRenderContext
.GetFont() );
599 aFont
.SetColor( aLineColor
);
600 aFont
.SetFillColor( aFaceColor
);
601 aFont
.SetTransparent( false );
602 rRenderContext
.SetFont( aFont
);
605 tools::Long nLineWidth
;
606 Size
aSize(GetOutputSizePixel());
608 for (i
= 0; i
< WIDTH
; i
++)
612 rRenderContext
.SetLineColor(aHighlightLineColor
);
613 rRenderContext
.SetFillColor(aHighlightFillColor
);
617 rRenderContext
.SetLineColor(aLineColor
);
618 rRenderContext
.SetFillColor(aFillColor
);
621 rRenderContext
.DrawRect(tools::Rectangle(i
* nMX
- 1, -1, i
* nMX
+ nMX
, aSize
.Height() - 1));
624 while (j
< aSize
.Height() - 4)
630 rRenderContext
.DrawLine(Point(i
* nMX
+ 4, j
), Point(i
* nMX
+ nMX
- nLineWidth
- 4, j
));
635 rRenderContext
.SetLineColor();
636 rRenderContext
.SetFillColor(aFaceColor
);
638 rRenderContext
.DrawRect(tools::Rectangle(0,
640 aSize
.Width() / 2 - 1,
643 rRenderContext
.DrawRect(tools::Rectangle(aSize
.Width() / 2,
648 rRenderContext
.SetLineColor(aLineColor
);
649 rRenderContext
.SetFillColor();
650 rRenderContext
.DrawRect(tools::Rectangle( 0, 0, aSize
.Width() - 1, aSize
.Height() - 1));
652 rRenderContext
.Pop();
655 void SvxColumnsToolBoxControl::InsertColumns(const Sequence
< PropertyValue
>& rArgs
)
657 Reference
< XDispatchProvider
> xDispatchProvider( m_xFrame
, UNO_QUERY
);
658 if ( xDispatchProvider
.is() )
660 css::util::URL aTargetURL
;
661 Reference
< XURLTransformer
> xTrans( URLTransformer::create(::comphelper::getProcessComponentContext()) );
662 aTargetURL
.Complete
= m_aCommandURL
;
663 xTrans
->parseStrict( aTargetURL
);
665 Reference
< XDispatch
> xDispatch
= xDispatchProvider
->queryDispatch( aTargetURL
, OUString(), 0 );
666 if ( xDispatch
.is() )
667 xDispatch
->dispatch( aTargetURL
, rArgs
);
671 void ColumnsWidget::InsertColumns()
675 Sequence
< PropertyValue
> aArgs
{
676 comphelper::makePropertyValue("Columns", sal_Int16( nCol
)),
677 comphelper::makePropertyValue("Modifier", sal_Int16( m_bMod1
? KEY_MOD1
: 0 ))
679 mxControl
->InsertColumns(aArgs
);
683 SvxTableToolBoxControl::SvxTableToolBoxControl(const css::uno::Reference
<css::uno::XComponentContext
>& rContext
)
684 : PopupWindowController(rContext
, nullptr, OUString())
688 void SvxTableToolBoxControl::initialize( const css::uno::Sequence
< css::uno::Any
>& rArguments
)
690 PopupWindowController::initialize(rArguments
);
692 ToolBox
* pToolBox
= nullptr;
694 if (getToolboxId(nId
, &pToolBox
))
695 pToolBox
->SetItemBits(nId
, ToolBoxItemBits::DROPDOWNONLY
| pToolBox
->GetItemBits(nId
));
698 SvxTableToolBoxControl::~SvxTableToolBoxControl()
702 std::unique_ptr
<WeldToolbarPopup
> SvxTableToolBoxControl::weldPopupWindow()
704 return std::make_unique
<TableWindow
>(this, m_pToolbar
, m_aCommandURL
);
707 VclPtr
<vcl::Window
> SvxTableToolBoxControl::createVclPopupWindow( vcl::Window
* pParent
)
709 ToolBox
* pToolBox
= nullptr;
711 bool bToolBox
= getToolboxId(nId
, &pToolBox
);
713 mxInterimPopover
= VclPtr
<InterimToolbarPopup
>::Create(getFrameInterface(), pParent
,
714 std::make_unique
<TableWindow
>(this, pParent
->GetFrameWeld(), m_aCommandURL
));
716 mxInterimPopover
->SetText(bToolBox
? pToolBox
->GetItemText(nId
) : OUString());
718 mxInterimPopover
->Show();
720 return mxInterimPopover
;
723 OUString
SvxTableToolBoxControl::getImplementationName()
725 return "com.sun.star.comp.svx.TableToolBoxControl";
728 css::uno::Sequence
<OUString
> SvxTableToolBoxControl::getSupportedServiceNames()
730 return { "com.sun.star.frame.ToolbarController" };
733 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
734 com_sun_star_comp_svx_TableToolBoxControl_get_implementation(
735 css::uno::XComponentContext
* rContext
,
736 css::uno::Sequence
<css::uno::Any
> const & )
738 return cppu::acquire(new SvxTableToolBoxControl(rContext
));
741 SvxColumnsToolBoxControl::SvxColumnsToolBoxControl(const css::uno::Reference
<css::uno::XComponentContext
>& rContext
)
742 : PopupWindowController(rContext
, nullptr, OUString())
746 void SvxColumnsToolBoxControl::initialize( const css::uno::Sequence
< css::uno::Any
>& rArguments
)
748 PopupWindowController::initialize(rArguments
);
750 ToolBox
* pToolBox
= nullptr;
752 if (getToolboxId(nId
, &pToolBox
))
753 pToolBox
->SetItemBits(nId
, ToolBoxItemBits::DROPDOWNONLY
| pToolBox
->GetItemBits(nId
));
756 SvxColumnsToolBoxControl::~SvxColumnsToolBoxControl()
760 std::unique_ptr
<WeldToolbarPopup
> SvxColumnsToolBoxControl::weldPopupWindow()
762 return std::make_unique
<ColumnsWindow
>(this, m_pToolbar
);
765 VclPtr
<vcl::Window
> SvxColumnsToolBoxControl::createVclPopupWindow(vcl::Window
* pParent
)
767 ToolBox
* pToolBox
= nullptr;
769 bool bToolBox
= getToolboxId(nId
, &pToolBox
);
771 mxInterimPopover
= VclPtr
<InterimToolbarPopup
>::Create(getFrameInterface(), pParent
,
772 std::make_unique
<ColumnsWindow
>(this, pParent
->GetFrameWeld()));
774 mxInterimPopover
->SetText(bToolBox
? pToolBox
->GetItemText(nId
) : OUString());
776 mxInterimPopover
->Show();
778 return mxInterimPopover
;
781 OUString
SvxColumnsToolBoxControl::getImplementationName()
783 return "com.sun.star.comp.svx.ColumnsToolBoxControl";
786 css::uno::Sequence
<OUString
> SvxColumnsToolBoxControl::getSupportedServiceNames()
788 return { "com.sun.star.frame.ToolbarController" };
791 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
792 com_sun_star_comp_svx_ColumnsToolBoxControl_get_implementation(
793 css::uno::XComponentContext
* rContext
,
794 css::uno::Sequence
<css::uno::Any
> const & )
796 return cppu::acquire(new SvxColumnsToolBoxControl(rContext
));
799 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */