[Libreoffice-commits] core.git: 5 commits - include/svx officecfg/registry sc/source sd/source svx/source svx/util sw/source
Maxim Monastirsky
momonasmon at gmail.com
Wed Jan 4 22:12:32 UTC 2017
include/svx/dialogs.hrc | 10
include/svx/linectrl.hxx | 62 -
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 11
sc/source/ui/app/scdll.cxx | 1
sd/source/ui/app/sddll.cxx | 2
svx/source/tbxctrls/extrusioncontrols.src | 5
svx/source/tbxctrls/linectrl.cxx | 333 +++-------
svx/source/tbxctrls/tbcontrl.cxx | 50 -
svx/source/tbxctrls/tbcontrl.src | 30
svx/util/svx.component | 4
sw/source/uibase/app/swmodule.cxx | 1
11 files changed, 162 insertions(+), 347 deletions(-)
New commits:
commit 9ae8e4d35681890c5db153c53c74377428fa31d4
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Dec 25 03:11:31 2016 +0200
Base SvxLineEndWindow on ToolbarPopup
Fixes size and position issues under gtk3/wayland
Change-Id: I357a5935e2b44fd3d5effde8cf7d3499e26384db
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index bc6f82b..2c47611 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -72,62 +72,6 @@ public:
virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) override;
};
-
-// class SvxLineEndWindow
-
-class SvxLineEndWindow : public SfxPopupWindow
-{
-private:
- XLineEndListRef mpLineEndList;
- VclPtr<ValueSet> mpLineEndSet;
- sal_uInt16 mnCols;
- sal_uInt16 mnLines;
- Size maBmpSize;
- css::uno::Reference< css::frame::XFrame > mxFrame;
-
-
- DECL_LINK( SelectHdl, ValueSet*, void );
- void FillValueSet();
- void SetSize();
- void implInit();
-
-protected:
- /** This function is called when the window gets the focus. It grabs
- the focus to the line ends value set so that it can be controlled with
- the keyboard.
- */
- virtual void GetFocus() override;
-
-public:
- SvxLineEndWindow( sal_uInt16 nId,
- const css::uno::Reference< css::frame::XFrame >& rFrame,
- vcl::Window* pParentWindow,
- const OUString& rWndTitle );
- virtual ~SvxLineEndWindow() override;
- virtual void dispose() override;
-
- void StartSelection();
-
- virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
-};
-
-
-// class SvxLineEndToolBoxControl
-
-
-class SVX_DLLPUBLIC SvxLineEndToolBoxControl : public SfxToolBoxControl
-{
-public:
- SFX_DECL_TOOLBOX_CONTROL();
- SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
- virtual ~SvxLineEndToolBoxControl() override;
-
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState ) override;
- virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
-};
-
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 631d5a2..2ec77ea 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1130,6 +1130,17 @@
<value>com.sun.star.comp.sfx2.ClassificationCategoriesController</value>
</prop>
</node>
+ <node oor:name="LineEndToolBoxControl" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:LineEndStyle</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.LineEndToolBoxControl</value>
+ </prop>
+ </node>
<node oor:name="BorderStyleToolBoxControl" oor:op="replace">
<prop oor:name="Command">
<value>.uno:SetBorderStyle</value>
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 6bec013..0d9df65 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -162,7 +162,6 @@ void ScDLL::Init()
SvxLineWidthToolBoxControl ::RegisterControl(0, pMod);
SvxColorToolBoxControl ::RegisterControl(SID_ATTR_LINE_COLOR, pMod);
SvxColorToolBoxControl ::RegisterControl(SID_ATTR_FILL_COLOR, pMod);
- SvxLineEndToolBoxControl ::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod);
SvxStyleToolBoxControl ::RegisterControl(SID_STYLE_APPLY, pMod);
SvxColorToolBoxControl ::RegisterControl(SID_ATTR_CHAR_COLOR, pMod);
SvxColorToolBoxControl ::RegisterControl(SID_BACKGROUND_COLOR, pMod);
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 97a4e08d..1f467d7 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -186,8 +186,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
SvxColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod);
SvxColorToolBoxControl::RegisterControl(SID_ATTR_FILL_COLOR, pMod);
- SvxLineEndToolBoxControl::RegisterControl( SID_ATTR_LINEEND_STYLE, pMod );
-
SvxStyleToolBoxControl::RegisterControl(0, pMod);
SvxColorToolBoxControl::RegisterControl( SID_ATTR_CHAR_COLOR, pMod );
SvxColorToolBoxControl::RegisterControl( SID_ATTR_CHAR_BACK_COLOR, pMod );
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 76b022e..53dd837 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -24,6 +24,9 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/objsh.hxx>
+#include <svtools/toolbarmenu.hxx>
+#include <svtools/popupwindowcontroller.hxx>
+
#include <svx/dialogs.hrc>
#include "helpid.hrc"
@@ -49,7 +52,6 @@ using namespace ::com::sun::star;
SFX_IMPL_TOOLBOX_CONTROL( SvxLineStyleToolBoxControl, XLineStyleItem );
SFX_IMPL_TOOLBOX_CONTROL( SvxLineWidthToolBoxControl, XLineWidthItem );
-SFX_IMPL_TOOLBOX_CONTROL( SvxLineEndToolBoxControl, SfxBoolItem );
SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( sal_uInt16 nSlotId,
sal_uInt16 nId,
@@ -243,31 +245,42 @@ VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *p
return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get();
}
-SvxLineEndWindow::SvxLineEndWindow(
- sal_uInt16 nSlotId,
- const Reference< XFrame >& rFrame,
- vcl::Window* pParentWindow,
- const OUString& rWndTitle ) :
- SfxPopupWindow( nSlotId,
- rFrame,
- pParentWindow,
- WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
+class SvxLineEndWindow : public svtools::ToolbarPopup
+{
+private:
+ XLineEndListRef mpLineEndList;
+ VclPtr<ValueSet> mpLineEndSet;
+ sal_uInt16 mnCols;
+ sal_uInt16 mnLines;
+ Size maBmpSize;
+ svt::ToolboxController& mrController;
+
+ DECL_LINK( SelectHdl, ValueSet*, void );
+ void FillValueSet();
+ void SetSize();
+
+protected:
+ virtual void GetFocus() override;
+
+public:
+ SvxLineEndWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow );
+ virtual ~SvxLineEndWindow() override;
+ virtual void dispose() override;
+ virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override;
+};
+
+SvxLineEndWindow::SvxLineEndWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow )
+ : ToolbarPopup ( rController.getFrameInterface(), pParentWindow, WB_STDPOPUP | WB_MOVEABLE | WB_CLOSEABLE ),
mpLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )),
mnCols ( 2 ),
mnLines ( 12 ),
- mxFrame ( rFrame )
-{
- SetText( rWndTitle );
- implInit();
-}
-
-void SvxLineEndWindow::implInit()
+ mrController ( rController )
{
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
-
+ SetText( SVX_RESSTR( RID_SVXSTR_LINEEND ) );
SetHelpId( HID_POPUP_LINEEND );
mpLineEndSet->SetHelpId( HID_POPUP_LINEEND_CTRL );
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_LINEEND_LIST );
@@ -284,7 +297,6 @@ void SvxLineEndWindow::implInit()
AddStatusListener( ".uno:LineEndListState");
- //ChangeHelpId( HID_POPUP_LINEENDSTYLE );
mpLineEndSet->Show();
}
@@ -296,7 +308,7 @@ SvxLineEndWindow::~SvxLineEndWindow()
void SvxLineEndWindow::dispose()
{
mpLineEndSet.disposeAndClear();
- SfxPopupWindow::dispose();
+ ToolbarPopup::dispose();
}
IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
@@ -348,12 +360,9 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
while in Dispatch()), accessing members will crash in this case. */
mpLineEndSet->SetNoSelection();
- SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
- ".uno:LineEndStyle",
- aArgs );
+ mrController.dispatchCommand( mrController.getCommandURL(), aArgs );
}
-
void SvxLineEndWindow::FillValueSet()
{
if( mpLineEndList.is() )
@@ -402,13 +411,8 @@ void SvxLineEndWindow::FillValueSet()
}
}
-void SvxLineEndWindow::StartSelection()
-{
- mpLineEndSet->StartSelection();
-}
-
-
void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
+ throw ( css::uno::RuntimeException, std::exception )
{
if ( rEvent.FeatureURL.Complete == ".uno:LineEndListState" )
{
@@ -449,46 +453,68 @@ void SvxLineEndWindow::SetSize()
void SvxLineEndWindow::GetFocus()
{
- SfxPopupWindow::GetFocus();
- // Grab the focus to the line ends value set so that it can be controlled
- // with the keyboard.
if ( mpLineEndSet )
+ {
mpLineEndSet->GrabFocus();
+ mpLineEndSet->StartSelection();
+ }
}
-SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) :
- SfxToolBoxControl( nSlotId, nId, rTbx )
+class SvxLineEndToolBoxControl : public svt::PopupWindowController
{
- rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits( nId ) );
- rTbx.Invalidate();
-}
+public:
+ explicit SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) override;
-SvxLineEndToolBoxControl::~SvxLineEndToolBoxControl()
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw ( css::uno::RuntimeException, std::exception ) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException, std::exception ) override;
+
+private:
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
+ using svt::ToolboxController::createPopupWindow;
+};
+
+SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext )
+ : svt::PopupWindowController( rContext, nullptr, OUString() )
{
}
+void SvxLineEndToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>& rArguments )
+ throw ( css::uno::Exception, css::uno::RuntimeException, std::exception )
+{
+ svt::PopupWindowController::initialize( rArguments );
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
+}
-VclPtr<SfxPopupWindow> SvxLineEndToolBoxControl::CreatePopupWindow()
+VclPtr<vcl::Window> SvxLineEndToolBoxControl::createPopupWindow( vcl::Window* pParent )
{
- VclPtrInstance<SvxLineEndWindow> pLineEndWin( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
- pLineEndWin->StartPopupMode( &GetToolBox(),
- FloatWinPopupFlags::GrabFocus |
- FloatWinPopupFlags::AllowTearOff |
- FloatWinPopupFlags::NoAppFocusClose );
- pLineEndWin->StartSelection();
- SetPopupWindow( pLineEndWin );
- return pLineEndWin;
+ return VclPtr<SvxLineEndWindow>::Create( *this, pParent );
}
+OUString SvxLineEndToolBoxControl::getImplementationName()
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ return OUString( "com.sun.star.comp.svx.LineEndToolBoxControl" );
+}
-void SvxLineEndToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* )
+css::uno::Sequence<OUString> SvxLineEndToolBoxControl::getSupportedServiceNames()
+ throw ( css::uno::RuntimeException, std::exception )
{
- sal_uInt16 nId = GetId();
- ToolBox& rTbx = GetToolBox();
+ return { "com.sun.star.frame.ToolbarController" };
+}
- rTbx.EnableItem( nId, SfxItemState::DISABLED != eState );
- rTbx.SetItemState( nId, ( SfxItemState::DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE );
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation(
+ css::uno::XComponentContext* rContext,
+ css::uno::Sequence<css::uno::Any> const & )
+{
+ return cppu::acquire( new SvxLineEndToolBoxControl( rContext ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/util/svx.component b/svx/util/svx.component
index eeecf60..bc5bbb2 100644
--- a/svx/util/svx.component
+++ b/svx/util/svx.component
@@ -100,4 +100,8 @@
constructor="com_sun_star_comp_svx_SmartTagMenuController_get_implementation">
<service name="com.sun.star.frame.PopupMenuController"/>
</implementation>
+ <implementation name="com.sun.star.comp.svx.LineEndToolBoxControl"
+ constructor="com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
</component>
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index de6a738..bd57486 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -309,7 +309,6 @@ void SwDLL::RegisterControls()
SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
SvxColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
- SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod );
SvxColorToolBoxControl::RegisterControl(SID_ATTR_FILL_COLOR, pMod);
SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_BACK_COLOR, pMod);
commit 835556b51afd21f47b1bd1910cad0b7389ca04a8
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Dec 25 02:23:49 2016 +0200
Prefix SvxLineEndWindow members
Change-Id: I0cfe88c65cc75757938a9f8004c219fbe39f88dd
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index 1b154aa..bc6f82b 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -78,11 +78,11 @@ public:
class SvxLineEndWindow : public SfxPopupWindow
{
private:
- XLineEndListRef pLineEndList;
- VclPtr<ValueSet> aLineEndSet;
- sal_uInt16 nCols;
- sal_uInt16 nLines;
- Size aBmpSize;
+ XLineEndListRef mpLineEndList;
+ VclPtr<ValueSet> mpLineEndSet;
+ sal_uInt16 mnCols;
+ sal_uInt16 mnLines;
+ Size maBmpSize;
css::uno::Reference< css::frame::XFrame > mxFrame;
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 2986514..76b022e 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -252,9 +252,9 @@ SvxLineEndWindow::SvxLineEndWindow(
rFrame,
pParentWindow,
WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
- aLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )),
- nCols ( 2 ),
- nLines ( 12 ),
+ mpLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )),
+ mnCols ( 2 ),
+ mnLines ( 12 ),
mxFrame ( rFrame )
{
SetText( rWndTitle );
@@ -266,18 +266,18 @@ void SvxLineEndWindow::implInit()
SfxObjectShell* pDocSh = SfxObjectShell::Current();
SetHelpId( HID_POPUP_LINEEND );
- aLineEndSet->SetHelpId( HID_POPUP_LINEEND_CTRL );
+ mpLineEndSet->SetHelpId( HID_POPUP_LINEEND_CTRL );
if ( pDocSh )
{
const SfxPoolItem* pItem = pDocSh->GetItem( SID_LINEEND_LIST );
if( pItem )
- pLineEndList = static_cast<const SvxLineEndListItem*>( pItem )->GetLineEndList();
+ mpLineEndList = static_cast<const SvxLineEndListItem*>( pItem )->GetLineEndList();
}
- DBG_ASSERT( pLineEndList.is(), "LineEndList not found" );
+ DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
- aLineEndSet->SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
- aLineEndSet->SetColCount( nCols );
+ mpLineEndSet->SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
+ mpLineEndSet->SetColCount( mnCols );
// ValueSet fill with entries of LineEndList
FillValueSet();
@@ -285,7 +285,7 @@ void SvxLineEndWindow::implInit()
AddStatusListener( ".uno:LineEndListState");
//ChangeHelpId( HID_POPUP_LINEENDSTYLE );
- aLineEndSet->Show();
+ mpLineEndSet->Show();
}
SvxLineEndWindow::~SvxLineEndWindow()
@@ -295,7 +295,7 @@ SvxLineEndWindow::~SvxLineEndWindow()
void SvxLineEndWindow::dispose()
{
- aLineEndSet.disposeAndClear();
+ mpLineEndSet.disposeAndClear();
SfxPopupWindow::dispose();
}
@@ -303,7 +303,7 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
{
std::unique_ptr<XLineEndItem> pLineEndItem;
std::unique_ptr<XLineStartItem> pLineStartItem;
- sal_uInt16 nId = aLineEndSet->GetSelectItemId();
+ sal_uInt16 nId = mpLineEndSet->GetSelectItemId();
if( nId == 1 )
{
@@ -315,12 +315,12 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
}
else if( nId % 2 ) // beginning of line
{
- const XLineEndEntry* pEntry = pLineEndList->GetLineEnd( (nId - 1) / 2 - 1 );
+ const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd( (nId - 1) / 2 - 1 );
pLineStartItem.reset(new XLineStartItem(pEntry->GetName(), pEntry->GetLineEnd()));
}
else // end of line
{
- const XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nId / 2 - 2 );
+ const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd( nId / 2 - 2 );
pLineEndItem.reset(new XLineEndItem(pEntry->GetName(), pEntry->GetLineEnd()));
}
@@ -346,7 +346,7 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
/* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
This instance may be deleted in the meantime (i.e. when a dialog is opened
while in Dispatch()), accessing members will crash in this case. */
- aLineEndSet->SetNoSelection();
+ mpLineEndSet->SetNoSelection();
SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
".uno:LineEndStyle",
@@ -356,47 +356,47 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
void SvxLineEndWindow::FillValueSet()
{
- if( pLineEndList.is() )
+ if( mpLineEndList.is() )
{
ScopedVclPtrInstance< VirtualDevice > pVD;
- long nCount = pLineEndList->Count();
+ long nCount = mpLineEndList->Count();
// First entry: no line end.
// An entry is temporarly added to get the UI bitmap
basegfx::B2DPolyPolygon aNothing;
- pLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aNothing, SVX_RESSTR(RID_SVXSTR_NONE)));
- const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nCount);
- Bitmap aBmp = pLineEndList->GetUiBitmap( nCount );
+ mpLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aNothing, SVX_RESSTR(RID_SVXSTR_NONE)));
+ const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(nCount);
+ Bitmap aBmp = mpLineEndList->GetUiBitmap( nCount );
OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
- aBmpSize = aBmp.GetSizePixel();
- pVD->SetOutputSizePixel( aBmpSize, false );
- aBmpSize.Width() = aBmpSize.Width() / 2;
+ maBmpSize = aBmp.GetSizePixel();
+ pVD->SetOutputSizePixel( maBmpSize, false );
+ maBmpSize.Width() = maBmpSize.Width() / 2;
Point aPt0( 0, 0 );
- Point aPt1( aBmpSize.Width(), 0 );
+ Point aPt1( maBmpSize.Width(), 0 );
pVD->DrawBitmap( Point(), aBmp );
- aLineEndSet->InsertItem(1, Image(pVD->GetBitmap(aPt0, aBmpSize)), pEntry->GetName());
- aLineEndSet->InsertItem(2, Image(pVD->GetBitmap(aPt1, aBmpSize)), pEntry->GetName());
+ mpLineEndSet->InsertItem(1, Image(pVD->GetBitmap(aPt0, maBmpSize)), pEntry->GetName());
+ mpLineEndSet->InsertItem(2, Image(pVD->GetBitmap(aPt1, maBmpSize)), pEntry->GetName());
- pLineEndList->Remove(nCount);
+ mpLineEndList->Remove(nCount);
for( long i = 0; i < nCount; i++ )
{
- pEntry = pLineEndList->GetLineEnd( i );
+ pEntry = mpLineEndList->GetLineEnd( i );
DBG_ASSERT( pEntry, "Could not access LineEndEntry" );
- aBmp = pLineEndList->GetUiBitmap( i );
+ aBmp = mpLineEndList->GetUiBitmap( i );
OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
pVD->DrawBitmap( aPt0, aBmp );
- aLineEndSet->InsertItem((sal_uInt16)((i+1L)*2L+1L),
- Image(pVD->GetBitmap(aPt0, aBmpSize)), pEntry->GetName());
- aLineEndSet->InsertItem((sal_uInt16)((i+2L)*2L),
- Image(pVD->GetBitmap(aPt1, aBmpSize)), pEntry->GetName());
+ mpLineEndSet->InsertItem((sal_uInt16)((i+1L)*2L+1L),
+ Image(pVD->GetBitmap(aPt0, maBmpSize)), pEntry->GetName());
+ mpLineEndSet->InsertItem((sal_uInt16)((i+2L)*2L),
+ Image(pVD->GetBitmap(aPt1, maBmpSize)), pEntry->GetName());
}
- nLines = std::min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
- aLineEndSet->SetLineCount( nLines );
+ mnLines = std::min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
+ mpLineEndSet->SetLineCount( mnLines );
SetSize();
}
@@ -404,7 +404,7 @@ void SvxLineEndWindow::FillValueSet()
void SvxLineEndWindow::StartSelection()
{
- aLineEndSet->StartSelection();
+ mpLineEndSet->StartSelection();
}
@@ -416,10 +416,10 @@ void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEven
css::uno::Reference< css::uno::XWeak > xWeak;
if ( rEvent.State >>= xWeak )
{
- pLineEndList.set( static_cast< XLineEndList* >( xWeak.get() ) );
- DBG_ASSERT( pLineEndList.is(), "LineEndList not found" );
+ mpLineEndList.set( static_cast< XLineEndList* >( xWeak.get() ) );
+ DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
- aLineEndSet->Clear();
+ mpLineEndSet->Clear();
FillValueSet();
}
}
@@ -427,21 +427,21 @@ void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEven
void SvxLineEndWindow::SetSize()
{
- sal_uInt16 nItemCount = aLineEndSet->GetItemCount();
- sal_uInt16 nMaxLines = nItemCount / nCols;
+ sal_uInt16 nItemCount = mpLineEndSet->GetItemCount();
+ sal_uInt16 nMaxLines = nItemCount / mnCols;
- WinBits nBits = aLineEndSet->GetStyle();
- if ( nLines == nMaxLines )
+ WinBits nBits = mpLineEndSet->GetStyle();
+ if ( mnLines == nMaxLines )
nBits &= ~WB_VSCROLL;
else
nBits |= WB_VSCROLL;
- aLineEndSet->SetStyle( nBits );
+ mpLineEndSet->SetStyle( nBits );
- Size aSize( aBmpSize );
+ Size aSize( maBmpSize );
aSize.Width() += 6;
aSize.Height() += 6;
- aSize = aLineEndSet->CalcWindowSizePixel( aSize );
- aLineEndSet->SetPosSizePixel( Point( 2, 2 ), aSize );
+ aSize = mpLineEndSet->CalcWindowSizePixel( aSize );
+ mpLineEndSet->SetPosSizePixel( Point( 2, 2 ), aSize );
aSize.Width() += 4;
aSize.Height() += 4;
SetOutputSizePixel( aSize );
@@ -452,8 +452,8 @@ void SvxLineEndWindow::GetFocus()
SfxPopupWindow::GetFocus();
// Grab the focus to the line ends value set so that it can be controlled
// with the keyboard.
- if ( aLineEndSet )
- aLineEndSet->GrabFocus();
+ if ( mpLineEndSet )
+ mpLineEndSet->GrabFocus();
}
SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) :
commit 9e4ae869f45fdd1d6e9f268bb3d6a531e76cf752
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Dec 25 01:59:42 2016 +0200
Get rid of SvxLineEndWindow resizing
Change-Id: I0135f084f64b9709688f0f9205940baf193c5d83
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index 99c4dbc..1b154aa 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -83,8 +83,6 @@ private:
sal_uInt16 nCols;
sal_uInt16 nLines;
Size aBmpSize;
- bool bPopupMode;
- bool mbInResize;
css::uno::Reference< css::frame::XFrame > mxFrame;
@@ -94,10 +92,6 @@ private:
void implInit();
protected:
- virtual void Resizing( Size& rSize ) override;
- virtual void Resize() override;
- virtual void PopupModeEnd() override;
-
/** This function is called when the window gets the focus. It grabs
the focus to the line ends value set so that it can be controlled with
the keyboard.
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 3e73166..2986514 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -255,8 +255,6 @@ SvxLineEndWindow::SvxLineEndWindow(
aLineEndSet ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )),
nCols ( 2 ),
nLines ( 12 ),
- bPopupMode ( true ),
- mbInResize ( false ),
mxFrame ( rFrame )
{
SetText( rWndTitle );
@@ -404,79 +402,6 @@ void SvxLineEndWindow::FillValueSet()
}
}
-
-void SvxLineEndWindow::Resize()
-{
- // since we change the size inside this call, check if we
- // are called recursive
- if( !mbInResize )
- {
- mbInResize = true;
- if ( !IsRollUp() )
- {
- aLineEndSet->SetColCount( nCols );
- aLineEndSet->SetLineCount( nLines );
-
- SetSize();
-
- Size aSize = GetOutputSizePixel();
- aSize.Width() -= 4;
- aSize.Height() -= 4;
- aLineEndSet->SetPosSizePixel( Point( 2, 2 ), aSize );
- }
- //SfxPopupWindow::Resize();
- mbInResize = false;
- }
-}
-
-
-void SvxLineEndWindow::Resizing( Size& rNewSize )
-{
- Size aBitmapSize = aBmpSize; // -> Member
- aBitmapSize.Width() += 6;
- aBitmapSize.Height() += 6;
-
- Size aItemSize = aLineEndSet->CalcItemSizePixel( aBitmapSize ); // -> Member
- //Size aOldSize = GetOutputSizePixel(); // for width
-
- sal_uInt16 nItemCount = aLineEndSet->GetItemCount(); // -> Member
-
- // identify columns
- long nItemW = aItemSize.Width();
- long nW = rNewSize.Width();
- nCols = (sal_uInt16) std::max( ( (sal_uIntPtr)(( nW + nItemW ) / ( nItemW * 2 ) )),
- (sal_uIntPtr) 1L );
- nCols *= 2;
-
- // identify lines
- long nItemH = aItemSize.Height();
- long nH = rNewSize.Height();
- nLines = (sal_uInt16) std::max( ( ( nH + nItemH / 2 ) / nItemH ), 1L );
-
- sal_uInt16 nMaxCols = nItemCount / nLines;
- if( nItemCount % nLines )
- nMaxCols++;
- if( nCols > nMaxCols )
- nCols = nMaxCols;
- nW = nItemW * nCols;
-
- // No odd number of columns
- if( nCols % 2 )
- nCols--;
- nCols = std::max( nCols, (sal_uInt16) 2 );
-
- sal_uInt16 nMaxLines = nItemCount / nCols;
- if( nItemCount % nCols )
- nMaxLines++;
- if( nLines > nMaxLines )
- nLines = nMaxLines;
- nH = nItemH * nLines;
-
- rNewSize.Width() = nW;
- rNewSize.Height() = nH;
-}
-
-
void SvxLineEndWindow::StartSelection()
{
aLineEndSet->StartSelection();
@@ -496,54 +421,30 @@ void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEven
aLineEndSet->Clear();
FillValueSet();
-
- Size aSize = GetOutputSizePixel();
- Resizing( aSize );
- Resize();
}
}
}
-
-void SvxLineEndWindow::PopupModeEnd()
-{
- if ( IsVisible() )
- {
- bPopupMode = false;
- SetSize();
- }
- SfxPopupWindow::PopupModeEnd();
-}
-
-
void SvxLineEndWindow::SetSize()
{
- //if( !bPopupMode )
- if( !IsInPopupMode() )
- {
- sal_uInt16 nItemCount = aLineEndSet->GetItemCount(); // -> Member
- sal_uInt16 nMaxLines = nItemCount / nCols; // -> Member ?
- if( nItemCount % nCols )
- nMaxLines++;
-
- WinBits nBits = aLineEndSet->GetStyle();
- if ( nLines == nMaxLines )
- nBits &= ~WB_VSCROLL;
- else
- nBits |= WB_VSCROLL;
- aLineEndSet->SetStyle( nBits );
- }
+ sal_uInt16 nItemCount = aLineEndSet->GetItemCount();
+ sal_uInt16 nMaxLines = nItemCount / nCols;
+
+ WinBits nBits = aLineEndSet->GetStyle();
+ if ( nLines == nMaxLines )
+ nBits &= ~WB_VSCROLL;
+ else
+ nBits |= WB_VSCROLL;
+ aLineEndSet->SetStyle( nBits );
Size aSize( aBmpSize );
aSize.Width() += 6;
aSize.Height() += 6;
aSize = aLineEndSet->CalcWindowSizePixel( aSize );
+ aLineEndSet->SetPosSizePixel( Point( 2, 2 ), aSize );
aSize.Width() += 4;
aSize.Height() += 4;
SetOutputSizePixel( aSize );
- aSize.Height() = aBmpSize.Height();
- aSize.Height() += 14;
- //SetMinOutputSizePixel( aSize );
}
void SvxLineEndWindow::GetFocus()
commit 697590be0903edbf23b35be7a9c48910d59b938b
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sat Dec 24 19:46:34 2016 +0200
Support icon theme change in a floating border control
was unintentionally broken by
64a2dc962cd68c86281ed747d3dc96bc996115eb
Change-Id: I3358d8104dd1e2200f84019a2c4c41f1e0019399
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index bacad89..3362174b 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -273,6 +273,7 @@ public:
virtual void dispose() override;
virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
};
class SvxLineWindow_Impl : public svtools::ToolbarPopup
@@ -1754,6 +1755,20 @@ void SvxFrameWindow_Impl::KeyInput( const KeyEvent& rKEvt )
aFrameSet->KeyInput( rKEvt );
}
+void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ToolbarPopup::DataChanged( rDCEvt );
+
+ if ( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) )
+ {
+ InitImageList();
+
+ sal_uInt16 nNumOfItems = aFrameSet->GetItemCount();
+ for ( sal_uInt16 i = 1 ; i <= nNumOfItems ; ++i )
+ aFrameSet->SetItemImage( i, Image(aImgVec[i-1]) );
+ }
+}
+
enum class FrmValidFlags {
NONE = 0x00,
Left = 0x01,
commit a487e548a0e8c40320cd44b2c7779787e9c0f860
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Wed Dec 28 15:51:17 2016 +0200
Use command labels for the color popup title
Change-Id: I2f61e25ef4451775320f8fa1761a951ab94af7d5
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 437db03..64fee58 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -243,16 +243,12 @@
// Strings of the ToolBox-Controls from tbcontrl.cxx
#define RID_SVXSTR_FILLPATTERN (RID_SVX_START + 191)
#define RID_SVXSTR_FRAME (RID_SVX_START + 192)
-#define RID_SVXSTR_FRAME_COLOR (RID_SVX_START + 194)
#define RID_SVXSTR_FRAME_STYLE (RID_SVX_START + 195)
-#define RID_SVXSTR_EXTRAS_CHARBACKGROUND (RID_SVX_START + 196)
#define RID_SVXSTR_CLEARFORM (RID_SVX_START + 197)
#define RID_SVXSTR_MORE (RID_SVX_START + 198)
#define RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE (RID_SVX_START + 199)
#define RID_SVXSTR_CHARFONTNAME (RID_SVX_START + 200)
-#define RID_SVXSTR_LINECOLOR (RID_SVX_START + 201)
#define RID_SVXSTR_MORE_STYLES (RID_SVX_START + 202)
-#define RID_SVXSTR_FILLCOLOR (RID_SVX_START + 203)
#define RID_SVXSTR_MORENUMBERING (RID_SVX_START + 204)
#define RID_SVXSTR_MOREBULLETS (RID_SVX_START + 205)
@@ -384,8 +380,6 @@
#define STR_INSERT_SOUND_TITLE (RID_SVX_START + 529)
#define STR_INSERT_VIDEO_TITLE (RID_SVX_START + 530)
-#define RID_SVXSTR_BACKGROUND (RID_SVX_START + 531)
-
#define RID_SVXIMG_WIRE_FRAME (RID_SVX_START + 532)
#define RID_SVXIMG_MATTE (RID_SVX_START + 533)
#define RID_SVXIMG_PLASTIC (RID_SVX_START + 534)
@@ -885,8 +879,6 @@
#define RID_SVX_EXTRUSION_BAR (RID_SVX_START + 986)
#define RID_SVX_FONTWORK_BAR (RID_SVX_START + 987)
-#define RID_SVXSTR_EXTRUSION_COLOR (RID_SVX_START + 991)
-
#define RID_SVXSTR_DEPTH_0 (RID_SVX_START + 992)
#define RID_SVXSTR_DEPTH_1 (RID_SVX_START + 993)
#define RID_SVXSTR_DEPTH_2 (RID_SVX_START + 994)
@@ -949,8 +941,6 @@
#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 6)//?
#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 7)//?
-#define RID_SVXSTR_TEXTCOLOR (RID_SVX_START + 1178)
-
#define RID_SVXSTR_FINDBAR_SEARCHFORMATTED (RID_SVX_START + 1188)
#define RID_SVXSTR_FINDBAR_MATCHCASE (RID_SVX_START + 1189)
#define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190)
diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src
index 7dfc57d..8760914 100644
--- a/svx/source/tbxctrls/extrusioncontrols.src
+++ b/svx/source/tbxctrls/extrusioncontrols.src
@@ -355,11 +355,6 @@ Image RID_SVXIMG_DEPTH_INFINITY
ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; };
};
-String RID_SVXSTR_EXTRUSION_COLOR
-{
- Text [ en-US ] = "Extrusion Color";
-};
-
String RID_SVXSTR_DEPTH_0
{
Text [ en-US ] = "~0 cm";
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index fcbbd75..bacad89 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -25,6 +25,7 @@
#include <svl/poolitem.hxx>
#include <svl/eitem.hxx>
#include <svl/itemset.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/bitmapaccess.hxx>
#include <vcl/menubtn.hxx>
@@ -1309,39 +1310,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
}
}
- OUString aWindowTitle;
- switch ( theSlotId )
- {
- case SID_ATTR_CHAR_COLOR:
- case SID_ATTR_CHAR_COLOR2:
- aWindowTitle = SVX_RESSTR( RID_SVXSTR_TEXTCOLOR );
- break;
-
- case SID_ATTR_CHAR_COLOR_BACKGROUND:
- case SID_ATTR_CHAR_BACK_COLOR:
- aWindowTitle = SVX_RESSTR( RID_SVXSTR_EXTRAS_CHARBACKGROUND );
- break;
-
- case SID_BACKGROUND_COLOR:
- aWindowTitle = SVX_RESSTR( RID_SVXSTR_BACKGROUND );
- break;
-
- case SID_FRAME_LINECOLOR:
- aWindowTitle = SVX_RESSTR( RID_SVXSTR_FRAME_COLOR );
- break;
-
- case SID_EXTRUSION_3D_COLOR:
- aWindowTitle = SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR );
- break;
-
- case SID_ATTR_LINE_COLOR:
- aWindowTitle = SVX_RESSTR( RID_SVXSTR_LINECOLOR );
- break;
-
- case SID_ATTR_FILL_COLOR:
- aWindowTitle = SVX_RESSTR( RID_SVXSTR_FILLCOLOR );
- break;
- }
+ OUString aWindowTitle = vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, rFrame );
SetText( aWindowTitle );
mpColorSet->SetAccessibleName( aWindowTitle );
diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src
index c8447b2..f0c92ff 100644
--- a/svx/source/tbxctrls/tbcontrl.src
+++ b/svx/source/tbxctrls/tbcontrl.src
@@ -119,21 +119,6 @@ String RID_SVXSTR_FRAME_STYLE
Text [ en-US ] = "Border Style" ;
};
-String RID_SVXSTR_FRAME_COLOR
-{
- Text [ en-US ] = "Border Color" ;
-};
-
-String RID_SVXSTR_LINECOLOR
-{
- Text [ en-US ] = "Line Color" ;
-};
-
-String RID_SVXSTR_FILLCOLOR
-{
- Text [ en-US ] = "Fill Color" ;
-};
-
String RID_SVXSTR_MORENUMBERING
{
Text [ en-US ] = "More Numbering..." ;
@@ -178,16 +163,6 @@ Menu RID_SVX_PRESET_MENU
};
};
-String RID_SVXSTR_EXTRAS_CHARBACKGROUND
-{
- Text [ en-US ] = "Highlight Color" ;
-};
-
-String RID_SVXSTR_BACKGROUND
-{
- Text [ en-US ] = "Background";
-};
-
String RID_SVXSTR_AUTOMATIC
{
Text [ en-US ] = "Automatic";
@@ -247,11 +222,6 @@ String RID_SVXSTR_MORE
Text [ en-US ] = "More Options...";
};
-String RID_SVXSTR_TEXTCOLOR
-{
- Text [ en-US ] = "Font color";
-};
-
// This is duplicated in GenericCommands.xcu in officecfg.
String RID_SVXSTR_CHARFONTNAME
{
More information about the Libreoffice-commits
mailing list