[Libreoffice-commits] core.git: 2 commits - extras/source include/svx include/vcl reportdesign/source reportdesign/uiconfig sc/uiconfig solenv/bin svx/inc svx/source vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Oct 13 14:17:14 UTC 2019
extras/source/glade/libreoffice-catalog.xml.in | 12
include/svx/colorwindow.hxx | 21 +
include/svx/fntctrl.hxx | 35 --
include/vcl/weld.hxx | 9
reportdesign/source/ui/dlg/AddField.cxx | 10
reportdesign/source/ui/dlg/CondFormat.cxx | 228 ++-----------
reportdesign/source/ui/dlg/Condition.cxx | 295 ++++++----------
reportdesign/source/ui/dlg/Condition.hxx | 116 +++---
reportdesign/source/ui/inc/AddField.hxx | 6
reportdesign/source/ui/inc/CondFormat.hxx | 40 --
reportdesign/source/ui/inc/GroupsSorting.hxx | 2
reportdesign/source/ui/misc/UITools.cxx | 3
reportdesign/source/ui/report/ReportController.cxx | 4
reportdesign/uiconfig/dbreport/ui/condformatdialog.ui | 10
reportdesign/uiconfig/dbreport/ui/conditionwin.ui | 82 ++--
sc/uiconfig/scalc/ui/conditionalentrymobile.ui | 2
solenv/bin/native-code.py | 1
svx/inc/pch/precompiled_svx.hxx | 4
svx/inc/pch/precompiled_svxcore.hxx | 27 -
svx/source/dialog/fntctrl.cxx | 313 ------------------
svx/source/tbxctrls/tbcontrl.cxx | 59 ++-
vcl/source/app/salvtables.cxx | 59 +++
vcl/unx/gtk3/gtk3gtkinst.cxx | 79 ++++
23 files changed, 501 insertions(+), 916 deletions(-)
New commits:
commit d854687a1316783e40d227756fef08af925e93e6
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 11 13:04:14 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 13 16:16:39 2019 +0200
SvxFontPrevWindow is now unused
sc/uiconfig/scalc/ui/conditionalentrymobile.ui was already non-functional
before this change
Change-Id: I07743a8fcca4b3cf325ce3d3d0699bf68c0115f3
Reviewed-on: https://gerrit.libreoffice.org/80690
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/fntctrl.hxx b/include/svx/fntctrl.hxx
index 5332c98ed52e..f2489c750f3c 100644
--- a/include/svx/fntctrl.hxx
+++ b/include/svx/fntctrl.hxx
@@ -28,35 +28,6 @@
class SfxItemSet;
class FontPrevWin_Impl;
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontPrevWindow : public vcl::Window
-{
- using OutputDevice::SetFont;
-private:
- std::unique_ptr<FontPrevWin_Impl> pImpl;
- bool mbResetForeground : 1;
- bool mbResetBackground : 1;
-
- SVX_DLLPRIVATE void ResetSettings(bool bForeground, bool bBackground);
- SVX_DLLPRIVATE void ApplySettings(vcl::RenderContext& rRenderContext) override;
- SVX_DLLPRIVATE void Init ();
-
-public:
- SvxFontPrevWindow(vcl::Window* pParent, WinBits nStyle);
- virtual ~SvxFontPrevWindow() override;
- virtual void dispose() override;
-
- virtual void StateChanged( StateChangedType nStateChange ) override;
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
-
- void SetFont( const SvxFont& rNormalFont, const SvxFont& rCJKFont, const SvxFont& rCTLFont );
- void SetBackColor( const Color& rColor );
- void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
-
- bool IsTwoLines() const;
-
- virtual Size GetOptimalSize() const override;
-};
-
class SAL_WARN_UNUSED SVX_DLLPUBLIC FontPrevWindow : public weld::CustomWidgetController
{
private:
diff --git a/sc/uiconfig/scalc/ui/conditionalentrymobile.ui b/sc/uiconfig/scalc/ui/conditionalentrymobile.ui
index a4f1b39185bd..3b1cda8a5661 100644
--- a/sc/uiconfig/scalc/ui/conditionalentrymobile.ui
+++ b/sc/uiconfig/scalc/ui/conditionalentrymobile.ui
@@ -92,7 +92,7 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxFontPrevWindow" id="preview:border">
+ <object class="GtkDrawingArea" id="preview:border">
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes" context="conditionalentrymobile|preview|tooltip_text">Example</property>
</object>
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
index 083aff353175..85a2bc8ba450 100644
--- a/svx/inc/pch/precompiled_svx.hxx
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2019-10-02 17:03:44 using:
+ Generated on 2019-10-11 13:05:53 using:
./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -59,10 +59,8 @@
#include <rtl/instance.hxx>
#include <rtl/math.hxx>
#include <rtl/ref.hxx>
-#include <rtl/strbuf.h>
#include <rtl/string.h>
#include <rtl/string.hxx>
-#include <rtl/stringutils.hxx>
#include <rtl/tencinfo.h>
#include <rtl/textenc.h>
#include <rtl/uri.hxx>
diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx
index a576a2da5eca..3978d42f17cd 100644
--- a/svx/inc/pch/precompiled_svxcore.hxx
+++ b/svx/inc/pch/precompiled_svxcore.hxx
@@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2019-05-12 16:57:24 using:
+ Generated on 2019-10-11 13:06:07 using:
./bin/update_pch svx svxcore --cutoff=7 --exclude:system --include:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -58,7 +58,6 @@
#include <osl/interlck.h>
#include <osl/mutex.hxx>
#include <osl/process.h>
-#include <osl/thread.h>
#include <osl/time.h>
#include <rtl/alloc.h>
#include <rtl/character.hxx>
@@ -91,10 +90,8 @@
#include <vcl/AccessibleBrowseBoxObjType.hxx>
#include <vcl/EnumContext.hxx>
#include <vcl/GraphicExternalLink.hxx>
-#include <vcl/GraphicObject.hxx>
-#include <vcl/IContext.hxx>
-#include <vcl/abstdlg.hxx>
-#include <vcl/accel.hxx>
+#include <vcl/NotebookBarAddonsMerger.hxx>
+#include <vcl/Scanline.hxx>
#include <vcl/alpha.hxx>
#include <vcl/animate/Animation.hxx>
#include <vcl/animate/AnimationBitmap.hxx>
@@ -116,8 +113,6 @@
#include <vcl/edit.hxx>
#include <vcl/errcode.hxx>
#include <vcl/event.hxx>
-#include <vcl/field.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/fntstyle.hxx>
#include <vcl/font.hxx>
@@ -133,10 +128,8 @@
#include <vcl/mapmod.hxx>
#include <vcl/menu.hxx>
#include <vcl/metaact.hxx>
-#include <vcl/mnemonicengine.hxx>
#include <vcl/outdev.hxx>
#include <vcl/ptrstyle.hxx>
-#include <vcl/quickselectionengine.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
@@ -144,10 +137,9 @@
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>
#include <vcl/task.hxx>
+#include <vcl/textfilter.hxx>
#include <vcl/timer.hxx>
#include <vcl/transfer.hxx>
-#include <vcl/treelist.hxx>
-#include <vcl/treelistentries.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/vclevent.hxx>
#include <vcl/vclptr.hxx>
@@ -199,8 +191,10 @@
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XVetoableChangeListener.hpp>
#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/datatransfer/DataFlavor.hpp>
#include <com/sun/star/datatransfer/XTransferable2.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp>
@@ -216,8 +210,10 @@
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/graphic/XPrimitive2D.hpp>
#include <com/sun/star/graphic/XPrimitive3D.hpp>
#include <com/sun/star/i18n/Calendar2.hpp>
@@ -228,7 +224,6 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
@@ -262,9 +257,7 @@
#include <comphelper/comphelperdllapi.h>
#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/propagg.hxx>
#include <comphelper/property.hxx>
-#include <comphelper/propertycontainerhelper.hxx>
#include <comphelper/propstate.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
@@ -371,7 +364,6 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/bigint.hxx>
#include <tools/color.hxx>
-#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
#include <tools/debug.hxx>
@@ -411,7 +403,6 @@
#include <xmloff/dllapi.h>
#endif // PCH_LEVEL >= 3
#if PCH_LEVEL >= 4
-#include <svx/SvxColorValueSet.hxx>
#include <svx/XPropertyTable.hxx>
#include <svx/cube3d.hxx>
#include <svx/dialmgr.hxx>
@@ -433,6 +424,7 @@
#include <svx/scene3d.hxx>
#include <svx/sdasitm.hxx>
#include <svx/sdmetitm.hxx>
+#include <svx/sdooitm.hxx>
#include <svx/sdr/animation/scheduler.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
@@ -526,6 +518,7 @@
#include <svx/xpoly.hxx>
#include <svx/xpool.hxx>
#include <svx/xtable.hxx>
+#include <svx/xtextit0.hxx>
#endif // PCH_LEVEL >= 4
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index c1b7a2d65895..96df4da9c639 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -20,7 +20,6 @@
#include <sfx2/dialoghelper.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/printer.hxx>
-#include <vcl/builderfactory.hxx>
#include <vcl/event.hxx>
#include <vcl/metric.hxx>
#include <vcl/svapp.hxx>
@@ -141,7 +140,6 @@ bool CleanAndCheckEmpty(OUString& rText)
class FontPrevWin_Impl
{
- friend class SvxFontPrevWindow;
friend class FontPrevWindow;
SvxFont maFont;
@@ -461,312 +459,6 @@ void FontPrevWin_Impl::ScaleFontWidth(vcl::RenderContext const & rOutDev)
maCTLFont.SetAverageFontWidth(mn100PercentFontWidthCTL * mnFontWidthScale / 100);
}
-void SvxFontPrevWindow::ResetSettings(bool bForeground, bool bBackground)
-{
- mbResetForeground = bForeground;
- mbResetBackground = bBackground;
- Invalidate();
-}
-
-void SvxFontPrevWindow::ApplySettings(vcl::RenderContext& rRenderContext)
-{
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
- if (mbResetForeground)
- {
- svtools::ColorConfig aColorConfig;
- Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
-
- if (IsControlForeground())
- aTextColor = GetControlForeground();
- rRenderContext.SetTextColor(aTextColor);
- mbResetForeground = false;
- }
-
- if (mbResetBackground)
- {
- if (IsControlBackground())
- rRenderContext.SetBackground(GetControlBackground());
- else
- rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
- mbResetBackground = false;
- }
-}
-
-void SvxFontPrevWindow::Init()
-{
- pImpl.reset(new FontPrevWin_Impl);
- SfxViewShell* pSh = SfxViewShell::Current();
-
- if (pSh)
- pImpl->mpPrinter = pSh->GetPrinter();
-
- if (!pImpl->mpPrinter)
- {
- pImpl->mpPrinter = VclPtr<Printer>::Create();
- pImpl->mbDelPrinter = true;
- }
- SetMapMode(MapMode(MapUnit::MapTwip));
- initFont(pImpl->maFont);
- initFont(pImpl->maCJKFont);
- initFont(pImpl->maCTLFont);
-
- ResetSettings(true, true);
-
- SetBorderStyle(WindowBorderStyle::MONO);
-}
-
-SvxFontPrevWindow::SvxFontPrevWindow(vcl::Window* pParent, WinBits nStyle)
- : Window(pParent, nStyle)
- , mbResetForeground(true)
- , mbResetBackground(true)
-{
- Init();
-}
-
-VCL_BUILDER_FACTORY_CONSTRUCTOR(SvxFontPrevWindow, 0)
-
-SvxFontPrevWindow::~SvxFontPrevWindow()
-{
- disposeOnce();
-}
-
-void SvxFontPrevWindow::dispose()
-{
- pImpl.reset();
- vcl::Window::dispose();
-}
-
-void SvxFontPrevWindow::StateChanged( StateChangedType nType )
-{
- if (nType == StateChangedType::ControlForeground)
- ResetSettings(true, false);
- else if (nType == StateChangedType::ControlBackground)
- ResetSettings(false, true);
-
- Window::StateChanged(nType);
- Invalidate();
-}
-
-void SvxFontPrevWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
- ResetSettings(true, true);
- else
- Window::DataChanged( rDCEvt );
-}
-
-void SvxFontPrevWindow::SetFont( const SvxFont& rNormalOutFont, const SvxFont& rCJKOutFont, const SvxFont& rCTLFont )
-{
- setFont(rNormalOutFont, pImpl->maFont);
- setFont(rCJKOutFont, pImpl->maCJKFont);
- setFont(rCTLFont, pImpl->maCTLFont);
-
- pImpl->Invalidate100PercentFontWidth();
- Invalidate();
-}
-
-void SvxFontPrevWindow::SetBackColor(const Color &rColor)
-{
- pImpl->mpBackColor.reset(new Color(rColor));
- Invalidate();
-}
-
-void SvxFontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
-{
- ApplySettings(rRenderContext);
-
- Printer* pPrinter = pImpl->mpPrinter;
- const SvxFont& rFont = pImpl->maFont;
- const SvxFont& rCJKFont = pImpl->maCJKFont;
- const SvxFont& rCTLFont = pImpl->maCTLFont;
-
- if (!IsEnabled())
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Size aLogSize(rRenderContext.GetOutputSize());
-
- tools::Rectangle aRect(Point(0, 0), aLogSize);
- rRenderContext.SetLineColor();
- rRenderContext.SetFillColor(rStyleSettings.GetWindowColor());
- rRenderContext.DrawRect(aRect);
- }
- else
- {
- if (!pImpl->mbSelection && !pImpl->mbTextInited)
- {
- using namespace css::i18n::ScriptType;
-
- SfxViewShell* pSh = SfxViewShell::Current();
-
- if (pSh && !pImpl->mbGetSelection && !pImpl->mbUseFontNameAsText)
- {
- pImpl->maText = pSh->GetSelectionText();
- pImpl->mbGetSelection = true;
- pImpl->mbSelection = !CleanAndCheckEmpty(pImpl->maText);
- }
-
- if (!pImpl->mbSelection || pImpl->mbUseFontNameAsText)
- {
- //If we're showing multiple sample texts, then they're all
- //sample texts. If only showing Latin, continue to use
- //the fontname as the preview
- if ((pImpl->m_bCJKEnabled) || (pImpl->m_bCTLEnabled))
- pImpl->maText = makeRepresentativeTextForFont(LATIN, rFont);
- else
- pImpl->maText = rFont.GetFamilyName();
-
- if (pImpl->m_bCJKEnabled)
- {
- if (!pImpl->maText.isEmpty())
- pImpl->maText += " ";
- pImpl->maText += makeRepresentativeTextForFont(ASIAN, rCJKFont);
-
- }
- if (pImpl->m_bCTLEnabled)
- {
- if (!pImpl->maText.isEmpty())
- pImpl->maText += " ";
- pImpl->maText += makeRepresentativeTextForFont(COMPLEX, rCTLFont);
- }
- }
-
- if (pImpl->maText.isEmpty())
- pImpl->maText = GetText();
-
- if (pImpl->maText.isEmpty())
- { // fdo#58427: still no text? let's try that one...
- pImpl->maText = makeRepresentativeTextForFont(LATIN, rFont);
- }
-
- bool bEmpty = CleanAndCheckEmpty(pImpl->maText);
- if (bEmpty)
- pImpl->maText = GetText();
-
- if (pImpl->maText.getLength() > (TEXT_WIDTH - 1))
- {
- const sal_Int32 nSpaceIdx = pImpl->maText.indexOf(" ", TEXT_WIDTH);
- if (nSpaceIdx != -1)
- pImpl->maText = pImpl->maText.copy(0, nSpaceIdx);
- else
- pImpl->maText = pImpl->maText.copy(0, (TEXT_WIDTH - 1));
- }
- }
-
- // calculate text width scaling
- pImpl->ScaleFontWidth(rRenderContext);
-
- pImpl->CheckScript();
- Size aTxtSize = pImpl->CalcTextSize(rRenderContext, pPrinter, rFont);
-
- const Size aLogSize(rRenderContext.GetOutputSize());
-
- long nX = aLogSize.Width() / 2 - aTxtSize.Width() / 2;
- long nY = aLogSize.Height() / 2 - aTxtSize.Height() / 2;
-
- if (nY + pImpl->mnAscent > aLogSize.Height())
- nY = aLogSize.Height() - pImpl->mnAscent;
-
- if (pImpl->mpBackColor)
- {
- tools::Rectangle aRect(Point(0, 0), aLogSize);
- Color aLineCol = rRenderContext.GetLineColor();
- Color aFillCol = rRenderContext.GetFillColor();
- rRenderContext.SetLineColor();
- rRenderContext.SetFillColor(*pImpl->mpBackColor);
- rRenderContext.DrawRect(aRect);
- rRenderContext.SetLineColor(aLineCol);
- rRenderContext.SetFillColor(aFillCol);
- }
- if (pImpl->mpColor)
- {
- tools::Rectangle aRect(Point(nX, nY), aTxtSize);
- Color aLineCol = rRenderContext.GetLineColor();
- Color aFillCol = rRenderContext.GetFillColor();
- rRenderContext.SetLineColor();
- rRenderContext.SetFillColor(*pImpl->mpColor);
- rRenderContext.DrawRect(aRect);
- rRenderContext.SetLineColor(aLineCol);
- rRenderContext.SetFillColor(aFillCol);
- }
-
- long nStdAscent = pImpl->mnAscent;
- nY += nStdAscent;
-
- if (IsTwoLines())
- {
- SvxFont aSmallFont(rFont);
- Size aOldSize = pImpl->maCJKFont.GetFontSize();
- setFontSize(aSmallFont);
- setFontSize(pImpl->maCJKFont);
-
- long nStartBracketWidth = 0;
- long nEndBracketWidth = 0;
- long nTextWidth = 0;
- if (pImpl->mcStartBracket)
- {
- OUString sBracket(pImpl->mcStartBracket);
- nStartBracketWidth = rFont.GetTextSize(pPrinter, sBracket).Width();
- }
- if (pImpl->mcEndBracket)
- {
- OUString sBracket(pImpl->mcEndBracket);
- nEndBracketWidth = rFont.GetTextSize(pPrinter, sBracket).Width();
- }
- nTextWidth = pImpl->CalcTextSize(rRenderContext, pPrinter, aSmallFont).Width();
- long nResultWidth = nStartBracketWidth;
- nResultWidth += nEndBracketWidth;
- nResultWidth += nTextWidth;
-
- long _nX = (aLogSize.Width() - nResultWidth) / 2;
- rRenderContext.DrawLine(Point(0, nY), Point(_nX, nY));
- rRenderContext.DrawLine(Point(_nX + nResultWidth, nY), Point(aLogSize.Width(), nY));
-
- long nSmallAscent = pImpl->mnAscent;
- long nOffset = (nStdAscent - nSmallAscent) / 2;
-
- if (pImpl->mcStartBracket)
- {
- OUString sBracket(pImpl->mcStartBracket);
- rFont.DrawPrev(&rRenderContext, pPrinter, Point(_nX, nY - nOffset - 4), sBracket);
- _nX += nStartBracketWidth;
- }
-
- Point aTmpPoint1(_nX, nY - nSmallAscent - 2);
- Point aTmpPoint2(_nX, nY);
- pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint1, aSmallFont);
- pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint2, aSmallFont);
-
- _nX += nTextWidth;
- if (pImpl->mcEndBracket)
- {
- Point aTmpPoint( _nX + 1, nY - nOffset - 4);
- OUString sBracket(pImpl->mcEndBracket);
- rFont.DrawPrev(&rRenderContext, pPrinter, aTmpPoint, sBracket);
- }
- pImpl->maCJKFont.SetFontSize(aOldSize);
- }
- else
- {
-
- Color aLineCol = rRenderContext.GetLineColor();
-
- rRenderContext.SetLineColor(rFont.GetColor());
- rRenderContext.DrawLine(Point(0, nY), Point(nX, nY));
- rRenderContext.DrawLine(Point(nX + aTxtSize.Width(), nY), Point(aLogSize.Width(), nY));
- rRenderContext.SetLineColor(aLineCol);
-
- Point aTmpPoint(nX, nY);
- pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint, rFont);
- }
- }
-}
-
-bool SvxFontPrevWindow::IsTwoLines() const
-{
- return pImpl->mbTwoLines;
-}
-
static bool GetWhich (const SfxItemSet& rSet, sal_uInt16 nSlot, sal_uInt16& rWhich)
{
rWhich = rSet.GetPool()->GetWhich(nSlot);
@@ -810,11 +502,6 @@ static void SetPrevFontEscapement(SvxFont& rFont, sal_uInt8 nProp, sal_uInt8 nEs
rFont.SetEscapement(nEsc);
}
-Size SvxFontPrevWindow::GetOptimalSize() const
-{
- return getPreviewStripSize(*this);
-}
-
void FontPrevWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
commit 226fcda0a888c4959b1f895de31856f1624f04ee
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 11 13:02:57 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 13 16:16:24 2019 +0200
weld ConditionalFormattingDialog
Change-Id: I87c03555c5555b12a1be997e368a96d9b07d2b63
Reviewed-on: https://gerrit.libreoffice.org/80689
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 90f30ba68ea6..c915344ed631 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -86,18 +86,6 @@
</properties>
</glade-widget-class>
- <glade-widget-class title="Font Preview" name="svxlo-SvxFontPrevWindow"
- generic-name="Font Preview Window" parent="GtkDrawingArea"
- icon-name="widget-gtk-drawingarea">
- <properties>
- <property id="text" name="Label">
- <parameter-spec>
- <type>GParamString</type>
- </parameter-spec>
- </property>
- </properties>
- </glade-widget-class>
-
<glade-widget-class title="Document Preview Window" name="sdlo-SdDocPreviewWin"
generic-name="Document Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index 183a29d231ba..4656f3d37af7 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -110,6 +110,23 @@ public:
void SetSelectedHdl( const Link<const NamedColor&, void>& rLink ) { maSelectedLink = rLink; }
};
+class SVX_DLLPUBLIC MenuOrToolMenuButton
+{
+private:
+ // either
+ weld::MenuButton* m_pMenuButton;
+ // or
+ weld::Toolbar* m_pToolbar;
+ OString m_aIdent;
+public:
+ MenuOrToolMenuButton(weld::MenuButton* pMenuButton);
+ MenuOrToolMenuButton(weld::Toolbar* pToolbar, const OString& rIdent);
+
+ bool get_active() const;
+ void set_active(bool bActive) const;
+ weld::Widget* get_widget() const;
+};
+
class SVX_DLLPUBLIC ColorWindow : public svtools::ToolbarPopupBase
{
private:
@@ -117,7 +134,7 @@ private:
const sal_uInt16 theSlotId;
weld::Window* const mpParentWindow;
- weld::MenuButton* mpMenuButton;
+ MenuOrToolMenuButton maMenuButton;
std::shared_ptr<PaletteManager> mxPaletteManager;
ColorStatus& mrColorStatus;
ColorSelectFunction const maColorSelectFunction;
@@ -148,7 +165,7 @@ public:
ColorStatus& rColorStatus,
sal_uInt16 nSlotId,
const css::uno::Reference< css::frame::XFrame >& rFrame,
- weld::Window* pParentWindow, weld::MenuButton* pMenuButton,
+ weld::Window* pParentWindow, const MenuOrToolMenuButton &rMenuButton,
bool bInterimBuilder,
ColorSelectFunction const& rColorSelectFunction);
weld::Container* GetWidget() { return mxTopLevel.get(); }
diff --git a/include/svx/fntctrl.hxx b/include/svx/fntctrl.hxx
index d07d60edb62f..5332c98ed52e 100644
--- a/include/svx/fntctrl.hxx
+++ b/include/svx/fntctrl.hxx
@@ -20,12 +20,10 @@
#define INCLUDED_SVX_FNTCTRL_HXX
#include <memory>
-#include <vcl/customweld.hxx>
-#include <vcl/window.hxx>
#include <editeng/svxfont.hxx>
-#include <svx/svxdllapi.h>
-
#include <rtl/ustring.hxx>
+#include <svx/svxdllapi.h>
+#include <vcl/customweld.hxx>
class SfxItemSet;
class FontPrevWin_Impl;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 33dadea0cc03..c85b86d7a8c7 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -266,6 +266,13 @@ public:
virtual css::uno::Reference<css::awt::XWindow> CreateChildFrame() = 0;
};
+class VCL_DLLPUBLIC Box : virtual public Container
+{
+public:
+ // Moves child to a new position in the list of children
+ virtual void reorder_child(weld::Widget* pWidget, int position) = 0;
+};
+
class VCL_DLLPUBLIC ScrolledWindow : virtual public Container
{
protected:
@@ -1830,6 +1837,7 @@ public:
virtual bool get_item_sensitive(const OString& rIdent) const = 0;
virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
virtual bool get_item_active(const OString& rIdent) const = 0;
+ virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0;
virtual void insert_separator(int pos, const OUString& rId) = 0;
void append_separator(const OUString& rId) { insert_separator(-1, rId); }
@@ -1873,6 +1881,7 @@ public:
virtual std::unique_ptr<Container> weld_container(const OString& id,
bool bTakeOwnership = false)
= 0;
+ virtual std::unique_ptr<Box> weld_box(const OString& id, bool bTakeOwnership = false) = 0;
virtual std::unique_ptr<Button> weld_button(const OString& id, bool bTakeOwnership = false) = 0;
virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id,
bool bTakeOwnership = false)
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index 5a56839f1ef9..6c7728ebc54d 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -172,7 +172,6 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent ,const uno::Reference< bea
m_aActions->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
m_aActions->SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction));
- setToolBox(m_aActions.get());
m_aActions->CheckItem(m_nSortUpId);
m_aActions->EnableItem(m_nInsertId, false);
@@ -450,15 +449,6 @@ IMPL_LINK_NOARG( OAddFieldWindow, OnDoubleClickHdl, SvTreeListBox*, bool )
return false;
}
-void OAddFieldWindow::resizeControls(const Size& _rDiff)
-{
- // we use large images so we must change them
- if ( _rDiff.Width() || _rDiff.Height() )
- {
- Invalidate();
- }
-}
-
IMPL_LINK_NOARG( OAddFieldWindow, OnSortAction, ToolBox*, void )
{
const sal_uInt16 nCurItem = m_aActions->GetCurItemId();
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx
index 0fa1180884ba..bb5df9b50c73 100644
--- a/reportdesign/source/ui/dlg/CondFormat.cxx
+++ b/reportdesign/source/ui/dlg/CondFormat.cxx
@@ -58,25 +58,6 @@ namespace rptui
using namespace ::com::sun::star::report;
-
- // UpdateLocker
-
- class UpdateLocker
- {
- vcl::Window& m_rWindow;
-
- public:
- explicit UpdateLocker( vcl::Window& _rWindow )
- :m_rWindow( _rWindow )
- {
- _rWindow.SetUpdateMode( false );
- }
- ~UpdateLocker()
- {
- m_rWindow.SetUpdateMode( true );
- }
- };
-
void ConditionalFormattingDialog::impl_setPrefHeight(bool bFirst)
{
if (!m_bConstructed && !bFirst)
@@ -86,37 +67,35 @@ namespace rptui
size_t nCount = impl_getConditionCount();
if (nCount)
{
- long nHeight = m_aConditions[0]->get_preferred_size().Height();
+ auto nHeight = m_aConditions[0]->get_preferred_size().Height();
size_t nVisibleConditions = ::std::min(nCount, MAX_CONDITIONS);
nHeight *= nVisibleConditions;
- if (nHeight != m_pScrollWindow->get_height_request())
+ nHeight += 2;
+ if (nHeight != m_xScrollWindow->get_size_request().Height())
{
- m_pScrollWindow->set_height_request(nHeight);
- if (!isCalculatingInitialLayoutSize() && !bFirst)
- setOptimalLayoutSize();
+ m_xScrollWindow->set_size_request(-1, nHeight);
+ if (!bFirst)
+ m_xDialog->resize_to_request();
}
}
}
// class ConditionalFormattingDialog
ConditionalFormattingDialog::ConditionalFormattingDialog(
- vcl::Window* _pParent, const Reference< XReportControlModel >& _rxFormatConditions, ::rptui::OReportController& _rController )
- :ModalDialog( _pParent, "CondFormat", "modules/dbreport/ui/condformatdialog.ui" )
- ,m_rController( _rController )
- ,m_xFormatConditions( _rxFormatConditions )
- ,m_bDeletingCondition( false )
- ,m_bConstructed( false )
+ weld::Window* _pParent, const Reference< XReportControlModel >& _rxFormatConditions, ::rptui::OReportController& _rController)
+ : GenericDialogController(_pParent, "modules/dbreport/ui/condformatdialog.ui", "CondFormat")
+ , m_rController(_rController)
+ , m_xFormatConditions(_rxFormatConditions)
+ , m_bDeletingCondition(false)
+ , m_bConstructed(false)
+ , m_xScrollWindow(m_xBuilder->weld_scrolled_window("scrolledwindow"))
+ , m_xConditionPlayground(m_xBuilder->weld_box("condPlaygroundDrawingarea"))
{
- get(m_pConditionPlayground, "condPlaygroundDrawingarea");
- get(m_pScrollWindow, "scrolledwindow");
- m_pScrollWindow->setUserManagedScrolling(true);
- m_pCondScroll = &(m_pScrollWindow->getVertScrollBar());
-
OSL_ENSURE( m_xFormatConditions.is(), "ConditionalFormattingDialog::ConditionalFormattingDialog: ReportControlModel is NULL -> Prepare for GPF!" );
m_xCopy.set( m_xFormatConditions->createClone(), UNO_QUERY_THROW );
- m_pCondScroll->SetScrollHdl( LINK( this, ConditionalFormattingDialog, OnScroll ) );
+ m_xScrollWindow->connect_vadjustment_changed(LINK(this, ConditionalFormattingDialog, OnScroll));
impl_initializeConditions();
@@ -127,22 +106,6 @@ namespace rptui
ConditionalFormattingDialog::~ConditionalFormattingDialog()
{
- disposeOnce();
- }
-
- void ConditionalFormattingDialog::dispose()
- {
-
- for (auto& rxCondition : m_aConditions)
- {
- rxCondition.disposeAndClear();
- }
-
- m_aConditions.clear();
- m_pConditionPlayground.clear();
- m_pScrollWindow.clear();
- m_pCondScroll.clear();
- ModalDialog::dispose();
}
void ConditionalFormattingDialog::impl_updateConditionIndicies()
@@ -151,6 +114,7 @@ namespace rptui
for (const auto& rxCondition : m_aConditions)
{
rxCondition->setConditionIndex( nIndex, impl_getConditionCount() );
+ m_xConditionPlayground->reorder_child(rxCondition->get_widget(), nIndex);
++nIndex;
}
}
@@ -162,7 +126,6 @@ namespace rptui
impl_setPrefHeight(false);
- impl_updateScrollBarRange();
impl_updateConditionIndicies();
impl_layoutAll();
}
@@ -182,8 +145,6 @@ namespace rptui
void ConditionalFormattingDialog::impl_addCondition_nothrow( size_t _nNewCondIndex )
{
- UpdateLocker aLockUpdates( *this );
-
try
{
if ( _nNewCondIndex > static_cast<size_t>(m_xCopy->getCount()) )
@@ -192,10 +153,10 @@ namespace rptui
Reference< XFormatCondition > xCond = m_xCopy->createFormatCondition();
::comphelper::copyProperties(m_xCopy.get(),xCond.get());
m_xCopy->insertByIndex( _nNewCondIndex, makeAny( xCond ) );
- VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController );
- pCon->setCondition( xCond );
- pCon->reorderWithinParent(_nNewCondIndex);
- m_aConditions.insert( m_aConditions.begin() + _nNewCondIndex, pCon );
+ auto xCon = std::make_unique<Condition>(m_xConditionPlayground.get(), m_xDialog.get(), *this, m_rController);
+ xCon->setCondition(xCond);
+ m_xConditionPlayground->reorder_child(xCon->get_widget(), _nNewCondIndex);
+ m_aConditions.insert(m_aConditions.begin() + _nNewCondIndex, std::move(xCon));
}
catch( const Exception& )
{
@@ -207,21 +168,17 @@ namespace rptui
impl_ensureConditionVisible( _nNewCondIndex );
}
-
void ConditionalFormattingDialog::impl_focusCondition( size_t _nCondIndex )
{
OSL_PRECOND( _nCondIndex < impl_getConditionCount(),
"ConditionalFormattingDialog::impl_focusCondition: illegal index!" );
impl_ensureConditionVisible( _nCondIndex );
- m_aConditions[ _nCondIndex ]->GrabFocus();
+ m_aConditions[ _nCondIndex ]->grab_focus();
}
-
void ConditionalFormattingDialog::impl_deleteCondition_nothrow( size_t _nCondIndex )
{
- UpdateLocker aLockUpdates( *this );
-
OSL_PRECOND( _nCondIndex < impl_getConditionCount(),
"ConditionalFormattingDialog::impl_deleteCondition_nothrow: illegal index!" );
@@ -243,9 +200,13 @@ namespace rptui
}
else
{
- bSetNewFocus = (*pos)->HasChildPathFocus();
+ bSetNewFocus = (*pos)->has_focus();
m_bDeletingCondition = true;
- m_aConditions.erase( pos );
+
+ auto xMovedCondition = std::move(*pos);
+ m_aConditions.erase(pos);
+ m_xConditionPlayground->move(xMovedCondition->get_widget(), nullptr);
+
m_bDeletingCondition = false;
}
@@ -273,14 +234,14 @@ namespace rptui
// do this in two steps, so we don't become inconsistent if any of the UNO actions fails
Any aMovedCondition;
- Condition *pMovedCondition;
+ std::unique_ptr<Condition> xMovedCondition;
try
{
aMovedCondition = m_xCopy->getByIndex( static_cast<sal_Int32>(nOldConditionIndex) );
m_xCopy->removeByIndex( static_cast<sal_Int32>(nOldConditionIndex) );
Conditions::iterator aRemovePos( m_aConditions.begin() + nOldConditionIndex );
- pMovedCondition = aRemovePos->get();
+ xMovedCondition = std::move(*aRemovePos);
m_aConditions.erase( aRemovePos );
}
catch( const Exception& )
@@ -292,7 +253,7 @@ namespace rptui
try
{
m_xCopy->insertByIndex( static_cast<sal_Int32>(nNewConditionIndex), aMovedCondition );
- m_aConditions.insert( m_aConditions.begin() + nNewConditionIndex, pMovedCondition );
+ m_aConditions.insert(m_aConditions.begin() + nNewConditionIndex, std::move(xMovedCondition));
}
catch( const Exception& )
{
@@ -302,44 +263,27 @@ namespace rptui
// at least the two swapped conditions need to know their new index
impl_updateConditionIndicies();
- // re-layout all conditions
- impl_layoutConditions();
-
// ensure the moved condition is visible
impl_ensureConditionVisible( nNewConditionIndex );
}
- IMPL_LINK( ConditionalFormattingDialog, OnScroll, ScrollBar*, /*_pNotInterestedIn*/, void )
+ IMPL_LINK_NOARG(ConditionalFormattingDialog, OnScroll, weld::ScrolledWindow&, void)
{
size_t nFirstCondIndex( impl_getFirstVisibleConditionIndex() );
size_t nFocusCondIndex = impl_getFocusedConditionIndex( nFirstCondIndex );
- impl_layoutConditions();
-
if ( nFocusCondIndex < nFirstCondIndex )
impl_focusCondition( nFirstCondIndex );
else if ( nFocusCondIndex >= nFirstCondIndex + MAX_CONDITIONS )
impl_focusCondition( nFirstCondIndex + MAX_CONDITIONS - 1 );
}
- void ConditionalFormattingDialog::impl_layoutConditions()
- {
- if (m_aConditions.empty())
- return;
- long nConditionHeight = m_aConditions[0]->get_preferred_size().Height();
- Point aConditionPos(0, -1 * nConditionHeight * impl_getFirstVisibleConditionIndex());
- m_pConditionPlayground->SetPosPixel(aConditionPos);
- }
-
void ConditionalFormattingDialog::impl_layoutAll()
{
- // condition's positions
- impl_layoutConditions();
-
// scrollbar visibility
if ( m_aConditions.size() <= MAX_CONDITIONS )
// normalize the position, so it can, in all situations, be used as top index
- m_pCondScroll->SetThumbPos( 0 );
+ m_xScrollWindow->vadjustment_set_value(0);
}
void ConditionalFormattingDialog::impl_initializeConditions()
@@ -349,12 +293,12 @@ namespace rptui
sal_Int32 nCount = m_xCopy->getCount();
for ( sal_Int32 i = 0; i < nCount ; ++i )
{
- VclPtrInstance<Condition> pCon( m_pConditionPlayground, *this, m_rController );
+ auto xCon = std::make_unique<Condition>(m_xConditionPlayground.get(), m_xDialog.get(), *this, m_rController);
Reference< XFormatCondition > xCond( m_xCopy->getByIndex(i), UNO_QUERY );
- pCon->reorderWithinParent(i);
- pCon->setCondition( xCond );
- pCon->updateToolbar( xCond.get() );
- m_aConditions.push_back( pCon );
+ m_xConditionPlayground->reorder_child(xCon->get_widget(), i);
+ xCon->setCondition(xCond);
+ xCon->updateToolbar(xCond.get());
+ m_aConditions.push_back(std::move(xCon));
}
}
catch(Exception&)
@@ -378,7 +322,7 @@ namespace rptui
aArgs[0].Value <<= xReportControlFormat;
aArgs[1].Name = CURRENT_WINDOW;
- aArgs[1].Value <<= VCLUnoHelper::GetInterface(this);
+ aArgs[1].Value <<= m_xDialog->GetXWindow();
aArgs[2].Name = PROPERTY_FONTCOLOR;
aArgs[2].Value <<= rColor;
@@ -409,7 +353,6 @@ namespace rptui
impl_moveCondition_nothrow( _nCondIndex, false );
}
-
OUString ConditionalFormattingDialog::getDataField() const
{
OUString sDataField;
@@ -424,11 +367,10 @@ namespace rptui
return sDataField;
}
-
- short ConditionalFormattingDialog::Execute()
+ short ConditionalFormattingDialog::run()
{
- short nRet = ModalDialog::Execute();
- if ( nRet == RET_OK )
+ short nRet = GenericDialogController::run();
+ if (nRet == RET_OK)
{
const OUString sUndoAction( RptResId( RID_STR_UNDO_CONDITIONAL_FORMATTING ) );
const UndoContext aUndoContext( m_rController.getUndoManager(), sUndoAction );
@@ -474,105 +416,35 @@ namespace rptui
return nRet;
}
-
- bool ConditionalFormattingDialog::PreNotify( NotifyEvent& _rNEvt )
- {
- switch ( _rNEvt.GetType() )
- {
- case MouseNotifyEvent::KEYINPUT:
- {
- const KeyEvent* pKeyEvent( _rNEvt.GetKeyEvent() );
- const vcl::KeyCode& rKeyCode = pKeyEvent->GetKeyCode();
- if ( rKeyCode.IsMod1() && rKeyCode.IsMod2() )
- {
- if ( rKeyCode.GetCode() == 0x0508 )
- {
- impl_deleteCondition_nothrow( impl_getFocusedConditionIndex( 0 ) );
- return true;
- }
- if ( rKeyCode.GetCode() == 0x0507 ) // +
- {
- impl_addCondition_nothrow( impl_getFocusedConditionIndex( impl_getConditionCount() - 1 ) + 1 );
- return true;
- }
- }
- break;
- }
- case MouseNotifyEvent::GETFOCUS:
- {
- if (m_bDeletingCondition)
- break;
-
- if (!m_pConditionPlayground) //e.g. during dispose
- break;
-
- const vcl::Window* pGetFocusWindow( _rNEvt.GetWindow() );
-
- // determine whether the new focus window is part of an (currently invisible) condition
- const vcl::Window* pConditionCandidate = pGetFocusWindow->GetParent();
- const vcl::Window* pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : nullptr;
- while ( pPlaygroundCandidate
- && ( pPlaygroundCandidate != this )
- && ( pPlaygroundCandidate != m_pConditionPlayground )
- )
- {
- pConditionCandidate = pConditionCandidate->GetParent();
- pPlaygroundCandidate = pConditionCandidate ? pConditionCandidate->GetParent() : nullptr;
- }
- if (pConditionCandidate && pPlaygroundCandidate == m_pConditionPlayground)
- {
- impl_ensureConditionVisible( dynamic_cast< const Condition& >( *pConditionCandidate ).getConditionIndex() );
- }
- break;
- }
- default:
- break;
- }
-
- return ModalDialog::PreNotify( _rNEvt );
- }
-
-
size_t ConditionalFormattingDialog::impl_getFirstVisibleConditionIndex() const
{
- return static_cast<size_t>(m_pCondScroll->GetThumbPos());
+ auto nHeight = m_aConditions[0]->get_preferred_size().Height();
+ return m_xScrollWindow->vadjustment_get_value() / nHeight;
}
-
size_t ConditionalFormattingDialog::impl_getLastVisibleConditionIndex() const
{
return ::std::min( impl_getFirstVisibleConditionIndex() + MAX_CONDITIONS, impl_getConditionCount() ) - 1;
}
-
size_t ConditionalFormattingDialog::impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const
{
auto cond = std::find_if(m_aConditions.begin(), m_aConditions.end(),
- [](const VclPtr<Condition>& rxCondition) { return rxCondition->HasChildPathFocus(); });
+ [](const std::unique_ptr<Condition>& rxCondition) { return rxCondition->has_focus(); });
if (cond != m_aConditions.end())
return static_cast<size_t>(std::distance(m_aConditions.begin(), cond));
return _nFallBackIfNone;
}
-
- void ConditionalFormattingDialog::impl_updateScrollBarRange()
- {
- long nMax = ( impl_getConditionCount() > MAX_CONDITIONS ) ? impl_getConditionCount() - MAX_CONDITIONS + 1 : 0;
-
- m_pCondScroll->SetRangeMin( 0 );
- m_pCondScroll->SetRangeMax( nMax );
- m_pCondScroll->SetVisibleSize( 1 );
- }
-
-
- void ConditionalFormattingDialog::impl_scrollTo( size_t _nTopCondIndex )
+ void ConditionalFormattingDialog::impl_scrollTo( size_t nTopCondIndex )
{
- OSL_PRECOND( _nTopCondIndex + MAX_CONDITIONS <= impl_getConditionCount(),
+ OSL_PRECOND( nTopCondIndex + MAX_CONDITIONS <= impl_getConditionCount(),
"ConditionalFormattingDialog::impl_scrollTo: illegal index!" );
- m_pCondScroll->SetThumbPos( _nTopCondIndex );
- OnScroll( m_pCondScroll );
- }
+ auto nHeight = m_aConditions[0]->get_preferred_size().Height();
+ m_xScrollWindow->vadjustment_set_value(nTopCondIndex * nHeight);
+ OnScroll(*m_xScrollWindow);
+ }
void ConditionalFormattingDialog::impl_ensureConditionVisible( size_t _nCondIndex )
{
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 1504ea8f7d8a..9e79c3d8830b 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -55,236 +55,175 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-ConditionField::ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *pFormula)
+ConditionField::ConditionField(Condition* pParent, std::unique_ptr<weld::Entry> xSubEdit,
+ std::unique_ptr<weld::Button> xFormula)
: m_pParent(pParent)
- , m_pSubEdit(pSubEdit)
- , m_pFormula(pFormula)
+ , m_xSubEdit(std::move(xSubEdit))
+ , m_xFormula(std::move(xFormula))
{
- m_pSubEdit->EnableRTL( false );
-
- m_pFormula->SetText("...");
- m_pFormula->SetClickHdl( LINK( this, ConditionField, OnFormula ) );
+ m_xFormula->set_label("...");
+ m_xFormula->connect_clicked( LINK( this, ConditionField, OnFormula ) );
}
-IMPL_LINK( ConditionField, OnFormula, Button*, _pClickedButton, void )
+IMPL_LINK_NOARG(ConditionField, OnFormula, weld::Button&, void)
{
- OUString sFormula(m_pSubEdit->GetText());
+ OUString sFormula(m_xSubEdit->get_text());
const sal_Int32 nLen = sFormula.getLength();
if ( nLen )
{
ReportFormula aFormula( sFormula );
sFormula = aFormula.getCompleteFormula();
}
- uno::Reference< awt::XWindow> xInspectorWindow = VCLUnoHelper::GetInterface(_pClickedButton);
+ uno::Reference< awt::XWindow> xInspectorWindow = m_pParent->GetXWindow();
uno::Reference< beans::XPropertySet> xProp(m_pParent->getController().getRowSet(),uno::UNO_QUERY);
if ( rptui::openDialogFormula_nothrow( sFormula, m_pParent->getController().getContext(),xInspectorWindow,xProp ) )
{
ReportFormula aFormula( sFormula );
- m_pSubEdit->SetText(aFormula.getUndecoratedContent());
+ m_xSubEdit->set_text(aFormula.getUndecoratedContent());
}
}
-ConditionColorWrapper::ConditionColorWrapper(Condition* pControl)
- : mxControl(pControl)
- , mnSlotId(0)
-{
-}
-
-void ConditionColorWrapper::dispose()
+ConditionColorWrapper::ConditionColorWrapper(Condition* pControl, sal_uInt16 nSlotId)
+ : mpControl(pControl)
+ , mnSlotId(nSlotId)
{
- mxControl.clear();
}
void ConditionColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rNamedColor)
{
- mxControl->ApplyCommand(mnSlotId, rNamedColor);
+ mpControl->ApplyCommand(mnSlotId, rNamedColor);
}
// = Condition
-
-
-Condition::Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController )
- : VclHBox(_pParent)
- , m_xPaletteManager(new PaletteManager)
- , m_aColorWrapper(this)
+Condition::Condition(weld::Container* pParent, weld::Window* pDialog, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController)
+ : m_xPaletteManager(new PaletteManager)
+ , m_aBackColorWrapper(this, SID_BACKGROUND_COLOR)
+ , m_aForeColorWrapper(this, SID_ATTR_CHAR_COLOR2)
, m_rController(_rController)
, m_rAction(_rAction)
, m_nCondIndex(0)
- , m_bInDestruction(false)
+ , m_pDialog(pDialog)
+ , m_xBuilder(Application::CreateBuilder(pParent, "modules/dbreport/ui/conditionwin.ui"))
+ , m_xContainer(m_xBuilder->weld_container("ConditionWin"))
+ , m_xHeader(m_xBuilder->weld_label("headerLabel"))
+ , m_xConditionType(m_xBuilder->weld_combo_box("typeCombobox"))
+ , m_xOperationList(m_xBuilder->weld_combo_box("opCombobox"))
+ , m_xOperandGlue(m_xBuilder->weld_label("andLabel"))
+ , m_xActions(m_xBuilder->weld_toolbar("formatToolbox"))
+ , m_xPreview(new weld::CustomWeld(*m_xBuilder, "previewDrawingarea", m_aPreview))
+ , m_xMoveUp(m_xBuilder->weld_button("upButton"))
+ , m_xMoveDown(m_xBuilder->weld_button("downButton"))
+ , m_xAddCondition(m_xBuilder->weld_button("addButton"))
+ , m_xRemoveCondition(m_xBuilder->weld_button("removeButton"))
{
- m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), "modules/dbreport/ui/conditionwin.ui"));
-
- get(m_pHeader, "headerLabel");
- get(m_pConditionType, "typeCombobox");
- get(m_pOperationList, "opCombobox");
- m_pCondLHS.reset( new ConditionField(this, get<Edit>("lhsEntry"), get<PushButton>("lhsButton")) );
- get(m_pOperandGlue, "andLabel");
- m_pCondRHS.reset( new ConditionField(this, get<Edit>("rhsEntry"), get<PushButton>("rhsButton")) );
- get(m_pActions, "formatToolbox");
- get(m_pPreview, "previewDrawingarea");
- get(m_pMoveUp, "upButton");
- get(m_pMoveDown, "downButton");
- get(m_pAddCondition, "addButton");
- get(m_pRemoveCondition, "removeButton");
-
- m_pActions->SetLineSpacing(true);
- m_pCondLHS->GrabFocus();
-
- m_pConditionType->SetSelectHdl( LINK( this, Condition, OnTypeSelected ) );
-
- m_pOperationList->SetDropDownLineCount( 10 );
- m_pOperationList->SetSelectHdl( LINK( this, Condition, OnOperationSelected ) );
-
- m_pActions->SetSelectHdl(LINK(this, Condition, OnFormatAction));
- m_pActions->SetDropdownClickHdl( LINK( this, Condition, DropdownClick ) );
- setToolBox(m_pActions);
-
- m_pMoveUp->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
- m_pMoveDown->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
- m_pAddCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
- m_pRemoveCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
-
- vcl::Font aFont( m_pAddCondition->GetFont() );
- aFont.SetWeight( WEIGHT_BOLD );
- m_pAddCondition->SetFont( aFont );
- m_pRemoveCondition->SetFont( aFont );
-
- m_pOperandGlue->SetStyle( m_pOperandGlue->GetStyle() | WB_VCENTER );
-
- m_pConditionType->SelectEntryPos( 0 );
- m_pOperationList->SelectEntryPos( 0 );
-
- m_nBoldId = m_pActions->GetItemId(".uno:Bold");
- m_nItalicId = m_pActions->GetItemId(".uno:Italic");
- m_nUnderLineId = m_pActions->GetItemId(".uno:Underline");
- m_nBackgroundColorId = m_pActions->GetItemId(".uno:BackgroundColor");
- m_nFontColorId = m_pActions->GetItemId(".uno:FontColor");
- m_nFontDialogId = m_pActions->GetItemId(".uno:FontDialog");
-
- m_pBtnUpdaterBackgroundColor.reset( new svx::ToolboxButtonColorUpdater(
- SID_BACKGROUND_COLOR, m_nBackgroundColorId, m_pActions, false,
- m_pActions->GetItemText( m_nBackgroundColorId ) ) );
- m_pBtnUpdaterFontColor.reset( new svx::ToolboxButtonColorUpdater(
- SID_ATTR_CHAR_COLOR2, m_nFontColorId, m_pActions, false,
- m_pActions->GetItemText( m_nFontColorId ) ) );
-
- Show();
+ m_xCondLHS.reset(new ConditionField(this, m_xBuilder->weld_entry("lhsEntry"), m_xBuilder->weld_button("lhsButton")));
+ m_xCondRHS.reset(new ConditionField(this, m_xBuilder->weld_entry("rhsEntry"), m_xBuilder->weld_button("rhsButton")));
+
+ m_xCondLHS->grab_focus();
+
+ m_xConditionType->connect_changed( LINK( this, Condition, OnTypeSelected ) );
+
+ m_xOperationList->connect_changed( LINK( this, Condition, OnOperationSelected ) );
+
+ m_xActions->connect_clicked(LINK(this, Condition, OnFormatAction));
+
+ m_xMoveUp->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+ m_xMoveDown->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+ m_xAddCondition->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+ m_xRemoveCondition->connect_clicked( LINK( this, Condition, OnConditionAction ) );
+
+ m_xConditionType->set_active(0);
+ m_xOperationList->set_active(0);
+
+ SetBackgroundDropdownClick();
+ SetForegroundDropdownClick();
+
+ m_xContainer->show();
ConditionalExpressionFactory::getKnownConditionalExpressions( m_aConditionalExpressions );
}
-sal_uInt16 Condition::mapToolbarItemToSlotId(sal_uInt16 nItemId) const
+sal_uInt16 Condition::mapToolbarItemToSlotId(const OString& rItemId)
{
- if (nItemId == m_nBoldId)
+ if (rItemId == "bold")
return SID_ATTR_CHAR_WEIGHT;
- if (nItemId == m_nItalicId)
+ if (rItemId == "italic")
return SID_ATTR_CHAR_POSTURE;
- if (nItemId == m_nUnderLineId)
+ if (rItemId == "underline")
return SID_ATTR_CHAR_UNDERLINE;
- if (nItemId == m_nBackgroundColorId)
+ if (rItemId == "background")
return SID_BACKGROUND_COLOR;
- if (nItemId == m_nFontColorId)
+ if (rItemId == "foreground")
return SID_ATTR_CHAR_COLOR2;
- if (nItemId == m_nFontDialogId)
+ if (rItemId == "fontdialog")
return SID_CHAR_DLG;
return 0;
}
Condition::~Condition()
{
- disposeOnce();
}
-void Condition::dispose()
+void Condition::SetBackgroundDropdownClick()
{
- m_bInDestruction = true;
-
- m_pBtnUpdaterFontColor.reset();
- m_pCondLHS.reset();
- m_pCondRHS.reset();
- m_pBtnUpdaterBackgroundColor.reset();
- m_pHeader.clear();
- m_pConditionType.clear();
- m_pOperationList.clear();
- m_pOperandGlue.clear();
- m_pActions.clear();
- m_pPreview.clear();
- m_pMoveUp.clear();
- m_pMoveDown.clear();
- m_pAddCondition.clear();
- m_pRemoveCondition.clear();
- m_pColorFloat.disposeAndClear();
- m_aColorWrapper.dispose();
- disposeBuilder();
- VclHBox::dispose();
+ m_xBackColorFloat.reset(new ColorWindow(
+ m_xPaletteManager,
+ m_aColorStatus,
+ SID_BACKGROUND_COLOR,
+ nullptr,
+ m_pDialog,
+ MenuOrToolMenuButton(m_xActions.get(), "background"),
+ /*bInterimBuilder*/false,
+ m_aBackColorWrapper));
+
+ m_xActions->set_item_popover("background", m_xBackColorFloat->GetWidget());
}
-IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void)
+void Condition::SetForegroundDropdownClick()
{
- sal_uInt16 nId( m_pActions->GetCurItemId() );
- m_pColorFloat.disposeAndClear();
- sal_uInt16 nSlotId(mapToolbarItemToSlotId(nId));
- m_aColorWrapper.SetSlotId(nSlotId);
- m_pColorFloat = VclPtr<SvxColorWindow>::Create(
- OUString() /*m_aCommandURL*/,
- m_xPaletteManager,
- m_aColorStatus,
- nSlotId,
- nullptr,
- pToolBox,
- false,
- m_aColorWrapper);
-
- m_pColorFloat->EnableDocking();
- vcl::Window::GetDockingManager()->StartPopupMode(pToolBox, m_pColorFloat, FloatWinPopupFlags::GrabFocus);
+ m_xForeColorFloat.reset(new ColorWindow(
+ m_xPaletteManager,
+ m_aColorStatus,
+ SID_ATTR_CHAR_COLOR2,
+ nullptr,
+ m_pDialog,
+ MenuOrToolMenuButton(m_xActions.get(), "foreground"),
+ /*bInterimBuilder*/false,
+ m_aForeColorWrapper));
+
+ m_xActions->set_item_popover("foreground", m_xForeColorFloat->GetWidget());
}
-IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void )
+
+IMPL_LINK(Condition, OnFormatAction, const OString&, rIdent, void)
{
- ApplyCommand(mapToolbarItemToSlotId(m_pActions->GetCurItemId()),
+ ApplyCommand(mapToolbarItemToSlotId(rIdent),
NamedColor(COL_AUTO, "#" + COL_AUTO.AsRGBHexString()));
}
-IMPL_LINK( Condition, OnConditionAction, Button*, _pClickedButton, void )
+IMPL_LINK(Condition, OnConditionAction, weld::Button&, rClickedButton, void)
{
- if ( _pClickedButton == m_pMoveUp )
+ if ( &rClickedButton == m_xMoveUp.get() )
m_rAction.moveConditionUp( getConditionIndex() );
- else if ( _pClickedButton == m_pMoveDown )
+ else if ( &rClickedButton == m_xMoveDown.get() )
m_rAction.moveConditionDown( getConditionIndex() );
- else if ( _pClickedButton == m_pAddCondition )
+ else if ( &rClickedButton == m_xAddCondition.get() )
m_rAction.addCondition( getConditionIndex() );
- else if ( _pClickedButton == m_pRemoveCondition )
+ else if ( &rClickedButton == m_xRemoveCondition.get() )
m_rAction.deleteCondition( getConditionIndex() );
}
void Condition::ApplyCommand( sal_uInt16 _nCommandId, const NamedColor& rNamedColor )
{
- if ( _nCommandId == SID_ATTR_CHAR_COLOR2 )
- m_pBtnUpdaterFontColor->Update( rNamedColor );
- else if ( _nCommandId == SID_BACKGROUND_COLOR )
- m_pBtnUpdaterBackgroundColor->Update( rNamedColor );
-
m_rAction.applyCommand( m_nCondIndex, _nCommandId, rNamedColor.first );
}
-void Condition::resizeControls(const Size& /*_rDiff*/)
-{
-}
-
-void Condition::GetFocus()
-{
- VclHBox::GetFocus();
- if ( !m_bInDestruction )
- m_pCondLHS->GrabFocus();
-}
-
-IMPL_LINK_NOARG( Condition, OnTypeSelected, ListBox&, void )
+IMPL_LINK_NOARG( Condition, OnTypeSelected, weld::ComboBox&, void )
{
impl_layoutOperands();
}
-
-IMPL_LINK_NOARG( Condition, OnOperationSelected, ListBox&, void )
+IMPL_LINK_NOARG( Condition, OnOperationSelected, weld::ComboBox&, void )
{
impl_layoutOperands();
}
@@ -303,9 +242,9 @@ void Condition::impl_layoutOperands()
);
// the "condition type" list box
- m_pOperationList->Show( !bIsExpression );
- m_pOperandGlue->Show( bHaveRHS );
- m_pCondRHS->Show( bHaveRHS );
+ m_xOperationList->set_visible( !bIsExpression );
+ m_xOperandGlue->set_visible( bHaveRHS );
+ m_xCondRHS->set_visible( bHaveRHS );
}
void Condition::impl_setCondition( const OUString& _rConditionFormula )
@@ -347,10 +286,10 @@ void Condition::impl_setCondition( const OUString& _rConditionFormula )
}
// update UI
- m_pConditionType->SelectEntryPos( static_cast<sal_uInt16>(eType) );
- m_pOperationList->SelectEntryPos( static_cast<sal_uInt16>(eOperation) );
- m_pCondLHS->SetText( sLHS );
- m_pCondRHS->SetText( sRHS );
+ m_xConditionType->set_active(static_cast<sal_uInt16>(eType));
+ m_xOperationList->set_active(static_cast<sal_uInt16>(eOperation));
+ m_xCondLHS->set_text( sLHS );
+ m_xCondRHS->set_text( sRHS );
// re-layout
impl_layoutOperands();
@@ -380,15 +319,15 @@ void Condition::setCondition( const uno::Reference< report::XFormatCondition >&
void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat >& _xReportControlFormat)
{
+ OString aItems[] = { "bold", "italic", "underline", "fontdialog" };
+
OSL_ENSURE(_xReportControlFormat.is(),"XReportControlFormat is NULL!");
if ( _xReportControlFormat.is() )
{
- ToolBox::ImplToolItems::size_type nItemCount = m_pActions->GetItemCount();
- for (ToolBox::ImplToolItems::size_type j = 0; j< nItemCount; ++j)
+ for (size_t j = 0; j < SAL_N_ELEMENTS(aItems); ++j)
{
- sal_uInt16 nItemId = m_pActions->GetItemId(j);
- m_pActions->CheckItem( nItemId, OReportController::isFormatCommandEnabled(mapToolbarItemToSlotId(nItemId),
- _xReportControlFormat ) );
+ m_xActions->set_item_active(aItems[j], OReportController::isFormatCommandEnabled(mapToolbarItemToSlotId(aItems[j]),
+ _xReportControlFormat));
}
try
@@ -399,9 +338,9 @@ void Condition::updateToolbar(const uno::Reference< report::XReportControlFormat
aFont.SetEmphasisMark( static_cast< FontEmphasisMark >( _xReportControlFormat->getControlTextEmphasis() ) );
aFont.SetRelief( static_cast< FontRelief >( _xReportControlFormat->getCharRelief() ) );
aFont.SetColor( Color(_xReportControlFormat->getCharColor()) );
- m_pPreview->SetFont( aFont, aFont, aFont );
- m_pPreview->SetBackColor( Color(_xReportControlFormat->getControlBackground()) );
- m_pPreview->SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) );
+ m_aPreview.SetFont( aFont, aFont, aFont );
+ m_aPreview.SetBackColor( Color(_xReportControlFormat->getControlBackground()) );
+ m_aPreview.SetTextLineColor( Color( _xReportControlFormat->getCharUnderlineColor() ) );
}
catch( const Exception& )
{
@@ -415,8 +354,8 @@ void Condition::fillFormatCondition(const uno::Reference< report::XFormatConditi
const ConditionType eType( impl_getCurrentConditionType() );
const ComparisonOperation eOperation( impl_getCurrentComparisonOperation() );
- const OUString sLHS( m_pCondLHS->GetText() );
- const OUString sRHS( m_pCondRHS->GetText() );
+ const OUString sLHS( m_xCondLHS->get_text() );
+ const OUString sRHS( m_xCondRHS->get_text() );
OUString sUndecoratedFormula( sLHS );
@@ -438,20 +377,18 @@ void Condition::setConditionIndex( size_t _nCondIndex, size_t _nCondCount )
m_nCondIndex = _nCondIndex;
OUString sHeader( RptResId( STR_NUMBERED_CONDITION ) );
sHeader = sHeader.replaceFirst( "$number$", OUString::number( _nCondIndex + 1) );
- m_pHeader->SetText( sHeader );
+ m_xHeader->set_label( sHeader );
- m_pMoveUp->Enable( _nCondIndex > 0 );
+ m_xMoveUp->set_sensitive(_nCondIndex > 0);
OSL_PRECOND( _nCondCount > 0, "Condition::setConditionIndex: having no conditions at all is nonsense!" );
- m_pMoveDown->Enable( _nCondIndex < _nCondCount - 1 );
+ m_xMoveDown->set_sensitive(_nCondIndex < _nCondCount - 1);
}
-
bool Condition::isEmpty() const
{
- return m_pCondLHS->GetText().isEmpty();
+ return m_xCondLHS->get_text().isEmpty();
}
-
} // rptui
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
index d8a03ac82f57..1b9a5ea365fa 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -24,8 +24,6 @@
#include <com/sun/star/report/XFormatCondition.hpp>
-#include <dbaccess/ToolBoxHelper.hxx>
-
#include <svx/colorwindow.hxx>
#include <svx/fntctrl.hxx>
@@ -35,7 +33,8 @@
#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/builder.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
#include <memory>
@@ -50,84 +49,74 @@ namespace rptui
class ConditionField
{
- VclPtr<Condition> m_pParent;
- VclPtr<Edit> m_pSubEdit;
- VclPtr<PushButton> m_pFormula;
+ Condition* m_pParent;
+ std::unique_ptr<weld::Entry> m_xSubEdit;
+ std::unique_ptr<weld::Button> m_xFormula;
- DECL_LINK( OnFormula, Button*, void );
+ DECL_LINK(OnFormula, weld::Button&, void);
public:
- ConditionField(Condition* pParent, Edit* pSubEdit, PushButton *pFormula);
- void GrabFocus() { m_pSubEdit->GrabFocus(); }
- void Show(bool bShow) { m_pSubEdit->Show(bShow); m_pFormula->Show(bShow); }
- void SetText(const OUString& rText) { m_pSubEdit->SetText(rText); }
- OUString GetText() const { return m_pSubEdit->GetText(); }
+ ConditionField(Condition* pParent, std::unique_ptr<weld::Entry> xSubEdit, std::unique_ptr<weld::Button> xFormula);
+ void grab_focus() { m_xSubEdit->grab_focus(); }
+ void set_visible(bool bShow) { m_xSubEdit->set_visible(bShow); m_xFormula->set_visible(bShow); }
+ void set_text(const OUString& rText) { m_xSubEdit->set_text(rText); }
+ OUString get_text() const { return m_xSubEdit->get_text(); }
};
class ConditionColorWrapper
{
public:
- ConditionColorWrapper(Condition* pControl);
- void SetSlotId(sal_uInt16 nSlotId) { mnSlotId = nSlotId; }
+ ConditionColorWrapper(Condition* pControl, sal_uInt16 nSlotId);
void operator()(const OUString& rCommand, const NamedColor& rColor);
void dispose();
private:
- VclPtr<Condition> mxControl;
+ Condition* mpControl;
sal_uInt16 mnSlotId;
};
//= Condition
- class Condition :public VclHBox
- ,public dbaui::OToolBoxHelper
- ,public VclBuilderContainer
+ class Condition
{
- sal_uInt16 m_nBoldId;
- sal_uInt16 m_nItalicId;
- sal_uInt16 m_nUnderLineId;
- sal_uInt16 m_nBackgroundColorId;
- sal_uInt16 m_nFontColorId;
- sal_uInt16 m_nFontDialogId;
std::shared_ptr<PaletteManager> m_xPaletteManager;
ColorStatus m_aColorStatus;
- ConditionColorWrapper m_aColorWrapper;
+ ConditionColorWrapper m_aBackColorWrapper;
+ ConditionColorWrapper m_aForeColorWrapper;
::rptui::OReportController& m_rController;
IConditionalFormatAction& m_rAction;
- VclPtr<FixedText> m_pHeader;
- VclPtr<ListBox> m_pConditionType;
- VclPtr<ListBox> m_pOperationList;
- std::unique_ptr<ConditionField> m_pCondLHS;
- VclPtr<FixedText> m_pOperandGlue;
- std::unique_ptr<ConditionField> m_pCondRHS;
- VclPtr<ToolBox> m_pActions;
- VclPtr<SvxFontPrevWindow> m_pPreview;
- VclPtr<PushButton> m_pMoveUp;
- VclPtr<PushButton> m_pMoveDown;
- VclPtr<PushButton> m_pAddCondition;
- VclPtr<PushButton> m_pRemoveCondition;
- VclPtr<SvxColorWindow> m_pColorFloat;
-
- std::unique_ptr<svx::ToolboxButtonColorUpdater> m_pBtnUpdaterFontColor; // updates the color below the toolbar icon
- std::unique_ptr<svx::ToolboxButtonColorUpdater> m_pBtnUpdaterBackgroundColor;
-
size_t m_nCondIndex;
- bool m_bInDestruction;
ConditionalExpressions m_aConditionalExpressions;
- DECL_LINK( OnFormatAction, ToolBox*, void );
- DECL_LINK( DropdownClick, ToolBox*, void );
- DECL_LINK( OnConditionAction, Button*, void );
+ FontPrevWindow m_aPreview;
+ weld::Window* m_pDialog;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::Label> m_xHeader;
+ std::unique_ptr<weld::ComboBox> m_xConditionType;
+ std::unique_ptr<weld::ComboBox> m_xOperationList;
+ std::unique_ptr<ConditionField> m_xCondLHS;
+ std::unique_ptr<weld::Label> m_xOperandGlue;
+ std::unique_ptr<ConditionField> m_xCondRHS;
+ std::unique_ptr<weld::Toolbar> m_xActions;
+ std::unique_ptr<weld::CustomWeld> m_xPreview;
+ std::unique_ptr<weld::Button> m_xMoveUp;
+ std::unique_ptr<weld::Button> m_xMoveDown;
+ std::unique_ptr<weld::Button> m_xAddCondition;
+ std::unique_ptr<weld::Button> m_xRemoveCondition;
+ std::unique_ptr<ColorWindow> m_xBackColorFloat;
+ std::unique_ptr<ColorWindow> m_xForeColorFloat;
+
+ void SetBackgroundDropdownClick();
+ void SetForegroundDropdownClick();
+
+ DECL_LINK( OnFormatAction, const OString&, void );
+ DECL_LINK( OnConditionAction, weld::Button&, void );
public:
- Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController );
- virtual ~Condition() override;
- virtual void dispose() override;
-
- /** will be called when the controls need to be resized.
- */
- virtual void resizeControls(const Size& _rDiff) override;
+ Condition(weld::Container* pParent, weld::Window* pDialog, IConditionalFormatAction& rAction, ::rptui::OReportController& rController);
+ ~Condition();
/** sets the props at the control
@param _xCondition the source
@@ -160,10 +149,14 @@ namespace rptui
::rptui::OReportController& getController() const { return m_rController; }
- sal_uInt16 mapToolbarItemToSlotId(sal_uInt16 nItemId) const;
+ static sal_uInt16 mapToolbarItemToSlotId(const OString& rItemId);
- protected:
- virtual void GetFocus() override;
+ css::uno::Reference<css::awt::XWindow> GetXWindow() const { return m_pDialog->GetXWindow(); }
+
+ void grab_focus() { m_xContainer->grab_focus(); }
+ bool has_focus() const { return m_xContainer->has_focus(); }
+ Size get_preferred_size() const { return m_xContainer->get_preferred_size(); }
+ weld::Widget* get_widget() const { return m_xContainer.get(); }
private:
void impl_layoutOperands();
@@ -177,23 +170,20 @@ namespace rptui
void impl_setCondition( const OUString& _rConditionFormula );
private:
- DECL_LINK( OnTypeSelected, ListBox&, void );
- DECL_LINK( OnOperationSelected, ListBox&, void );
+ DECL_LINK( OnTypeSelected, weld::ComboBox&, void );
+ DECL_LINK( OnOperationSelected, weld::ComboBox&, void );
};
-
inline ConditionType Condition::impl_getCurrentConditionType() const
{
- return sal::static_int_cast< ConditionType >( m_pConditionType->GetSelectedEntryPos() );
+ return sal::static_int_cast<ConditionType>(m_xConditionType->get_active());
}
-
inline ComparisonOperation Condition::impl_getCurrentComparisonOperation() const
{
- return sal::static_int_cast< ComparisonOperation >( m_pOperationList->GetSelectedEntryPos() );
+ return sal::static_int_cast<ComparisonOperation>(m_xOperationList->get_active());
}
-
} // namespace rptui
#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_DLG_CONDITION_HXX
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx
index b122bb3012d7..2c16546e1004 100644
--- a/reportdesign/source/ui/inc/AddField.hxx
+++ b/reportdesign/source/ui/inc/AddField.hxx
@@ -32,7 +32,6 @@
#include <svx/dataaccessdescriptor.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <dbaccess/ToolBoxHelper.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/fixed.hxx>
@@ -48,7 +47,6 @@ class OAddFieldWindow :public FloatingWindow
, public ::cppu::BaseMutex
, public ::comphelper::OPropertyChangeListener
, public ::comphelper::OContainerListener
- , public dbaui::OToolBoxHelper
{
css::uno::Reference< css::lang::XComponent> m_xHoldAlive;
css::uno::Reference< css::container::XNameAccess> m_xColumns;
@@ -95,10 +93,6 @@ public:
css::uno::Sequence< css::beans::PropertyValue > getSelectedFieldDescriptors();
- /** will be called when the controls need to be resized.
- */
- virtual void resizeControls(const Size& _rDiff) override;
-
/// Updates the current field list
void Update();
diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx
index eecf554f8c46..a3260c134ecb 100644
--- a/reportdesign/source/ui/inc/CondFormat.hxx
+++ b/reportdesign/source/ui/inc/CondFormat.hxx
@@ -21,16 +21,9 @@
#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX
#include <com/sun/star/report/XReportControlModel.hpp>
-
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/layout.hxx>
-#include <vcl/scrbar.hxx>
-
+#include <vcl/weld.hxx>
#include <vector>
-
namespace rptui
{
@@ -62,15 +55,10 @@ namespace rptui
|* Conditional formatting dialog
|*
\************************************************************************/
- class ConditionalFormattingDialog :public ModalDialog
- ,public IConditionalFormatAction
+ class ConditionalFormattingDialog : public weld::GenericDialogController
+ , public IConditionalFormatAction
{
- typedef ::std::vector< VclPtr<Condition> > Conditions;
-
- VclPtr<vcl::Window> m_pConditionPlayground;
- Conditions m_aConditions;
- VclPtr<VclScrolledWindow> m_pScrollWindow;
- VclPtr<ScrollBar> m_pCondScroll;
+ typedef ::std::vector< std::unique_ptr<Condition> > Conditions;
::rptui::OReportController& m_rController;
css::uno::Reference< css::report::XReportControlModel >
@@ -81,16 +69,19 @@ namespace rptui
bool m_bDeletingCondition;
bool m_bConstructed;
+ std::unique_ptr<weld::ScrolledWindow> m_xScrollWindow;
+ std::unique_ptr<weld::Box> m_xConditionPlayground;
+ Conditions m_aConditions;
+
public:
ConditionalFormattingDialog(
- vcl::Window* pParent,
+ weld::Window* pParent,
const css::uno::Reference< css::report::XReportControlModel>& _xHoldAlive,
::rptui::OReportController& _rController
);
virtual ~ConditionalFormattingDialog() override;
- virtual void dispose() override;
// Dialog overridables
- virtual short Execute() override;
+ virtual short run() override;
// IConditionalFormatAction overridables
virtual void addCondition( size_t _nAddAfterIndex ) override;
@@ -100,11 +91,8 @@ namespace rptui
virtual void moveConditionDown( size_t _nCondIndex ) override;
virtual OUString getDataField() const override;
- protected:
- virtual bool PreNotify( NotifyEvent& rNEvt ) override;
-
private:
- DECL_LINK( OnScroll, ScrollBar*, void );
+ DECL_LINK(OnScroll, weld::ScrolledWindow&, void);
private:
/// returns the current number of conditions
@@ -125,9 +113,6 @@ namespace rptui
/// does the dialog layouting
void impl_layoutAll();
- /// does the layout for the condition windows
- void impl_layoutConditions();
-
/// called when the number of conditions has changed in any way
void impl_conditionCountChanged();
@@ -149,9 +134,6 @@ namespace rptui
/// focuses the condition with the given index, making it visible if necessary
void impl_focusCondition( size_t _nCondIndex );
- /// updates the scrollbar range. (does not update the scrollbar visibility)
- void impl_updateScrollBarRange();
-
/// scrolls the condition with the given index to the top position
void impl_scrollTo( size_t _nTopCondIndex );
diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx
index 453963c8687d..2c4be48ab602 100644
--- a/reportdesign/source/ui/inc/GroupsSorting.hxx
+++ b/reportdesign/source/ui/inc/GroupsSorting.hxx
@@ -38,8 +38,6 @@
#include <vector>
-#include <dbaccess/ToolBoxHelper.hxx>
-
namespace comphelper
{
class OPropertyChangeMultiplexer;
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 51d7b5e7cf69..21d6e3c8af7a 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -637,8 +637,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
{ SID_ATTR_CHAR_CTL_POSTURE, true },
{ SID_ATTR_CHAR_CTL_WEIGHT, true }
};
- VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( _rxParentWindow );
- ::std::unique_ptr<FontList> pFontList(new FontList( pParent ));
+ ::std::unique_ptr<FontList> pFontList(new FontList(Application::GetDefaultDevice()));
XColorListRef pColorList( XColorList::CreateStdColorList() );
std::vector<SfxPoolItem*> pDefaults
{
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index cf89c567fbd2..92481ac15918 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -1548,8 +1548,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY);
if ( xFormattedField.is() )
{
- ScopedVclPtrInstance< ConditionalFormattingDialog > aDlg( getView(), xFormattedField.get(), *this );
- aDlg->Execute();
+ ConditionalFormattingDialog aDlg(getFrameWeld(), xFormattedField.get(), *this);
+ aDlg.run();
}
}
break;
diff --git a/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui
index 9ecfac38f421..0e19789d966a 100644
--- a/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui
+++ b/reportdesign/uiconfig/dbreport/ui/condformatdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="rpt">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="CondFormat">
@@ -8,7 +8,13 @@
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="condformatdialog|CondFormat">Conditional Formatting</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -87,10 +93,12 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkBox" id="condPlaygroundDrawingarea">
<property name="visible">True</property>
diff --git a/reportdesign/uiconfig/dbreport/ui/conditionwin.ui b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
index fa615089c50b..18ef29bae9af 100644
--- a/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
+++ b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="rpt">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -17,7 +16,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
@@ -38,7 +36,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
@@ -46,7 +43,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkComboBoxText" id="typeCombobox">
@@ -89,17 +85,18 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
+ <property name="hexpand">True</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkEntry" id="lhsEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -112,8 +109,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -127,6 +122,7 @@
<object class="GtkLabel" id="andLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="valign">center</property>
<property name="label" translatable="yes" context="conditionwin|andLabel">and</property>
</object>
<packing>
@@ -140,17 +136,18 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
+ <property name="hexpand">True</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkEntry" id="rhsEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -163,8 +160,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -178,8 +173,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -193,8 +186,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -202,7 +193,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkToolbar" id="formatToolbox">
@@ -213,45 +203,42 @@
<property name="toolbar_style">icons</property>
<property name="show_arrow">False</property>
<child>
- <object class="GtkToolButton" id="ToolBoxItem1">
+ <object class="GtkToggleToolButton" id="bold">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:Bold</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem1">Bold</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_bold.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolBoxItem2">
+ <object class="GtkToggleToolButton" id="italic">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:Italic</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem2">Italic</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_italic.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolBoxItem3">
+ <object class="GtkToggleToolButton" id="underline">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:Underline</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem3">Underline</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_underline.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
@@ -265,45 +252,42 @@
</packing>
</child>
<child>
- <object class="GtkMenuToolButton" id="ToolBoxItem4">
+ <object class="GtkMenuToolButton" id="background">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:BackgroundColor</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem4">Background Color</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_backgroundcolor.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkMenuToolButton" id="ToolBoxItem5">
+ <object class="GtkMenuToolButton" id="foreground">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:FontColor</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem5">Font Color</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_fontcolor.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="ToolBoxItem6">
+ <object class="GtkToggleToolButton" id="fontdialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:FontDialog</property>
<property name="label" translatable="yes" context="conditionwin|ToolBoxItem6">Character Formatting</property>
<property name="use_underline">True</property>
<property name="icon_name">cmd/sc_fontdialog.png</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
</object>
@@ -314,10 +298,26 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxFontPrevWindow" id="previewDrawingarea">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="previewDrawingarea">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -329,8 +329,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -345,8 +343,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -373,8 +369,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -389,8 +383,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 192fb0be7801..e854f84fdf74 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -505,7 +505,6 @@ custom_widgets = [
'SvxColorValueSet',
'SvxFillAttrBox',
'SvxFillTypeBox',
- 'SvxFontPrevWindow',
'SvxLanguageBox',
'SvxLanguageComboBox',
'SvxLightCtl3D',
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 51b746694a7d..6dc4292b57ec 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1704,15 +1704,15 @@ ColorWindow::ColorWindow(std::shared_ptr<PaletteManager> const & rPaletteManager
sal_uInt16 nSlotId,
const Reference< XFrame >& rFrame,
weld::Window* pParentWindow,
- weld::MenuButton* pMenuButton,
+ const MenuOrToolMenuButton& rMenuButton,
bool bInterimBuilder,
ColorSelectFunction const & aFunction)
: ToolbarPopupBase(rFrame)
- , m_xBuilder(bInterimBuilder ? Application::CreateInterimBuilder(pMenuButton, "svx/ui/colorwindow.ui")
- : Application::CreateBuilder(pMenuButton, "svx/ui/colorwindow.ui"))
+ , m_xBuilder(bInterimBuilder ? Application::CreateInterimBuilder(rMenuButton.get_widget(), "svx/ui/colorwindow.ui")
+ : Application::CreateBuilder(rMenuButton.get_widget(), "svx/ui/colorwindow.ui"))
, theSlotId(nSlotId)
, mpParentWindow(pParentWindow)
- , mpMenuButton(pMenuButton)
+ , maMenuButton(rMenuButton)
, mxPaletteManager(rPaletteManager)
, mrColorStatus(rColorStatus)
, maColorSelectFunction(aFunction)
@@ -1956,12 +1956,12 @@ IMPL_LINK(ColorWindow, SelectHdl, SvtValueSet*, pColorSet, void)
if (pColorSet != mxRecentColorSet.get())
{
mxPaletteManager->AddRecentColor(aNamedColor.first, aNamedColor.second);
- if (!mpMenuButton->get_active())
+ if (!maMenuButton.get_active())
mxPaletteManager->ReloadRecentColorSet(*mxRecentColorSet);
}
- if (mpMenuButton->get_active())
- mpMenuButton->set_active(false);
+ if (maMenuButton.get_active())
+ maMenuButton.set_active(false);
maColorSelectFunction(OUString(), aNamedColor);
}
@@ -2014,8 +2014,8 @@ IMPL_LINK(ColorWindow, AutoColorClickHdl, weld::Button&, rButton, void)
mxRecentColorSet->SetNoSelection();
- if (mpMenuButton->get_active())
- mpMenuButton->set_active(false);
+ if (maMenuButton.get_active())
+ maMenuButton.set_active(false);
maColorSelectFunction(OUString(), aNamedColor);
}
@@ -2042,8 +2042,8 @@ IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void)
IMPL_LINK_NOARG(ColorWindow, OpenPickerClickHdl, weld::Button&, void)
{
- if (mpMenuButton->get_active())
- mpMenuButton->set_active(false);
+ if (maMenuButton.get_active())
+ maMenuButton.set_active(false);
mxPaletteManager->PopupColorPicker(mpParentWindow, OUString(), GetSelectEntryColor().first);
}
@@ -4168,4 +4168,41 @@ void ColorListBox::ShowPreview(const NamedColor &rColor)
m_xButton->set_label(rColor.second);
}
+MenuOrToolMenuButton::MenuOrToolMenuButton(weld::MenuButton* pMenuButton)
+ : m_pMenuButton(pMenuButton)
+ , m_pToolbar(nullptr)
+{
+}
+
+MenuOrToolMenuButton::MenuOrToolMenuButton(weld::Toolbar* pToolbar, const OString& rIdent)
+ : m_pMenuButton(nullptr)
+ , m_pToolbar(pToolbar)
+ , m_aIdent(rIdent)
+{
+}
+
+bool MenuOrToolMenuButton::get_active() const
+{
+ if (m_pMenuButton)
+ return m_pMenuButton->get_active();
+ return m_pToolbar->get_item_active(m_aIdent);
+}
+
+void MenuOrToolMenuButton::set_active(bool bActive) const
+{
+ if (m_pMenuButton)
+ {
+ m_pMenuButton->set_active(bActive);
+ return;
+ }
+ m_pToolbar->set_item_active(m_aIdent, bActive);
+}
+
+weld::Widget* MenuOrToolMenuButton::get_widget() const
+{
+ if (m_pMenuButton)
+ return m_pMenuButton;
+ return m_pToolbar;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index d12c3464c75d..6cf9e010178c 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -923,14 +923,17 @@ class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolba
{
private:
VclPtr<ToolBox> m_xToolBox;
+ std::map<sal_uInt16, VclPtr<vcl::Window>> m_aFloats;
DECL_LINK(ClickHdl, ToolBox*, void);
+ DECL_LINK(DropdownClick, ToolBox*, void);
public:
SalInstanceToolbar(ToolBox* pToolBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: SalInstanceWidget(pToolBox, pBuilder, bTakeOwnership)
, m_xToolBox(pToolBox)
{
m_xToolBox->SetSelectHdl(LINK(this, SalInstanceToolbar, ClickHdl));
+ m_xToolBox->SetDropdownClickHdl(LINK(this, SalInstanceToolbar, DropdownClick));
}
virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override
@@ -945,7 +948,19 @@ public:
virtual void set_item_active(const OString& rIdent, bool bActive) override
{
- m_xToolBox->CheckItem(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)), bActive);
+ sal_uInt16 nItemId = m_xToolBox->GetItemId(OUString::fromUtf8(rIdent));
+ m_xToolBox->CheckItem(nItemId, bActive);
+
+ if (m_xToolBox->GetItemBits(nItemId) & ToolBoxItemBits::DROPDOWN)
+ {
+ auto pFloat = m_aFloats[nItemId];
+ if (!pFloat)
+ return;
+ if (bActive)
+ vcl::Window::GetDockingManager()->StartPopupMode(m_xToolBox, pFloat, FloatWinPopupFlags::GrabFocus);
+ else
+ vcl::Window::GetDockingManager()->EndPopupMode(pFloat);
+ }
}
virtual bool get_item_active(const OString& rIdent) const override
@@ -953,6 +968,17 @@ public:
return m_xToolBox->IsItemChecked(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)));
}
+ virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) override
+ {
+ SalInstanceWidget* pPopoverWidget = dynamic_cast<SalInstanceWidget*>(pPopover);
+
+ vcl::Window* pFloat = pPopoverWidget ? pPopoverWidget->getWidget() : nullptr;
+ if (pFloat)
+ pFloat->EnableDocking();
+
+ m_aFloats[m_xToolBox->GetItemId(OUString::fromUtf8(rIdent))] = pFloat;
+ }
+
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list