[Libreoffice-commits] core.git: 7 commits - extras/source include/sfx2 include/svx svx/source svx/uiconfig sw/source
Caolán McNamara
caolanm at redhat.com
Tue May 5 09:22:31 PDT 2015
extras/source/glade/libreoffice-catalog.xml.in | 8
include/sfx2/tbxctrl.hxx | 3
include/svx/fillctrl.hxx | 46
svx/source/sidebar/area/AreaPropertyPanel.cxx | 8
svx/source/tbxctrls/fillctrl.cxx | 1186 ++++++++++++-------------
svx/uiconfig/ui/sidebararea.ui | 31
sw/source/uibase/lingu/hhcwrp.cxx | 12
7 files changed, 640 insertions(+), 654 deletions(-)
New commits:
commit f34a473ba96849e2e5277702a7b2bbef9398b6d4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 5 16:51:17 2015 +0100
restore this utter madness
where we get the untranslated names for these for some
weird and wonderful reason that escapes me, but this
is clearly why this existed.
Change-Id: Ic7a7897a4988a981a3a77a8e64521d1738a323ee
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 7ec5ff6..e1e58e6 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -28,6 +28,9 @@
#include <vcl/toolbox.hxx>
#include <svx/dialogs.hrc>
+#define TMP_STR_BEGIN "["
+#define TMP_STR_END "]"
+
#include "svx/drawitem.hxx"
#include "svx/xattr.hxx"
#include <svx/xtable.hxx>
@@ -355,6 +358,39 @@ void SvxFillToolBoxControl::Update()
const OUString aString(mpFillGradientItem->GetName());
mpLbFillAttr->SelectEntry(aString);
+
+ // Check if the entry is not in the list
+ if (mpLbFillAttr->GetSelectEntry() != aString)
+ {
+ sal_Int32 nCount = mpLbFillAttr->GetEntryCount();
+ OUString aTmpStr;
+ if( nCount > 0 )
+ {
+ // Last entry gets tested against temporary entry
+ aTmpStr = mpLbFillAttr->GetEntry( nCount - 1 );
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
+ {
+ mpLbFillAttr->RemoveEntry(nCount - 1);
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+
+ boost::scoped_ptr<XGradientEntry> pEntry(new XGradientEntry(mpFillGradientItem->GetGradientValue(), aTmpStr));
+ XGradientList aGradientList( "", ""/*TODO?*/ );
+ aGradientList.Insert( pEntry.get() );
+ aGradientList.SetDirty( false );
+ const Bitmap aBmp = aGradientList.GetUiBitmap( 0 );
+
+ if(!aBmp.IsEmpty())
+ {
+ mpLbFillAttr->InsertEntry(pEntry->GetName(), Image(aBmp));
+ mpLbFillAttr->SelectEntryPos(mpLbFillAttr->GetEntryCount() - 1);
+ }
+
+ aGradientList.Remove( 0 );
+ }
+
}
else
{
@@ -384,6 +420,40 @@ void SvxFillToolBoxControl::Update()
const OUString aString(mpHatchItem->GetName());
mpLbFillAttr->SelectEntry( aString );
+
+ // Check if the entry is not in the list
+ if( mpLbFillAttr->GetSelectEntry() != aString )
+ {
+ sal_uInt16 nCount = mpLbFillAttr->GetEntryCount();
+ OUString aTmpStr;
+ if( nCount > 0 )
+ {
+ // Last entry gets tested against temporary entry
+ aTmpStr = mpLbFillAttr->GetEntry( nCount - 1 );
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
+ {
+ mpLbFillAttr->RemoveEntry( nCount - 1 );
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+
+ XHatchEntry* pEntry = new XHatchEntry(mpHatchItem->GetHatchValue(), aTmpStr);
+ XHatchList aHatchList( "", ""/*TODO?*/ );
+ aHatchList.Insert( pEntry );
+ aHatchList.SetDirty( sal_False );
+ const Bitmap aBmp = aHatchList.GetUiBitmap( 0 );
+
+ if( !aBmp.IsEmpty() )
+ {
+ mpLbFillAttr->InsertEntry(pEntry->GetName(), Image(aBmp));
+ mpLbFillAttr->SelectEntryPos( mpLbFillAttr->GetEntryCount() - 1 );
+ //delete pBmp;
+ }
+
+ aHatchList.Remove( 0 );
+ delete pEntry;
+ }
}
else
{
@@ -413,6 +483,36 @@ void SvxFillToolBoxControl::Update()
const OUString aString(mpBitmapItem->GetName());
mpLbFillAttr->SelectEntry(aString);
+
+ // Check if the entry is not in the list
+ if (mpLbFillAttr->GetSelectEntry() != aString)
+ {
+ sal_Int32 nCount = mpLbFillAttr->GetEntryCount();
+ OUString aTmpStr;
+ if( nCount > 0 )
+ {
+ // Last entry gets tested against temporary entry
+ aTmpStr = mpLbFillAttr->GetEntry(nCount - 1);
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
+ {
+ mpLbFillAttr->RemoveEntry(nCount - 1);
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+
+ boost::scoped_ptr<XBitmapEntry> pEntry(new XBitmapEntry(mpBitmapItem->GetGraphicObject(), aTmpStr));
+ XBitmapListRef xBitmapList =
+ XPropertyList::AsBitmapList(
+ XPropertyList::CreatePropertyList(
+ XBITMAP_LIST, "TmpList", ""/*TODO?*/));
+ xBitmapList->Insert( pEntry.get() );
+ xBitmapList->SetDirty( false );
+ mpLbFillAttr->Fill( xBitmapList );
+ mpLbFillAttr->SelectEntryPos(mpLbFillAttr->GetEntryCount() - 1);
+ xBitmapList->Remove( 0 );
+ }
+
}
else
{
commit 8c73b6eeb87eeac3def69e0026e80d7d951e2592
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 5 15:57:23 2015 +0100
vertically center toolbox/listboxes
Change-Id: I01270b85e019362e8343f4b097620620674f0443
diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx
index 1ec8a4184..b140998 100644
--- a/include/svx/fillctrl.hxx
+++ b/include/svx/fillctrl.hxx
@@ -83,8 +83,8 @@ private:
VclPtr<SvxFillTypeBox> mpLbFillType;
VclPtr<ToolBox> mpToolBoxColor;
VclPtr<SvxFillAttrBox> mpLbFillAttr;
- Size maLogicalFillSize;
- Size maLogicalAttrSize;
+
+ void SetOptimalSize();
virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 58673dd..7ec5ff6 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -445,6 +445,7 @@ VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent
mpLbFillType = mpFillControl->mpLbFillType;
mpLbFillAttr = mpFillControl->mpLbFillAttr;
mpToolBoxColor = mpFillControl->mpToolBoxColor;
+ mpFillControl->Resize();
mpToolBoxColor->InsertItem(".uno:FillColor", m_xFrame, ToolBoxItemBits::DROPDOWNONLY, Size(mpToolBoxColor->GetSizePixel().Width(), 0));
mpLbFillAttr->SetUniqueId(HID_FILL_ATTR_LISTBOX);
@@ -460,26 +461,12 @@ VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent
}
FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)
-: Window(pParent,nStyle | WB_DIALOGCONTROL),
- mpLbFillType(VclPtr<SvxFillTypeBox>::Create(this)),
- mpToolBoxColor(VclPtr<sfx2::sidebar::SidebarToolBox>::Create(this)),
- mpLbFillAttr(VclPtr<SvxFillAttrBox>::Create(this)),
- maLogicalFillSize(40,80),
- maLogicalAttrSize(50,80)
+ : Window(pParent,nStyle | WB_DIALOGCONTROL)
+ , mpLbFillType(VclPtr<SvxFillTypeBox>::Create(this))
+ , mpToolBoxColor(VclPtr<sfx2::sidebar::SidebarToolBox>::Create(this))
+ , mpLbFillAttr(VclPtr<SvxFillAttrBox>::Create(this))
{
- Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
- Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
- mpLbFillType->SetSizePixel(aTypeSize);
- mpToolBoxColor->SetSizePixel(aAttrSize);
- mpLbFillAttr->SetSizePixel(aAttrSize);
-
- //to get the base height
- aTypeSize = mpLbFillType->GetSizePixel();
- aAttrSize = mpLbFillAttr->GetSizePixel();
- Point aAttrPnt = mpLbFillAttr->GetPosPixel();
- SetSizePixel(
- Size(aAttrPnt.X() + aAttrSize.Width(),
- std::max(aAttrSize.Height(),aTypeSize.Height())));
+ SetOptimalSize();
}
FillControl::~FillControl()
@@ -795,14 +782,36 @@ IMPL_LINK(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox *, pToolBox)
void FillControl::Resize()
{
- // Width of the two list boxes not 1/2 : 1/2, but 2/5 : 3/5
- long nW = GetOutputSizePixel().Width() / 5;
- long nH = 180;
- long nSep = 0; // was previously 4
-
- mpLbFillType->SetSizePixel(Size(nW * 2 - nSep,nH));
- mpToolBoxColor->SetPosSizePixel(Point(nW * 2 + nSep,0),Size(nW * 3 - nSep,nH));
- mpLbFillAttr->SetPosSizePixel(Point(nW * 2 + nSep,0),Size(nW * 3 - nSep,nH));
+ // Relative width of the two list boxes is 2/5 : 3/5
+ Size aSize(GetOutputSizePixel());
+ long nW = aSize.Width() / 5;
+ long nH = aSize.Height();
+
+ long nPrefHeight = mpLbFillType->get_preferred_size().Height();
+ long nOffset = (nH - nPrefHeight)/2;
+ mpLbFillType->SetPosSizePixel(Point(0, nOffset), Size(nW * 2, nPrefHeight));
+ nPrefHeight = mpToolBoxColor->get_preferred_size().Height();
+ nOffset = (nH - nPrefHeight)/2;
+ mpToolBoxColor->SetPosSizePixel(Point(nW * 2, nOffset),Size(nW * 3, nPrefHeight));
+ nPrefHeight = mpLbFillType->get_preferred_size().Height();
+ nOffset = (nH - nPrefHeight)/2;
+ mpLbFillAttr->SetPosSizePixel(Point(nW * 2, nOffset),Size(nW * 3, nPrefHeight));
+}
+
+void FillControl::SetOptimalSize()
+{
+ const Size aLogicalAttrSize(50,0);
+ Size aSize(LogicToPixel(aLogicalAttrSize,MAP_APPFONT));
+
+ Point aAttrPnt = mpLbFillAttr->GetPosPixel();
+
+ aSize.Height() = std::max(aSize.Height(), mpLbFillType->get_preferred_size().Height());
+ aSize.Height() = std::max(aSize.Height(), mpToolBoxColor->get_preferred_size().Height());
+ aSize.Height() = std::max(aSize.Height(), mpLbFillAttr->get_preferred_size().Height());
+
+ aSize.Width() = aAttrPnt.X() + aSize.Width();
+
+ SetSizePixel(aSize);
}
void FillControl::DataChanged(const DataChangedEvent& rDCEvt)
@@ -810,20 +819,7 @@ void FillControl::DataChanged(const DataChangedEvent& rDCEvt)
if((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
{
- Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
- Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
- mpLbFillType->SetSizePixel(aTypeSize);
- mpToolBoxColor->SetSizePixel(aAttrSize);
- mpLbFillAttr->SetSizePixel(aAttrSize);
-
- //to get the base height
- aTypeSize = mpLbFillType->GetSizePixel();
- aAttrSize = mpLbFillAttr->GetSizePixel();
- Point aAttrPnt = mpLbFillAttr->GetPosPixel();
-
- SetSizePixel(
- Size(aAttrPnt.X() + aAttrSize.Width(),
- std::max(aAttrSize.Height(), aTypeSize.Height())));
+ SetOptimalSize();
}
Window::DataChanged(rDCEvt);
}
commit 8caebf50b3ee159da4db500f969427b49f07af80
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 1 17:15:31 2015 +0100
Use new color selector in the toolbar for area fills
Change-Id: I4da718620f4864c1c7742ecb9a0fcb8fc787f573
diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx
index d33c5e6..1ec8a4184 100644
--- a/include/svx/fillctrl.hxx
+++ b/include/svx/fillctrl.hxx
@@ -24,6 +24,7 @@
#include <sfx2/tbxctrl.hxx>
#include <svx/svxdllapi.h>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <boost/scoped_ptr.hpp>
class XFillStyleItem;
class XFillColorItem;
@@ -44,20 +45,24 @@ class ListBox;
class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxFillToolBoxControl : public SfxToolBoxControl
{
private:
- XFillStyleItem* mpStyleItem;
- XFillColorItem* mpColorItem;
- XFillGradientItem* mpGradientItem;
- XFillHatchItem* mpHatchItem;
- XFillBitmapItem* mpBitmapItem;
+ boost::scoped_ptr< XFillStyleItem > mpStyleItem;
+ boost::scoped_ptr< XFillColorItem > mpColorItem;
+ boost::scoped_ptr< XFillGradientItem > mpFillGradientItem;
+ boost::scoped_ptr< XFillHatchItem > mpHatchItem;
+ boost::scoped_ptr< XFillBitmapItem > mpBitmapItem;
VclPtr<FillControl> mpFillControl;
- VclPtr<SvxFillTypeBox> mpFillTypeLB;
- VclPtr<SvxFillAttrBox> mpFillAttrLB;
+ VclPtr<SvxFillTypeBox> mpLbFillType;
+ VclPtr<ToolBox> mpToolBoxColor;
+ VclPtr<SvxFillAttrBox> mpLbFillAttr;
- css::drawing::FillStyle meLastXFS;
+ sal_uInt16 meLastXFS;
+ sal_Int32 mnLastPosGradient;
+ sal_Int32 mnLastPosHatch;
+ sal_Int32 mnLastPosBitmap;
- /// bitfield
- bool mbUpdate:1;
+ DECL_LINK(SelectFillTypeHdl,ListBox *);
+ DECL_LINK(SelectFillAttrHdl,ListBox *);
public:
SFX_DECL_TOOLBOX_CONTROL();
@@ -66,38 +71,23 @@ public:
virtual ~SvxFillToolBoxControl();
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE;
- void Update(const SfxPoolItem* pState);
+ void Update();
virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
};
-
-
class SAL_WARN_UNUSED FillControl : public vcl::Window
{
private:
friend class SvxFillToolBoxControl;
VclPtr<SvxFillTypeBox> mpLbFillType;
+ VclPtr<ToolBox> mpToolBoxColor;
VclPtr<SvxFillAttrBox> mpLbFillAttr;
Size maLogicalFillSize;
Size maLogicalAttrSize;
- //
- sal_uInt16 mnLastFillTypeControlSelectEntryPos;
- sal_uInt16 mnLastFillAttrControlSelectEntryPos;
-
- /// bitfield
- bool mbFillTypeChanged : 1;
-
- DECL_LINK(SelectFillTypeHdl,ListBox *);
- DECL_LINK(SelectFillAttrHdl,ListBox *);
-
virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
- void InitializeFillStyleAccordingToGivenFillType(css::drawing::FillStyle eFillStyle);
- void updateLastFillTypeControlSelectEntryPos();
- void updateLastFillAttrControlSelectEntryPos();
-
public:
FillControl(vcl::Window* pParent, WinBits nStyle = 0);
virtual ~FillControl();
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index a0d41c2..82a931f 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -202,9 +202,7 @@ void AreaPropertyPanel::Initialize()
SetupIcons();
}
-
-
-IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox )
+IMPL_LINK(AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox)
{
const drawing::FillStyle eXFS = (drawing::FillStyle)mpLbFillType->GetSelectEntryPos();
@@ -379,9 +377,7 @@ IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox )
return 0;
}
-
-
-IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox )
+IMPL_LINK(AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox)
{
const drawing::FillStyle eXFS = (drawing::FillStyle)mpLbFillType->GetSelectEntryPos();
const XFillStyleItem aXFillStyleItem(eXFS);
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 4386b78..58673dd 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -22,14 +22,12 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/viewsh.hxx>
+#include <sfx2/sidebar/SidebarToolBox.hxx>
#include <rtl/ustring.hxx>
#include <vcl/settings.hxx>
#include <vcl/toolbox.hxx>
#include <svx/dialogs.hrc>
-#define TMP_STR_BEGIN "["
-#define TMP_STR_END "]"
-
#include "svx/drawitem.hxx"
#include "svx/xattr.hxx"
#include <svx/xtable.hxx>
@@ -53,16 +51,18 @@ SvxFillToolBoxControl::SvxFillToolBoxControl(
sal_uInt16 nId,
ToolBox& rTbx )
: SfxToolBoxControl( nSlotId, nId, rTbx )
- , mpStyleItem(0)
- , mpColorItem(0)
- , mpGradientItem(0)
- , mpHatchItem(0)
- , mpBitmapItem(0)
+ , mpStyleItem()
+ , mpColorItem()
+ , mpFillGradientItem()
+ , mpHatchItem()
+ , mpBitmapItem()
, mpFillControl(0)
- , mpFillTypeLB(0)
- , mpFillAttrLB(0)
- , meLastXFS(drawing::FillStyle_NONE)
- , mbUpdate(false)
+ , mpLbFillType(0)
+ , mpLbFillAttr(0)
+ , meLastXFS(static_cast<sal_uInt16>(-1))
+ , mnLastPosGradient(0)
+ , mnLastPosHatch(0)
+ , mnLastPosBitmap(0)
{
addStatusListener( OUString( ".uno:FillColor" ));
addStatusListener( OUString( ".uno:FillGradient" ));
@@ -74,432 +74,363 @@ SvxFillToolBoxControl::SvxFillToolBoxControl(
addStatusListener( OUString( ".uno:BitmapListState" ));
}
-
-
SvxFillToolBoxControl::~SvxFillToolBoxControl()
{
- delete mpStyleItem;
- delete mpColorItem;
- delete mpGradientItem;
- delete mpHatchItem;
- delete mpBitmapItem;
}
-
-
void SvxFillToolBoxControl::StateChanged(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
{
- if(eState == SfxItemState::DISABLED)
- {
- // slot disable state
- if(nSID == SID_ATTR_FILL_STYLE)
- {
- mpFillTypeLB->Disable();
- mpFillTypeLB->SetNoSelection();
- }
+ const bool bDisabled(SfxItemState::DISABLED == eState);
- mpFillAttrLB->Disable();
- mpFillAttrLB->SetNoSelection();
- }
- else if(SfxItemState::DEFAULT == eState)
+ switch(nSID)
{
- bool bEnableControls(false);
-
- // slot available state
- if(nSID == SID_ATTR_FILL_STYLE)
+ case SID_ATTR_FILL_STYLE:
{
- delete mpStyleItem;
- mpStyleItem = static_cast< XFillStyleItem* >(pState->Clone());
- mpFillTypeLB->Enable();
- }
- else if(mpStyleItem)
- {
- const drawing::FillStyle eXFS(static_cast< drawing::FillStyle >(mpStyleItem->GetValue()));
-
- if(nSID == SID_ATTR_FILL_COLOR)
+ if(bDisabled)
{
- delete mpColorItem;
- mpColorItem = static_cast< XFillColorItem* >(pState->Clone());
-
- if(eXFS == drawing::FillStyle_SOLID)
- {
- bEnableControls = true;
- }
+ mpLbFillType->Disable();
+ mpLbFillType->SetNoSelection();
+ mpLbFillAttr->Show();
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ mpToolBoxColor->Hide();
+ meLastXFS = static_cast<sal_uInt16>(-1);
+ mpStyleItem.reset();
}
- else if(nSID == SID_ATTR_FILL_GRADIENT)
- {
- delete mpGradientItem;
- mpGradientItem = static_cast< XFillGradientItem* >(pState->Clone());
- if(eXFS == drawing::FillStyle_GRADIENT)
- {
- bEnableControls = true;
- }
- }
- else if(nSID == SID_ATTR_FILL_HATCH)
+ if(eState >= SfxItemState::DEFAULT)
{
- delete mpHatchItem;
- mpHatchItem = static_cast< XFillHatchItem* >(pState->Clone());
+ const XFillStyleItem* pItem = dynamic_cast< const XFillStyleItem* >(pState);
- if(eXFS == drawing::FillStyle_HATCH)
+ if(pItem)
{
- bEnableControls = true;
- }
- }
- else if(nSID == SID_ATTR_FILL_BITMAP)
- {
- delete mpBitmapItem;
- mpBitmapItem = static_cast< XFillBitmapItem* >(pState->Clone());
+ mpStyleItem.reset(dynamic_cast< XFillStyleItem* >(pItem->Clone()));
+ mpLbFillType->Enable();
+ drawing::FillStyle eXFS = (drawing::FillStyle)mpStyleItem->GetValue();
+ meLastXFS = eXFS;
+ mpLbFillType->SelectEntryPos(sal::static_int_cast< sal_Int32 >(eXFS));
- if(eXFS == drawing::FillStyle_BITMAP)
- {
- bEnableControls = true;
+ if(drawing::FillStyle_NONE == eXFS)
+ {
+ mpLbFillAttr->SetNoSelection();
+ mpLbFillAttr->Disable();
+ }
+
+ Update();
+ break;
}
}
- }
- if(mpStyleItem)
+ mpLbFillType->SetNoSelection();
+ mpLbFillAttr->Show();
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ mpToolBoxColor->Hide();
+ meLastXFS = static_cast<sal_uInt16>(-1);
+ mpStyleItem.reset();
+ break;
+ }
+ case SID_ATTR_FILL_COLOR:
{
- // ensure that the correct entry is selected in mpFillTypeLB
- drawing::FillStyle eXFS(static_cast< drawing::FillStyle >(mpStyleItem->GetValue()));
- const bool bFillTypeChangedByUser(mpFillControl->mbFillTypeChanged);
-
- if(bFillTypeChangedByUser)
+ if(SfxItemState::DEFAULT == eState)
{
- meLastXFS = static_cast< drawing::FillStyle >(mpFillControl->mnLastFillTypeControlSelectEntryPos);
- mpFillControl->mbFillTypeChanged = false;
+ mpColorItem.reset(pState ? static_cast<XFillColorItem*>(pState->Clone()) : 0);
}
- if(meLastXFS != eXFS)
+ if(mpStyleItem && drawing::FillStyle_SOLID == (drawing::FillStyle)mpStyleItem->GetValue())
{
- mbUpdate = true;
- mpFillTypeLB->SelectEntryPos(sal::static_int_cast<sal_uInt16>(eXFS));
- }
+ mpLbFillAttr->Hide();
+ mpToolBoxColor->Show();
- mpFillAttrLB->Enable();
- }
-
- if(bEnableControls)
- {
- mpFillAttrLB->Enable();
- mbUpdate = true;
- }
-
- Update(pState);
- }
- else
- {
- // slot empty or ambigous
- if(nSID == SID_ATTR_FILL_STYLE)
- {
- mpFillTypeLB->SetNoSelection();
- mpFillAttrLB->Disable();
- mpFillAttrLB->SetNoSelection();
- delete mpStyleItem;
- mpStyleItem = 0;
- mbUpdate = false;
+ Update();
+ }
+ break;
}
- else
+ case SID_ATTR_FILL_GRADIENT:
{
- drawing::FillStyle eXFS(drawing::FillStyle_NONE);
-
- if(mpStyleItem)
+ if(SfxItemState::DEFAULT == eState)
{
- eXFS = static_cast< drawing::FillStyle >(mpStyleItem->GetValue());
+ mpFillGradientItem.reset(pState ? static_cast<XFillGradientItem*>(pState->Clone()) : 0);
}
- if(!mpStyleItem ||
- (nSID == SID_ATTR_FILL_COLOR && eXFS == drawing::FillStyle_SOLID) ||
- (nSID == SID_ATTR_FILL_GRADIENT && eXFS == drawing::FillStyle_GRADIENT) ||
- (nSID == SID_ATTR_FILL_HATCH && eXFS == drawing::FillStyle_HATCH) ||
- (nSID == SID_ATTR_FILL_BITMAP && eXFS == drawing::FillStyle_BITMAP))
+ if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue())
{
- mpFillAttrLB->SetNoSelection();
- }
- }
- }
-}
-
-
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
-void SvxFillToolBoxControl::Update(const SfxPoolItem* pState)
-{
- if(mpStyleItem && pState && mbUpdate)
- {
- mbUpdate = false;
- const drawing::FillStyle eXFS(static_cast< drawing::FillStyle >(mpStyleItem->GetValue()));
-
- // Check if the fill style was already active
- if(meLastXFS != eXFS)
- {
- // update mnLastFillTypeControlSelectEntryPos and fill style list
- mpFillControl->updateLastFillTypeControlSelectEntryPos();
- mpFillControl->InitializeFillStyleAccordingToGivenFillType(eXFS);
- meLastXFS = eXFS;
+ if(SfxItemState::DEFAULT == eState)
+ {
+ mpLbFillAttr->Enable();
+ Update();
+ }
+ else if(SfxItemState::DISABLED == eState )
+ {
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ break;
}
-
- switch(eXFS)
+ case SID_ATTR_FILL_HATCH:
{
- case drawing::FillStyle_NONE:
+ if(SfxItemState::DEFAULT == eState)
{
- break;
+ mpHatchItem.reset(pState ? static_cast<XFillHatchItem*>(pState->Clone()) : 0);
}
- case drawing::FillStyle_SOLID:
+ if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue())
{
- if(mpColorItem)
- {
- OUString aString(mpColorItem->GetName());
- ::Color aColor = mpColorItem->GetColorValue();
-
- mpFillAttrLB->SelectEntry(aString);
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
- if(mpFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || mpFillAttrLB->GetSelectEntryColor() != aColor)
- {
- mpFillAttrLB->SelectEntry(aColor);
- }
-
- // Check if the entry is not in the list
- if( mpFillAttrLB->GetSelectEntryPos() ==
- LISTBOX_ENTRY_NOTFOUND ||
- mpFillAttrLB->GetSelectEntryColor() != aColor )
- {
- sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
- OUString aTmpStr;
- if( nCount > 0 )
- {
- // Last entry gets tested against temporary color
- aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
- aTmpStr.endsWith(TMP_STR_END) )
- {
- mpFillAttrLB->RemoveEntry(nCount - 1);
- }
- }
- aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
-
- sal_Int32 nPos = mpFillAttrLB->InsertEntry(aColor, aTmpStr);
- mpFillAttrLB->SelectEntryPos(nPos);
- }
+ if(SfxItemState::DEFAULT == eState)
+ {
+ mpLbFillAttr->Enable();
+ Update();
+ }
+ else if(SfxItemState::DISABLED == eState )
+ {
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
}
else
{
- mpFillAttrLB->SetNoSelection();
+ mpLbFillAttr->SetNoSelection();
}
- break;
}
-
- case drawing::FillStyle_GRADIENT:
+ break;
+ }
+ case SID_ATTR_FILL_BITMAP:
+ {
+ if(SfxItemState::DEFAULT == eState)
{
- if(mpGradientItem)
- {
- OUString aString(mpGradientItem->GetName());
- mpFillAttrLB->SelectEntry( aString );
- // Check if the entry is not in the list
- if (mpFillAttrLB->GetSelectEntry() != aString)
- {
- sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
- OUString aTmpStr;
- if( nCount > 0 )
- {
- // Last entry gets tested against temporary entry
- aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
- aTmpStr.endsWith(TMP_STR_END) )
- {
- mpFillAttrLB->RemoveEntry(nCount - 1);
- }
- }
- aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
-
- boost::scoped_ptr<XGradientEntry> pEntry(new XGradientEntry(mpGradientItem->GetGradientValue(), aTmpStr));
- XGradientList aGradientList( "", ""/*TODO?*/ );
- aGradientList.Insert( pEntry.get() );
- aGradientList.SetDirty( false );
- const Bitmap aBmp = aGradientList.GetUiBitmap( 0 );
+ mpBitmapItem.reset(pState ? static_cast<XFillBitmapItem*>(pState->Clone()) : 0);
+ }
- if(!aBmp.IsEmpty())
- {
- mpFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
- mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
- }
+ if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue())
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
- aGradientList.Remove( 0 );
- }
+ if(SfxItemState::DEFAULT == eState)
+ {
+ mpLbFillAttr->Enable();
+ Update();
+ }
+ else if(SfxItemState::DISABLED == eState )
+ {
+ mpLbFillAttr->Disable();
+ mpLbFillAttr->SetNoSelection();
}
else
{
- mpFillAttrLB->SetNoSelection();
+ mpLbFillAttr->SetNoSelection();
}
- break;
}
-
- case drawing::FillStyle_HATCH:
+ break;
+ }
+ case SID_GRADIENT_LIST:
+ {
+ if(SfxItemState::DEFAULT == eState)
{
- if(mpHatchItem)
+ if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue())
{
- OUString aString(mpHatchItem->GetName());
- mpFillAttrLB->SelectEntry( aString );
- // Check if the entry is not in the list
- if (mpFillAttrLB->GetSelectEntry() != aString)
+ if(mpFillGradientItem)
{
- sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
- OUString aTmpStr;
- if( nCount > 0 )
- {
- // Last entry gets tested against temporary entry
- aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
- if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
- aTmpStr.endsWith(TMP_STR_END) )
- {
- mpFillAttrLB->RemoveEntry(nCount - 1);
- }
- }
- aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
-
- boost::scoped_ptr<XHatchEntry> pEntry(new XHatchEntry(mpHatchItem->GetHatchValue(), aTmpStr));
- XHatchList aHatchList( "", ""/*TODO?*/ );
- aHatchList.Insert( pEntry.get() );
- aHatchList.SetDirty( false );
- const Bitmap aBmp = aHatchList.GetUiBitmap( 0 );
-
- if(!aBmp.IsEmpty())
- {
- mpFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
- mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
- }
-
- aHatchList.Remove( 0 );
+ const OUString aString( mpFillGradientItem->GetName() );
+ const SfxObjectShell* pSh = SfxObjectShell::Current();
+ const SvxGradientListItem aItem( *static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST)));
+
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Fill(aItem.GetGradientList());
+ mpLbFillAttr->SelectEntry(aString);
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
}
}
- else
- {
- mpFillAttrLB->SetNoSelection();
- }
- break;
}
-
- case drawing::FillStyle_BITMAP:
+ break;
+ }
+ case SID_HATCH_LIST:
+ {
+ if(SfxItemState::DEFAULT == eState)
{
- if(mpBitmapItem)
+ if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue())
{
- OUString aString(mpBitmapItem->GetName());
- mpFillAttrLB->SelectEntry( aString );
- // Check if the entry is not in the list
- if (mpFillAttrLB->GetSelectEntry() != aString)
+ if(mpHatchItem)
{
- sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
- OUString aTmpStr;
- if( nCount > 0 )
- {
- // Last entry gets tested against temporary entry
- aTmpStr = mpFillAttrLB->GetEntry(nCount - 1);
- if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
- aTmpStr.endsWith(TMP_STR_END) )
- {
- mpFillAttrLB->RemoveEntry(nCount - 1);
- }
- }
- aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
-
- boost::scoped_ptr<XBitmapEntry> pEntry(new XBitmapEntry(mpBitmapItem->GetGraphicObject(), aTmpStr));
- XBitmapListRef xBitmapList =
- XPropertyList::AsBitmapList(
- XPropertyList::CreatePropertyList(
- XBITMAP_LIST, "TmpList", ""/*TODO?*/));
- xBitmapList->Insert( pEntry.get() );
- xBitmapList->SetDirty( false );
- mpFillAttrLB->Fill( xBitmapList );
- mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
- xBitmapList->Remove( 0 );
+ const OUString aString( mpHatchItem->GetName() );
+ const SfxObjectShell* pSh = SfxObjectShell::Current();
+ const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST)));
+
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Fill(aItem.GetHatchList());
+ mpLbFillAttr->SelectEntry(aString);
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
}
}
- else
- {
- mpFillAttrLB->SetNoSelection();
- }
- break;
}
-
- default:
+ break;
+ }
+ case SID_BITMAP_LIST:
+ {
+ if(SfxItemState::DEFAULT == eState)
{
- OSL_FAIL( "Unsupported fill type" );
- break;
+ if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue())
+ {
+ if(mpBitmapItem)
+ {
+ const OUString aString( mpBitmapItem->GetName() );
+ const SfxObjectShell* pSh = SfxObjectShell::Current();
+ const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST)));
+
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Fill(aItem.GetBitmapList());
+ mpLbFillAttr->SelectEntry(aString);
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
}
+ break;
}
-
- // update mnLastFillAttrControlSelectEntryPos
- mpFillControl->updateLastFillAttrControlSelectEntryPos();
}
+}
- if(pState && mpStyleItem)
+void SvxFillToolBoxControl::Update()
+{
+ if(mpStyleItem)
{
- drawing::FillStyle eXFS = static_cast< drawing::FillStyle >(mpStyleItem->GetValue());
+ const drawing::FillStyle eXFS = (drawing::FillStyle)mpStyleItem->GetValue();
+ SfxObjectShell* pSh = SfxObjectShell::Current();
- // Does the lists have changed?
- switch(eXFS)
+ switch( eXFS )
{
+ case drawing::FillStyle_NONE:
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ break;
+ }
case drawing::FillStyle_SOLID:
{
- const SvxColorListItem* pItem = dynamic_cast< const SvxColorListItem* >(pState);
-
- if(pItem)
+ if(mpColorItem)
{
- ::Color aTmpColor(mpFillAttrLB->GetSelectEntryColor());
- mpFillAttrLB->Clear();
- mpFillAttrLB->Fill(pItem->GetColorList());
- mpFillAttrLB->SelectEntry(aTmpColor);
+ mpLbFillAttr->Hide();
+ mpToolBoxColor->Show();
}
break;
}
case drawing::FillStyle_GRADIENT:
{
- const SvxGradientListItem* pItem = dynamic_cast< const SvxGradientListItem* >(pState);
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
- if(pItem)
+ if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
{
- OUString aString(mpFillAttrLB->GetSelectEntry());
- mpFillAttrLB->Clear();
- mpFillAttrLB->Fill(pItem->GetGradientList());
- mpFillAttrLB->SelectEntry(aString);
+ const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST)));
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill(aItem.GetGradientList());
+
+ if(mpFillGradientItem)
+ {
+ const OUString aString(mpFillGradientItem->GetName());
+
+ mpLbFillAttr->SelectEntry(aString);
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
}
break;
}
case drawing::FillStyle_HATCH:
{
- const SvxHatchListItem* pItem = dynamic_cast< const SvxHatchListItem* >(pState);
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
- if(pItem)
+ if(pSh && pSh->GetItem(SID_HATCH_LIST))
{
- OUString aString(mpFillAttrLB->GetSelectEntry());
- mpFillAttrLB->Clear();
- mpFillAttrLB->Fill(pItem->GetHatchList());
- mpFillAttrLB->SelectEntry(aString);
+ const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST)));
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill(aItem.GetHatchList());
+
+ if(mpHatchItem)
+ {
+ const OUString aString(mpHatchItem->GetName());
+
+ mpLbFillAttr->SelectEntry( aString );
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
}
break;
}
case drawing::FillStyle_BITMAP:
{
- const SvxBitmapListItem* pItem = dynamic_cast< const SvxBitmapListItem* >(pState);
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
- if(pItem)
+ if(pSh && pSh->GetItem(SID_BITMAP_LIST))
{
- OUString aString(mpFillAttrLB->GetSelectEntry());
- mpFillAttrLB->Clear();
- mpFillAttrLB->Fill(pItem->GetBitmapList());
- mpFillAttrLB->SelectEntry(aString);
+ const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST)));
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill(aItem.GetBitmapList());
+
+ if(mpBitmapItem)
+ {
+ const OUString aString(mpBitmapItem->GetName());
+
+ mpLbFillAttr->SelectEntry(aString);
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
+ }
+ }
+ else
+ {
+ mpLbFillAttr->SetNoSelection();
}
break;
}
- default: // drawing::FillStyle_NONE
- {
- break;
- }
+ default:
+ OSL_ENSURE(false, "Non supported FillType (!)");
+ break;
}
}
+
}
VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
@@ -511,22 +442,17 @@ VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent
// (and in order to remain compatible)
mpFillControl->SetData(this);
- mpFillAttrLB = (SvxFillAttrBox*)mpFillControl->mpLbFillAttr;
- mpFillTypeLB = (SvxFillTypeBox*)mpFillControl->mpLbFillType;
+ mpLbFillType = mpFillControl->mpLbFillType;
+ mpLbFillAttr = mpFillControl->mpLbFillAttr;
+ mpToolBoxColor = mpFillControl->mpToolBoxColor;
+ mpToolBoxColor->InsertItem(".uno:FillColor", m_xFrame, ToolBoxItemBits::DROPDOWNONLY, Size(mpToolBoxColor->GetSizePixel().Width(), 0));
- mpFillAttrLB->SetUniqueId(HID_FILL_ATTR_LISTBOX);
- mpFillTypeLB->SetUniqueId(HID_FILL_TYPE_LISTBOX);
+ mpLbFillAttr->SetUniqueId(HID_FILL_ATTR_LISTBOX);
+ mpToolBoxColor->SetUniqueId(HID_FILL_ATTR_LISTBOX);
+ mpLbFillType->SetUniqueId(HID_FILL_TYPE_LISTBOX);
- if(!mpStyleItem)
- {
- // for Writer and Calc it's not the same instance of
- // SvxFillToolBoxControl which gets used after deselecting
- // and selecting a DrawObject, thhus a useful initialization is
- // needed to get the FillType and the FillStyle List inited
- // correctly. This in combination with meLastXFS inited to
- // drawing::FillStyle_NONE do the trick
- mpStyleItem = new XFillStyleItem(drawing::FillStyle_SOLID);
- }
+ mpLbFillType->SetSelectHdl(LINK(this,SvxFillToolBoxControl,SelectFillTypeHdl));
+ mpLbFillAttr->SetSelectHdl(LINK(this,SvxFillToolBoxControl,SelectFillAttrHdl));
return mpFillControl.get();
}
@@ -536,16 +462,15 @@ VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent
FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)
: Window(pParent,nStyle | WB_DIALOGCONTROL),
mpLbFillType(VclPtr<SvxFillTypeBox>::Create(this)),
+ mpToolBoxColor(VclPtr<sfx2::sidebar::SidebarToolBox>::Create(this)),
mpLbFillAttr(VclPtr<SvxFillAttrBox>::Create(this)),
maLogicalFillSize(40,80),
- maLogicalAttrSize(50,80),
- mnLastFillTypeControlSelectEntryPos(mpLbFillType->GetSelectEntryPos()),
- mnLastFillAttrControlSelectEntryPos(mpLbFillAttr->GetSelectEntryPos()),
- mbFillTypeChanged(false)
+ maLogicalAttrSize(50,80)
{
Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
mpLbFillType->SetSizePixel(aTypeSize);
+ mpToolBoxColor->SetSizePixel(aAttrSize);
mpLbFillAttr->SetSizePixel(aAttrSize);
//to get the base height
@@ -555,9 +480,6 @@ FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)
SetSizePixel(
Size(aAttrPnt.X() + aAttrSize.Width(),
std::max(aAttrSize.Height(),aTypeSize.Height())));
-
- mpLbFillType->SetSelectHdl(LINK(this,FillControl,SelectFillTypeHdl));
- mpLbFillAttr->SetSelectHdl(LINK(this,FillControl,SelectFillAttrHdl));
}
FillControl::~FillControl()
@@ -568,311 +490,309 @@ FillControl::~FillControl()
void FillControl::dispose()
{
mpLbFillType.disposeAndClear();
+ mpToolBoxColor.disposeAndClear();
mpLbFillAttr.disposeAndClear();
vcl::Window::dispose();
}
-void FillControl::InitializeFillStyleAccordingToGivenFillType(drawing::FillStyle aFillStyle)
+IMPL_LINK(SvxFillToolBoxControl, SelectFillTypeHdl, ListBox *, pToolBox)
{
- SfxObjectShell* pSh = SfxObjectShell::Current();
- bool bDone(false);
+ const drawing::FillStyle eXFS = (drawing::FillStyle)mpLbFillType->GetSelectEntryPos();
- if(pSh)
+ if((drawing::FillStyle)meLastXFS != eXFS)
{
- // clear in all cases, else we would risk a mix of FillStyles in the Style list
mpLbFillAttr->Clear();
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ const XFillStyleItem aXFillStyleItem(eXFS);
- switch (aFillStyle)
+ // #i122676# Do no longer trigger two Execute calls, one for SID_ATTR_FILL_STYLE
+ // and one for setting the fill attribute itself, but add two SfxPoolItems to the
+ // call to get just one action at the SdrObject and to create only one Undo action, too.
+ // Checked that this works in all apps.
+ switch( eXFS )
{
+ default:
+ case drawing::FillStyle_NONE:
+ {
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+ mpLbFillType->Selected();
+ mpLbFillAttr->Disable();
+
+ // #i122676# need to call a single SID_ATTR_FILL_STYLE change
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_STYLE, SfxCallMode::RECORD, &aXFillStyleItem, 0L);
+ break;
+ }
case drawing::FillStyle_SOLID:
{
- if(pSh->GetItem(SID_COLOR_TABLE))
- {
- const SvxColorListItem* pItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE));
- mpLbFillAttr->Enable();
- mpLbFillAttr->Fill(pItem->GetColorList());
- bDone = true;
- }
+ mpLbFillAttr->Hide();
+ mpToolBoxColor->Show();
+ const OUString aTmpStr;
+ const Color aColor = mpColorItem->GetColorValue();
+ const XFillColorItem aXFillColorItem( aTmpStr, aColor );
+
+ // #i122676# change FillStyle and Color in one call
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_COLOR, SfxCallMode::RECORD, &aXFillColorItem, &aXFillStyleItem, 0L);
break;
}
-
case drawing::FillStyle_GRADIENT:
{
- if(pSh->GetItem(SID_GRADIENT_LIST))
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+
+ if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
{
- const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST));
- mpLbFillAttr->Enable();
- mpLbFillAttr->Fill(pItem->GetGradientList());
- bDone = true;
+ if(!mpLbFillAttr->GetEntryCount())
+ {
+ const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST)));
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill(aItem.GetGradientList());
+ }
+
+ mpLbFillAttr->AdaptDropDownLineCountToMaximum();
+
+ if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient)
+ {
+ const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST)));
+
+ if(mnLastPosGradient < aItem.GetGradientList()->Count())
+ {
+ const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient();
+ const XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient);
+
+ // #i122676# change FillStyle and Gradient in one call
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_GRADIENT, SfxCallMode::RECORD, &aXFillGradientItem, &aXFillStyleItem, 0L);
+ mpLbFillAttr->SelectEntryPos(mnLastPosGradient);
+ }
+ }
+ }
+ else
+ {
+ mpLbFillAttr->Disable();
}
break;
}
-
case drawing::FillStyle_HATCH:
{
- if(pSh->GetItem(SID_HATCH_LIST))
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
+
+ if(pSh && pSh->GetItem(SID_HATCH_LIST))
{
- const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST));
- mpLbFillAttr->Enable();
- mpLbFillAttr->Fill(pItem->GetHatchList());
- bDone = true;
- }
- break;
- }
+ if(!mpLbFillAttr->GetEntryCount())
+ {
+ const SvxHatchListItem aItem( *static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST)));
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill(aItem.GetHatchList());
+ }
- case drawing::FillStyle_BITMAP:
- {
- if(pSh->GetItem(SID_BITMAP_LIST))
+ mpLbFillAttr->AdaptDropDownLineCountToMaximum();
+
+ if(LISTBOX_ENTRY_NOTFOUND != mnLastPosHatch)
+ {
+ const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST)));
+
+ if(mnLastPosHatch < aItem.GetHatchList()->Count())
+ {
+ const XHatch aHatch = aItem.GetHatchList()->GetHatch(mnLastPosHatch)->GetHatch();
+ const XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectEntry(), aHatch);
+
+ // #i122676# change FillStyle and Hatch in one call
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_HATCH, SfxCallMode::RECORD, &aXFillHatchItem, &aXFillStyleItem, 0L);
+ mpLbFillAttr->SelectEntryPos(mnLastPosHatch);
+ }
+ }
+ }
+ else
{
- const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST));
- mpLbFillAttr->Enable();
- mpLbFillAttr->Fill(pItem->GetBitmapList());
- bDone = true;
+ mpLbFillAttr->Disable();
}
break;
}
- default: // drawing::FillStyle_NONE
+ case drawing::FillStyle_BITMAP:
{
- // accept disable (no styles for drawing::FillStyle_NONE)
- break;
- }
- }
- }
-
- if (!bDone)
- {
- mpLbFillAttr->Disable();
- }
-}
-
-void FillControl::updateLastFillTypeControlSelectEntryPos()
-{
- mnLastFillTypeControlSelectEntryPos = mpLbFillType->GetSelectEntryPos();
-}
+ mpLbFillAttr->Show();
+ mpToolBoxColor->Hide();
-IMPL_LINK(FillControl,SelectFillTypeHdl,ListBox *,pBox)
-{
- if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here
- {
- return 0;
- }
-
- const bool bAction(
- !mpLbFillType->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list
- && mpLbFillType->GetSelectEntryCount()
- && mpLbFillType->GetSelectEntryPos() != mnLastFillTypeControlSelectEntryPos);
-
- updateLastFillTypeControlSelectEntryPos();
- drawing::FillStyle eXFS = static_cast< drawing::FillStyle >(mpLbFillType->GetSelectEntryPos());
+ if(pSh && pSh->GetItem(SID_BITMAP_LIST))
+ {
+ if(!mpLbFillAttr->GetEntryCount())
+ {
+ const SvxBitmapListItem aItem( *static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST)));
+ mpLbFillAttr->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillAttr->Fill(aItem.GetBitmapList());
+ }
- if(bAction && drawing::FillStyle_NONE != eXFS)
- {
- mbFillTypeChanged = true;
- }
+ mpLbFillAttr->AdaptDropDownLineCountToMaximum();
- // update list of FillStyles in any case
- InitializeFillStyleAccordingToGivenFillType(eXFS);
+ if(LISTBOX_ENTRY_NOTFOUND != mnLastPosBitmap)
+ {
+ const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST)));
- // for drawing::FillStyle_NONE do no longer call SelectFillAttrHdl (as done before),
- // trigger needed actions directly. This is the only action this handler
- // can trigger directly as the user action is finished in this case
- if(drawing::FillStyle_NONE == eXFS && bAction)
- {
- // for drawing::FillStyle_NONE do no longer call SelectFillAttrHdl,
- // trigger needed actions directly
- Any a;
- Sequence< PropertyValue > aArgsFillStyle(1);
- XFillStyleItem aXFillStyleItem(eXFS);
-
- aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
- aXFillStyleItem.QueryValue(a);
- aArgsFillStyle[0].Value = a;
- static_cast<SvxFillToolBoxControl*>(GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle);
- }
+ if(mnLastPosBitmap < aItem.GetBitmapList()->Count())
+ {
+ const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap);
+ const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject());
- mpLbFillType->Selected();
+ // #i122676# change FillStyle and Bitmap in one call
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_BITMAP, SfxCallMode::RECORD, &aXFillBitmapItem, &aXFillStyleItem, 0L);
+ mpLbFillAttr->SelectEntryPos(mnLastPosBitmap);
+ }
+ }
+ }
+ else
+ {
+ mpLbFillAttr->Disable();
+ }
+ break;
+ }
+ }
- // release focus. Needed to get focus automatically back to EditView
- if(mpLbFillType->IsRelease())
- {
- SfxViewShell* pViewShell = SfxViewShell::Current();
+ meLastXFS = (sal_uInt16)eXFS;
- if(pViewShell && pViewShell->GetWindow())
+ if(drawing::FillStyle_NONE != eXFS)
{
- pViewShell->GetWindow()->GrabFocus();
+ if(pToolBox)
+ {
+ mpLbFillType->Selected();
+ }
}
}
return 0;
}
-
-
-void FillControl::updateLastFillAttrControlSelectEntryPos()
+IMPL_LINK(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox *, pToolBox)
{
- mnLastFillAttrControlSelectEntryPos = mpLbFillAttr->GetSelectEntryPos();
-}
-
-IMPL_LINK(FillControl, SelectFillAttrHdl, ListBox *, pBox)
-{
- if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here
- {
- return 0;
- }
-
- const bool bAction(
- !mpLbFillAttr->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list
- && mpLbFillAttr->GetSelectEntryCount()
- && mpLbFillAttr->GetSelectEntryPos() != mnLastFillAttrControlSelectEntryPos);
-
- updateLastFillAttrControlSelectEntryPos();
+ const drawing::FillStyle eXFS = (drawing::FillStyle)mpLbFillType->GetSelectEntryPos();
+ const XFillStyleItem aXFillStyleItem(eXFS);
+ SfxObjectShell* pSh = SfxObjectShell::Current();
- if(bAction)
+ if(pToolBox)
{
- SfxObjectShell* pSh = SfxObjectShell::Current();
-
- // Need to prepare the PropertyValue for the FillStyle dispatch action early,
- // else the call for FillType to Dispatch(".uno:FillStyle") will already destroy the current state
- // of selection in mpLbFillAttr again by calls to StateChanged which *will* set to no
- // selection again (e.g. when two objects, same fill style, but different fill attributes)
- Any a;
- Sequence< PropertyValue > aArgsFillAttr(1);
- OUString aFillAttrCommand;
- drawing::FillStyle eXFS(static_cast< drawing::FillStyle >(mpLbFillType->GetSelectEntryPos()));
+ // #i122676# dependent from bFillStyleChange, do execute a single or two
+ // changes in one Execute call
+ const bool bFillStyleChange((drawing::FillStyle) meLastXFS != eXFS);
switch(eXFS)
{
- default:
- case drawing::FillStyle_NONE:
- {
- // handled in SelectFillTypeHdl, nothing to do here
- break;
- }
-
case drawing::FillStyle_SOLID:
{
- // Entry gets tested against temporary color
- OUString aTmpStr = mpLbFillAttr->GetSelectEntry();
- if( aTmpStr.startsWith(TMP_STR_BEGIN) && aTmpStr.endsWith(TMP_STR_END) )
+ if(bFillStyleChange)
{
- aTmpStr = aTmpStr.copy(1, aTmpStr.getLength()-2);
+ // #i122676# Single FillStyle change call needed here
+ SfxViewFrame::Current()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SfxCallMode::RECORD, &aXFillStyleItem, 0L);
}
-
- XFillColorItem aXFillColorItem(aTmpStr, mpLbFillAttr->GetSelectEntryColor());
- aArgsFillAttr[0].Name = "FillColor";
- aXFillColorItem.QueryValue(a);
- aArgsFillAttr[0].Value = a;
- aFillAttrCommand = ".uno:FillColor";
break;
}
case drawing::FillStyle_GRADIENT:
{
sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
- if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_GRADIENT_LIST))
+
+ if(LISTBOX_ENTRY_NOTFOUND == nPos)
{
- const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST));
+ nPos = mnLastPosGradient;
+ }
- if (nPos < pItem->GetGradientList()->Count()) // no temporary entry?
+ if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_GRADIENT_LIST))
+ {
+ const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST)));
+
+ if(nPos < aItem.GetGradientList()->Count())
{
- XGradient aGradient = pItem->GetGradientList()->GetGradient(nPos)->GetGradient();
- XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetSelectEntry(),aGradient);
- aArgsFillAttr[0].Name = "FillGradient";
- aXFillGradientItem.QueryValue(a);
- aArgsFillAttr[0].Value = a;
- aFillAttrCommand = ".uno:FillGradient";
+ const XGradient aGradient = aItem.GetGradientList()->GetGradient(nPos)->GetGradient();
+ const XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetSelectEntry(), aGradient);
+
+ // #i122676# Change FillStale and Gradinet in one call
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_GRADIENT, SfxCallMode::RECORD, &aXFillGradientItem,
+ bFillStyleChange ? &aXFillStyleItem : 0L, 0L);
}
}
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ mnLastPosGradient = nPos;
+ }
break;
}
-
case drawing::FillStyle_HATCH:
{
sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
- if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_HATCH_LIST))
+
+ if(LISTBOX_ENTRY_NOTFOUND == nPos)
+ {
+ nPos = mnLastPosHatch;
+ }
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_HATCH_LIST))
{
- const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST));
+ const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST)));
- if (nPos < pItem->GetHatchList()->Count()) // no temporary entry?
+ if(nPos < aItem.GetHatchList()->Count())
{
- XHatch aHatch = pItem->GetHatchList()->GetHatch(nPos)->GetHatch();
- XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectEntry(), aHatch);
+ const XHatch aHatch = aItem.GetHatchList()->GetHatch(nPos)->GetHatch();
+ const XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch);
- aArgsFillAttr[0].Name = "FillHatch";
- aXFillHatchItem.QueryValue(a);
- aArgsFillAttr[0].Value = a;
- aFillAttrCommand = ".uno:FillHatch";
+ // #i122676# Change FillStale and Hatch in one call
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_HATCH, SfxCallMode::RECORD, &aXFillHatchItem,
+ bFillStyleChange ? &aXFillStyleItem : 0L, 0L);
}
}
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ mnLastPosHatch = nPos;
+ }
break;
}
-
case drawing::FillStyle_BITMAP:
{
sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
- if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_BITMAP_LIST))
+
+ if(LISTBOX_ENTRY_NOTFOUND == nPos)
{
- const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST));
+ nPos = mnLastPosBitmap;
+ }
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_BITMAP_LIST))
+ {
+ const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST)));
- if (nPos < pItem->GetBitmapList()->Count()) // no temporary entry?
+ if(nPos < aItem.GetBitmapList()->Count())
{
- const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(nPos);
- const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(),pXBitmapEntry->GetGraphicObject());
+ const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos);
+ const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject());
- aArgsFillAttr[0].Name = "FillBitmap";
- aXFillBitmapItem.QueryValue(a);
- aArgsFillAttr[0].Value = a;
- aFillAttrCommand = ".uno:FillBitmap";
+ // #i122676# Change FillStale and Bitmap in one call
+ SfxViewFrame::Current()->GetDispatcher()->Execute(
+ SID_ATTR_FILL_BITMAP, SfxCallMode::RECORD, &aXFillBitmapItem,
+ bFillStyleChange ? &aXFillStyleItem : 0L, 0L);
}
}
- break;
- }
- }
-
- // this is the place where evtl. a new slot action may be introduced to avoid the
- // two undo entries. Reason for this is that indeed two actions are executed, the fill style
- // and the fill attribute change. The sidebar already handles both separately, so
- // changing the fill style already changes the object and adds a default fill attribute for
- // the newly chosen fill style.
- // This control uses the older user's two-step action to select a fill style and a fill attribute. In
- // this case a lot of things may go wrong (e.g. the user stops that action and does something
- // different), thus the solution of the sidebar should be preferred from my POV in the future
-
- // first set the fill style if changed
- if(mbFillTypeChanged)
- {
- Sequence< PropertyValue > aArgsFillStyle(1);
- XFillStyleItem aXFillStyleItem(eXFS);
-
- aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
- aXFillStyleItem.QueryValue(a);
- aArgsFillStyle[0].Value = a;
- static_cast<SvxFillToolBoxControl*>(GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle);
- mbFillTypeChanged = false;
- }
-
- // second set fill attribute when a change was detected and prepared
- if(aFillAttrCommand.getLength())
- {
- static_cast<SvxFillToolBoxControl*>(GetData())->Dispatch(aFillAttrCommand, aArgsFillAttr);
- }
- // release focus. Needed to get focus automatically back to EditView
- if(mpLbFillAttr->IsRelease() && pBox)
- {
- SfxViewShell* pViewShell = SfxViewShell::Current();
-
- if(pViewShell && pViewShell->GetWindow())
- {
- pViewShell->GetWindow()->GrabFocus();
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ mnLastPosBitmap = nPos;
+ }
+ break;
}
+ default: break;
}
}
return 0;
}
-
-
void FillControl::Resize()
{
// Width of the two list boxes not 1/2 : 1/2, but 2/5 : 3/5
@@ -881,6 +801,7 @@ void FillControl::Resize()
long nSep = 0; // was previously 4
mpLbFillType->SetSizePixel(Size(nW * 2 - nSep,nH));
+ mpToolBoxColor->SetPosSizePixel(Point(nW * 2 + nSep,0),Size(nW * 3 - nSep,nH));
mpLbFillAttr->SetPosSizePixel(Point(nW * 2 + nSep,0),Size(nW * 3 - nSep,nH));
}
@@ -892,6 +813,7 @@ void FillControl::DataChanged(const DataChangedEvent& rDCEvt)
Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
mpLbFillType->SetSizePixel(aTypeSize);
+ mpToolBoxColor->SetSizePixel(aAttrSize);
mpLbFillAttr->SetSizePixel(aAttrSize);
//to get the base height
commit 1c6d21d017721f014d5a3c0588c1717f939c5581
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 5 13:55:47 2015 +0100
these are not used in this .hxx
Change-Id: I81bffed8f47849bb1289cdcef4fa10a332a1c86c
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index 9de550e..d39337c 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -39,11 +39,8 @@
#include <com/sun/star/frame/XSubToolbarController.hpp>
-
class SfxToolBoxControl;
-class SfxBindings;
class SfxModule;
-class SfxUnoControllerItem;
svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL );
commit 7fb784ff2c58f7ad89b0f961fee76e3a363841ff
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 5 13:31:29 2015 +0100
use a sizegroup to stop area panel 'jumping'
toolbox and lists are a little different in height naturally causing a little
jump in layout on toggling between color and anything else
Change-Id: I0b2ab92ab2fb5bec7d7fecc7aeaf15f47781a67b
diff --git a/svx/uiconfig/ui/sidebararea.ui b/svx/uiconfig/ui/sidebararea.ui
index cbea7cb..adad038 100644
--- a/svx/uiconfig/ui/sidebararea.ui
+++ b/svx/uiconfig/ui/sidebararea.ui
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
- <!-- interface-requires LibreOffice 1.0 -->
+ <requires lib="gtk+" version="3.0"/>
+ <requires lib="LibreOffice" version="1.0"/>
<object class="GtkGrid" id="AreaPropertyPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -36,8 +37,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -53,8 +52,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -64,7 +61,6 @@
<property name="hexpand">True</property>
<child>
<object class="sfxlo-SidebarToolBox" id="selectcolor">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuToolButton" id="color">
@@ -91,7 +87,6 @@
</child>
<child>
<object class="svxlo-SvxFillAttrBox" id="fillattr">
- <property name="visible">False</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup" translatable="yes">Select the effect to apply.</property>
@@ -107,8 +102,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -126,8 +119,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -137,8 +128,6 @@
<property name="has_tooltip">True</property>
<property name="tooltip_markup" translatable="yes">Select the type of transparency to apply.</property>
<property name="tooltip_text" translatable="yes">Select the type of transparency to apply.</property>
- <property name="entry_text_column">0</property>
- <property name="id_column">1</property>
<items>
<item translatable="yes">None</item>
<item translatable="yes">Solid</item>
@@ -153,8 +142,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -198,7 +185,6 @@
<property name="hexpand">True</property>
<property name="max_length">100</property>
<property name="invisible_char">•</property>
- <property name="invisible_char_set">True</property>
<property name="secondary_icon_activatable">False</property>
<property name="climb_rate">5</property>
<property name="numeric">True</property>
@@ -213,8 +199,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -234,9 +218,14 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
+ <object class="GtkSizeGroup" id="sizegroup1">
+ <property name="mode">both</property>
+ <widgets>
+ <widget name="selectcolor"/>
+ <widget name="fillattr"/>
+ </widgets>
+ </object>
</interface>
commit 9a5361df8c3b89203315ba0a33bc4d8f613d701f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 5 13:24:34 2015 +0100
add some missing glade prototypes
Change-Id: Iff936ca81c594b588b0dd8b66970fa6135a4c53e
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index d2f5aca..58f70c4 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -696,6 +696,14 @@
generic-name="Fade Effect ListBox" parent="GtkComboBox"
icon-name="widget-gtk-combobox"/>
+ <glade-widget-class title="Fill Type ListBox" name="svxlo-SvxFillTypeBox"
+ generic-name="Fill Type ListBox" parent="GtkComboBox"
+ icon-name="widget-gtk-combobox"/>
+
+ <glade-widget-class title="Fill Attr ListBox" name="svxlo-SvxFillAttrBox"
+ generic-name="Fill Attr ListBox" parent="GtkComboBox"
+ icon-name="widget-gtk-combobox"/>
+
<glade-widget-class title="Open Document Button" name="dbulo-OpenDocumentButton"
generic-name="Open Document Button" parent="GtkButton"
icon-name="widget-gtk-button"/>
commit 5d7af14e3224e784a3c1cc6b0fcd23889c3d8ed1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 5 15:35:14 2015 +0100
drop useless temp debugging strings
Change-Id: I7731d16044fe884d5678330920bf468ccff87d19
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx
index 796d8bc..1ff242c 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -270,9 +270,6 @@ void SwHHCWrapper::ChangeText( const OUString &rNewText,
{
nChgLen = nIndex - nChgPos;
nConvChgLen = nPos - nConvChgPos;
-#if OSL_DEBUG_LEVEL > 1
- OUString aInOrig( rOrigText.copy( nChgPos, nChgLen ) );
-#endif
OUString aInNew( rNewText.copy( nConvChgPos, nConvChgLen ) );
// set selection to sub string to be replaced in original text
@@ -280,9 +277,6 @@ void SwHHCWrapper::ChangeText( const OUString &rNewText,
OSL_ENSURE( m_rWrtShell.GetCrsr()->HasMark(), "cursor misplaced (nothing selected)" );
m_rWrtShell.GetCrsr()->GetMark()->nContent.Assign( pStartTxtNode, nChgInNodeStartIndex );
m_rWrtShell.GetCrsr()->GetPoint()->nContent.Assign( pStartTxtNode, nChgInNodeStartIndex + nChgLen );
-#if OSL_DEBUG_LEVEL > 1
- OUString aSelTxt1( m_rWrtShell.GetSelTxt() );
-#endif
// replace selected sub string with the corresponding
// sub string from the new text while keeping as
@@ -334,9 +328,6 @@ void SwHHCWrapper::ChangeText_impl( const OUString &rNewText, bool bKeepAttribut
// restore those for the new text
m_rWrtShell.GetCurAttr( aItemSet );
-#if OSL_DEBUG_LEVEL > 1
- OUString aSelTxt1( m_rWrtShell.GetSelTxt() );
-#endif
m_rWrtShell.Delete();
m_rWrtShell.Insert( rNewText );
@@ -345,9 +336,6 @@ void SwHHCWrapper::ChangeText_impl( const OUString &rNewText, bool bKeepAttribut
m_rWrtShell.GetCrsr()->SetMark();
SwPosition *pMark = m_rWrtShell.GetCrsr()->GetMark();
pMark->nContent = pMark->nContent.GetIndex() - rNewText.getLength();
-#if OSL_DEBUG_LEVEL > 1
- OUString aSelTxt2( m_rWrtShell.GetSelTxt() );
-#endif
// since 'SetAttr' below functions like merging with the attributes
// from the itemset with any existing ones we have to get rid of all
More information about the Libreoffice-commits
mailing list