Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / tbxctrls / layctrl.cxx
blob0ec276a5a9f1f0d4fa5b02c79807b2a9c8a0c587
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <utility>
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>
37 // namespaces
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;
43 namespace {
45 class TableWidget final : public weld::CustomWidgetController
47 private:
48 rtl::Reference<SvxTableToolBoxControl> mxControl;
49 OUString maCommand;
51 tools::Long nCol;
52 tools::Long nLine;
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;
63 ::Color aFontColor;
64 ::Color aLineColor;
65 ::Color aFillColor;
66 ::Color aHighlightFillColor;
67 ::Color aBackgroundColor;
69 void Update(tools::Long nNewCol, tools::Long nNewLine);
70 void InsertTable();
72 public:
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
86 private:
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);
94 public:
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))
128 , nCol(0)
129 , nLine(0)
130 , mnTableCellWidth(0)
131 , mnTableCellHeight(0)
132 , mnTableWidth(0)
133 , mnTableHeight(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 );
170 return true;
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();
178 if ( !nModifier )
180 bHandled = true;
181 tools::Long nNewCol = nCol;
182 tools::Long nNewLine = nLine;
183 switch(nKey)
185 case KEY_UP:
186 if ( nNewLine > 1 )
187 nNewLine--;
188 else
189 mxControl->EndPopupMode();
190 break;
191 case KEY_DOWN:
192 if ( nNewLine < TABLE_CELLS_VERT )
194 nNewLine++;
195 if ( nNewCol == 0 )
196 nNewCol = 1;
198 else
199 mxControl->CloseAndShowTableDialog();
200 break;
201 case KEY_LEFT:
202 if ( nNewCol > 1 )
203 nNewCol--;
204 else
205 mxControl->EndPopupMode();
206 break;
207 case KEY_RIGHT:
208 if ( nNewCol < TABLE_CELLS_HORIZ )
210 nNewCol++;
211 if ( nNewLine == 0 )
212 nNewLine = 1;
214 else
215 mxControl->CloseAndShowTableDialog();
216 break;
217 case KEY_ESCAPE:
218 mxControl->EndPopupMode();
219 break;
220 case KEY_RETURN:
221 InsertTable();
222 mxControl->EndPopupMode();
223 return true;
224 default:
225 bHandled = false;
227 if ( bHandled )
229 Update( nNewCol, nNewLine );
232 else if (KEY_MOD1 == nModifier && KEY_RETURN == nKey)
234 InsertTable();
235 mxControl->EndPopupMode();
236 return true;
239 return bHandled;
242 bool TableWidget::MouseButtonUp(const MouseEvent&)
244 InsertTable();
245 mxControl->EndPopupMode();
246 return true;
249 bool TableWidget::MouseButtonDown(const MouseEvent&)
251 return true;
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));
275 // the selection
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
297 if (!nCol || !nLine)
299 rRenderContext.Pop();
300 return;
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
329 if (IsRTLEnabled())
330 aText = u"\u202D" + aText;
332 rRenderContext.DrawText(Point(nTextX, nTextY), aText);
334 rRenderContext.Pop();
337 void TableWidget::InsertTable()
339 if (nCol && nLine)
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 )
351 nNewCol = 0;
353 if ( nNewLine < 0 || nNewLine > TABLE_CELLS_VERT )
354 nNewLine = 0;
356 if ( nNewCol != nCol || nNewLine != nLine )
358 nCol = nNewCol;
359 nLine = nNewLine;
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
383 EndPopupMode();
385 // and open the table dialog instead
386 TableDialog( Sequence< PropertyValue >() );
389 namespace {
391 class ColumnsWidget final : public weld::CustomWidgetController
393 private:
394 static constexpr tools::Long WIDTH = 5;
396 rtl::Reference<SvxColumnsToolBoxControl> mxControl;
397 weld::SpinButton& mrSpinButton;
399 ::Color aLineColor;
400 ::Color aHighlightLineColor;
401 ::Color aFillColor;
402 ::Color aHighlightFillColor;
403 ::Color aFaceColor;
404 tools::Long nCol;
405 tools::Long nMX;
406 bool m_bMod1;
408 DECL_LINK(ValueChangedHdl, weld::SpinButton&, void);
409 DECL_LINK(ActivateHdl, weld::Entry&, bool);
411 void InsertColumns();
412 void UpdateSize_Impl( tools::Long nNewCol );
413 public:
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
428 private:
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;
434 public:
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)
457 , nCol(1)
458 , nMX(0)
459 , m_bMod1(false)
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)
479 InsertColumns();
480 mxControl->EndPopupMode();
481 return true;
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;
500 if ( aPos.X() > 0 )
501 nNewCol = aPos.X() / nMX + 1;
502 if ( nNewCol > 20 )
503 nNewCol = 20;
504 UpdateSize_Impl( nNewCol );
506 return true;
509 void ColumnsWidget::UpdateSize_Impl( tools::Long nNewCol )
511 if ( nNewCol == nCol )
512 return;
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 )
523 nMinCol = nNewCol;
524 nMaxCol = nCol;
526 else
528 nMinCol = nCol;
529 nMaxCol = nNewCol;
532 Invalidate( tools::Rectangle( nMinCol*nMX-1, 0,
533 nMaxCol*nMX+1, aWinSize.Height() - 2 ) );
534 nCol = nNewCol;
535 mrSpinButton.set_value(nCol);
538 bool ColumnsWidget::MouseButtonDown(const MouseEvent&)
540 return true;
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();
548 if(!nModifier)
550 if( KEY_LEFT == nKey || KEY_RIGHT == nKey ||
551 KEY_RETURN == nKey ||KEY_ESCAPE == nKey ||
552 KEY_UP == nKey)
554 bHandled = true;
555 tools::Long nNewCol = nCol;
556 switch(nKey)
558 case KEY_LEFT :
559 if(nNewCol)
560 nNewCol--;
561 break;
562 case KEY_RIGHT :
563 nNewCol++;
564 break;
565 case KEY_RETURN :
566 InsertColumns();
567 mxControl->EndPopupMode();
568 break;
569 case KEY_ESCAPE :
570 case KEY_UP :
571 mxControl->EndPopupMode();
572 break;
574 UpdateSize_Impl( nNewCol );
577 else if(KEY_MOD1 == nModifier && KEY_RETURN == nKey)
579 m_bMod1 = true;
580 InsertColumns();
581 mxControl->EndPopupMode();
583 return bHandled;
586 bool ColumnsWidget::MouseButtonUp(const MouseEvent&)
588 InsertColumns();
589 mxControl->EndPopupMode();
590 return true;
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 );
604 tools::Long i;
605 tools::Long nLineWidth;
606 Size aSize(GetOutputSizePixel());
608 for (i = 0; i < WIDTH; i++)
610 if (i < nCol)
612 rRenderContext.SetLineColor(aHighlightLineColor);
613 rRenderContext.SetFillColor(aHighlightFillColor);
615 else
617 rRenderContext.SetLineColor(aLineColor);
618 rRenderContext.SetFillColor(aFillColor);
621 rRenderContext.DrawRect(tools::Rectangle(i * nMX - 1, -1, i * nMX + nMX, aSize.Height() - 1));
623 tools::Long j = 4;
624 while (j < aSize.Height() - 4)
626 if (!(j % 16))
627 nLineWidth = 10;
628 else
629 nLineWidth = 4;
630 rRenderContext.DrawLine(Point(i * nMX + 4, j), Point(i * nMX + nMX - nLineWidth - 4, j));
631 j += 4;
635 rRenderContext.SetLineColor();
636 rRenderContext.SetFillColor(aFaceColor);
638 rRenderContext.DrawRect(tools::Rectangle(0,
639 aSize.Height() - 2,
640 aSize.Width() / 2 - 1,
641 aSize.Height()));
643 rRenderContext.DrawRect(tools::Rectangle(aSize.Width() / 2,
644 aSize.Height() - 2,
645 aSize.Width(),
646 aSize.Height()));
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()
673 if (nCol)
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;
693 ToolBoxItemId nId;
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;
710 ToolBoxItemId nId;
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;
751 ToolBoxItemId nId;
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;
768 ToolBoxItemId nId;
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: */