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 37d2b00dfd5cbbda3492b00a06201879b629f1af Author: Szymon Kłos <[email protected]> AuthorDate: Wed Oct 23 13:29:37 2019 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Wed Oct 23 17:12:16 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 <[email protected]> (cherry picked from commit c7b97f2e4b8f47107bc91ded0295dcfffd0c71b6) Reviewed-on: https://gerrit.libreoffice.org/81395 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index c748507a1fc8..deecd6b37353 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -235,6 +235,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 @@ -987,6 +988,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() @@ -1260,6 +1262,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 18b22663e2c0..917d87b462ca 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -91,6 +91,7 @@ public: void SetOptimalSize(); virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual boost::property_tree::ptree DumpAsPropertyTree() override; protected: virtual void Select() override; @@ -120,6 +121,7 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl( { SetValue( 0 ); SetText( "" ); + set_id("fontsizecombobox"); } void SvxFontSizeBox_Impl::ReleaseFocus_Impl() @@ -260,6 +262,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 5e5de5430d22..9a618a0b07eb 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1794,21 +1794,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 [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
