summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2014-02-06 01:21:54 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-02-07 14:28:23 +0000
commit5024ce2a2c0c08dcd74b2410d088a9daf83d2f31 (patch)
tree624e6fb920bf003831cf11d74a16bf42e8b3baf5
parentb6542ea43ac6141486d3d1f29bbab9b053c26b21 (diff)
sidebar: even more cleanup of text panel
Contains the following changes: - Kill SvxSBFontNameBox. - Remove ToolboxFontSelectHandler. - Move .uno:Color to a separate toolbox. It allows to remove some hardcoded uno commands from the code, and also solves a redrawing issue. - General cleanup. Change-Id: I6fb797aa95d1a73dca0003ad1a40aee55e27e163 Reviewed-on: https://gerrit.libreoffice.org/7893 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--extras/source/glade/libreoffice-catalog.xml.in4
-rw-r--r--svx/Library_svx.mk1
-rw-r--r--svx/source/sidebar/text/SvxSBFontNameBox.cxx173
-rw-r--r--svx/source/sidebar/text/SvxSBFontNameBox.hxx54
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.cxx7
-rw-r--r--svx/source/sidebar/text/TextPropertyPanel.cxx274
-rw-r--r--svx/source/sidebar/text/TextPropertyPanel.hxx20
-rw-r--r--svx/source/sidebar/text/TextUnderlineControl.cxx3
-rw-r--r--svx/uiconfig/ui/sidebartextpanel.ui70
9 files changed, 77 insertions, 529 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index dc574818a660..71c7ac168e56 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -138,10 +138,6 @@
</properties>
</glade-widget-class>
- <glade-widget-class title="Sidebar Font Name ListBox" name="svxlo-SvxSBFontNameBox"
- generic-name="Sidebar Font name ListBox" parent="GtkComboBox"
- icon-name="widget-gtk-combobox"/>
-
<glade-widget-class title="Font Size ListBox" name="svtlo-FontSizeBox"
generic-name="Font Size ListBox" parent="GtkComboBox"
icon-name="widget-gtk-combobox">
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 70cf3efb81cf..74b1db5bfa2d 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -178,7 +178,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/debug/ColorPanel \
svx/source/sidebar/debug/ContextPanel \
svx/source/sidebar/debug/NotYetImplementedPanel \
- svx/source/sidebar/text/SvxSBFontNameBox \
svx/source/sidebar/text/TextCharacterSpacingControl \
svx/source/sidebar/text/TextCharacterSpacingPopup \
svx/source/sidebar/text/TextUnderlineControl \
diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.cxx b/svx/source/sidebar/text/SvxSBFontNameBox.cxx
deleted file mode 100644
index c52ce7edb04f..000000000000
--- a/svx/source/sidebar/text/SvxSBFontNameBox.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "SvxSBFontNameBox.hxx"
-
-#include <unotools/fontoptions.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/dispatch.hxx>
-#include <editeng/flstitem.hxx>
-#include <editeng/editids.hrc>
-#include <editeng/fontitem.hxx>
-#include <vcl/builder.hxx>
-
-const static sal_uInt16 MAX_MRU_FONTNAME_ENTRIES = 5;
-
-
-namespace svx { namespace sidebar {
-
-namespace {
- bool GetDocFontList_Impl( const FontList** ppFontList, SvxSBFontNameBox* pBox )
- {
- bool bChanged = false;
- const SfxObjectShell* pDocSh = SfxObjectShell::Current();
- SvxFontListItem* pFontListItem = NULL;
-
- if ( pDocSh )
- pFontListItem =
- (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
-
- if ( pFontListItem )
- {
- const FontList* pNewFontList = pFontListItem->GetFontList();
- DBG_ASSERT( pNewFontList, "Doc-FontList not available!" );
-
- if ( !*ppFontList )
- {
- *ppFontList = pNewFontList;
- bChanged = true;
- }
- else
- {
- bChanged = ( *ppFontList != pNewFontList );
- if( !bChanged && pBox!=NULL )
- bChanged = ( pBox->GetListCount() != pNewFontList->GetFontNameCount() );
- //HACK(vergleich ist unvollstaendig)
- if ( bChanged )
- *ppFontList = pNewFontList;
- }
-
- if ( pBox )
- pBox->Enable();
- }
- else if ( pBox )
- pBox->Disable();
-
- // in die FontBox ggf. auch die neue Liste f"ullen
- if ( pBox && bChanged )
- {
- if ( *ppFontList )
- pBox->Fill( *ppFontList );
- else
- pBox->Clear();
- }
- return bChanged;
- }
-}
-
-SvxSBFontNameBox::SvxSBFontNameBox( Window* pParent ) :
- FontNameBox ( pParent, WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP|WB_DROPDOWN )
-, pFontList ( NULL )
-, nFtCount ( 0 )
-, pBindings(NULL)
-{
- EnableControls_Impl();
- EnableAutoSize(true);
-// StartListening( *SFX_APP() );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxSBFontNameBox(Window *pParent, VclBuilder::stringmap &)
-{
- return new SvxSBFontNameBox(pParent);
-}
-
-void SvxSBFontNameBox::EnableControls_Impl()
-{
- SvtFontOptions aFontOpt;
- bool bEnable = aFontOpt.IsFontHistoryEnabled();
- sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0;
- if ( GetMaxMRUCount() != nEntries )
- {
- // refill in the next GetFocus-Handler
- pFontList = NULL;
- Clear();
- SetMaxMRUCount( nEntries );
- }
-
- bEnable = aFontOpt.IsFontWYSIWYGEnabled();
- EnableWYSIWYG( bEnable );
-}
-
-void SvxSBFontNameBox::FillList()
-{
- Selection aOldSel = GetSelection();
- GetDocFontList_Impl( &pFontList, this );
- aCurText = GetText();
- SetSelection( aOldSel );
-}
-
-bool SvxSBFontNameBox::PreNotify( NotifyEvent& rNEvt )
-{
- const sal_uInt16 nType (rNEvt.GetType());
-
- if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
- FillList();
- return FontNameBox::PreNotify( rNEvt );
-}
-//<<modify
-bool SvxSBFontNameBox::Notify( NotifyEvent& rNEvt) //SfxBroadcaster& rBC, const SfxHint& rHint
-{
- //SfxItemSetHint* pHint = PTR_CAST(SfxItemSetHint, &rHint);
- //if ( pHint )
- // EnableControls_Impl();
- bool bHandle = false;
- if ( rNEvt.GetType() == EVENT_KEYINPUT )
- {
- const sal_uInt16 nCode (rNEvt.GetKeyEvent()->GetKeyCode().GetCode());
-
- if( nCode == KEY_RETURN)
- {
- bHandle = true;
- Select();
- }
- }
-
- return bHandle || FontNameBox::Notify( rNEvt );
-}
-void SvxSBFontNameBox::Select()
-{
- FontNameBox::Select();
-
- if ( !IsTravelSelect() )
- {
- FillList();
- FontInfo aInfo( pFontList->Get( GetText(),WEIGHT_NORMAL, ITALIC_NORMAL ) );//meWeight, meItalic
-
- SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(),
- aInfo.GetPitch(), aInfo.GetCharSet(), SID_ATTR_CHAR_FONT );
-
- pBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONT, SFX_CALLMODE_RECORD, &aFontItem, 0L );
- pBindings->Invalidate(SID_ATTR_CHAR_FONT,true,false);
- }
-}
-void SvxSBFontNameBox::SetBindings(SfxBindings* pB)
-{
- pBindings = pB;
-}
-
-} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.hxx b/svx/source/sidebar/text/SvxSBFontNameBox.hxx
deleted file mode 100644
index 6724b9f7ff97..000000000000
--- a/svx/source/sidebar/text/SvxSBFontNameBox.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_TEXT_SVXSBFONTNAMEBOX_HXX
-#define INCLUDED_SVX_SOURCE_SIDEBAR_TEXT_SVXSBFONTNAMEBOX_HXX
-
-#include <sfx2/bindings.hxx>
-#include <svtools/ctrlbox.hxx>
-#include <svtools/ctrltool.hxx>
-
-namespace svx { namespace sidebar {
-
-class SvxSBFontNameBox : public FontNameBox//, public SfxListener
-{
-private:
- const FontList* pFontList;
- Font aCurFont;
- OUString aCurText;
- sal_uInt16 nFtCount;
- void EnableControls_Impl();
- SfxBindings* pBindings;//
-protected:
- virtual void Select();
-
-public:
- SvxSBFontNameBox(Window* pParent);
- void FillList();
- sal_uInt16 GetListCount() const { return nFtCount; }
- void Clear() { FontNameBox::Clear(); nFtCount = 0; }
- void Fill( const FontList* pList )
- { FontNameBox::Fill( pList );
- nFtCount = pList->GetFontNameCount(); }
- void SetBindings(SfxBindings* pBinding);//
- virtual bool PreNotify( NotifyEvent& rNEvt );
- virtual bool Notify( NotifyEvent& rNEvt );//
-};
-
-} } // end of namespace svx::sidebar
-
-#endif
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index ce1941c25dcc..ad52b0c7f765 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -304,7 +304,6 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
nKern = (short)maEditKerning.Denormalize(nVal);
SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
- mrTextPropertyPanel.SetSpacing(-nKern);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
}
else if(iPos == 2)
@@ -313,14 +312,12 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
nKern = (short)maEditKerning.Denormalize(nVal);
SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
- mrTextPropertyPanel.SetSpacing(-nKern);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
}
else if(iPos == 3)
{
SvxKerningItem aKernItem(0, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
- mrTextPropertyPanel.SetSpacing(0);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
}
else if(iPos == 4)
@@ -329,7 +326,6 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
nKern = (short)maEditKerning.Denormalize(nVal);
SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
- mrTextPropertyPanel.SetSpacing(nKern);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
}
else if(iPos == 5)
@@ -338,7 +334,6 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
nKern = (short)maEditKerning.Denormalize(nVal);
SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
- mrTextPropertyPanel.SetSpacing(nKern);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
}
else if(iPos == 6)
@@ -350,7 +345,6 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
nKern = (short)maEditKerning.Denormalize(nVal);
SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
- mrTextPropertyPanel.SetSpacing(nKern);
mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
}
else
@@ -443,7 +437,6 @@ IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*, EMPTYARG)
}
SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
- mrTextPropertyPanel.SetSpacing(nKern);
return 0;
}
short TextCharacterSpacingControl::GetLastCustomState()
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 6c7e7431a463..e00f7cc543cd 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -18,21 +18,13 @@
#include "TextPropertyPanel.hrc"
#include "TextPropertyPanel.hxx"
-#include "SvxSBFontNameBox.hxx"
-#include <editeng/flstitem.hxx>
-#include <editeng/fontitem.hxx>
#include <editeng/kernitem.hxx>
#include <editeng/udlnitem.hxx>
#include <rtl/ref.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/viewsh.hxx>
-#include <sfx2/sidebar/SidebarToolBox.hxx>
-#include <svtools/ctrltool.hxx>
#include <svtools/unitconv.hxx>
-#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
#include "TextCharacterSpacingControl.hxx"
#include "TextCharacterSpacingPopup.hxx"
@@ -45,9 +37,6 @@
using namespace css;
using namespace cssu;
-const char UNO_BACKCOLOR[] = ".uno:BackColor";
-const char UNO_COLOR[] = ".uno:Color";
-const char UNO_FONTCOLOR[] = ".uno:FontColor";
const char UNO_SPACING[] = ".uno:Spacing";
const char UNO_UNDERLINE[] = ".uno:Underline";
@@ -72,7 +61,6 @@ long TextPropertyPanel::GetSelFontSize()
return nH;
}
-
TextPropertyPanel* TextPropertyPanel::Create (
Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame,
@@ -93,7 +81,6 @@ TextPropertyPanel* TextPropertyPanel::Create (
rContext);
}
-
::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
{
return maSpacingControl;
@@ -101,43 +88,39 @@ TextPropertyPanel* TextPropertyPanel::Create (
TextPropertyPanel::TextPropertyPanel ( Window* pParent, const cssu::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const ::sfx2::sidebar::EnumContext& /*rContext*/ )
: PanelLayout(pParent, "SidebarTextPanel", "svx/ui/sidebartextpanel.ui", rxFrame),
- maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this, OUString("CharFontName"), rxFrame),
maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this, OUString("FontHeight"), rxFrame),
maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this, OUString("Underline"), rxFrame),
maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this, OUString("Spacing"), rxFrame),
- mbFocusOnFontSizeCtrl(false),
maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
maContext(),
mpBindings(pBindings)
{
- get(mpFontNameBox, "font");
- get(mpFontSizeBox, "fontsize");
get(mpToolBoxFont, "fonteffects");
get(mpToolBoxIncDec, "fontadjust");
get(mpToolBoxSpacing, "spacingbar");
- get(mpToolBoxFontColor, "colorbar");
-
- Initialize();
-}
-
-
+ get(mpToolBoxFontColorSw, "colorbar");
+ get(mpToolBoxFontColor, "colorsingle");
+ //toolbox
+ SetupToolboxItems();
+ InitToolBoxFont();
+ InitToolBoxSpacing();
-TextPropertyPanel::~TextPropertyPanel (void)
-{
+ //init state
+ mpHeightItem = NULL;
+ meUnderline = UNDERLINE_NONE;
+ meUnderlineColor = COL_AUTO;
+ mbKernAvailable = true;
+ mbKernLBAvailable = true;
+ mlKerning = 0;
}
-
-
-
-void TextPropertyPanel::SetSpacing(long nKern)
+TextPropertyPanel::~TextPropertyPanel (void)
{
- mlKerning = nKern;
}
-
void TextPropertyPanel::HandleContextChange (
const ::sfx2::sidebar::EnumContext aContext)
{
@@ -183,85 +166,15 @@ void TextPropertyPanel::HandleContextChange (
break;
}
- UpdateFontColorToolbox(bWriterText);
-}
-
-void TextPropertyPanel::UpdateFontColorToolbox (bool bWriterText)
-{
- if (bWriterText)
- {
- mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_COLOR));
- mpToolBoxFontColor->ShowItem(mpToolBoxFontColor->GetItemId(UNO_FONTCOLOR));
- mpToolBoxFontColor->ShowItem(mpToolBoxFontColor->GetItemId(UNO_BACKCOLOR));
- }
- else
- {
- mpToolBoxFontColor->ShowItem(mpToolBoxFontColor->GetItemId(UNO_COLOR));
- mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_FONTCOLOR));
- mpToolBoxFontColor->HideItem(mpToolBoxFontColor->GetItemId(UNO_BACKCOLOR));
- }
+ mpToolBoxFontColor->Show(!bWriterText);
+ mpToolBoxFontColorSw->Show(bWriterText);
}
-
void TextPropertyPanel::DataChanged (const DataChangedEvent& /*rEvent*/)
{
SetupToolboxItems();
}
-
-
-
-void TextPropertyPanel::Initialize (void)
-{
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
- const SfxPoolItem* pItem = NULL;
- const FontList* pFontList = NULL;
- bool bMustDelete = false;
-
- if (pDocSh != NULL)
- pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
- if (pItem != NULL)
- pFontList = ( (SvxFontListItem*)pItem )->GetFontList();
- else
- {
- pFontList = new FontList( Application::GetDefaultDevice() );
- bMustDelete = true;
- }
-
- const FontInfo aFontInfo (pFontList->Get( OUString( "" ), OUString( "" )));
- mpFontSizeBox->Fill(&aFontInfo,pFontList);
-
- if (bMustDelete)
- delete pFontList;
-
- mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
- mpFontSizeBox->SetAccessibleName(mpFontSizeBox->GetQuickHelpText());
-
- //toolbox
- SetupToolboxItems();
- InitToolBoxFont();
- InitToolBoxSpacing();
-
- //init state
- mpHeightItem = NULL;
- meUnderline = UNDERLINE_NONE;
- meUnderlineColor = COL_AUTO;
- mbKernAvailable = true;
- mbKernLBAvailable = true;
- mlKerning = 0;
-
- //set handler
- mpFontNameBox->SetBindings(mpBindings);
- Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
- mpFontNameBox->SetSelectHdl(aLink);
- aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
- mpFontSizeBox->SetModifyHdl(aLink);
- aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
- mpFontSizeBox->SetSelectHdl(aLink);
- aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
- mpFontSizeBox->SetLoseFocusHdl(aLink);
-}
-
void TextPropertyPanel::EndSpacingPopupMode (void)
{
maCharSpacePopup.Hide();
@@ -272,19 +185,12 @@ void TextPropertyPanel::EndUnderlinePopupMode (void)
maUnderlinePopup.Hide();
}
-
void TextPropertyPanel::InitToolBoxFont()
{
- Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
- mpToolBoxFont->SetSelectHdl ( aLink );
-
- aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
+ Link aLink = LINK(this, TextPropertyPanel, UnderlineClickHdl);
mpToolBoxFont->SetDropdownClickHdl(aLink);
}
-
-
-
void TextPropertyPanel::InitToolBoxSpacing()
{
const sal_uInt16 nId = mpToolBoxSpacing->GetItemId(UNO_SPACING);
@@ -295,94 +201,13 @@ void TextPropertyPanel::InitToolBoxSpacing()
mpToolBoxSpacing->SetSelectHdl( aLink );
}
-
-
-
void TextPropertyPanel::SetupToolboxItems (void)
{
maUnderlineControl.SetupToolBoxItem(*mpToolBoxFont, mpToolBoxFont->GetItemId(UNO_UNDERLINE));
maSpacingControl.SetupToolBoxItem(*mpToolBoxSpacing, mpToolBoxSpacing->GetItemId(UNO_SPACING));
}
-
-
-
-IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
-{
- if ( !pBox->IsTravelSelect() )
- {
- if( SfxViewShell::Current() )
- {
- Window* pShellWnd = SfxViewShell::Current()->GetWindow();
-
- if ( pShellWnd )
- pShellWnd->GrabFocus();
- }
- }
- return 0;
-}
-
-IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
-{
- if (pSizeBox == mpFontSizeBox)
- {
- long nSize = pSizeBox->GetValue();
- mbFocusOnFontSizeCtrl = true;
-
- float fSize = (float)nSize / 10;
- SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
- SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
-
- mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
- mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
- }
- return 0;
-}
-
-IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
-{
- if ( !pSizeBox->IsTravelSelect() )
- {
- if( SfxViewShell::Current() )
- {
- Window* pShellWnd = SfxViewShell::Current()->GetWindow();
-
- if ( pShellWnd )
- pShellWnd->GrabFocus();
- }
- }
-
- return 0;
-}
-
-IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
-{
- if(pSizeBox == mpFontSizeBox)
- {
- mbFocusOnFontSizeCtrl = false;
- }
- return 0;
-}
-
-IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
-{
- const sal_uInt16 nId = pToolBox->GetCurItemId();
- const OUString aCommand(pToolBox->GetItemCommand(nId));
-
- EndTracking();
-
- if (aCommand == UNO_UNDERLINE)
- meUnderline = UNDERLINE_NONE;
-
- dispatch(aCommand);
-
- return 0;
-}
-
-
-
-
-IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
+IMPL_LINK(TextPropertyPanel, UnderlineClickHdl, ToolBox*, pToolBox)
{
const sal_uInt16 nId = pToolBox->GetCurItemId();
const OUString aCommand(pToolBox->GetItemCommand(nId));
@@ -397,9 +222,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
return 0L;
}
-
-
-
IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
{
const sal_uInt16 nId = pToolBox->GetCurItemId();
@@ -415,74 +237,32 @@ IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
return 0L;
}
-
-
-
void TextPropertyPanel::NotifyItemUpdate (
const sal_uInt16 nSID,
const SfxItemState eState,
const SfxPoolItem* pState,
const bool bIsEnabled)
{
- bool bIsControlEnabled (bIsEnabled);
-
switch(nSID)
{
- case SID_ATTR_CHAR_FONT:
- {
- if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
- {
- const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
- mpFontNameBox->SetText( pFontItem->GetFamilyName() );
- }
- else
- {
- mpFontNameBox->SetText( "" );
- if (SFX_ITEM_DISABLED == eState)
- bIsControlEnabled = false;
- }
- mpFontNameBox->Enable(bIsControlEnabled);
- }
- break;
case SID_ATTR_CHAR_FONTHEIGHT:
{
if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
- {
- mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
- SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
- const sal_Int64 nValue (CalcToPoint(mpHeightItem->GetHeight(), eUnit, 10 ));
-
- if( mbFocusOnFontSizeCtrl )
- return;
-
- mpFontSizeBox->SetValue(nValue);
- mpFontSizeBox->LoseFocus();
- }
+ mpHeightItem = (SvxFontHeightItem*)pState;
else
- {
mpHeightItem = NULL;
- mpFontSizeBox->SetText( "" );
- if ( eState <= SFX_ITEM_READONLY )
- bIsControlEnabled = false;
- }
- mpFontSizeBox->Enable(bIsControlEnabled);
}
break;
case SID_ATTR_CHAR_UNDERLINE:
{
- if( eState >= SFX_ITEM_DEFAULT)
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxUnderlineItem) )
{
- if(pState->ISA(SvxUnderlineItem))
- {
- const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
- meUnderline = (FontUnderline)pItem->GetValue();
- meUnderlineColor = pItem->GetColor();
- }
+ const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
+ meUnderline = (FontUnderline)pItem->GetValue();
+ meUnderlineColor = pItem->GetColor();
}
else
- {
meUnderline = UNDERLINE_NONE;
- }
}
break;
case SID_ATTR_CHAR_KERNING:
@@ -521,17 +301,9 @@ void TextPropertyPanel::NotifyItemUpdate (
}
}
-
-
-
Color& TextPropertyPanel::GetUnderlineColor()
{
return meUnderlineColor;
}
-void TextPropertyPanel::SetUnderline(FontUnderline eUnderline)
-{
- meUnderline = eUnderline;
-}
-
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index e75e234f340c..c496ff128782 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -22,7 +22,6 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/EnumContext.hxx>
-
#include <svtools/ctrlbox.hxx>
#include <editeng/fhgtitem.hxx>
@@ -38,7 +37,6 @@ class ToolBox;
namespace svx { namespace sidebar {
-class SvxSBFontNameBox;
class PopupControl;
class PopupContainer;
@@ -58,10 +56,8 @@ public:
::sfx2::sidebar::ControllerItem& GetSpaceController();
long GetSelFontSize();
- void SetSpacing(long nKern);
void EndSpacingPopupMode (void);
void EndUnderlinePopupMode (void);
- void SetUnderline(FontUnderline eUnderline);
Color& GetUnderlineColor();
@@ -77,15 +73,13 @@ public:
private:
//ui controls
- SvxSBFontNameBox* mpFontNameBox;
- FontSizeBox* mpFontSizeBox;
ToolBox* mpToolBoxFont;
ToolBox* mpToolBoxIncDec;
ToolBox* mpToolBoxSpacing;
+ ToolBox* mpToolBoxFontColorSw;
ToolBox* mpToolBoxFontColor;
//control items
- ::sfx2::sidebar::ControllerItem maFontNameControl;
::sfx2::sidebar::ControllerItem maFontSizeControl;
::sfx2::sidebar::ControllerItem maUnderlineControl;
::sfx2::sidebar::ControllerItem maSpacingControl;
@@ -97,7 +91,6 @@ private:
long mlKerning;
SvxFontHeightItem* mpHeightItem;
- bool mbFocusOnFontSizeCtrl;
TextCharacterSpacingPopup maCharSpacePopup;
TextUnderlinePopup maUnderlinePopup;
@@ -115,20 +108,11 @@ private:
PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
DECL_LINK(SpacingClickHdl, ToolBox*);
- DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
+ DECL_LINK(UnderlineClickHdl, ToolBox* );
- void Initialize (void);
void SetupToolboxItems (void);
void InitToolBoxFont();
void InitToolBoxSpacing();
-
- DECL_LINK(FontSelHdl, FontNameBox *);
- DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
- DECL_LINK(FontSizeSelHdl, FontSizeBox *);
- DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
- DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
-
- void UpdateFontColorToolbox (bool bWriterText);
};
} } // end of namespace ::svx::sidebar
diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index 89e9ca676340..f4a7993d2e6c 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -211,9 +211,6 @@ IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
aLineItem.SetColor(mrTextPropertyPanel.GetUnderlineColor());
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
-
- mrTextPropertyPanel.SetUnderline(eUnderline);
-
mrTextPropertyPanel.EndUnderlinePopupMode();
}
return( 0L );
diff --git a/svx/uiconfig/ui/sidebartextpanel.ui b/svx/uiconfig/ui/sidebartextpanel.ui
index c17f141206f0..91930e9b0df5 100644
--- a/svx/uiconfig/ui/sidebartextpanel.ui
+++ b/svx/uiconfig/ui/sidebartextpanel.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkGrid" id="SidebarTextPanel">
<property name="visible">True</property>
@@ -18,12 +19,23 @@
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">12</property>
+ <property name="spacing">6</property>
<child>
- <object class="svxlo-SvxSBFontNameBox" id="font">
- <property name="width_request">150</property>
+ <object class="sfxlo-SidebarToolBox" id="font">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <child>
+ <object class="GtkToolButton" id="fontname">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="is_important">True</property>
+ <property name="action_name">.uno:CharFontName</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
@@ -32,10 +44,21 @@
</packing>
</child>
<child>
- <object class="svtlo-FontSizeBox" id="fontsize">
- <property name="width_request">60</property>
+ <object class="sfxlo-SidebarToolBox" id="fontheight">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <child>
+ <object class="GtkToolButton" id="fontsize">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="is_important">True</property>
+ <property name="action_name">.uno:FontHeight</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -48,7 +71,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -183,7 +206,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -197,12 +220,12 @@
<property name="can_focus">False</property>
<property name="show_arrow">False</property>
<child>
- <object class="GtkMenuToolButton" id="color">
+ <object class="GtkMenuToolButton" id="fontcolor">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="is_important">True</property>
- <property name="action_name">.uno:Color</property>
+ <property name="action_name">.uno:FontColor</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -211,12 +234,12 @@
</packing>
</child>
<child>
- <object class="GtkMenuToolButton" id="fontcolor">
+ <object class="GtkMenuToolButton" id="highlight">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="is_important">True</property>
- <property name="action_name">.uno:FontColor</property>
+ <property name="action_name">.uno:BackColor</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -224,13 +247,24 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="sfxlo-SidebarToolBox" id="colorsingle">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkMenuToolButton" id="highlight">
+ <object class="GtkMenuToolButton" id="color">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="is_important">True</property>
- <property name="action_name">.uno:BackColor</property>
+ <property name="action_name">.uno:Color</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -242,7 +276,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -281,7 +315,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -307,14 +341,14 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</object>