summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-11-14 23:34:37 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2015-11-14 23:02:47 +0000
commit7272e8df62a12d6172b297d7a82a0265cd1bc44a (patch)
treec7d457a98fdaf19f90bd97558badc38ad9e61032
parent2faf5622664c322f0516dd2484fc154ae504049a (diff)
tdf#95403 Add Outline button
Change-Id: I0d5187ed34539a05ab9f2ffdfb89118df0aa3511 Reviewed-on: https://gerrit.libreoffice.org/19964 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
-rw-r--r--include/svx/svxids.hrc2
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu11
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu8
-rw-r--r--svx/sdi/svx.sdi47
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx2
-rw-r--r--svx/source/tbxctrls/bulletsnumbering.cxx97
-rw-r--r--sw/sdi/_textsh.sdi10
-rw-r--r--sw/source/uibase/shells/textsh1.cxx12
-rw-r--r--sw/source/uibase/shells/txtnum.cxx13
-rw-r--r--sw/uiconfig/swriter/toolbar/textobjectbar.xml1
10 files changed, 159 insertions, 44 deletions
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index c6338220c563..1ec7daa1bda6 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -222,6 +222,7 @@
#define FN_NUM_NUMBERING_ON (FN_EDIT + 44) /* Numerierung an */
#define FN_BUL_NUM_RULE_INDEX (FN_EDIT + 120) /* Achieving num rule index */
#define FN_NUM_NUM_RULE_INDEX (FN_EDIT + 121)
+#define FN_OUTLINE_RULE_INDEX (FN_EDIT + 122)
#define FN_INSERT (SID_SW_START + 300)
#define FN_DELETE_BOOKMARK (FN_INSERT + 1)
@@ -996,6 +997,7 @@
#define FN_SVX_SET_NUMBER ( SID_SVX_START + 1136 )
#define FN_SVX_SET_BULLET ( SID_SVX_START + 1137 )
+#define FN_SVX_SET_OUTLINE ( SID_SVX_START + 1138 )
#define SID_ATTR_BORDER_STYLES ( SID_SVX_START + 1140 )
#define SID_ATTR_BORDER_DEFAULT_WIDTH ( SID_SVX_START + 1141 )
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index c4f67118098e..6daf7197602d 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -563,6 +563,17 @@
<value>com.sun.star.comp.svx.NumberingToolBoxControl</value>
</prop>
</node>
+ <node oor:name="OutlineToolBox" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:SetOutline</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.NumberingToolBoxControl</value>
+ </prop>
+ </node>
<node oor:name="ExtrusionDirectionFloater" oor:op="replace">
<prop oor:name="Command">
<value>.uno:ExtrusionDirectionFloater</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index df59ee80d209..33949fd3a59d 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2405,6 +2405,14 @@
<value>15</value>
</prop>
</node>
+ <node oor:name=".uno:SetOutline" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Outline Presets</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>15</value>
+ </prop>
+ </node>
<node oor:name=".uno:BezierConvert" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Convert to Curve</value>
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index b5e87ad34615..51b6e8091ffe 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -16444,3 +16444,50 @@ SfxVoidItem ParaspaceIncrease SID_PARASPACE_INCREASE
ToolBoxConfig = TRUE,
GroupId = GID_FORMAT;
]
+
+SfxVoidItem SetOutline FN_SVX_SET_OUTLINE
+(SfxUInt16Item SetOutline FN_SVX_SET_OUTLINE)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+SfxUInt16Item CurrentOutlineType FN_OUTLINE_RULE_INDEX
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_ENUMERATION;
+]
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index 18884050b214..953f062a2095 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -246,6 +246,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
// Outline numbering has to be painted into the virtual device
// to get correct lines
// has to be made again
+ pVDev->SetLineColor(aBackColor);
pVDev->DrawRect(aOrgRect);
long nStartX = aOrgRect.TopLeft().X();
long nStartY = aOrgRect.TopLeft().Y();
@@ -352,6 +353,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
long nLineTop = nStartY + nRectHeight * aLinesArr[2 * i + 1]/100 ;
Point aLineLeft(aLeft.X(), nLineTop );
Point aLineRight(nStartX + nRectWidth * 90 /100, nLineTop );
+ pVDev->SetLineColor(COL_LIGHTGRAY);
pVDev->DrawLine(aLineLeft, aLineRight);
}
diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx
index f753f238697a..305f3a3af5ed 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -10,7 +10,7 @@
#include <com/sun/star/text/DefaultNumberingProvider.hpp>
#include <com/sun/star/text/XNumberingFormatter.hpp>
-#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <sfx2/imagemgr.hxx>
#include <svtools/popupwindowcontroller.hxx>
@@ -25,7 +25,7 @@ class NumberingToolBoxControl;
class NumberingPopup : public svtools::ToolbarMenu
{
- bool mbBulletItem;
+ NumberingPageType mePageType;
NumberingToolBoxControl& mrController;
VclPtr<SvxNumValueSet> mpValueSet;
DECL_LINK_TYPED( VSSelectToolbarMenuHdl, ToolbarMenu*, void );
@@ -34,7 +34,7 @@ class NumberingPopup : public svtools::ToolbarMenu
public:
NumberingPopup( NumberingToolBoxControl& rController,
const css::uno::Reference< css::frame::XFrame >& rFrame,
- vcl::Window* pParent, bool bBulletItem );
+ vcl::Window* pParent, NumberingPageType ePageType );
virtual ~NumberingPopup();
virtual void dispose() override;
@@ -44,7 +44,7 @@ public:
class NumberingToolBoxControl : public svt::PopupWindowController
{
- bool mbBulletItem;
+ NumberingPageType mePageType;
public:
explicit NumberingToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
@@ -71,31 +71,35 @@ public:
//class NumberingPopup
NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
const css::uno::Reference< css::frame::XFrame >& rFrame,
- vcl::Window* pParent, bool bBulletItem ) :
+ vcl::Window* pParent, NumberingPageType ePageType ) :
ToolbarMenu( rFrame, pParent, WB_STDPOPUP ),
- mbBulletItem( bBulletItem ),
+ mePageType( ePageType ),
mrController( rController )
{
WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT;
mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits );
- mpValueSet->init( mbBulletItem ? NumberingPageType::BULLET : NumberingPageType::SINGLENUM );
+ mpValueSet->init( mePageType );
- if ( !mbBulletItem )
+ if ( mePageType != NumberingPageType::BULLET )
{
- css::uno::Reference< css::text::XDefaultNumberingProvider > xDefNum = css::text::DefaultNumberingProvider::create( comphelper::getProcessComponentContext() );
+ css::uno::Reference< css::text::XDefaultNumberingProvider > xDefNum = css::text::DefaultNumberingProvider::create( mrController.getContext() );
if ( xDefNum.is() )
{
- css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aNumberings;
css::lang::Locale aLocale = GetSettings().GetLanguageTag().getLocale();
- try
+ css::uno::Reference< css::text::XNumberingFormatter > xFormat( xDefNum, css::uno::UNO_QUERY );
+
+ if ( mePageType == NumberingPageType::SINGLENUM )
{
- aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale );
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aNumberings(
+ xDefNum->getDefaultContinuousNumberingLevels( aLocale ) );
+ mpValueSet->SetNumberingSettings( aNumberings, xFormat, aLocale );
+ }
+ else if ( mePageType == NumberingPageType::OUTLINE )
+ {
+ css::uno::Sequence< css::uno::Reference< css::container::XIndexAccess > > aOutline(
+ xDefNum->getDefaultOutlineNumberings( aLocale ) );
+ mpValueSet->SetOutlineNumberingSettings( aOutline, xFormat, aLocale );
}
- catch( css::uno::Exception& )
- {}
-
- css::uno::Reference< css::text::XNumberingFormatter > xFormat( xDefNum, css::uno::UNO_QUERY );
- mpValueSet->SetNumberingSettings( aNumberings, xFormat, aLocale );
}
}
@@ -107,19 +111,28 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
appendEntry( 0, mpValueSet );
appendSeparator();
- if ( mbBulletItem )
- appendEntry( 1, SVX_RESSTR( RID_SVXSTR_MOREBULLETS ), ::GetImage( rFrame, ".uno:OutlineBullet", false ) );
+ OUString aMoreItemText;
+ if ( mePageType == NumberingPageType::BULLET )
+ {
+ aMoreItemText = SVX_RESSTR( RID_SVXSTR_MOREBULLETS );
+ AddStatusListener( ".uno:CurrentBulletListType" );
+ }
+ else if ( mePageType == NumberingPageType::SINGLENUM )
+ {
+ aMoreItemText = SVX_RESSTR( RID_SVXSTR_MORENUMBERING );
+ AddStatusListener( ".uno:CurrentNumListType" );
+ }
else
- appendEntry( 1, SVX_RESSTR( RID_SVXSTR_MORENUMBERING ), ::GetImage( rFrame, ".uno:OutlineBullet", false ) );
+ {
+ aMoreItemText = SVX_RESSTR( RID_SVXSTR_MORE );
+ AddStatusListener( ".uno:CurrentOutlineType" );
+ }
+
+ appendEntry( 1, aMoreItemText, ::GetImage( rFrame, ".uno:OutlineBullet", false ) );
SetOutputSizePixel( getMenuSize() );
mpValueSet->SetSelectHdl( LINK( this, NumberingPopup, VSSelectValueSetHdl ) );
SetSelectHdl( LINK( this, NumberingPopup, VSSelectToolbarMenuHdl ) );
-
- if ( mbBulletItem )
- AddStatusListener( ".uno:CurrentBulletListType" );
- else
- AddStatusListener( ".uno:CurrentNumListType" );
}
NumberingPopup::~NumberingPopup()
@@ -160,19 +173,21 @@ void NumberingPopup::VSSelectHdl(void* pControl)
if ( pControl == mpValueSet )
{
sal_uInt16 nSelItem = mpValueSet->GetSelectItemId();
- css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
- if ( mbBulletItem )
+ if ( mePageType == NumberingPageType::BULLET )
{
- aArgs[0].Name = "SetBullet";
- aArgs[0].Value <<= sal_uInt16( nSelItem );
+ auto aArgs( comphelper::InitPropertySequence( { { "SetBullet", css::uno::makeAny( nSelItem ) } } ) );
mrController.dispatchCommand( ".uno:SetBullet", aArgs );
}
- else
+ else if ( mePageType == NumberingPageType::SINGLENUM )
{
- aArgs[0].Name = "SetNumber";
- aArgs[0].Value <<= sal_uInt16( nSelItem );
+ auto aArgs( comphelper::InitPropertySequence( { { "SetNumber", css::uno::makeAny( nSelItem ) } } ) );
mrController.dispatchCommand( ".uno:SetNumber", aArgs );
}
+ else
+ {
+ auto aArgs( comphelper::InitPropertySequence( { { "SetOutline", css::uno::makeAny( nSelItem ) } } ) );
+ mrController.dispatchCommand( ".uno:SetOutline", aArgs );
+ }
}
else if ( getSelectedEntryId() == 1 )
{
@@ -183,9 +198,7 @@ void NumberingPopup::VSSelectHdl(void* pControl)
// Writer variants
aPageName = "options";
- css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
- aArgs[0].Name = "Page";
- aArgs[0].Value <<= aPageName;
+ auto aArgs( comphelper::InitPropertySequence( { { "Page", css::uno::makeAny( aPageName ) } } ) );
mrController.dispatchCommand( ".uno:OutlineBullet", aArgs );
}
}
@@ -194,13 +207,13 @@ void NumberingPopup::VSSelectHdl(void* pControl)
//class NumberingToolBoxControl
NumberingToolBoxControl::NumberingToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ):
svt::PopupWindowController( rxContext, css::uno::Reference< css::frame::XFrame >(), OUString() ),
- mbBulletItem( false )
+ mePageType( NumberingPageType::SINGLENUM )
{
}
VclPtr<vcl::Window> NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent )
{
- return VclPtr<NumberingPopup>::Create( *this, m_xFrame, pParent, mbBulletItem );
+ return VclPtr<NumberingPopup>::Create( *this, m_xFrame, pParent, mePageType );
}
bool NumberingToolBoxControl::IsInImpressDraw()
@@ -228,12 +241,16 @@ void SAL_CALL NumberingToolBoxControl::initialize( const css::uno::Sequence< css
{
svt::PopupWindowController::initialize( aArguments );
+ if ( m_aCommandURL == ".uno:DefaultBullet" )
+ mePageType = NumberingPageType::BULLET;
+ else if ( m_aCommandURL == ".uno:SetOutline" )
+ mePageType = NumberingPageType::OUTLINE;
+
+ ToolBoxItemBits nBits = ( mePageType == NumberingPageType::OUTLINE ) ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN;
ToolBox* pToolBox = nullptr;
sal_uInt16 nId = 0;
if ( getToolboxId( nId, &pToolBox ) )
- pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWN );
-
- mbBulletItem = m_aCommandURL == ".uno:DefaultBullet";
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | nBits );
}
OUString SAL_CALL NumberingToolBoxControl::getImplementationName()
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 3cd6d8f795a7..d27eae2981f5 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -736,6 +736,11 @@ interface BaseText
StateMethod = GetState ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
+ FN_OUTLINE_RULE_INDEX // status(final|play)
+ [
+ StateMethod = GetState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
FN_NUMBER_BULLETS // status(final|play)
[
ExecMethod = ExecEnterNum ;
@@ -804,6 +809,11 @@ interface BaseText
ExecMethod = ExecSetNumber;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
+ FN_SVX_SET_OUTLINE
+ [
+ ExecMethod = ExecSetNumber;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
SID_OUTLINE_BULLET // status(final|play)
[
ExecMethod = ExecEnterNum ;
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 3e3e2e3b1ba6..18656e218b45 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1828,6 +1828,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case FN_BUL_NUM_RULE_INDEX:
case FN_NUM_NUM_RULE_INDEX:
+ case FN_OUTLINE_RULE_INDEX:
{
SwNumRule* pCurRule = const_cast<SwNumRule*>(GetShell().GetNumRuleAtCurrCrsrPos());
sal_uInt16 nActNumLvl = USHRT_MAX;
@@ -1860,6 +1861,17 @@ void SwTextShell::GetState( SfxItemSet &rSet )
rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
}
}
+
+ if ( nWhich == FN_OUTLINE_RULE_INDEX )
+ {
+ rSet.Put(SfxUInt16Item(FN_OUTLINE_RULE_INDEX, USHRT_MAX));
+ NBOTypeMgrBase* pOutline = NBOutlineTypeMgrFact::CreateInstance(eNBOType::OUTLINE);
+ if ( pOutline )
+ {
+ const sal_uInt16 nIndex = pOutline->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
+ rSet.Put(SfxUInt16Item(FN_OUTLINE_RULE_INDEX,nIndex));
+ }
+ }
}
}
break;
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index acebe2535ad3..bf159472b88d 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -246,15 +246,20 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
{
case FN_SVX_SET_NUMBER:
case FN_SVX_SET_BULLET:
+ case FN_SVX_SET_OUTLINE:
{
const SfxUInt16Item* pItem = rReq.GetArg<SfxUInt16Item>(nSlot);
if ( pItem != nullptr )
{
const sal_uInt16 nChoosenItemIdx = pItem->GetValue();
- svx::sidebar::NBOTypeMgrBase* pNBOTypeMgr =
- nSlot == FN_SVX_SET_NUMBER
- ? svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::NUMBERING )
- : svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::BULLETS );
+ sal_uInt16 nNBOType = svx::sidebar::eNBOType::BULLETS;
+ if ( nSlot == FN_SVX_SET_NUMBER )
+ nNBOType = svx::sidebar::eNBOType::NUMBERING;
+ else if ( nSlot == FN_SVX_SET_OUTLINE )
+ nNBOType = svx::sidebar::eNBOType::OUTLINE;
+
+ svx::sidebar::NBOTypeMgrBase* pNBOTypeMgr = svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( nNBOType );
+
if ( pNBOTypeMgr != nullptr )
{
const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
diff --git a/sw/uiconfig/swriter/toolbar/textobjectbar.xml b/sw/uiconfig/swriter/toolbar/textobjectbar.xml
index 9b9ef6234cd4..24b5be46d54d 100644
--- a/sw/uiconfig/swriter/toolbar/textobjectbar.xml
+++ b/sw/uiconfig/swriter/toolbar/textobjectbar.xml
@@ -51,6 +51,7 @@
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:DefaultBullet"/>
<toolbar:toolbaritem xlink:href=".uno:DefaultNumbering"/>
+ <toolbar:toolbaritem xlink:href=".uno:SetOutline" toolbar:visible="false"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio"/>