summaryrefslogtreecommitdiff
path: root/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2016-04-16 16:38:43 +0200
committerJan Holesovsky <kendy@collabora.com>2016-04-20 07:53:17 +0000
commitccaf108651ee7e477b09f496f33ea778307fe60b (patch)
tree11c22a3675a8ee06ab248d4879d582e6d1970c84 /svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
parentf7aa4344e4fec0e8bb49d6ba210bc3a78b7e1365 (diff)
character spacing control possible to use outside sidebar
Change-Id: Ic0c6458268b529bd0107d6ed5a35f49241cfb833 Reviewed-on: https://gerrit.libreoffice.org/24146 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'svx/source/sidebar/text/TextCharacterSpacingPopup.cxx')
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingPopup.cxx46
1 files changed, 14 insertions, 32 deletions
diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
index 148b864297d5..266b9d392aae 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
@@ -16,53 +16,35 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "TextCharacterSpacingPopup.hxx"
+#include <svx/TextCharacterSpacingPopup.hxx>
#include "TextCharacterSpacingControl.hxx"
#include <unotools/viewoptions.hxx>
+#include <vcl/toolbox.hxx>
+#include <editeng/kernitem.hxx>
-namespace svx { namespace sidebar {
+using namespace svx;
-TextCharacterSpacingPopup::TextCharacterSpacingPopup (
- vcl::Window* pParent,
- const ::std::function<VclPtr<PopupControl>(PopupContainer*)>& rControlCreator)
- : Popup(
- pParent,
- rControlCreator,
- OUString( "Character Spacing"))
+SFX_IMPL_TOOLBOX_CONTROL(TextCharacterSpacingPopup, SvxKerningItem);
+
+TextCharacterSpacingPopup::TextCharacterSpacingPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
+ : SfxToolBoxControl(nSlotId, nId, rTbx)
{
- SetPopupModeEndHandler([this] () { return this->PopupModeEndCallback(); });
+ rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId));
}
TextCharacterSpacingPopup::~TextCharacterSpacingPopup()
{
}
-void TextCharacterSpacingPopup::Rearrange (bool bLBAvailable,bool bAvailable, long nKerning)
+VclPtr<SfxPopupWindow> TextCharacterSpacingPopup::CreatePopupWindow()
{
- ProvideContainerAndControl();
+ VclPtr<TextCharacterSpacingControl> pControl = VclPtr<TextCharacterSpacingControl>::Create(GetSlotId());
- TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mxControl.get());
- if (pControl != nullptr)
- pControl->Rearrange(bLBAvailable,bAvailable,nKerning);
-}
+ pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus|FloatWinPopupFlags::NoAppFocusClose);
-void TextCharacterSpacingPopup::PopupModeEndCallback()
-{
- ProvideContainerAndControl();
- TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mxControl.get());
- if (pControl == nullptr)
- return;
+ SetPopupWindow(pControl);
- if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT)
- {
- SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
- css::uno::Sequence < css::beans::NamedValue > aSeq
- { { "Spacing", css::uno::makeAny(OUString::number(pControl->GetLastCustomValue())) } };
- aWinOpt.SetUserData( aSeq );
-
- }
+ return pControl;
}
-} } // end of namespace svx::sidebar
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */