Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2440
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/40/2440/1
resolve fdo#54335 type an existing style name into Style box changes hierarchy
Change-Id: If2fd4eecec4f6f031b264a9a1b0c31e938194878
Reviewed-on: https://gerrit.libreoffice.org/2292
Reviewed-by: Thorsten Behrens <tbehrens@suse.com>
Tested-by: Thorsten Behrens <tbehrens@suse.com>
---
M svx/source/tbxctrls/tbcontrl.cxx
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index fab0466..45a8f06 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -371,20 +371,20 @@
if ( !IsTravelSelect() )
{
- String aSelEntry( GetText() );
+ OUString aSearchEntry( GetText() );
bool bDoIt = true, bClear = false;
if( bInSpecialMode )
{
- if( aSelEntry == aClearFormatKey && GetSelectEntryPos() == 0 )
+ if( aSearchEntry == aClearFormatKey && GetSelectEntryPos() == 0 )
{
- aSelEntry = sDefaultStyle;
+ aSearchEntry = sDefaultStyle;
bClear = true;
//not only apply default style but also call 'ClearFormatting'
Sequence< PropertyValue > aEmptyVals;
- SfxToolBoxControl::Dispatch( m_xDispatchProvider,
rtl::OUString(".uno:ResetAttributes"),
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, OUString(".uno:ResetAttributes"),
aEmptyVals);
}
- else if( aSelEntry == aMoreKey && GetSelectEntryPos() == ( GetEntryCount() - 1 ) )
+ else if( aSearchEntry == aMoreKey && GetSelectEntryPos() == ( GetEntryCount() - 1 ) )
{
SfxViewFrame* pViewFrm = SfxViewFrame::Current();
DBG_ASSERT( pViewFrm, "SvxStyleBox_Impl::Select(): no viewframe" );
@@ -401,8 +401,28 @@
}
}
- // #i36723# after ReleaseFocus() the new entry is included into the List
- sal_Bool bCreateNew = GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND;
+ //Do we need to create a new style?
+ SfxObjectShell *pShell = SfxObjectShell::Current();
+ SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyle = NULL;
+
+ bool bCreateNew = 0;
+
+ if ( pPool )
+ {
+ pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
+
+ pStyle = pPool->First();
+ while ( pStyle && OUString( pStyle->GetName() ) != aSearchEntry )
+ pStyle = pPool->Next();
+ }
+
+ if ( !pStyle )
+ {
+ // cannot find the style for whatever reason
+ // therefore create a new style
+ bCreateNew = 1;
+ }
/* #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
@@ -412,17 +432,17 @@
if( bDoIt )
{
if ( bClear )
- SetText( aSelEntry );
+ SetText( aSearchEntry );
SaveValue();
Sequence< PropertyValue > aArgs( 2 );
- aArgs[0].Value = makeAny( OUString( aSelEntry ) );
+ aArgs[0].Value = makeAny( OUString( aSearchEntry ) );
aArgs[1].Name = OUString("Family");
aArgs[1].Value = makeAny( sal_Int16( eStyleFamily ));
if( bCreateNew )
{
aArgs[0].Name = OUString("Param");
- SfxToolBoxControl::Dispatch( m_xDispatchProvider,
rtl::OUString(".uno:StyleNewByExample"), aArgs);
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider,
OUString(".uno:StyleNewByExample"), aArgs);
}
else
{
--
To view, visit https://gerrit.libreoffice.org/2440
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If2fd4eecec4f6f031b264a9a1b0c31e938194878
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Joren De Cuyper <joren.libreoffice@telenet.be>
Gerrit-Reviewer: Thorsten Behrens <tbehrens@suse.com>
Context
- [PATCH libreoffice-4-0] resolve fdo#54335 type an existing style name into Style box... · Joren De Cuyper (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.