[Libreoffice-commits] core.git: 11 commits - include/svx sc/AllLangResTarget_sc.mk sc/source sc/uiconfig sc/UIConfig_scalc.mk svx/source vcl/source
Jan Holesovsky
kendy at suse.cz
Wed Jun 5 09:33:30 PDT 2013
include/svx/sidebar/SidebarDialControl.hxx | 1
sc/AllLangResTarget_sc.mk | 1
sc/UIConfig_scalc.mk | 1
sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 129 +++----
sc/source/ui/sidebar/AlignmentPropertyPanel.hrc | 84 -----
sc/source/ui/sidebar/AlignmentPropertyPanel.hxx | 33 -
sc/source/ui/sidebar/AlignmentPropertyPanel.src | 213 ------------
sc/uiconfig/scalc/ui/sidebaralignment.ui | 367 ++++++++++++++++++++++
svx/source/sidebar/possize/SidebarDialControl.cxx | 14
vcl/source/window/builder.cxx | 48 +-
10 files changed, 485 insertions(+), 406 deletions(-)
New commits:
commit 765a030767e2ca8cd4b6159587ccd232127b896b
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 15:16:19 2013 +0200
sidebar conversion tutorial: Cleanup - remove .src and .hrc (if possible).
When the .src/.hrc is not used by anything else, remove it from the makefile
and from repository. Otherwise remove at least the relevant parts that were
converted to .ui.
Change-Id: I2d28220416f90b87553023ec3c6aa015993f24fb
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index b83e0f9..1230786 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -85,7 +85,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
sc/source/ui/miscdlgs/acredlin.src \
sc/source/ui/formdlg/formdlgs.src \
sc/source/ui/formdlg/dwfunctr.src \
- sc/source/ui/sidebar/AlignmentPropertyPanel.src \
sc/source/ui/sidebar/CellAppearancePropertyPanel.src \
sc/source/ui/sidebar/NumberFormatPropertyPanel.src \
sc/source/core/src/compiler.src \
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index b571b4f6..d20a906 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -20,7 +20,6 @@
#include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx>
#include <AlignmentPropertyPanel.hxx>
-#include <AlignmentPropertyPanel.hrc>
#include <editeng/justifyitem.hxx>
#include <svx/dialmgr.hxx>
#include "sc.hrc"
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc b/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc
deleted file mode 100644
index 96b795f..0000000
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc
+++ /dev/null
@@ -1,84 +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 .
- */
-// RID_PROPERTYPANEL_SC_ALIGNMENT--------------------------------------------------------------
-#define FT_ORIENT 1
-#define CBX_WRAP 5
-#define FT_LEFT_INDENT 7
-#define MF_LEFT_INDENT 8
-#define CBX_MERGE 9
-#define CBX_VERT 10
-#define CTL_SBSHAPE_POSREFERENCE 12
-#define CBOX_ANGLE 14
-#define TBX_HORIZONTAL_ALIGNMENT 15
-#define TBX_VERTICAL_ALIGN 16
-#define DIAL_CONTROL 17
-#define ID_SUBSTLEFT 20
-#define ID_SUBSTCENTER 21
-#define ID_SUBSTRIGHT 22
-#define ID_SUBSTJUSTIFY 23
-#define IID_VERT_TOP 24
-#define IID_VERT_CENTER 25
-#define IID_VERT_BOTTOM 26
-
-#define MBOX_WIDTH 45
-#define TEXT_WIDTH 40
-#define FLIP_BUTTON_SIZE 13
-#define ALIGNMENT_TBX_HEIGHT 17
-#define ALIGNMENT_TBX_WIDTH 13
-
-#define IMG_ALIGN_LEFT 50
-#define IMG_ALIGN_CENTER 51
-#define IMG_ALIGN_RIGHT 52
-#define IMG_ALIGN_JUST 53
-#define IMG_ALIGN_TOP 54
-#define IMG_ALIGN_CENTER_V 55
-#define IMG_ALIGN_BOTTOM 56
-
-//---------------position-----------------
-
-#define ALIGNMENT_X SECTIONPAGE_MARGIN_HORIZONTAL
-#define ALIGNMENT_Y SECTIONPAGE_MARGIN_VERTICAL_TOP
-#define ALIGNMENT_VERT_X (ALIGNMENT_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL)
-#define ALIGNMENT_VERT_Y ALIGNMENT_Y
-
-#define FT_LEFTINDENT_X ALIGNMENT_X
-#define FT_LEFTINDENT_Y (ALIGNMENT_Y + TOOLBOX_ITEM_HEIGHT + TBX_OUT_BORDER_OFFSET_Y + CONTROL_SPACING_VERTICAL)
-#define MTR_LEFTINDENT_X ALIGNMENT_X
-#define MTR_LEFTINDENT_Y (FT_LEFTINDENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)
-
-#define CBX_WRAP_X (ALIGNMENT_X + TEXT_WIDTH + 10 + CONTROL_SPACING_HORIZONTAL)
-#define CBX_WRAP_Y (FT_LEFTINDENT_Y + 2)
-
-#define CBX_MERGE_X CBX_WRAP_X
-#define CBX_MERGE_Y CBX_WRAP_Y + CBOX_HEIGHT + 2
-
-#define FT_ORIENT_X ALIGNMENT_X
-#define FT_ORIENT_Y MTR_LEFTINDENT_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
-
-#define COMOBX_ROTATION_X FT_ORIENT_X + 30 + CONTROL_SPACING_HORIZONTAL
-#define COMOBX_ROTATION_Y FT_ORIENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + 5
-
-#define ROTATE_CONTROL_X FT_ORIENT_X
-#define ROTATE_CONTROL_Y COMOBX_ROTATION_Y - 3
-
-#define CBX_VERT_X COMOBX_ROTATION_X
-#define CBX_VERT_Y COMOBX_ROTATION_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 2
-
-#define PANEL_HEIGHT CBX_VERT_Y + 6 + SECTIONPAGE_MARGIN_VERTICAL_BOT
-
-// eof
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.src b/sc/source/ui/sidebar/AlignmentPropertyPanel.src
deleted file mode 100644
index 5a55012..0000000
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.src
+++ /dev/null
@@ -1,213 +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 "AlignmentPropertyPanel.hrc"
-#include <sfx2/sidebar/ResourceDefinitions.hrc>
-#include "sc.hrc"
-#include "helpids.h"
-
-Control RID_PROPERTYPANEL_SC_ALIGNMENT
-{
- OutputSize = TRUE;
- DialogControl = TRUE;
- Border = FALSE;
-
- Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PANEL_HEIGHT );
- HelpID = HID_PROPERTYPANEL_SC_ALIGN_SECTION;
- Text [ en-US ] = "Alignment";
-
- //------------ Alignment -------------
- ToolBox TBX_HORIZONTAL_ALIGNMENT
- {
- Pos = MAP_APPFONT ( ALIGNMENT_X , ALIGNMENT_Y );
- Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT);
- SVLook = TRUE ;
- Border = FALSE ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_HOR;
- Text [ en-US ] = "Horizontal Alignment" ;
- ItemList =
- {
- ToolBoxItem
- {
- Identifier = ID_SUBSTLEFT ;
- Text [ en-US ] = "Align Left" ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L;
- };
- ToolBoxItem
- {
- Identifier = ID_SUBSTCENTER ;
- Text [ en-US ] = "Align Center" ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C;
- };
- ToolBoxItem
- {
- Identifier = ID_SUBSTRIGHT ;
- Text [ en-US ] = "Align Right" ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R;
- };
- ToolBoxItem
- {
- Identifier = ID_SUBSTJUSTIFY ;
- Text [ en-US ] = "Align Justified" ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J;
- };
- };
- };
- ToolBox TBX_VERTICAL_ALIGN
- {
- SVLook = TRUE ;
- Border = FALSE ;
- Pos = MAP_APPFONT ( ALIGNMENT_VERT_X, ALIGNMENT_VERT_Y ) ;
- Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 , TOOLBOX_ITEM_HEIGHT) ;
- TabStop = TRUE ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_VER;
- Text [ en-US ] = "Vertical Alignment" ;
- ItemList =
- {
- ToolBoxItem
- {
- Identifier = IID_VERT_TOP ;
- Text [ en-US ] = "Align Top" ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_T;
- };
-
- ToolBoxItem
- {
- Identifier = IID_VERT_CENTER ;
- Text [ en-US ] = "Align Center Vertically" ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_C;
- };
-
- ToolBoxItem
- {
- Identifier = IID_VERT_BOTTOM ;
- Text [ en-US ] = "Align Bottom" ;
- HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_B;
- };
- };
- };
- //------------ Left indent ------------
- FixedText FT_LEFT_INDENT
- {
- Pos = MAP_APPFONT ( FT_LEFTINDENT_X, FT_LEFTINDENT_Y );
- Size = MAP_APPFONT (CBX_WRAP_X - FT_LEFTINDENT_X - 1 , TEXT_HEIGHT) ; //MBOX_WIDTH
- Text [ en-US ] = "Left ~indent:";
- };
- MetricField MF_LEFT_INDENT
- {
- Border = TRUE;
- Pos = MAP_APPFONT ( MTR_LEFTINDENT_X , MTR_LEFTINDENT_Y );
- Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ;
- TabStop = TRUE;
- Repeat = TRUE;
- Spin = TRUE;
- Minimum = 0;
- Maximum = 990;
- Unit = FUNIT_POINT;
- SpinSize = 10;
- QuickHelpText [ en-US ] = "Indents from the left edge.";
- HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_INDENT;
- };
- CheckBox CBX_WRAP
- {
- Pos = MAP_APPFONT ( CBX_WRAP_X , CBX_WRAP_Y ) ;
- Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;//
- TabStop = TRUE ;
- Text [ en-US ] = "~Wrap text" ;
- QuickHelpText [ en-US ] = "Wrap texts automatically.";
- HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_WRAP;
- };
- CheckBox CBX_MERGE
- {
- Pos = MAP_APPFONT ( CBX_MERGE_X , CBX_MERGE_Y ) ;
- Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;//
- TabStop = TRUE ;
- Text [ en-US ] = "~Merge cells" ;
- QuickHelpText [ en-US ] = "Joins the selected cells into one.";
- HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_MERGE;
- };
- //------------ Text orientation ------------
- FixedText FT_ORIENT
- {
- Pos = MAP_APPFONT ( FT_ORIENT_X, FT_ORIENT_Y );
- Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ;
- Text [ en-US ] = "Text ~orientation:";
- };
- MetricBox CBOX_ANGLE
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( COMOBX_ROTATION_X , COMOBX_ROTATION_Y );
- Size = MAP_APPFONT ( MBOX_WIDTH + 20, MBOX_HEIGHT ) ;
- Unit = FUNIT_CUSTOM ;
- CustomUnitText [ en-US ] = " degrees";
- DecimalDigits = 0;
- Minimum = 0;
- Maximum = 359;
- TabStop = TRUE ;
- DropDown = TRUE ;
- QuickHelpText [ en-US ] = "Select the angle for rotation.";
- HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE;
- };
-
- Control DIAL_CONTROL
- {
- Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y );
- Size = MAP_PIXEL( 50, 50 );
- HelpID = HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL;
- QuickHelpText [ en-US ] = "Drag to change the rotation value.";
- };
- CheckBox CBX_VERT
- {
- Pos = MAP_APPFONT ( CBX_VERT_X , CBX_VERT_Y ) ;
- Size = MAP_APPFONT ( MBOX_WIDTH + 20 , CBOX_HEIGHT + 5 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Vertically stacked" ;
- QuickHelpText [ en-US ] = "Aligns text vertically.";
- HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_VERT;
- };
-
- Image IMG_ALIGN_LEFT
- {
- ImageBitmap = Bitmap{File = "sidebar/sc_alignleft.png";};
- };
- Image IMG_ALIGN_CENTER
- {
- ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter.png";};
- };
- Image IMG_ALIGN_RIGHT
- {
- ImageBitmap = Bitmap{File = "sidebar/sc_alignright.png";};
- };
- Image IMG_ALIGN_JUST
- {
- ImageBitmap = Bitmap{File = "sidebar/sc_alignjust.png";};
- };
- Image IMG_ALIGN_TOP
- {
- ImageBitmap = Bitmap{File = "sidebar/sc_aligntop.png";};
- };
- Image IMG_ALIGN_CENTER_V
- {
- ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter_v.png";};
- };
- Image IMG_ALIGN_BOTTOM
- {
- ImageBitmap = Bitmap{File = "sidebar/sc_alignbottom.png";};
- };
-};
-
-// eof
commit b3de4693ed6880f5a488dae6483959713ad1601c
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 18:02:09 2013 +0200
sidebar conversion tutorial: Cleanup - remove calls of SetOutputSizePixel().
Change-Id: I942c52488e038dd3b91296596dd2ea7b75c54eb2
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 3b5c8b6..b571b4f6 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -99,17 +99,9 @@ AlignmentPropertyPanel::~AlignmentPropertyPanel()
void AlignmentPropertyPanel::Initialize()
{
- Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() );
- mpTBHorizontal->SetOutputSizePixel( aTbxSize );
- mpTBHorizontal->SetBackground(Wallpaper());
- mpTBHorizontal->SetPaintTransparent(true);
Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl);
mpTBHorizontal->SetSelectHdl ( aLink );
- Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() );
- mpTBVertical->SetOutputSizePixel( aTbxSize2 );
- mpTBVertical->SetBackground(Wallpaper());
- mpTBVertical->SetPaintTransparent(true);
aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl);
mpTBVertical->SetSelectHdl ( aLink );
commit 07b0ad4fa63e2a5606587370da4b60e6b1ddfa39
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 14:57:11 2013 +0200
sidebar conversion tutorial: Create entry points for custom widgets.
For custom widgets, you need an external function named 'makeXYZ' where XYZ is
name of the type you want to construct. It exists for many already, but for
those that don't yet, you need to create that.
Change-Id: I3ad65886897fa73764af2372ceffeca1a57f3165
diff --git a/include/svx/sidebar/SidebarDialControl.hxx b/include/svx/sidebar/SidebarDialControl.hxx
index f468784..4f2c118 100644
--- a/include/svx/sidebar/SidebarDialControl.hxx
+++ b/include/svx/sidebar/SidebarDialControl.hxx
@@ -27,6 +27,7 @@ namespace svx { namespace sidebar {
class SVX_DLLPUBLIC SidebarDialControl : public svx::DialControl
{
public:
+ SidebarDialControl (Window* pParent, WinBits nBits = 0);
SidebarDialControl (Window* pParent, const ResId& rResId);
virtual ~SidebarDialControl (void);
diff --git a/sc/uiconfig/scalc/ui/sidebaralignment.ui b/sc/uiconfig/scalc/ui/sidebaralignment.ui
index 23335e2..0a14810 100644
--- a/sc/uiconfig/scalc/ui/sidebaralignment.ui
+++ b/sc/uiconfig/scalc/ui/sidebaralignment.ui
@@ -285,7 +285,7 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <object class="GtkScaleButton" id="orientationcontrol">
+ <object class="svxlo-SidebarDialControl" id="orientationcontrol">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
diff --git a/svx/source/sidebar/possize/SidebarDialControl.cxx b/svx/source/sidebar/possize/SidebarDialControl.cxx
index 374c905..a6611b7 100644
--- a/svx/source/sidebar/possize/SidebarDialControl.cxx
+++ b/svx/source/sidebar/possize/SidebarDialControl.cxx
@@ -22,6 +22,20 @@
namespace svx { namespace sidebar {
+SidebarDialControl::SidebarDialControl (Window* pParent, WinBits nBits)
+ : svx::DialControl(pParent, nBits)
+{
+ mpImpl->mpBmpEnabled.reset(new SidebarDialControlBmp(*this));
+ mpImpl->mpBmpDisabled.reset(new SidebarDialControlBmp(*this));
+ mpImpl->mpBmpBuffered.reset(new SidebarDialControlBmp(*this));
+ Init(GetOutputSizePixel());
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSidebarDialControl(Window *pParent)
+{
+ return new SidebarDialControl(pParent, WB_TABSTOP);
+}
+
SidebarDialControl::SidebarDialControl (
Window* pParent,
const ResId& rResId)
commit 4774976d82be529c6057a5d3451933b2fc6e19cc
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 14:45:18 2013 +0200
sidebar conversion tutorial: Address the toolbar items via commands.
Remove the uses of constants (defined in .hrc, used in .src), and instead use
toolbox's methods GetItemCommand() to map the ItemId to the command, or
GetItemId() to map the command to ItemId.
Change-Id: I1ff380e306c1f7b007a6e9d70dc5571e9a78d5eb
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index a9b787a..3b5c8b6 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -206,30 +206,30 @@ IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG )
IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox)
{
- sal_uInt16 nId = pToolBox->GetCurItemId();
+ const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
- if(nId == ID_SUBSTLEFT)
+ if(aCommand == UNO_ALIGNLEFT)
{
if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT)
meHorAlignState = SVX_HOR_JUSTIFY_LEFT;
else
meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
}
- else if( nId == ID_SUBSTCENTER )
+ else if(aCommand == UNO_ALIGNHORIZONTALCENTER )
{
if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER)
meHorAlignState = SVX_HOR_JUSTIFY_CENTER;
else
meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
}
- else if( nId == ID_SUBSTRIGHT )
+ else if(aCommand == UNO_ALIGNRIGHT )
{
if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT)
meHorAlignState = SVX_HOR_JUSTIFY_RIGHT;
else
meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
}
- else if( nId == ID_SUBSTJUSTIFY )
+ else if(aCommand == UNO_ALIGNBLOCK )
{
if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK)
meHorAlignState = SVX_HOR_JUSTIFY_BLOCK;
@@ -246,24 +246,23 @@ IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox)
IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox)
{
- sal_uInt16 nId = pToolBox->GetCurItemId();
+ const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
- //Bold
- if(nId == IID_VERT_TOP)
+ if(aCommand == UNO_ALIGNTOP)
{
if(meVerAlignState != SVX_VER_JUSTIFY_TOP)
meVerAlignState = SVX_VER_JUSTIFY_TOP;
else
meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
}
- else if( nId == IID_VERT_CENTER )
+ else if(aCommand == UNO_ALIGNVCENTER)
{
if(meVerAlignState != SVX_VER_JUSTIFY_CENTER)
meVerAlignState = SVX_VER_JUSTIFY_CENTER;
else
meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
}
- else if( nId == IID_VERT_BOTTOM )
+ else if(aCommand == UNO_ALIGNBOTTOM)
{
if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM)
meVerAlignState = SVX_VER_JUSTIFY_BOTTOM;
@@ -552,10 +551,15 @@ void AlignmentPropertyPanel::FormatDegrees(double& dTmp)
void AlignmentPropertyPanel::UpdateHorAlign()
{
- mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_NOCHECK);
- mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_NOCHECK);
- mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_NOCHECK);
- mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK);
+ const sal_uInt16 nIdLeft = mpTBHorizontal->GetItemId(UNO_ALIGNLEFT);
+ const sal_uInt16 nIdCenter = mpTBHorizontal->GetItemId(UNO_ALIGNHORIZONTALCENTER);
+ const sal_uInt16 nIdRight = mpTBHorizontal->GetItemId(UNO_ALIGNRIGHT);
+ const sal_uInt16 nIdBlock = mpTBHorizontal->GetItemId(UNO_ALIGNBLOCK);
+
+ mpTBHorizontal->SetItemState(nIdLeft, STATE_NOCHECK);
+ mpTBHorizontal->SetItemState(nIdCenter, STATE_NOCHECK);
+ mpTBHorizontal->SetItemState(nIdRight, STATE_NOCHECK);
+ mpTBHorizontal->SetItemState(nIdBlock, STATE_NOCHECK);
mpFTLeftIndent->Disable();
mpMFLeftIndent->Disable();
if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT)
@@ -584,13 +588,13 @@ void AlignmentPropertyPanel::UpdateHorAlign()
switch(meHorAlignState)
{
case SVX_HOR_JUSTIFY_LEFT:
- mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_CHECK);
+ mpTBHorizontal->SetItemState(nIdLeft, STATE_CHECK);
mpFTLeftIndent->Enable();
mpMFLeftIndent->Enable();
break;
- case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_CHECK);break;
- case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_CHECK);break;
- case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break;
+ case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(nIdCenter, STATE_CHECK);break;
+ case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(nIdRight, STATE_CHECK);break;
+ case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(nIdBlock, STATE_CHECK);break;
default:;
}
}
@@ -599,15 +603,19 @@ void AlignmentPropertyPanel::UpdateHorAlign()
void AlignmentPropertyPanel::UpdateVerAlign()
{
- mpTBVertical->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
- mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
- mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
+ const sal_uInt16 nIdTop = mpTBVertical->GetItemId(UNO_ALIGNTOP);
+ const sal_uInt16 nIdVCenter = mpTBVertical->GetItemId(UNO_ALIGNVCENTER);
+ const sal_uInt16 nIdBottom = mpTBVertical->GetItemId(UNO_ALIGNBOTTOM);
+
+ mpTBVertical->SetItemState(nIdTop, STATE_NOCHECK);
+ mpTBVertical->SetItemState(nIdVCenter, STATE_NOCHECK);
+ mpTBVertical->SetItemState(nIdBottom, STATE_NOCHECK);
switch(meVerAlignState)
{
- case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(IID_VERT_TOP, STATE_CHECK);break;
- case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_CHECK);break;
- case SVX_VER_JUSTIFY_BOTTOM: mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);break;
+ case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(nIdTop, STATE_CHECK);break;
+ case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(nIdVCenter, STATE_CHECK);break;
+ case SVX_VER_JUSTIFY_BOTTOM:mpTBVertical->SetItemState(nIdBottom, STATE_CHECK);break;
default:;
}
}
commit 3f68a8c05a5d8bcafe1355aecaeeba8346f7a1d9
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 12:37:52 2013 +0200
sidebar conversion tutorial: Make use of the .ui.
The .ui-based panels have to have PanelLayout as the base class instead of the
generic Control. We need to associate the id's from the .ui with the widgets
using the get() method.
Also we need to remove the call of FreeResource().
Change-Id: I61323b6a3dc622b4d594310edfd83c8d76f51d8f
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 8d3a77c..a9b787a 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -57,23 +57,7 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
- : Control(
- pParent,
- ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)),
- mpTBHorizontal(ControlFactory::CreateToolBox(
- mpTBHorizontalBackground.get(),
- ScResId(TBX_HORIZONTAL_ALIGNMENT))),
- mpTBVertical(ControlFactory::CreateToolBox(
- mpTBVerticalBackground.get(),
- ScResId(TBX_VERTICAL_ALIGN))),
- mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))),
- mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))),
- mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))),
- mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))),
- mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))),
- mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)),
- mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))),
- mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))),
+ : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui", rxFrame),
maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this),
maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this),
maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this),
@@ -88,8 +72,18 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
maContext(),
mpBindings(pBindings)
{
+ get(mpTBHorizontal, "horizontalalignment");
+ get(mpTBVertical, "verticalalignment");
+ get(mpFTLeftIndent, "leftindentlabel");
+ get(mpMFLeftIndent, "leftindent");
+ get(mpCBXWrapText, "wraptext");
+ get(mpCBXMergeCell, "mergecells");
+ get(mpFtRotate, "orientationlabel");
+ get(mpCtrlDial, "orientationcontrol");
+ get(mpMtrAngle, "orientationdegrees");
+ get(mpCbStacked, "verticallystacked");
+
Initialize();
- FreeResource();
mpFTLeftIndent->SetBackground(Wallpaper());
mpFtRotate->SetBackground(Wallpaper());
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index b2e4490..476633e 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -20,6 +20,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <svx/sidebar/PanelLayout.hxx>
#include <vcl/fixed.hxx>
#include <boost/scoped_ptr.hpp>
#include <editeng/svxenum.hxx>
@@ -33,7 +34,7 @@ namespace svx { namespace sidebar { class SidebarDialControl; }}
namespace sc { namespace sidebar {
class AlignmentPropertyPanel
-: public Control,
+: public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
commit 5e6ebfc35f4eab64a2ef2455771769314618e019
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 12:08:18 2013 +0200
sidebar conversion tutorial: Remove explicit assignment of images.
This is taken care of by using the correct .uno: commands in the "action_name"
part of the .ui.
Change-Id: I7710816b72990c4c535da0491e75edad5bbf30b3
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 8fd2ae9..8d3a77c 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -81,13 +81,6 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this),
maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this),
maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this),
- maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)),
- maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)),
- maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)),
- maIMGAlignJust(ScResId(IMG_ALIGN_JUST)),
- maIMGAlignTop(ScResId(IMG_ALIGN_TOP)),
- maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)),
- maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)),
meHorAlignState(SVX_HOR_JUSTIFY_STANDARD),
meVerAlignState(SVX_VER_JUSTIFY_STANDARD),
mbMultiDisable(false),
@@ -112,10 +105,6 @@ AlignmentPropertyPanel::~AlignmentPropertyPanel()
void AlignmentPropertyPanel::Initialize()
{
- mpTBHorizontal->SetItemImage(ID_SUBSTLEFT, maIMGAlignLeft);
- mpTBHorizontal->SetItemImage(ID_SUBSTCENTER, maIMGAlignCenter);
- mpTBHorizontal->SetItemImage(ID_SUBSTRIGHT, maIMGAlignRight);
- mpTBHorizontal->SetItemImage(ID_SUBSTJUSTIFY, maIMGAlignJust);
Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() );
mpTBHorizontal->SetOutputSizePixel( aTbxSize );
mpTBHorizontal->SetBackground(Wallpaper());
@@ -123,9 +112,6 @@ void AlignmentPropertyPanel::Initialize()
Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl);
mpTBHorizontal->SetSelectHdl ( aLink );
- mpTBVertical->SetItemImage(IID_VERT_TOP, maIMGAlignTop);
- mpTBVertical->SetItemImage(IID_VERT_CENTER, maIMGAlignCenterV);
- mpTBVertical->SetItemImage(IID_VERT_BOTTOM, maIMGAlignBottom);
Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() );
mpTBVertical->SetOutputSizePixel( aTbxSize2 );
mpTBVertical->SetBackground(Wallpaper());
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index eae2d2a..b2e4490 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -78,14 +78,6 @@ private:
::sfx2::sidebar::ControllerItem maAngleControl;
::sfx2::sidebar::ControllerItem maStackControl;
- Image maIMGAlignLeft;
- Image maIMGAlignCenter;
- Image maIMGAlignRight;
- Image maIMGAlignJust;
- Image maIMGAlignTop;
- Image maIMGAlignCenterV;
- Image maIMGAlignBottom;
-
SvxCellHorJustify meHorAlignState;
SvxCellVerJustify meVerAlignState;
commit e9cfaf1d29c66157b3bdc4bd4278cd3b5c90a29c
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 12:05:17 2013 +0200
sidebar conversion tutorial: Introduce action commands in the .ui and .cxx.
We will address the toolbox buttons in the .ui via the string constants.
Change-Id: I86dc101276de0d5487de3feb772381b76880dd23
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 4edabc5..8fd2ae9 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -36,6 +36,14 @@ using namespace css;
using namespace cssu;
using ::sfx2::sidebar::ControlFactory;
+const char UNO_ALIGNBLOCK[] = ".uno:AlignBlock";
+const char UNO_ALIGNBOTTOM[] = ".uno:AlignBottom";
+const char UNO_ALIGNLEFT[] = ".uno:AlignLeft";
+const char UNO_ALIGNHORIZONTALCENTER[] = ".uno:AlignHorizontalCenter";
+const char UNO_ALIGNRIGHT[] = ".uno:AlignRight";
+const char UNO_ALIGNTOP[] = ".uno:AlignTop";
+const char UNO_ALIGNVCENTER[] = ".uno:AlignVCenter";
+
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
//////////////////////////////////////////////////////////////////////////////
diff --git a/sc/uiconfig/scalc/ui/sidebaralignment.ui b/sc/uiconfig/scalc/ui/sidebaralignment.ui
index d14b34d..23335e2 100644
--- a/sc/uiconfig/scalc/ui/sidebaralignment.ui
+++ b/sc/uiconfig/scalc/ui/sidebaralignment.ui
@@ -29,12 +29,10 @@
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Left-align</property>
<property name="valign">start</property>
<property name="use_action_appearance">False</property>
- <property name="action_name">.uno:Bold</property>
+ <property name="action_name">.uno:AlignLeft</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-justify-left</property>
</object>
<packing>
<property name="expand">False</property>
@@ -46,11 +44,9 @@
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Center-align</property>
<property name="use_action_appearance">False</property>
- <property name="action_name">.uno:Italic</property>
+ <property name="action_name">.uno:AlignHorizontalCenter</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-justify-center</property>
</object>
<packing>
<property name="expand">False</property>
@@ -62,11 +58,9 @@
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Right-align</property>
<property name="use_action_appearance">False</property>
- <property name="action_name">.uno:Underline</property>
+ <property name="action_name">.uno:AlignRight</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-justify-right</property>
</object>
<packing>
<property name="expand">False</property>
@@ -78,11 +72,9 @@
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Justify</property>
<property name="use_action_appearance">False</property>
- <property name="action_name">.uno:Strikeout</property>
+ <property name="action_name">.uno:AlignBlock</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-justify-fill</property>
</object>
<packing>
<property name="expand">False</property>
@@ -110,6 +102,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
+ <property name="action_name">.uno:AlignTop</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -123,6 +116,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
+ <property name="action_name">.uno:AlignVCenter</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -136,6 +130,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
+ <property name="action_name">.uno:AlignBottom</property>
<property name="use_underline">True</property>
</object>
<packing>
commit d14933447c6e9a94a341d5385ada59ec322748bd
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 09:53:42 2013 +0200
sidebar conversion tutorial: Change boost::scoped_ptr's to normal pointers.
Change-Id: Ibcea80bcd75f3bec8367251c557ee859afd8dfbb
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index affafa3..4edabc5 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -159,12 +159,12 @@ void AlignmentPropertyPanel::Initialize()
mpMtrAngle->InsertValue(315, FUNIT_CUSTOM);
mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount());
- mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal.get());
- mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical.get());
- mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent.get());
- mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate.get());
+ mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal);
+ mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical);
+ mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent);
+ mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate);
#ifdef HAS_IA2
- mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate.get());
+ mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate);
#endif
}
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index b600aff..eae2d2a 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -59,16 +59,16 @@ public:
private:
//ui controls
- ::boost::scoped_ptr< ToolBox > mpTBHorizontal;
- ::boost::scoped_ptr< ToolBox > mpTBVertical;
- ::boost::scoped_ptr< FixedText > mpFTLeftIndent;
- ::boost::scoped_ptr< MetricField > mpMFLeftIndent;
- ::boost::scoped_ptr< CheckBox > mpCBXWrapText;
- ::boost::scoped_ptr< CheckBox > mpCBXMergeCell;
- ::boost::scoped_ptr< FixedText > mpFtRotate;
- ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial;
- ::boost::scoped_ptr< MetricBox > mpMtrAngle;
- ::boost::scoped_ptr< CheckBox > mpCbStacked;
+ ToolBox* mpTBHorizontal;
+ ToolBox* mpTBVertical;
+ FixedText* mpFTLeftIndent;
+ MetricField* mpMFLeftIndent;
+ CheckBox* mpCBXWrapText;
+ CheckBox* mpCBXMergeCell;
+ FixedText* mpFtRotate;
+ svx::sidebar::SidebarDialControl* mpCtrlDial;
+ MetricBox* mpMtrAngle;
+ CheckBox* mpCbStacked;
::sfx2::sidebar::ControllerItem maAlignHorControl;
::sfx2::sidebar::ControllerItem maAlignVerControl;
commit d17d8da64b2a9589d3194a370e3e39c647aa28a2
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 09:40:11 2013 +0200
sidebar conversion tutorial: Get rid of ToolBox backgound(s).
In the header files, they are Windows, with Background in the name; in the
.cxx, they are created using CreateToolBoxBackground() function.
Change-Id: If24db0c4a59b702f31481a4018c8c19383d01216
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 0ba2436..affafa3 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -52,11 +52,9 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
: Control(
pParent,
ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)),
- mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)),
mpTBHorizontal(ControlFactory::CreateToolBox(
mpTBHorizontalBackground.get(),
ScResId(TBX_HORIZONTAL_ALIGNMENT))),
- mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)),
mpTBVertical(ControlFactory::CreateToolBox(
mpTBVerticalBackground.get(),
ScResId(TBX_VERTICAL_ALIGN))),
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index 13742aa..b600aff 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -59,9 +59,7 @@ public:
private:
//ui controls
- ::boost::scoped_ptr<Window> mpTBHorizontalBackground;
::boost::scoped_ptr< ToolBox > mpTBHorizontal;
- ::boost::scoped_ptr<Window> mpTBVerticalBackground;
::boost::scoped_ptr< ToolBox > mpTBVertical;
::boost::scoped_ptr< FixedText > mpFTLeftIndent;
::boost::scoped_ptr< MetricField > mpMFLeftIndent;
commit 9e8869d8c9659ead95bd1c90e9e75d7726bdc96c
Author: Prashant Pandey <prashant3.yishu at gmail.com>
Date: Wed Jun 5 09:35:04 2013 +0200
sidebar conversion tutorial: Create .ui in glade.
This one is for the Alignment property sidebar.
Change-Id: I41161052c07e98d089eabe8f2e2f82bddad41902
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 27563d3..f29ba07 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/sharedocumentdlg \
sc/uiconfig/scalc/ui/sharedfooterdialog \
sc/uiconfig/scalc/ui/sharedheaderdialog \
+ sc/uiconfig/scalc/ui/sidebaralignment \
sc/uiconfig/scalc/ui/solverdlg \
sc/uiconfig/scalc/ui/sortcriteriapage \
sc/uiconfig/scalc/ui/sortkey \
diff --git a/sc/uiconfig/scalc/ui/sidebaralignment.ui b/sc/uiconfig/scalc/ui/sidebaralignment.ui
new file mode 100644
index 0000000..d14b34d
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/sidebaralignment.ui
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkGrid" id="AlignmentPropertyPanel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_homogeneous">True</property>
+ <property name="column_homogeneous">True</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox" id="box3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkToolbar" id="horizontalalignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Horizontal Alignment</property>
+ <property name="show_arrow">False</property>
+ <child>
+ <object class="GtkToolButton" id="substleft">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Left-align</property>
+ <property name="valign">start</property>
+ <property name="use_action_appearance">False</property>
+ <property name="action_name">.uno:Bold</property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-justify-left</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="substcenter">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Center-align</property>
+ <property name="use_action_appearance">False</property>
+ <property name="action_name">.uno:Italic</property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-justify-center</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="substright">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Right-align</property>
+ <property name="use_action_appearance">False</property>
+ <property name="action_name">.uno:Underline</property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-justify-right</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="substjustify">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Justify</property>
+ <property name="use_action_appearance">False</property>
+ <property name="action_name">.uno:Strikeout</property>
+ <property name="use_underline">True</property>
+ <property name="stock_id">gtk-justify-fill</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <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="GtkToolbar" id="verticalalignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Vertical Alignment</property>
+ <property name="margin_left">47</property>
+ <property name="show_arrow">False</property>
+ <child>
+ <object class="GtkToolButton" id="verttop">
+ <property name="use_action_appearance">False</property>
+ <property name="width_request">30</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="vertcenter">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="vertbottom">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</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="GtkBox" id="box5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox" id="box6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="leftindentlabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Left _indent:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="leftindent:0pt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Indents from the left edge.</property>
+ <property name="tooltip_text" translatable="yes">Indents from the left edge.</property>
+ <property name="invisible_char">â¢</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</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="GtkBox" id="box7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="mergecells">
+ <property name="label" translatable="yes">Merge Cells</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Joins the selected cells into one.</property>
+ <property name="tooltip_text" translatable="yes">Joins the selected cells into one.</property>
+ <property name="halign">start</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="image_position">right</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="wraptext">
+ <property name="label" translatable="yes">Wrap text</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Wrap texts automatically.</property>
+ <property name="tooltip_text" translatable="yes">Wrap texts automatically.</property>
+ <property name="halign">start</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="orientationlabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Text _orientation:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkScaleButton" id="orientationcontrol">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="vexpand">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="verticallystacked">
+ <property name="label" translatable="yes">Vertically Stacked</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Aligns text vertically.</property>
+ <property name="tooltip_text" translatable="yes">Aligns text vertically.</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="image_position">bottom</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="orientationdegrees:0 degrees">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup" translatable="yes">Select the angle for rotation.</property>
+ <property name="tooltip_text" translatable="yes">Select the angle for rotation.</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <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>
+</interface>
commit 4c597ce679c786bd927e9abf158047cb4d7bc46f
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Jun 5 17:26:24 2013 +0200
widget layout: Introduce a way to specify MetricBox in .ui.
Uses the same trick as MetricField - you set the units in the 'id' of
GtkComboBox in form like id="something:0mm", or id="something:0 degrees" (for
custom units).
Change-Id: I572c653b97e75dcf47f934415139e1bfb06dc89b
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 3824497..73a06c8 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -678,6 +678,20 @@ namespace
return pWindow;
}
+ OString extractUnit(const OString& sPattern)
+ {
+ OString sUnit(sPattern);
+ for (sal_Int32 i = 0; i < sPattern.getLength(); ++i)
+ {
+ if (sPattern[i] != '.' && sPattern[i] != ',' && sPattern[i] != '0')
+ {
+ sUnit = sPattern.copy(i);
+ break;
+ }
+ }
+ return sUnit;
+ }
+
FieldUnit detectMetricUnit(OString sUnit)
{
FieldUnit eUnit = FUNIT_NONE;
@@ -708,10 +722,8 @@ namespace
eUnit = FUNIT_LINE;
else if (sUnit == "%")
eUnit = FUNIT_PERCENT;
-
- // if lack of unit is not intentional
- if (sUnit != "0")
- assert(eUnit != FUNIT_NONE); //unknown unit
+ else if (sUnit != "0")
+ eUnit = FUNIT_CUSTOM;
return eUnit;
}
@@ -1045,16 +1057,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
{
OString sAdjustment = extractAdjustment(rMap);
OString sPattern = extractCustomProperty(rMap);
- OString sUnit = sPattern;
-
- for (sal_Int32 i = 0; i < sPattern.getLength(); ++i)
- {
- if (sPattern[i] != '.' && sPattern[i] != ',' && sPattern[i] != '0')
- {
- sUnit = sPattern.copy(i);
- break;
- }
- }
+ OString sUnit = extractUnit(sPattern);
WinBits nBits = WB_LEFT|WB_BORDER|WB_3DLOOK;
if (!id.endsWith("-nospin"))
@@ -1089,6 +1092,8 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
SAL_INFO("vcl.layout", "making metric field for " << name.getStr() << " " << sUnit.getStr());
MetricField *pField = new MetricField(pParent, nBits);
pField->SetUnit(eUnit);
+ if (eUnit == FUNIT_CUSTOM)
+ pField->SetCustomUnitText(OStringToOUString(sUnit, RTL_TEXTENCODING_UTF8));
pWindow = pField;
}
}
@@ -1097,8 +1102,21 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
pWindow = new FixedHyperlink(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK|WB_NOLABEL);
else if ((name == "GtkComboBox") || (name == "GtkComboBoxText") || (name == "VclComboBoxText"))
{
+ OString sPattern = extractCustomProperty(rMap);
extractModel(id, rMap);
- if (extractEntry(rMap))
+
+ if (!sPattern.isEmpty())
+ {
+ OString sUnit = extractUnit(sPattern);
+ FieldUnit eUnit = detectMetricUnit(sUnit);
+ SAL_INFO("vcl.layout", "making metric box for " << name.getStr() << " " << sUnit.getStr());
+ MetricBox *pBox = new MetricBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
+ pBox->SetUnit(eUnit);
+ if (eUnit == FUNIT_CUSTOM)
+ pBox->SetCustomUnitText(OStringToOUString(sUnit, RTL_TEXTENCODING_UTF8));
+ pWindow = pBox;
+ }
+ else if (extractEntry(rMap))
{
ComboBox* pComboBox = new ComboBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
pComboBox->EnableAutoSize(true);
More information about the Libreoffice-commits
mailing list