svx/source/tbxctrls/tbcontrl.cxx | 32 ++++++++++++++++++++++++++++++++ svx/source/tbxctrls/tbunocontroller.cxx | 32 ++++++++++++++++++++++++++++++++ vcl/source/window/toolbox2.cxx | 26 +++++++++++++++----------- 3 files changed, 79 insertions(+), 11 deletions(-)
New commits: commit c7b97f2e4b8f47107bc91ded0295dcfffd0c71b6 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Oct 23 13:29:37 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Oct 23 16:26:24 2019 +0200 jsdilogs: send data for font name & size toolitems Change-Id: Ia5ea058ba44b3a511a0bdbfc132a7de2d68f2e6b Reviewed-on: https://gerrit.libreoffice.org/81380 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index b1230050bc06..5f8ec0491977 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -242,6 +242,7 @@ public: virtual bool EventNotify( NotifyEvent& rNEvt ) override; virtual Reference< css::accessibility::XAccessible > CreateAccessible() override; void SetOwnFontList(::std::unique_ptr<FontList> && _aOwnFontList) { m_aOwnFontList = std::move(_aOwnFontList); } + virtual boost::property_tree::ptree DumpAsPropertyTree() override; }; // SelectHdl needs the Modifiers, get them in MouseButtonUp @@ -1311,6 +1312,7 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( vcl::Window* pParent, const Reference< SetOptimalSize(); EnableControls_Impl(); GetSubEdit()->AddEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont )); + set_id("fontnamecombobox"); } SvxFontNameBox_Impl::~SvxFontNameBox_Impl() @@ -1585,6 +1587,36 @@ void SvxFontNameBox_Impl::Select() } } +boost::property_tree::ptree SvxFontNameBox_Impl::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree(FontNameBox::DumpAsPropertyTree()); + + boost::property_tree::ptree aEntries; + + for (int i = 0; i < GetEntryCount(); ++i) + { + boost::property_tree::ptree aEntry; + aEntry.put("", GetEntry(i)); + aEntries.push_back(std::make_pair("", aEntry)); + } + + aTree.add_child("entries", aEntries); + + boost::property_tree::ptree aSelected; + + for (int i = 0; i < GetSelectedEntryCount(); ++i) + { + boost::property_tree::ptree aEntry; + aEntry.put("", GetSelectedEntryPos(i)); + aSelected.push_back(std::make_pair("", aEntry)); + } + + aTree.put("selectedCount", GetSelectedEntryCount()); + aTree.add_child("selectedEntries", aSelected); + + return aTree; +} + SvxColorWindow::SvxColorWindow(const OUString& rCommand, std::shared_ptr<PaletteManager> const & rPaletteManager, ColorStatus& rColorStatus, diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index b806251dd805..19b2147c8fad 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -96,6 +96,7 @@ public: void SetOptimalSize(); virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual boost::property_tree::ptree DumpAsPropertyTree() override; protected: virtual void Select() override; @@ -125,6 +126,7 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl( { SetValue( 0 ); SetText( "" ); + set_id("fontsizecombobox"); } void SvxFontSizeBox_Impl::ReleaseFocus_Impl() @@ -266,6 +268,36 @@ void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) FontSizeBox::DataChanged( rDCEvt ); } +boost::property_tree::ptree SvxFontSizeBox_Impl::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree(FontSizeBox::DumpAsPropertyTree()); + + boost::property_tree::ptree aEntries; + + for (int i = 0; i < GetEntryCount(); ++i) + { + boost::property_tree::ptree aEntry; + aEntry.put("", GetEntry(i)); + aEntries.push_back(std::make_pair("", aEntry)); + } + + aTree.add_child("entries", aEntries); + + boost::property_tree::ptree aSelected; + + for (int i = 0; i < GetSelectedEntryCount(); ++i) + { + boost::property_tree::ptree aEntry; + aEntry.put("", GetSelectedEntryPos(i)); + aSelected.push_back(std::make_pair("", aEntry)); + } + + aTree.put("selectedCount", GetSelectedEntryCount()); + aTree.add_child("selectedEntries", aSelected); + + return aTree; +} + FontHeightToolBoxControl::FontHeightToolBoxControl( const uno::Reference< uno::XComponentContext >& rxContext ) : svt::ToolboxController( rxContext, uno::Reference< frame::XFrame >(), diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 4aecf7abfaa6..6700c3466ff2 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1771,21 +1771,25 @@ boost::property_tree::ptree ToolBox::DumpAsPropertyTree() boost::property_tree::ptree aTree(DockingWindow::DumpAsPropertyTree()); boost::property_tree::ptree aChildren; - for (unsigned long i = 0; i < GetItemCount(); ++i) + boost::property_tree::ptree::const_assoc_iterator found = aTree.find("children"); + if (found == aTree.not_found()) { - ToolBoxItemType type = GetItemType(i); - if (type == ToolBoxItemType::BUTTON) + for (unsigned long i = 0; i < GetItemCount(); ++i) { - boost::property_tree::ptree aEntry; - int nId = GetItemId(i); - aEntry.put("type", "toolitem"); - aEntry.put("text", GetItemText(nId)); - aEntry.put("command", GetItemCommand(nId)); - aChildren.push_back(std::make_pair("", aEntry)); + ToolBoxItemType type = GetItemType(i); + if (type == ToolBoxItemType::BUTTON) + { + boost::property_tree::ptree aEntry; + int nId = GetItemId(i); + aEntry.put("type", "toolitem"); + aEntry.put("text", GetItemText(nId)); + aEntry.put("command", GetItemCommand(nId)); + aChildren.push_back(std::make_pair("", aEntry)); + } } - } - aTree.add_child("children", aChildren); + aTree.add_child("children", aChildren); + } return aTree; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits