Kaydet (Commit) 30c2ae28 authored tarafından Rishabh Kumar's avatar Rishabh Kumar Kaydeden (comit) Katarina Behrens

Addition of new controls to Wrap sidebar tab in Writer

Addition of Enable Contour and Edit Contour button to the sidebar

Change-Id: I9cadbcc9643b9fc87b3dbe3a9a2355cd674d1e53
Reviewed-on: https://gerrit.libreoffice.org/17324Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst d400f155
...@@ -22,15 +22,18 @@ ...@@ -22,15 +22,18 @@
#include <cmdid.h> #include <cmdid.h>
#include <swtypes.hxx> #include <swtypes.hxx>
#include <svx/svxids.hrc>
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
#include <sfx2/imagemgr.hxx> #include <sfx2/imagemgr.hxx>
#include <svl/eitem.hxx> #include <svl/eitem.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
#include <hintids.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
const char UNO_WRAPOFF[] = ".uno:WrapOff"; const char UNO_WRAPOFF[] = ".uno:WrapOff";
...@@ -67,7 +70,13 @@ WrapPropertyPanel::WrapPropertyPanel( ...@@ -67,7 +70,13 @@ WrapPropertyPanel::WrapPropertyPanel(
: PanelLayout(pParent, "WrapPropertyPanel", "modules/swriter/ui/sidebarwrap.ui", rxFrame) : PanelLayout(pParent, "WrapPropertyPanel", "modules/swriter/ui/sidebarwrap.ui", rxFrame)
, mxFrame( rxFrame ) , mxFrame( rxFrame )
, mpBindings(pBindings) , mpBindings(pBindings)
// spacing
, nTop(0)
, nBottom(0)
, nLeft(0)
, nRight(0)
// resources // resources
, aCustomEntry()
, aWrapIL(6,2) , aWrapIL(6,2)
// controller items // controller items
, maSwNoWrapControl(FN_FRAME_NOWRAP, *pBindings, *this) , maSwNoWrapControl(FN_FRAME_NOWRAP, *pBindings, *this)
...@@ -76,6 +85,9 @@ WrapPropertyPanel::WrapPropertyPanel( ...@@ -76,6 +85,9 @@ WrapPropertyPanel::WrapPropertyPanel(
, maSwWrapParallelControl(FN_FRAME_WRAP_LEFT, *pBindings, *this) , maSwWrapParallelControl(FN_FRAME_WRAP_LEFT, *pBindings, *this)
, maSwWrapThroughControl(FN_FRAME_WRAPTHRU, *pBindings, *this) , maSwWrapThroughControl(FN_FRAME_WRAPTHRU, *pBindings, *this)
, maSwWrapIdealControl(FN_FRAME_WRAP_IDEAL, *pBindings, *this) , maSwWrapIdealControl(FN_FRAME_WRAP_IDEAL, *pBindings, *this)
, maSwEnableContourControl(FN_FRAME_WRAP_CONTOUR, *pBindings, *this)
, maSwLRSpacingControl(SID_ATTR_LRSPACE, *pBindings, *this)
, maSwULSpacingControl(SID_ATTR_ULSPACE, *pBindings, *this)
{ {
get(mpRBNoWrap, "buttonnone"); get(mpRBNoWrap, "buttonnone");
get(mpRBWrapLeft, "buttonbefore"); get(mpRBWrapLeft, "buttonbefore");
...@@ -83,6 +95,10 @@ WrapPropertyPanel::WrapPropertyPanel( ...@@ -83,6 +95,10 @@ WrapPropertyPanel::WrapPropertyPanel(
get(mpRBWrapParallel, "buttonparallel"); get(mpRBWrapParallel, "buttonparallel");
get(mpRBWrapThrough, "buttonthrough"); get(mpRBWrapThrough, "buttonthrough");
get(mpRBIdealWrap, "buttonoptimal"); get(mpRBIdealWrap, "buttonoptimal");
get(mpEnableContour, "enablecontour");
get(mpEditContour, "editcontour");
get(mpSpacingLB, "spacingLB");
get(mpCustomEntry, "customlabel");
Initialize(); Initialize();
} }
...@@ -100,6 +116,10 @@ void WrapPropertyPanel::dispose() ...@@ -100,6 +116,10 @@ void WrapPropertyPanel::dispose()
mpRBWrapParallel.clear(); mpRBWrapParallel.clear();
mpRBWrapThrough.clear(); mpRBWrapThrough.clear();
mpRBIdealWrap.clear(); mpRBIdealWrap.clear();
mpEnableContour.clear();
mpEditContour.clear();
mpSpacingLB.clear();
mpCustomEntry.clear();
maSwNoWrapControl.dispose(); maSwNoWrapControl.dispose();
maSwWrapLeftControl.dispose(); maSwWrapLeftControl.dispose();
...@@ -107,6 +127,9 @@ void WrapPropertyPanel::dispose() ...@@ -107,6 +127,9 @@ void WrapPropertyPanel::dispose()
maSwWrapParallelControl.dispose(); maSwWrapParallelControl.dispose();
maSwWrapThroughControl.dispose(); maSwWrapThroughControl.dispose();
maSwWrapIdealControl.dispose(); maSwWrapIdealControl.dispose();
maSwEnableContourControl.dispose();
maSwLRSpacingControl.dispose();
maSwULSpacingControl.dispose();
PanelLayout::dispose(); PanelLayout::dispose();
} }
...@@ -121,6 +144,12 @@ void WrapPropertyPanel::Initialize() ...@@ -121,6 +144,12 @@ void WrapPropertyPanel::Initialize()
mpRBWrapThrough->SetClickHdl(aLink); mpRBWrapThrough->SetClickHdl(aLink);
mpRBIdealWrap->SetClickHdl(aLink); mpRBIdealWrap->SetClickHdl(aLink);
Link<Button*,void> EditContourLink = LINK(this, WrapPropertyPanel, EditContourHdl);
mpEditContour->SetClickHdl(EditContourLink);
Link<Button*, void> EnableContourLink = LINK(this,WrapPropertyPanel, EnableContourHdl);
mpEnableContour->SetClickHdl(EnableContourLink);
mpSpacingLB->SetSelectHdl(LINK(this, WrapPropertyPanel, SpacingLBHdl));
aWrapIL.AddImage( UNO_WRAPOFF, aWrapIL.AddImage( UNO_WRAPOFF,
::GetImage( mxFrame, UNO_WRAPOFF, false ) ); ::GetImage( mxFrame, UNO_WRAPOFF, false ) );
aWrapIL.AddImage( UNO_WRAPLEFT, aWrapIL.AddImage( UNO_WRAPLEFT,
...@@ -149,6 +178,8 @@ void WrapPropertyPanel::Initialize() ...@@ -149,6 +178,8 @@ void WrapPropertyPanel::Initialize()
mpRBWrapThrough->SetModeRadioImage( aWrapIL.GetImage(UNO_WRAPTHROUGH) ); mpRBWrapThrough->SetModeRadioImage( aWrapIL.GetImage(UNO_WRAPTHROUGH) );
mpRBIdealWrap->SetModeRadioImage( aWrapIL.GetImage(UNO_WRAPIDEAL) ); mpRBIdealWrap->SetModeRadioImage( aWrapIL.GetImage(UNO_WRAPIDEAL) );
aCustomEntry = mpCustomEntry->GetText();
mpRBNoWrap->SetAccessibleName(mpRBNoWrap->GetQuickHelpText()); mpRBNoWrap->SetAccessibleName(mpRBNoWrap->GetQuickHelpText());
mpRBWrapLeft->SetAccessibleName(mpRBWrapLeft->GetQuickHelpText()); mpRBWrapLeft->SetAccessibleName(mpRBWrapLeft->GetQuickHelpText());
mpRBWrapRight->SetAccessibleName(mpRBWrapRight->GetQuickHelpText()); mpRBWrapRight->SetAccessibleName(mpRBWrapRight->GetQuickHelpText());
...@@ -162,6 +193,56 @@ void WrapPropertyPanel::Initialize() ...@@ -162,6 +193,56 @@ void WrapPropertyPanel::Initialize()
mpBindings->Update( FN_FRAME_WRAP_LEFT ); mpBindings->Update( FN_FRAME_WRAP_LEFT );
mpBindings->Update( FN_FRAME_WRAPTHRU ); mpBindings->Update( FN_FRAME_WRAPTHRU );
mpBindings->Update( FN_FRAME_WRAP_IDEAL ); mpBindings->Update( FN_FRAME_WRAP_IDEAL );
mpBindings->Update( FN_FRAME_WRAP_CONTOUR );
mpBindings->Update( SID_ATTR_LRSPACE );
mpBindings->Update( SID_ATTR_ULSPACE );
}
void WrapPropertyPanel::UpdateSpacingLB()
{
if( (nLeft == nRight) && (nTop == nBottom) && (nLeft == nTop) )
{
for(sal_uInt16 i = 0; i < mpSpacingLB->GetEntryCount(); i++)
{
if(reinterpret_cast<sal_uLong>(mpSpacingLB->GetEntryData(i)) == nLeft )
{
mpSpacingLB->SelectEntryPos(i);
mpSpacingLB->RemoveEntry(aCustomEntry);
return;
}
}
}
mpSpacingLB->InsertEntry(aCustomEntry);
mpSpacingLB->SelectEntry(aCustomEntry);
}
IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, EditContourHdl, Button*, void)
{
SfxBoolItem aItem(SID_CONTOUR_DLG, true);
mpBindings->GetDispatcher()->Execute(SID_CONTOUR_DLG, SfxCallMode::RECORD, &aItem, 0L);
}
IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, EnableContourHdl, Button*, void)
{
bool IsContour = mpEnableContour->IsChecked();
SfxBoolItem aItem(FN_FRAME_WRAP_CONTOUR, IsContour);
mpBindings->GetDispatcher()->Execute(FN_FRAME_WRAP_CONTOUR, SfxCallMode::RECORD, &aItem, 0l);
}
IMPL_LINK(WrapPropertyPanel, SpacingLBHdl, ListBox*, pBox)
{
sal_uInt16 nVal = (sal_uInt16)reinterpret_cast<sal_uLong>(pBox->GetSelectEntryData());
SvxLRSpaceItem aLRItem(nVal, nVal, 0, 0, RES_LR_SPACE);
SvxULSpaceItem aULItem(nVal, nVal, RES_UL_SPACE);
nTop = nBottom = nLeft = nRight = nVal;
mpBindings->GetDispatcher()->Execute(SID_ATTR_LRSPACE, SfxCallMode::RECORD, &aLRItem, 0l);
mpBindings->GetDispatcher()->Execute(SID_ATTR_ULSPACE, SfxCallMode::RECORD, &aULItem, 0l);
return 0L;
} }
IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, WrapTypeHdl, Button*, void) IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, WrapTypeHdl, Button*, void)
...@@ -193,6 +274,21 @@ IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, WrapTypeHdl, Button*, void) ...@@ -193,6 +274,21 @@ IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, WrapTypeHdl, Button*, void)
} }
SfxBoolItem bStateItem( nSlot, true ); SfxBoolItem bStateItem( nSlot, true );
mpBindings->GetDispatcher()->Execute( nSlot, SfxCallMode::RECORD, &bStateItem, 0L ); mpBindings->GetDispatcher()->Execute( nSlot, SfxCallMode::RECORD, &bStateItem, 0L );
}
void WrapPropertyPanel::UpdateEditContour()
{
if(mpRBNoWrap->IsChecked() || mpRBWrapThrough->IsChecked())
{
mpEnableContour->Check( false );
mpEnableContour->Disable();
}
else
{
mpEnableContour->Enable();
}
} }
void WrapPropertyPanel::NotifyItemUpdate( void WrapPropertyPanel::NotifyItemUpdate(
...@@ -207,12 +303,13 @@ void WrapPropertyPanel::NotifyItemUpdate( ...@@ -207,12 +303,13 @@ void WrapPropertyPanel::NotifyItemUpdate(
pState->ISA(SfxBoolItem) ) pState->ISA(SfxBoolItem) )
{ {
//Set Radio Button enable //Set Radio Button enable
mpRBNoWrap->Enable(true); mpRBNoWrap->Enable();
mpRBWrapLeft->Enable(true); mpRBWrapLeft->Enable();
mpRBWrapRight->Enable(true); mpRBWrapRight->Enable();
mpRBWrapParallel->Enable(true); mpRBWrapParallel->Enable();
mpRBWrapThrough->Enable(true); mpRBWrapThrough->Enable();
mpRBIdealWrap->Enable(true); mpRBIdealWrap->Enable();
mpEnableContour->Enable();
const SfxBoolItem* pBoolItem = static_cast< const SfxBoolItem* >( pState ); const SfxBoolItem* pBoolItem = static_cast< const SfxBoolItem* >( pState );
switch( nSId ) switch( nSId )
...@@ -232,27 +329,47 @@ void WrapPropertyPanel::NotifyItemUpdate( ...@@ -232,27 +329,47 @@ void WrapPropertyPanel::NotifyItemUpdate(
case FN_FRAME_WRAP: case FN_FRAME_WRAP:
mpRBWrapParallel->Check( pBoolItem->GetValue() ); mpRBWrapParallel->Check( pBoolItem->GetValue() );
break; break;
case FN_FRAME_WRAP_CONTOUR:
mpEnableContour->Check( pBoolItem->GetValue() );
break;
case FN_FRAME_NOWRAP: case FN_FRAME_NOWRAP:
default:
mpRBNoWrap->Check( pBoolItem->GetValue() ); mpRBNoWrap->Check( pBoolItem->GetValue() );
break; break;
} }
UpdateEditContour();
} }
else switch(nSId)
{ {
mpRBNoWrap->Enable(false); case SID_ATTR_LRSPACE:
mpRBWrapLeft->Enable(false); {
mpRBWrapRight->Enable(false); if(eState >= SfxItemState::DEFAULT)
mpRBWrapParallel->Enable(false); {
mpRBWrapThrough->Enable(false); const SvxLRSpaceItem* pItem = dynamic_cast< const SvxLRSpaceItem* >(pState);
mpRBIdealWrap->Enable(false); if(pItem)
{
mpRBNoWrap->Check( false ); nLeft = pItem->GetLeft();
mpRBWrapLeft->Check( false ); nRight = pItem->GetRight();
mpRBWrapRight->Check( false );
mpRBWrapParallel->Check( false ); UpdateSpacingLB();
mpRBWrapThrough->Check( false ); }
mpRBIdealWrap->Check( false ); }
}
break;
case SID_ATTR_ULSPACE:
{
if(eState >= SfxItemState::DEFAULT)
{
const SvxULSpaceItem* pItem = dynamic_cast< const SvxULSpaceItem* >(pState);
if(pItem)
{
nTop = pItem->GetUpper();
nBottom = pItem->GetLower();
UpdateSpacingLB();
}
}
}
break;
} }
} }
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
#include <svx/sidebar/PanelLayout.hxx> #include <svx/sidebar/PanelLayout.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/image.hxx> #include <vcl/image.hxx>
#include <vcl/fixed.hxx>
#include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/ControllerItem.hxx>
#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hpp>
#include <vcl/lstbox.hxx>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
namespace sw { namespace sidebar { namespace sw { namespace sidebar {
...@@ -64,6 +64,19 @@ namespace sw { namespace sidebar { ...@@ -64,6 +64,19 @@ namespace sw { namespace sidebar {
VclPtr<RadioButton> mpRBWrapParallel; VclPtr<RadioButton> mpRBWrapParallel;
VclPtr<RadioButton> mpRBWrapThrough; VclPtr<RadioButton> mpRBWrapThrough;
VclPtr<RadioButton> mpRBIdealWrap; VclPtr<RadioButton> mpRBIdealWrap;
VclPtr<Button> mpEditContour;
VclPtr<CheckBox> mpEnableContour;
VclPtr<ListBox> mpSpacingLB;
VclPtr<FixedText> mpCustomEntry;
//Spacing
sal_uInt16 nTop;
sal_uInt16 nBottom;
sal_uInt16 nLeft;
sal_uInt16 nRight;
//custom entry
OUString aCustomEntry;
//Image resource. //Image resource.
ImageList aWrapIL; ImageList aWrapIL;
...@@ -75,10 +88,18 @@ namespace sw { namespace sidebar { ...@@ -75,10 +88,18 @@ namespace sw { namespace sidebar {
::sfx2::sidebar::ControllerItem maSwWrapParallelControl; ::sfx2::sidebar::ControllerItem maSwWrapParallelControl;
::sfx2::sidebar::ControllerItem maSwWrapThroughControl; ::sfx2::sidebar::ControllerItem maSwWrapThroughControl;
::sfx2::sidebar::ControllerItem maSwWrapIdealControl; ::sfx2::sidebar::ControllerItem maSwWrapIdealControl;
::sfx2::sidebar::ControllerItem maSwEnableContourControl;
::sfx2::sidebar::ControllerItem maSwLRSpacingControl;
::sfx2::sidebar::ControllerItem maSwULSpacingControl;
void Initialize(); void Initialize();
void UpdateEditContour();
void UpdateSpacingLB();
DECL_LINK_TYPED(WrapTypeHdl, Button*, void); DECL_LINK_TYPED(WrapTypeHdl, Button*, void);
DECL_LINK_TYPED(EnableContourHdl, Button*, void);
DECL_LINK_TYPED(EditContourHdl, Button*, void);
DECL_LINK(SpacingLBHdl, ListBox*);
}; };
} } // end of namespace ::sw::sidebar } } // end of namespace ::sw::sidebar
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment