[Libreoffice-commits] core.git: 2 commits - include/sfx2 sfx2/source starmath/inc starmath/source sw/inc sw/source sw/uiconfig
Caolán McNamara
caolanm at redhat.com
Sat Apr 28 20:03:00 UTC 2018
include/sfx2/tabdlg.hxx | 5
sfx2/source/dialog/tabdlg.cxx | 26 ++
starmath/inc/node.hxx | 26 +-
starmath/source/mathmlimport.cxx | 6
starmath/source/node.cxx | 270 +++++++++++++++----------------
sw/inc/swabstdlg.hxx | 2
sw/source/ui/dialog/swdlgfact.cxx | 37 +++-
sw/source/ui/dialog/swdlgfact.hxx | 20 ++
sw/source/ui/envelp/envfmt.cxx | 10 -
sw/source/ui/envelp/envfmt.hxx | 7
sw/source/ui/envelp/envlop1.cxx | 36 +---
sw/source/ui/envelp/envprt.hxx | 2
sw/source/uibase/app/appenv.cxx | 2
sw/source/uibase/inc/envlop.hxx | 21 --
sw/uiconfig/swriter/ui/envaddresspage.ui | 65 +------
sw/uiconfig/swriter/ui/envdialog.ui | 81 +++++++++
sw/uiconfig/swriter/ui/envformatpage.ui | 34 +++
sw/uiconfig/swriter/ui/envprinterpage.ui | 6
18 files changed, 388 insertions(+), 268 deletions(-)
New commits:
commit 4dbce627d3643babaf90a93c70b365ff08abfca6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 26 12:40:15 2018 +0100
weld SwEnvDlg
Change-Id: Ib92f790030ca6fbf64273cf45c710b2f698f45a4
Reviewed-on: https://gerrit.libreoffice.org/53569
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 4f99e12e5b71..d3fda57a3d32 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -232,6 +232,7 @@ protected:
private:
std::unique_ptr<weld::Button> m_xOKBtn;
std::unique_ptr<weld::Button> m_xApplyBtn;
+ std::unique_ptr<weld::Button> m_xUserBtn;
std::unique_ptr<weld::Button> m_xCancelBtn;
std::unique_ptr<weld::Button> m_xResetBtn;
@@ -245,6 +246,7 @@ private:
DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool);
DECL_DLLPRIVATE_LINK(OkHdl, weld::Button&, void);
DECL_DLLPRIVATE_LINK(ResetHdl, weld::Button&, void);
+ DECL_DLLPRIVATE_LINK(UserHdl, weld::Button&, void);
DECL_DLLPRIVATE_LINK(CancelHdl, weld::Button&, void);
SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag);
@@ -283,6 +285,9 @@ public:
void SetInputSet( const SfxItemSet* pInSet );
const SfxItemSet* GetOutputItemSet() const { return m_pOutSet.get(); }
+ const weld::Button* GetUserButton() const { return m_xUserBtn.get(); }
+ weld::Button* GetUserButton() { return m_xUserBtn.get(); }
+
short execute();
const SfxItemSet* GetExampleSet() const { return m_pExampleSet; }
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index a39efbd00cba..9fc31515b861 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1464,6 +1464,7 @@ SfxTabDialogController::SfxTabDialogController
, m_xTabCtrl(m_xBuilder->weld_notebook("tabcontrol"))
, m_xOKBtn(m_xBuilder->weld_button("ok"))
, m_xApplyBtn(m_xBuilder->weld_button("apply"))
+ , m_xUserBtn(m_xBuilder->weld_button("user"))
, m_xCancelBtn(m_xBuilder->weld_button("cancel"))
, m_xResetBtn(m_xBuilder->weld_button("reset"))
, m_pSet(pItemSet ? new SfxItemSet(*pItemSet) : nullptr)
@@ -1487,6 +1488,9 @@ void SfxTabDialogController::Init_Impl(bool /*bFmtFlag*/)
m_xTabCtrl->connect_leave_page(LINK(this, SfxTabDialogController, DeactivatePageHdl));
m_xResetBtn->set_help_id(HID_TABDLG_RESET_BTN);
+ if (m_xUserBtn)
+ m_xUserBtn->connect_clicked(LINK(this, SfxTabDialogController, UserHdl));
+
if (m_pSet)
{
m_pExampleSet = new SfxItemSet(*m_pSet);
@@ -1509,6 +1513,28 @@ IMPL_LINK_NOARG(SfxTabDialogController, OkHdl, weld::Button&, void)
m_xDialog->response(Ok());
}
+IMPL_LINK_NOARG(SfxTabDialogController, UserHdl, weld::Button&, void)
+
+/* [Description]
+
+ Handler of the User-Buttons
+ This calls the current page <SfxTabPage::DeactivatePage(SfxItemSet *)>.
+ returns this <DeactivateRC::LeavePage> and <SfxTabDialog::Ok()> is called.
+ Then the Dialog is ended with the Return value <SfxTabDialog::Ok()>
+*/
+
+{
+ if (PrepareLeaveCurrentPage())
+ {
+ short nRet = Ok();
+ if (RET_OK == nRet)
+ nRet = RET_USER;
+ else
+ nRet = RET_USER_CANCEL;
+ m_xDialog->response(nRet);
+ }
+}
+
IMPL_LINK_NOARG(SfxTabDialogController, CancelHdl, weld::Button&, void)
{
m_xDialog->response(RET_USER_CANCEL);
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 552c3b730b27..4fb601dc76a9 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -388,7 +388,7 @@ public:
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) = 0;
- virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) = 0;
+ virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) = 0;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
SwDBManager* pDBManager, bool bLabel) = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 3df60e9b35e0..a0b0d95e3897 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -127,6 +127,10 @@ short AbstractMultiTOXMarkDlg_Impl::Execute()
{
return m_xDlg->execute();
}
+short AbstractTabController_Impl::Execute()
+{
+ return m_xDlg->execute();
+}
IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
short AbstractSwConvertTableDlg_Impl::Execute()
{
@@ -212,6 +216,32 @@ void AbstractTabDialog_Impl::SetText( const OUString& rStr )
pDlg->SetText( rStr );
}
+void AbstractTabController_Impl::SetCurPageId( const OString &rName )
+{
+ m_xDlg->SetCurPageId( rName );
+}
+
+const SfxItemSet* AbstractTabController_Impl::GetOutputItemSet() const
+{
+ return m_xDlg->GetOutputItemSet();
+}
+
+const sal_uInt16* AbstractTabController_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return m_xDlg->GetInputRanges( pItem );
+}
+
+void AbstractTabController_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ m_xDlg->SetInputSet( pInSet );
+}
+
+//From class Window.
+void AbstractTabController_Impl::SetText( const OUString& rStr )
+{
+ m_xDlg->set_title(rStr);
+}
+
IMPL_LINK_NOARG(AbstractApplyTabDialog_Impl, ApplyHdl, Button*, void)
{
if (pDlg->Apply())
@@ -758,12 +788,11 @@ VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDown
return VclPtr<AbstractDropDownFieldDialog_Impl>::Create(new sw::DropDownFieldDialog(pParent, rSh, pField, bPrevButton, bNextButton));
}
-VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet,
+VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet,
SwWrtShell* pWrtSh, Printer* pPrt,
- bool bInsert )
+ bool bInsert)
{
- VclPtr<SfxTabDialog> pDlg = VclPtr<SwEnvDlg>::Create( pParent, rSet, pWrtSh,pPrt, bInsert );
- return VclPtr<AbstractTabDialog_Impl>::Create( pDlg );
+ return VclPtr<AbstractTabController_Impl>::Create(new SwEnvDlg(pParent, rSet, pWrtSh,pPrt, bInsert));
}
VclPtr<AbstractSwLabDlg> SwAbstractDialogFactory_Impl::CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 1be0a93ab046..3afdec171700 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -223,6 +223,24 @@ class AbstractTabDialog_Impl : virtual public SfxAbstractTabDialog
virtual void SetText( const OUString& rStr ) override;
};
+class AbstractTabController_Impl : virtual public SfxAbstractTabDialog
+{
+protected:
+ std::unique_ptr<SfxTabDialogController> m_xDlg;
+public:
+ explicit AbstractTabController_Impl(SfxTabDialogController* p)
+ : m_xDlg(p)
+ {
+ }
+ virtual short Execute() override;
+ virtual void SetCurPageId( const OString &rName ) override;
+ virtual const SfxItemSet* GetOutputItemSet() const override;
+ virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override;
+ virtual void SetInputSet( const SfxItemSet* pInSet ) override;
+ //From class Window.
+ virtual void SetText( const OUString& rStr ) override;
+};
+
class AbstractApplyTabDialog_Impl : public AbstractTabDialog_Impl, virtual public SfxAbstractApplyTabDialog
{
public:
@@ -550,7 +568,7 @@ public:
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) override;
- virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) override;
+ virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) override;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
SwDBManager* pDBManager, bool bLabel) override;
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index a7aaaf4cbd8c..4d264417f664 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -241,7 +241,7 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender)
bSender ? RES_POOLCOLL_SENDADRESS : RES_POOLCOLL_JAKETADRESS));
OSL_ENSURE(pColl, "Text collection missing");
- if (rIdent == "character")
+ if (rIdent.startsWith("character"))
{
SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender);
@@ -253,7 +253,8 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender)
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
const OUString sFormatStr = pColl->GetName();
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr));
+ ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(nullptr /*TODO*/, pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr));
+ //ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr));
OSL_ENSURE(pDlg, "Dialog creation failed!");
if (pDlg->Execute() == RET_OK)
{
@@ -262,7 +263,7 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender)
pCollSet->Put(aOutputSet);
}
}
- else if (rIdent == "paragraph")
+ else if (rIdent.startsWith("paragraph"))
{
SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender);
@@ -290,7 +291,8 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender)
::PrepareBoxInfo( aTmpSet, *pSh );
const OUString sFormatStr = pColl->GetName();
- VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr);
+ VclPtrInstance< SwParaDlg > pDlg(nullptr /*TODO*/, pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr);
+ //VclPtrInstance< SwParaDlg > pDlg(GetParentSwEnvDlg(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &sFormatStr);
if ( pDlg->Execute() == RET_OK )
{
diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx
index d5aec6713fe5..20d445f14c61 100644
--- a/sw/source/ui/envelp/envfmt.hxx
+++ b/sw/source/ui/envelp/envfmt.hxx
@@ -26,7 +26,7 @@ class SwTextFormatColl;
class SwEnvFormatPage : public SfxTabPage
{
- VclPtr<SwEnvDlg> m_pDialog;
+ SwEnvDlg* m_pDialog;
std::vector<sal_uInt16> m_aIDs;
std::unique_ptr<weld::MetricSpinButton> m_xAddrLeftField;
@@ -59,11 +59,6 @@ class SwEnvFormatPage : public SfxTabPage
public:
SwEnvFormatPage(TabPageParent pParent, const SfxItemSet& rSet);
void Init(SwEnvDlg* pDialog);
- virtual void dispose() override
- {
- m_pDialog.clear();
- SfxTabPage::dispose();
- }
virtual ~SwEnvFormatPage() override;
static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rSet);
diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
index 28926fb9b2dd..e7ae5d3a4ea1 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -63,8 +63,6 @@ IMPL_LINK(SwEnvPreview, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
{
vcl::RenderContext& rRenderContext = aPayload.first;
- //SetMapMode(MapMode(MapUnit::MapPixel));
-
const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings();
rRenderContext.SetBackground(rRenderContext.GetSettings().GetStyleSettings().GetDialogColor());
rRenderContext.Erase();
@@ -124,51 +122,43 @@ IMPL_LINK(SwEnvPreview, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
rRenderContext.DrawRect(tools::Rectangle(Point(nStmpX, nStmpY), Size(nStmpW, nStmpH)));
}
-SwEnvDlg::SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet,
+SwEnvDlg::SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet,
SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert)
- : SfxTabDialog(pParent, "EnvDialog",
- "modules/swriter/ui/envdialog.ui", &rSet)
+ : SfxTabDialogController(pParent, "modules/swriter/ui/envdialog.ui", "EnvDialog", &rSet)
, aEnvItem(static_cast<const SwEnvItem&>( rSet.Get(FN_ENVELOP)))
, pSh(pWrtSh)
, pPrinter(pPrt)
, pAddresseeSet(nullptr)
, pSenderSet(nullptr)
- , m_nEnvPrintId(0)
+ , m_xModify(m_xBuilder->weld_button("modify"))
{
if (!bInsert)
{
- GetUserButton()->SetText(get<PushButton>("modify")->GetText());
+ GetUserButton()->set_label(m_xModify->get_label());
}
- m_nEnvAddressId = AddTabPage("envelope", SwEnvPage ::Create, nullptr);
- m_nEnvFormatId = AddTabPage("format", SwEnvFormatPage::Create, nullptr);
- m_nEnvPrintId = AddTabPage("printer", SwEnvPrtPage::Create, nullptr);
+ AddTabPage("envelope", SwEnvPage::Create, nullptr);
+ AddTabPage("format", SwEnvFormatPage::Create, nullptr);
+ AddTabPage("printer", SwEnvPrtPage::Create, nullptr);
}
SwEnvDlg::~SwEnvDlg()
{
- disposeOnce();
-}
-
-void SwEnvDlg::dispose()
-{
delete pAddresseeSet;
delete pSenderSet;
- pPrinter.clear();
- SfxTabDialog::dispose();
}
-void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
+void SwEnvDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
{
- if (nId == m_nEnvPrintId)
+ if (rId == "printer")
{
static_cast<SwEnvPrtPage*>(&rPage)->SetPrt(pPrinter);
}
- else if (nId == m_nEnvAddressId)
+ else if (rId == "envelope")
{
static_cast<SwEnvPage*>(&rPage)->Init(this);
}
- else if (nId == m_nEnvFormatId)
+ else if (rId == "format")
{
static_cast<SwEnvFormatPage*>(&rPage)->Init(this);
}
@@ -176,7 +166,7 @@ void SwEnvDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
short SwEnvDlg::Ok()
{
- short nRet = SfxTabDialog::Ok();
+ short nRet = SfxTabDialogController::Ok();
if (nRet == RET_OK || nRet == RET_USER)
{
@@ -209,7 +199,7 @@ SwEnvPage::SwEnvPage(TabPageParent pParent, const SfxItemSet& rSet)
, m_xPreview(new SwEnvPreview(m_xBuilder->weld_drawing_area("preview")))
{
auto nTextBoxHeight(m_xAddrEdit->get_height_rows(10));
- auto nTextBoxWidth(m_xAddrEdit->get_approximate_digit_width() * 20);
+ auto nTextBoxWidth(m_xAddrEdit->get_approximate_digit_width() * 25);
m_xAddrEdit->set_size_request(nTextBoxWidth, nTextBoxHeight);
m_xSenderEdit->set_size_request(nTextBoxWidth, nTextBoxHeight);
diff --git a/sw/source/ui/envelp/envprt.hxx b/sw/source/ui/envelp/envprt.hxx
index 94b7d0886eef..a8c093c381fe 100644
--- a/sw/source/ui/envelp/envprt.hxx
+++ b/sw/source/ui/envelp/envprt.hxx
@@ -50,7 +50,7 @@ class SwEnvPrtPage : public SfxTabPage
DECL_LINK(AlignHdl, weld::ToggleButton&, void);
DECL_LINK(ButtonHdl, weld::Button&, void );
- SwEnvDlg* GetParentSwEnvDlg() {return static_cast<SwEnvDlg*>(GetTabDialog()); }
+ SwEnvDlg* GetParentSwEnvDlg() {return static_cast<SwEnvDlg*>(GetDialogController()); }
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx
index 3d860da8654f..bcb6932b2e1d 100644
--- a/sw/source/uibase/app/appenv.cxx
+++ b/sw/source/uibase/app/appenv.cxx
@@ -214,7 +214,7 @@ void SwModule::InsertEnv( SfxRequest& rReq )
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
- pDlg.disposeAndReset(pFact->CreateSwEnvDlg( pParent, aSet, pOldSh, pTempPrinter, !bEnvChange ));
+ pDlg.disposeAndReset(pFact->CreateSwEnvDlg(pParent ? pParent->GetFrameWeld() : nullptr, aSet, pOldSh, pTempPrinter, !bEnvChange));
OSL_ENSURE(pDlg, "Dialog creation failed!");
nMode = pDlg->Execute();
}
diff --git a/sw/source/uibase/inc/envlop.hxx b/sw/source/uibase/inc/envlop.hxx
index 989e50cfd4da..4d1b640b2bd1 100644
--- a/sw/source/uibase/inc/envlop.hxx
+++ b/sw/source/uibase/inc/envlop.hxx
@@ -53,7 +53,7 @@ class SwEnvPreview
{
private:
std::unique_ptr<weld::DrawingArea> m_xDrawingArea;
- VclPtr<SwEnvDlg> m_pDialog;
+ SwEnvDlg* m_pDialog;
Size m_aSize;
DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
@@ -65,7 +65,7 @@ public:
void queue_draw() { m_xDrawingArea->queue_draw(); }
};
-class SwEnvDlg : public SfxTabDialog
+class SwEnvDlg : public SfxTabDialogController
{
friend class SwEnvPage;
friend class SwEnvFormatPage;
@@ -77,22 +77,20 @@ friend class SwEnvPreview;
VclPtr<Printer> pPrinter;
SfxItemSet *pAddresseeSet;
SfxItemSet *pSenderSet;
- sal_uInt16 m_nEnvPrintId;
- sal_uInt16 m_nEnvAddressId;
- sal_uInt16 m_nEnvFormatId;
- virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override;
+ std::unique_ptr<weld::Button> m_xModify;
+
+ virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
virtual short Ok() override;
public:
- SwEnvDlg(vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert);
+ SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert);
virtual ~SwEnvDlg() override;
- virtual void dispose() override;
};
class SwEnvPage : public SfxTabPage
{
- VclPtr<SwEnvDlg> m_pDialog;
+ SwEnvDlg* m_pDialog;
SwWrtShell* m_pSh;
OUString m_sActDBName;
@@ -128,11 +126,6 @@ public:
void FillItem(SwEnvItem& rItem);
virtual bool FillItemSet(SfxItemSet* rSet) override;
virtual void Reset(const SfxItemSet* rSet) override;
- virtual void dispose() override
- {
- m_pDialog.clear();
- SfxTabPage::dispose();
- }
};
#endif
diff --git a/sw/uiconfig/swriter/ui/envaddresspage.ui b/sw/uiconfig/swriter/ui/envaddresspage.ui
index 37e84a26da6c..3f6849229426 100644
--- a/sw/uiconfig/swriter/ui/envaddresspage.ui
+++ b/sw/uiconfig/swriter/ui/envaddresspage.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
<interface domain="sw">
- <!-- interface-requires gtk+ 3.0 -->
- <!-- interface-requires LibreOffice 1.0 -->
+ <requires lib="gtk+" version="3.18"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -37,7 +37,7 @@
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="addredit:border">
+ <object class="GtkTextView" id="addredit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
@@ -48,8 +48,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>
@@ -57,24 +55,20 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="envaddresspage|label2">Addr_essee</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">addredit:border</property>
+ <property name="mnemonic_widget">addredit</property>
+ <property name="xalign">0</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>
</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>
@@ -94,16 +88,14 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="envaddresspage|label4">Database</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">database</property>
+ <property name="xalign">0</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>
@@ -111,22 +103,16 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="entry_text_column">0</property>
- <property name="id_column">1</property>
</object>
<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>
</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>
@@ -140,16 +126,14 @@
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="envaddresspage|label7">Table</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">table</property>
+ <property name="xalign">0</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>
@@ -157,22 +141,16 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="entry_text_column">0</property>
- <property name="id_column">1</property>
</object>
<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>
</object>
<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>
@@ -186,16 +164,14 @@
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="envaddresspage|label8">Database field</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">field</property>
+ <property name="xalign">0</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>
@@ -203,30 +179,22 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="entry_text_column">0</property>
- <property name="id_column">1</property>
</object>
<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>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -237,12 +205,11 @@
<property name="tooltip_text" translatable="yes" context="envaddresspage|insert|tooltip_text">Insert</property>
<property name="valign">center</property>
<property name="image">image1</property>
+ <property name="always_show_image">True</property>
</object>
<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>
@@ -274,7 +241,7 @@
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="senderedit:border">
+ <object class="GtkTextView" id="senderedit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
@@ -288,8 +255,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>
@@ -302,22 +267,18 @@
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<accessibility>
- <relation type="label-for" target="senderedit:border"/>
+ <relation type="label-for" target="senderedit"/>
</accessibility>
</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>
</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>
@@ -332,8 +293,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>
@@ -349,8 +308,6 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
diff --git a/sw/uiconfig/swriter/ui/envdialog.ui b/sw/uiconfig/swriter/ui/envdialog.ui
index e4996a3052ca..cc53d2313aa0 100644
--- a/sw/uiconfig/swriter/ui/envdialog.ui
+++ b/sw/uiconfig/swriter/ui/envdialog.ui
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="EnvDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="envdialog|EnvDialog">Envelope</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 internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
@@ -86,6 +89,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
+ <property name="secondary">True</property>
</packing>
</child>
<child>
@@ -123,6 +127,30 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
<child type="tab">
@@ -142,6 +170,30 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">1</property>
@@ -165,6 +217,30 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">2</property>
@@ -198,5 +274,8 @@
<action-widget response="-11">help</action-widget>
<action-widget response="0">reset</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
diff --git a/sw/uiconfig/swriter/ui/envformatpage.ui b/sw/uiconfig/swriter/ui/envformatpage.ui
index 8e8d742a8369..f49b6ea2db97 100644
--- a/sw/uiconfig/swriter/ui/envformatpage.ui
+++ b/sw/uiconfig/swriter/ui/envformatpage.ui
@@ -34,22 +34,42 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkMenu" id="editmenu">
+ <object class="GtkMenu" id="editmenu1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkMenuItem" id="character">
+ <object class="GtkMenuItem" id="character1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes" context="envformatpage|character">C_haracter...</property>
+ <property name="label" translatable="yes" context="envformatpage|character1">C_haracter...</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="paragraph">
+ <object class="GtkMenuItem" id="paragraph1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes" context="envformatpage|paragraph">P_aragraph...</property>
+ <property name="label" translatable="yes" context="envformatpage|paragraph1">P_aragraph...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ <object class="GtkMenu" id="editmenu2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="character2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="envformatpage|character2">C_haracter...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="paragraph2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="envformatpage|paragraph2">P_aragraph...</property>
<property name="use_underline">True</property>
</object>
</child>
@@ -209,7 +229,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="popup">editmenu</property>
+ <property name="popup">editmenu1</property>
<child>
<placeholder/>
</child>
@@ -406,7 +426,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="popup">editmenu</property>
+ <property name="popup">editmenu2</property>
<child>
<placeholder/>
</child>
diff --git a/sw/uiconfig/swriter/ui/envprinterpage.ui b/sw/uiconfig/swriter/ui/envprinterpage.ui
index 43f6f7e49daf..165600f6ec73 100644
--- a/sw/uiconfig/swriter/ui/envprinterpage.ui
+++ b/sw/uiconfig/swriter/ui/envprinterpage.ui
@@ -7,6 +7,11 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">9999</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -160,6 +165,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
+ <property name="adjustment">adjustment2</property>
<property name="digits">2</property>
</object>
<packing>
commit 5fa446204e1e686412d84562750d9802bf1b9468
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 28 15:45:31 2018 +0100
ofz#7861 fuzzer ooms
too many frequent tiny allocations in a short time span I believe
Change-Id: Iaccae6db7d18c9cd2f909f94dbe81a7dc6458bc2
Reviewed-on: https://gerrit.libreoffice.org/53589
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 7479e3385503..b9a11864b1a8 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -162,7 +162,7 @@ public:
void Move(const Point &rPosition);
void MoveTo(const Point &rPosition) { Move(rPosition - GetTopLeft()); }
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) = 0;
- virtual void CreateTextFromNode(OUString &rText);
+ virtual void CreateTextFromNode(OUStringBuffer &rText);
virtual void GetAccessibleText( OUStringBuffer &rText ) const = 0;
sal_Int32 GetAccessibleIndex() const { return mnAccIndex; }
@@ -333,7 +333,7 @@ public:
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -414,7 +414,7 @@ public:
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell, int nDepth) override;
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- virtual void CreateTextFromNode(OUString &rText) override;
+ virtual void CreateTextFromNode(OUStringBuffer &rText) override;
virtual void GetAccessibleText( OUStringBuffer &rText ) const override;
void Accept(SmVisitor* pVisitor) override;
@@ -494,7 +494,7 @@ public:
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell, int nDepth) override;
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -651,7 +651,7 @@ public:
{}
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -693,7 +693,7 @@ public:
}
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
SmNode* Argument();
@@ -759,7 +759,7 @@ public:
virtual const SmNode * GetLeftMost() const override;
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -869,7 +869,7 @@ public:
void SetSubSup(SmSubSup eSubSup, SmNode* pScript) { SetSubNode( 1 + eSubSup, pScript); }
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -904,7 +904,7 @@ public:
const SmMathSymbolNode* ClosingBrace() const;
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -1035,7 +1035,7 @@ public:
{}
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
SmNode* Attribute();
@@ -1068,7 +1068,7 @@ public:
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell, int nDepth) override;
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -1098,7 +1098,7 @@ public:
virtual const SmNode * GetLeftMost() const override;
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
- void CreateTextFromNode(OUString &rText) override;
+ void CreateTextFromNode(OUStringBuffer &rText) override;
void Accept(SmVisitor* pVisitor) override;
};
@@ -1126,7 +1126,7 @@ public:
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell, int nDepth) override;
virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override;
void Accept(SmVisitor* pVisitor) override;
- virtual void CreateTextFromNode(OUString &rText) override;
+ virtual void CreateTextFromNode(OUStringBuffer &rText) override;
};
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 6142db4a3ec4..8c0fc3f3d97c 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -515,9 +515,11 @@ void SmXMLImport::endDocument()
pDocShell->SetFormulaTree(static_cast<SmTableNode *>(pTree));
if (aText.isEmpty()) //If we picked up no annotation text
{
+ OUStringBuffer aStrBuf;
// Get text from imported formula
- pTree->CreateTextFromNode(aText);
- aText = comphelper::string::stripEnd(aText, ' ');
+ pTree->CreateTextFromNode(aStrBuf);
+ aStrBuf.stripEnd(' ');
+ aText = aStrBuf.makeStringAndClear();
}
// Convert symbol names
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 3d1190594002..55466245527d 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -251,16 +251,16 @@ void SmNode::Move(const Point& rPosition)
ForEachNonNull(this, [&rPosition](SmNode *pNode){pNode->Move(rPosition);});
}
-void SmNode::CreateTextFromNode(OUString &rText)
+void SmNode::CreateTextFromNode(OUStringBuffer &rText)
{
auto nSize = GetNumSubNodes();
if (nSize > 1)
- rText += "{";
+ rText.append("{");
ForEachNonNull(this, [&rText](SmNode *pNode){pNode->CreateTextFromNode(rText);});
if (nSize > 1)
{
- rText = comphelper::string::stripEnd(rText, ' ');
- rText += "} ";
+ rText.stripEnd(' ');
+ rText.append("} ");
}
}
@@ -454,11 +454,11 @@ void SmGraphicNode::GetAccessibleText( OUStringBuffer &rText ) const
rText.append(GetToken().aText);
}
-void SmExpressionNode::CreateTextFromNode(OUString &rText)
+void SmExpressionNode::CreateTextFromNode(OUStringBuffer &rText)
{
size_t nSize = GetNumSubNodes();
if (nSize > 1)
- rText += "{";
+ rText.append("{");
for (size_t i = 0; i < nSize; ++i)
{
SmNode *pNode = GetSubNode(i);
@@ -467,16 +467,16 @@ void SmExpressionNode::CreateTextFromNode(OUString &rText)
pNode->CreateTextFromNode(rText);
//Just a bit of foo to make unary +asd -asd +-asd -+asd look nice
if (pNode->GetType() == SmNodeType::Math)
- if ((nSize != 2) ||
- ( !rText.endsWith("+") && !rText.endsWith("-") ))
- rText += " ";
+ if ((nSize != 2) || rText.isEmpty() ||
+ (rText[rText.getLength() - 1] != '+' && rText[rText.getLength() - 1] != '-') )
+ rText.append(" ");
}
}
if (nSize > 1)
{
- rText = comphelper::string::stripEnd(rText, ' ');
- rText += "} ";
+ rText.stripEnd(' ');
+ rText.append("} ");
}
}
@@ -754,24 +754,24 @@ void SmRootNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
}
-void SmRootNode::CreateTextFromNode(OUString &rText)
+void SmRootNode::CreateTextFromNode(OUStringBuffer &rText)
{
SmNode *pExtra = GetSubNode(0);
if (pExtra)
{
- rText += "nroot ";
+ rText.append("nroot ");
pExtra->CreateTextFromNode(rText);
}
else
- rText += "sqrt ";
+ rText.append("sqrt ");
if (!pExtra && GetSubNode(2)->GetNumSubNodes() > 1)
- rText += "{ ";
+ rText.append("{ ");
GetSubNode(2)->CreateTextFromNode(rText);
if (!pExtra && GetSubNode(2)->GetNumSubNodes() > 1)
- rText += "} ";
+ rText.append("} ");
}
/**************************************************************************/
@@ -873,16 +873,15 @@ void SmBinVerNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
ExtendBy(*pDenom, RectCopyMBL::None).ExtendBy(*pLine, RectCopyMBL::None, pLine->GetCenterY());
}
-void SmBinVerNode::CreateTextFromNode(OUString &rText)
+void SmBinVerNode::CreateTextFromNode(OUStringBuffer &rText)
{
SmNode *pNum = GetSubNode(0),
*pDenom = GetSubNode(2);
pNum->CreateTextFromNode(rText);
- rText += "over ";
+ rText.append("over ");
pDenom->CreateTextFromNode(rText);
}
-
const SmNode * SmBinVerNode::GetLeftMost() const
{
return this;
@@ -1250,41 +1249,41 @@ void SmSubSupNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
}
}
-void SmSubSupNode::CreateTextFromNode(OUString &rText)
+void SmSubSupNode::CreateTextFromNode(OUStringBuffer &rText)
{
SmNode *pNode;
GetSubNode(0)->CreateTextFromNode(rText);
if (nullptr != (pNode = GetSubNode(LSUB+1)))
{
- rText += "lsub ";
+ rText.append("lsub ");
pNode->CreateTextFromNode(rText);
}
if (nullptr != (pNode = GetSubNode(LSUP+1)))
{
- rText += "lsup ";
+ rText.append("lsup ");
pNode->CreateTextFromNode(rText);
}
if (nullptr != (pNode = GetSubNode(CSUB+1)))
{
- rText += "csub ";
+ rText.append("csub ");
pNode->CreateTextFromNode(rText);
}
if (nullptr != (pNode = GetSubNode(CSUP+1)))
{
- rText += "csup ";
+ rText.append("csup ");
pNode->CreateTextFromNode(rText);
}
if (nullptr != (pNode = GetSubNode(RSUB+1)))
{
- rText = comphelper::string::stripEnd(rText, ' ');
- rText += "_";
+ rText.stripEnd(' ');
+ rText.append("_");
pNode->CreateTextFromNode(rText);
}
if (nullptr != (pNode = GetSubNode(RSUP+1)))
{
- rText = comphelper::string::stripEnd(rText, ' ');
- rText += "^";
+ rText.stripEnd(' ');
+ rText.append("^");
pNode->CreateTextFromNode(rText);
}
}
@@ -1292,55 +1291,56 @@ void SmSubSupNode::CreateTextFromNode(OUString &rText)
/**************************************************************************/
-void SmBraceNode::CreateTextFromNode(OUString &rText)
+void SmBraceNode::CreateTextFromNode(OUStringBuffer &rText)
{
if (GetScaleMode() == SmScaleMode::Height)
- rText += "left ";
+ rText.append("left ");
{
- OUString aStr;
- OpeningBrace()->CreateTextFromNode(aStr);
+ OUStringBuffer aStrBuf;
+ OpeningBrace()->CreateTextFromNode(aStrBuf);
+ OUString aStr = aStrBuf.makeStringAndClear();
aStr = comphelper::string::strip(aStr, ' ');
aStr = comphelper::string::stripStart(aStr, '\\');
if (!aStr.isEmpty())
{
if (aStr == "divides")
- rText += "lline";
+ rText.append("lline");
else if (aStr == "parallel")
- rText += "ldline";
+ rText.append("ldline");
else if (aStr == "<")
- rText += "langle";
+ rText.append("langle");
else
- rText += aStr;
- rText += " ";
+ rText.append(aStr);
+ rText.append(" ");
}
else
- rText += "none ";
+ rText.append("none ");
}
Body()->CreateTextFromNode(rText);
if (GetScaleMode() == SmScaleMode::Height)
- rText += "right ";
+ rText.append("right ");
{
- OUString aStr;
- ClosingBrace()->CreateTextFromNode(aStr);
+ OUStringBuffer aStrBuf;
+ ClosingBrace()->CreateTextFromNode(aStrBuf);
+ OUString aStr = aStrBuf.makeStringAndClear();
aStr = comphelper::string::strip(aStr, ' ');
aStr = comphelper::string::stripStart(aStr, '\\');
if (!aStr.isEmpty())
{
if (aStr == "divides")
- rText += "rline";
+ rText.append("rline");
else if (aStr == "parallel")
- rText += "rdline";
+ rText.append("rdline");
else if (aStr == ">")
- rText += "rangle";
+ rText.append("rangle");
else
- rText += aStr;
- rText += " ";
+ rText.append(aStr);
+ rText.append(" ");
}
else
- rText += "none ";
+ rText.append("none ");
}
- rText += " ";
-
+ rText.append(" ");
}
void SmBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
@@ -1709,126 +1709,126 @@ void SmAttributNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
ExtendBy(*pAttr, RectCopyMBL::This, true);
}
-void SmFontNode::CreateTextFromNode(OUString &rText)
+void SmFontNode::CreateTextFromNode(OUStringBuffer &rText)
{
- rText += "{";
+ rText.append("{");
switch (GetToken().eType)
{
case TBOLD:
- rText += "bold ";
+ rText.append("bold ");
break;
case TNBOLD:
- rText += "nbold ";
+ rText.append("nbold ");
break;
case TITALIC:
- rText += "italic ";
+ rText.append("italic ");
break;
case TNITALIC:
- rText += "nitalic ";
+ rText.append("nitalic ");
break;
case TPHANTOM:
- rText += "phantom ";
+ rText.append("phantom ");
break;
case TSIZE:
{
- rText += "size ";
+ rText.append("size ");
switch (meSizeType)
{
case FontSizeType::PLUS:
- rText += "+";
+ rText.append("+");
break;
case FontSizeType::MINUS:
- rText += "-";
+ rText.append("-");
break;
case FontSizeType::MULTIPLY:
- rText += "*";
+ rText.append("*");
break;
case FontSizeType::DIVIDE:
- rText += "/";
+ rText.append("/");
break;
case FontSizeType::ABSOLUT:
default:
break;
}
- rText += ::rtl::math::doubleToUString(
+ rText.append(::rtl::math::doubleToUString(
static_cast<double>(maFontSize),
rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true);
- rText += " ";
+ rtl_math_DecimalPlaces_Max, '.', true));
+ rText.append(" ");
}
break;
case TBLACK:
- rText += "color black ";
+ rText.append("color black ");
break;
case TWHITE:
- rText += "color white ";
+ rText.append("color white ");
break;
case TRED:
- rText += "color red ";
+ rText.append("color red ");
break;
case TGREEN:
- rText += "color green ";
+ rText.append("color green ");
break;
case TBLUE:
- rText += "color blue ";
+ rText.append("color blue ");
break;
case TCYAN:
- rText += "color cyan ";
+ rText.append("color cyan ");
break;
case TMAGENTA:
- rText += "color magenta ";
+ rText.append("color magenta ");
break;
case TYELLOW:
- rText += "color yellow ";
+ rText.append("color yellow ");
break;
case TTEAL:
- rText += "color teal ";
+ rText.append("color teal ");
break;
case TSILVER:
- rText += "color silver ";
+ rText.append("color silver ");
break;
case TGRAY:
- rText += "color gray ";
+ rText.append("color gray ");
break;
case TMAROON:
- rText += "color maroon ";
+ rText.append("color maroon ");
break;
case TPURPLE:
- rText += "color purple ";
+ rText.append("color purple ");
break;
case TLIME:
- rText += "color lime ";
+ rText.append("color lime ");
break;
case TOLIVE:
- rText += "color olive ";
+ rText.append("color olive ");
break;
case TNAVY:
- rText += "color navy ";
+ rText.append("color navy ");
break;
case TAQUA:
- rText += "color aqua ";
+ rText.append("color aqua ");
break;
case TFUCHSIA:
- rText += "color fuchsia ";
+ rText.append("color fuchsia ");
break;
case TSANS:
- rText += "font sans ";
+ rText.append("font sans ");
break;
case TSERIF:
- rText += "font serif ";
+ rText.append("font serif ");
break;
case TFIXED:
- rText += "font fixed ";
+ rText.append("font fixed ");
break;
default:
break;
}
- if(GetNumSubNodes() > 1)
+ if (GetNumSubNodes() > 1)
GetSubNode(1)->CreateTextFromNode(rText);
- rText = comphelper::string::stripEnd(rText, ' ');
- rText += "} ";
+ rText.stripEnd(' ');
+ rText.append("} ");
}
void SmFontNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell, int nDepth)
@@ -2091,12 +2091,12 @@ void SmTextNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
SmRect::operator = (SmRect(aTmpDev, &rFormat, maText, GetFont().GetBorderWidth()));
}
-void SmTextNode::CreateTextFromNode(OUString &rText)
+void SmTextNode::CreateTextFromNode(OUStringBuffer &rText)
{
bool bQuoted=false;
if (GetToken().eType == TTEXT)
{
- rText += "\"";
+ rText.append("\"");
bQuoted=true;
}
else
@@ -2120,24 +2120,23 @@ void SmTextNode::CreateTextFromNode(OUString &rText)
if ((GetToken().eType == TIDENT) && (GetFontDesc() == FNT_FUNCTION))
{
//Search for existing functions and remove extraneous keyword
- rText += "func ";
+ rText.append("func ");
}
else if (bQuoted)
- rText += "italic ";
+ rText.append("italic ");
if (bQuoted)
- rText += "\"";
+ rText.append("\"");
}
- rText += GetToken().aText;
+ rText.append(GetToken().aText);
if (bQuoted)
- rText += "\"";
- rText += " ";
+ rText.append("\"");
+ rText.append(" ");
}
-
void SmTextNode::GetAccessibleText( OUStringBuffer &rText ) const
{
rText.append(maText);
@@ -2209,9 +2208,9 @@ sal_Unicode SmTextNode::ConvertSymbolToUnicode(sal_Unicode nIn)
/**************************************************************************/
-void SmMatrixNode::CreateTextFromNode(OUString &rText)
+void SmMatrixNode::CreateTextFromNode(OUStringBuffer &rText)
{
- rText += "matrix {";
+ rText.append("matrix {");
for (size_t i = 0; i < mnNumRows; ++i)
{
for (size_t j = 0; j < mnNumCols; ++j)
@@ -2220,16 +2219,15 @@ void SmMatrixNode::CreateTextFromNode(OUString &rText)
if (pNode)
pNode->CreateTextFromNode(rText);
if (j != mnNumCols - 1U)
- rText += "# ";
+ rText.append("# ");
}
if (i != mnNumRows - 1U)
- rText += "## ";
+ rText.append("## ");
}
- rText = comphelper::string::stripEnd(rText, ' ');
- rText += "} ";
+ rText.stripEnd(' ');
+ rText.append("} ");
}
-
void SmMatrixNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
{
SmNode *pNode;
@@ -2447,7 +2445,7 @@ void SmMathSymbolNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
SmRect::operator = (SmRect(aTmpDev, &rFormat, rText, GetFont().GetBorderWidth()));
}
-void SmMathSymbolNode::CreateTextFromNode(OUString &rText)
+void SmMathSymbolNode::CreateTextFromNode(OUStringBuffer &rText)
{
OUString sStr;
sal_Unicode cChar = GetToken().cMathChar;
@@ -2455,99 +2453,99 @@ void SmMathSymbolNode::CreateTextFromNode(OUString &rText)
sStr = "intd ";
else
MathType::LookupChar(cChar, sStr, 3);
- rText += sStr;
+ rText.append(sStr);
}
-void SmRectangleNode::CreateTextFromNode(OUString &rText)
+void SmRectangleNode::CreateTextFromNode(OUStringBuffer &rText)
{
switch (GetToken().eType)
{
case TUNDERLINE:
- rText += "underline ";
+ rText.append("underline ");
break;
case TOVERLINE:
- rText += "overline ";
+ rText.append("overline ");
break;
case TOVERSTRIKE:
- rText += "overstrike ";
+ rText.append("overstrike ");
break;
default:
break;
}
}
-void SmAttributNode::CreateTextFromNode(OUString &rText)
+void SmAttributNode::CreateTextFromNode(OUStringBuffer &rText)
{
SmNode *pNode;
assert(GetNumSubNodes() == 2);
- rText += "{";
+ rText.append("{");
sal_Unicode nLast=0;
if (nullptr != (pNode = Attribute()))
{
- OUString aStr;
+ OUStringBuffer aStr;
pNode->CreateTextFromNode(aStr);
if (aStr.getLength() > 1)
- rText += aStr;
+ rText.append(aStr);
else
{
nLast = aStr[0];
switch (nLast)
{
case MS_BAR: // MACRON
- rText += "overline ";
+ rText.append("overline ");
break;
case MS_DOT: // DOT ABOVE
- rText += "dot ";
+ rText.append("dot ");
break;
case 0x2dc: // SMALL TILDE
- rText += "widetilde ";
+ rText.append("widetilde ");
break;
case MS_DDOT: // DIAERESIS
- rText += "ddot ";
+ rText.append("ddot ");
break;
case 0xE082:
break;
case 0xE09B:
case MS_DDDOT: // COMBINING THREE DOTS ABOVE
- rText += "dddot ";
+ rText.append("dddot ");
break;
case MS_ACUTE: // ACUTE ACCENT
case MS_COMBACUTE: // COMBINING ACUTE ACCENT
- rText += "acute ";
+ rText.append("acute ");
break;
case MS_GRAVE: // GRAVE ACCENT
case MS_COMBGRAVE: // COMBINING GRAVE ACCENT
- rText += "grave ";
+ rText.append("grave ");
break;
case MS_CHECK: // CARON
case MS_COMBCHECK: // COMBINING CARON
- rText += "check ";
+ rText.append("check ");
break;
case MS_BREVE: // BREVE
case MS_COMBBREVE: // COMBINING BREVE
- rText += "breve ";
+ rText.append("breve ");
break;
case MS_CIRCLE: // RING ABOVE
case MS_COMBCIRCLE: // COMBINING RING ABOVE
- rText += "circle ";
+ rText.append("circle ");
break;
case MS_RIGHTARROW: // RIGHTWARDS ARROW
case MS_VEC: // COMBINING RIGHT ARROW ABOVE
- rText += "vec ";
+ rText.append("vec ");
break;
case MS_TILDE: // TILDE
case MS_COMBTILDE: // COMBINING TILDE
- rText += "tilde ";
+ rText.append("tilde ");
break;
case MS_HAT: // CIRCUMFLEX ACCENT
case MS_COMBHAT: // COMBINING CIRCUMFLEX ACCENT
- rText += "hat ";
+ rText.append("hat ");
break;
case MS_COMBBAR: // COMBINING MACRON
- rText += "bar ";
+ rText.append("bar ");
break;
default:
- rText += OUStringLiteral1( nLast );
+ rText.append(OUStringLiteral1(nLast));
break;
}
}
@@ -2556,12 +2554,12 @@ void SmAttributNode::CreateTextFromNode(OUString &rText)
if (nullptr != (pNode = Body()))
pNode->CreateTextFromNode(rText);
- rText = comphelper::string::stripEnd(rText, ' ');
+ rText.stripEnd(' ');
if (nLast == 0xE082)
- rText += " overbrace {}";
+ rText.append(" overbrace {}");
- rText += "} ";
+ rText.append("} ");
}
/**************************************************************************/
@@ -2777,17 +2775,17 @@ void SmBlankNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
SetWidth(nSpace);
}
-void SmBlankNode::CreateTextFromNode(OUString &rText)
+void SmBlankNode::CreateTextFromNode(OUStringBuffer &rText)
{
if (mnNum <= 0)
return;
sal_uInt16 nWide = mnNum / 4;
sal_uInt16 nNarrow = mnNum % 4;
for (sal_uInt16 i = 0; i < nWide; i++)
- rText += "~";
+ rText.append("~");
for (sal_uInt16 i = 0; i < nNarrow; i++)
- rText += "`";
- rText += " ";
+ rText.append("`");
+ rText.append(" ");
}
More information about the Libreoffice-commits
mailing list