Kaydet (Commit) d9bfa462 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert chart color options page to .ui

Change-Id: I9420014d8bee8f71b5ab64aba5dbc7c27f4a25f4
üst 8d50fe51
......@@ -46,6 +46,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/optappearancepage \
cui/uiconfig/ui/optbrowserpage \
cui/uiconfig/ui/optctlpage \
cui/uiconfig/ui/optchartcolorspage \
cui/uiconfig/ui/optemailpage \
cui/uiconfig/ui/optfltrpage \
cui/uiconfig/ui/optfontspage \
......
......@@ -27,7 +27,6 @@
#define HID_OPTIONS_LINGU "CUI_HID_OPTIONS_LINGU"
#define HID_OPTIONS_DICT_NEW "CUI_HID_OPTIONS_DICT_NEW"
#define HID_OPTIONS_DICT_EDIT "CUI_HID_OPTIONS_DICT_EDIT"
#define HID_OPTIONS_CHART_DEFCOLORS "CUI_HID_OPTIONS_CHART_DEFCOLORS"
#define HID_OPTIONS_ASIAN_LAYOUT "CUI_HID_OPTIONS_ASIAN_LAYOUT"
#define HID_CLB_EDIT_MODULES_DICS "CUI_HID_CLB_EDIT_MODULES_DICS"
#define HID_CLB_EDIT_MODULES_MODULES "CUI_HID_CLB_EDIT_MODULES_MODULES"
......
......@@ -20,56 +20,47 @@
#include <unotools/pathoptions.hxx>
#include <cuires.hrc>
#include "optchart.hxx"
#include "optchart.hrc"
#include <dialmgr.hxx>
#include <vcl/msgbox.hxx>
#include <svx/svxids.hrc> // for SID_SCH_EDITOPTIONS
// ====================
// class ChartColorLB
// ====================
void ChartColorLB::FillBox( const SvxChartColorTable & rTab )
namespace
{
long nCount = rTab.size();
SetUpdateMode( sal_False );
for( long i = 0; i < nCount; i++ )
void FillBoxChartColorLB(ColorLB *pLB, const SvxChartColorTable & rTab)
{
Append( rTab[ i ] );
pLB->SetUpdateMode(false);
pLB->Clear();
long nCount = rTab.size();
for(long i = 0; i < nCount; ++i)
{
pLB->Append(rTab[i]);
}
pLB->SetUpdateMode(true);
}
SetUpdateMode( sal_True );
}
// ====================
// class SvxDefaultColorOptPage
// ====================
SvxDefaultColorOptPage::SvxDefaultColorOptPage( Window* pParent, const SfxItemSet& rInAttrs ) :
SfxTabPage( pParent, CUI_RES( RID_OPTPAGE_CHART_DEFCOLORS ), rInAttrs ),
aGbChartColors ( this, CUI_RES( FL_CHART_COLOR_LIST ) ),
aLbChartColors ( this, CUI_RES( LB_CHART_COLOR_LIST ) ),
aGbColorBox ( this, CUI_RES( FL_COLOR_BOX ) ),
aValSetColorBox ( this, CUI_RES( CT_COLOR_BOX ) ),
aPBDefault ( this, CUI_RES( PB_RESET_TO_DEFAULT ) ),
aPBAdd ( this, CUI_RES( PB_ADD_CHART_COLOR ) ),
aPBRemove ( this, CUI_RES( PB_REMOVE_CHART_COLOR ) )
SvxDefaultColorOptPage::SvxDefaultColorOptPage(Window* pParent, const SfxItemSet& rInAttrs)
: SfxTabPage(pParent, "OptChartColorsPage","cui/ui/optchartcolorspage.ui", rInAttrs)
{
FreeResource();
aPBDefault.SetClickHdl( LINK( this, SvxDefaultColorOptPage, ResetToDefaults ) );
aPBAdd.SetClickHdl( LINK( this, SvxDefaultColorOptPage, AddChartColor ) );
aPBRemove.SetClickHdl( LINK( this, SvxDefaultColorOptPage, RemoveChartColor ) );
aLbChartColors.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, ListClickedHdl ) );
aValSetColorBox.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, BoxClickedHdl ) );
aValSetColorBox.SetStyle( aValSetColorBox.GetStyle()
get(m_pPBRemove, "delete");
get(m_pPBAdd, "add");
get(m_pPBDefault, "default");
get(m_pValSetColorBox, "table");
get(m_pLbChartColors, "colors");
m_pLbChartColors->set_height_request(m_pLbChartColors->GetTextHeight()*16);
m_pPBDefault->SetClickHdl( LINK( this, SvxDefaultColorOptPage, ResetToDefaults ) );
m_pPBAdd->SetClickHdl( LINK( this, SvxDefaultColorOptPage, AddChartColor ) );
m_pPBRemove->SetClickHdl( LINK( this, SvxDefaultColorOptPage, RemoveChartColor ) );
m_pLbChartColors->SetSelectHdl( LINK( this, SvxDefaultColorOptPage, ListClickedHdl ) );
m_pValSetColorBox->SetSelectHdl( LINK( this, SvxDefaultColorOptPage, BoxClickedHdl ) );
m_pValSetColorBox->SetStyle( m_pValSetColorBox->GetStyle()
| WB_ITEMBORDER | WB_NAMEFIELD );
aValSetColorBox.SetColCount( 8 );
aValSetColorBox.SetLineCount( 13 );
aValSetColorBox.SetExtraSpacing( 0 );
aValSetColorBox.Show();
m_pValSetColorBox->SetColCount( 8 );
m_pValSetColorBox->SetLineCount( 13 );
m_pValSetColorBox->SetExtraSpacing( 0 );
m_pValSetColorBox->Show();
pChartOptions = new SvxChartOptions;
pColorList = XColorList::CreateStdColorList();
......@@ -103,12 +94,12 @@ SvxDefaultColorOptPage::~SvxDefaultColorOptPage()
void SvxDefaultColorOptPage::Construct()
{
if( pColorConfig )
aLbChartColors.FillBox( pColorConfig->GetColorList() );
FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList());
FillColorBox();
aLbChartColors.SelectEntryPos( 0 );
ListClickedHdl( &aLbChartColors );
m_pLbChartColors->SelectEntryPos( 0 );
ListClickedHdl(m_pLbChartColors);
}
......@@ -127,8 +118,8 @@ sal_Bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet& rOutAttrs )
void SvxDefaultColorOptPage::Reset( const SfxItemSet& )
{
aLbChartColors.SelectEntryPos( 0 );
ListClickedHdl( &aLbChartColors );
m_pLbChartColors->SelectEntryPos( 0 );
ListClickedHdl(m_pLbChartColors);
}
void SvxDefaultColorOptPage::FillColorBox()
......@@ -139,12 +130,12 @@ void SvxDefaultColorOptPage::FillColorBox()
XColorEntry* pColorEntry;
if( nCount > 104 )
aValSetColorBox.SetStyle( aValSetColorBox.GetStyle() | WB_VSCROLL );
m_pValSetColorBox->SetStyle( m_pValSetColorBox->GetStyle() | WB_VSCROLL );
for( long i = 0; i < nCount; i++ )
{
pColorEntry = pColorList->GetColor( i );
aValSetColorBox.InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() );
m_pValSetColorBox->InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() );
}
}
......@@ -181,12 +172,11 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, ResetToDefaults)
{
pColorConfig->GetColorList().useDefault();
aLbChartColors.Clear();
aLbChartColors.FillBox( pColorConfig->GetColorList() );
FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList());
aLbChartColors.GetFocus();
aLbChartColors.SelectEntryPos( 0 );
aPBRemove.Enable( sal_True );
m_pLbChartColors->GetFocus();
m_pLbChartColors->SelectEntryPos( 0 );
m_pPBRemove->Enable( sal_True );
}
return 0L;
......@@ -203,12 +193,11 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor)
pColorConfig->GetColorList().append (XColorEntry ( black, pColorConfig->GetColorList().getDefaultName(pColorConfig->GetColorList().size())));
aLbChartColors.Clear();
aLbChartColors.FillBox( pColorConfig->GetColorList() );
FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList());
aLbChartColors.GetFocus();
aLbChartColors.SelectEntryPos( pColorConfig->GetColorList().size() - 1 );
aPBRemove.Enable( sal_True );
m_pLbChartColors->GetFocus();
m_pLbChartColors->SelectEntryPos( pColorConfig->GetColorList().size() - 1 );
m_pPBRemove->Enable( sal_True );
}
return 0L;
......@@ -219,9 +208,9 @@ IMPL_LINK_NOARG(SvxDefaultColorOptPage, AddChartColor)
IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton )
{
size_t nIndex = aLbChartColors.GetSelectEntryPos();
size_t nIndex = m_pLbChartColors->GetSelectEntryPos();
if (aLbChartColors.GetSelectEntryCount() == 0)
if (m_pLbChartColors->GetSelectEntryCount() == 0)
return 0L;
if( pColorConfig )
......@@ -234,48 +223,47 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton )
{
pColorConfig->GetColorList().remove( nIndex );
aLbChartColors.Clear();
aLbChartColors.FillBox( pColorConfig->GetColorList() );
FillBoxChartColorLB(m_pLbChartColors, pColorConfig->GetColorList());
aLbChartColors.GetFocus();
m_pLbChartColors->GetFocus();
if (nIndex == aLbChartColors.GetEntryCount() && aLbChartColors.GetEntryCount() > 0)
aLbChartColors.SelectEntryPos( pColorConfig->GetColorList().size() - 1 );
else if (aLbChartColors.GetEntryCount() > 0)
aLbChartColors.SelectEntryPos( nIndex );
if (nIndex == m_pLbChartColors->GetEntryCount() && m_pLbChartColors->GetEntryCount() > 0)
m_pLbChartColors->SelectEntryPos( pColorConfig->GetColorList().size() - 1 );
else if (m_pLbChartColors->GetEntryCount() > 0)
m_pLbChartColors->SelectEntryPos( nIndex );
else
aPBRemove.Enable(true);
m_pPBRemove->Enable(true);
}
}
return 0L;
}
IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ChartColorLB*, _pColorList )
IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ColorLB*, _pColorList )
{
Color aCol = _pColorList->GetSelectEntryColor();
long nIndex = GetColorIndex( aCol );
if( nIndex == -1 ) // not found
aValSetColorBox.SetNoSelection();
m_pValSetColorBox->SetNoSelection();
else
aValSetColorBox.SelectItem( (sal_uInt16)nIndex + 1 ); // ValueSet is 1-based
m_pValSetColorBox->SelectItem( (sal_uInt16)nIndex + 1 ); // ValueSet is 1-based
return 0L;
}
IMPL_LINK_NOARG(SvxDefaultColorOptPage, BoxClickedHdl)
{
sal_uInt16 nIdx = aLbChartColors.GetSelectEntryPos();
sal_uInt16 nIdx = m_pLbChartColors->GetSelectEntryPos();
if( nIdx != LISTBOX_ENTRY_NOTFOUND )
{
const XColorEntry aEntry( aValSetColorBox.GetItemColor( aValSetColorBox.GetSelectItemId() ), aLbChartColors.GetSelectEntry() );
const XColorEntry aEntry( m_pValSetColorBox->GetItemColor( m_pValSetColorBox->GetSelectItemId() ), m_pLbChartColors->GetSelectEntry() );
aLbChartColors.Modify( aEntry, nIdx );
m_pLbChartColors->Modify( aEntry, nIdx );
pColorConfig->ReplaceColorByIndex( nIdx, aEntry );
aLbChartColors.SelectEntryPos( nIdx ); // reselect entry
m_pLbChartColors->SelectEntryPos( nIdx ); // reselect entry
}
return 0L;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 .
*/
// tab page for setting the default colors used for new charts
#define FL_CHART_COLOR_LIST 1
#define LB_CHART_COLOR_LIST 2
#define FL_COLOR_BOX 3
#define CT_COLOR_BOX 4
#define PB_RESET_TO_DEFAULT 5
#define PB_ADD_CHART_COLOR 6
#define PB_REMOVE_CHART_COLOR 7
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -34,27 +34,15 @@
#include "cfgchart.hxx"
class ChartColorLB : public ColorLB
{
public:
ChartColorLB( Window* pParent, ResId Id ) : ColorLB( pParent, Id ) {}
ChartColorLB( Window* pParent, WinBits aWB ) : ColorLB( pParent, aWB ) {}
void FillBox( const SvxChartColorTable & rTab );
};
class SvxDefaultColorOptPage : public SfxTabPage
{
private:
FixedLine aGbChartColors;
ChartColorLB aLbChartColors;
FixedLine aGbColorBox;
ValueSet aValSetColorBox;
PushButton aPBDefault;
PushButton aPBAdd;
PushButton aPBRemove;
ColorLB* m_pLbChartColors;
ValueSet* m_pValSetColorBox;
PushButton* m_pPBDefault;
PushButton* m_pPBAdd;
PushButton* m_pPBRemove;
SvxChartOptions* pChartOptions;
SvxChartColorTableItem* pColorConfig;
......@@ -63,7 +51,7 @@ private:
DECL_LINK( ResetToDefaults, void * );
DECL_LINK( AddChartColor, void * );
DECL_LINK( RemoveChartColor, PushButton * );
DECL_LINK( ListClickedHdl, ChartColorLB * );
DECL_LINK( ListClickedHdl, ColorLB * );
DECL_LINK(BoxClickedHdl, void *);
void FillColorBox();
......
......@@ -17,67 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "optchart.hrc"
#include <cuires.hrc>
#include "helpid.hrc"
// tab page for setting the default colors used for new charts
TabPage RID_OPTPAGE_CHART_DEFCOLORS
{
HelpID = HID_OPTIONS_CHART_DEFCOLORS;
Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
Hide = TRUE;
Text [ en-US ] = "Default Colors";
FixedLine FL_CHART_COLOR_LIST
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 80 , 8 ) ;
Text [ en-US ] = "Chart colors";
};
ListBox LB_CHART_COLOR_LIST
{
HelpID = "cui:ListBox:RID_OPTPAGE_CHART_DEFCOLORS:LB_CHART_COLOR_LIST";
Border = TRUE;
Pos = MAP_APPFONT ( 12 , 15 );
Size = MAP_APPFONT ( 68 , 152 );
DropDown = FALSE;
TabStop = TRUE ;
};
FixedLine FL_COLOR_BOX
{
Pos = MAP_APPFONT ( 92 , 3 ) ;
Size = MAP_APPFONT ( 106 , 8 ) ;
Text [ en-US ] = "Color table" ;
};
Control CT_COLOR_BOX
{
Border = TRUE;
Pos = MAP_APPFONT ( 98 , 15 );
Size = MAP_APPFONT ( 94 , 152 );
TabStop = TRUE ;
};
PushButton PB_ADD_CHART_COLOR
{
Pos = MAP_APPFONT ( 204 , 15 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Add";
};
PushButton PB_REMOVE_CHART_COLOR
{
Pos = MAP_APPFONT ( 204 , 32 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Remove";
};
PushButton PB_RESET_TO_DEFAULT
{
HelpID = "cui:PushButton:RID_OPTPAGE_CHART_DEFCOLORS:PB_RESET_TO_DEFAULT";
Pos = MAP_APPFONT ( 204 , 165 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Default";
};
};
String RID_SVXSTR_DIAGRAM_ROW
{
// $(ROW) can be a number or the caption of the row in quotes
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkBox" id="OptChartColorsPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="spacing">18</property>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="svxlo-ColorLB" id="colors:border">
<property name="dropdown">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Chart colors</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="spacing">12</property>
<child>
<object class="svtlo-ValueSet" id="table:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="add">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="default">
<property name="label">_Default</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Color Table</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
<widget name="colors:border"/>
<widget name="table:border"/>
</widgets>
</object>
</interface>
......@@ -4,7 +4,7 @@
<object class="GtkMessageDialog" id="QueryDeleteChartColorDialog">
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="title" translatable="yes">Show changes?</property>
<property name="title" translatable="yes">Delete Color?</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
......
......@@ -77,7 +77,11 @@
<glade-widget-class title="Other Color ListBox" name="svxlo-ColorLB"
generic-name="Other Color ListBox" parent="GtkComboBox"
icon-name="widget-gtk-combobox"/>
icon-name="widget-gtk-combobox">
<properties>
<property id="dropdown" default="True" common="True"/>
</properties>
</glade-widget-class>
<glade-widget-class title="Font Name ListBox" name="svtlo-FontNameBox"
generic-name="Font name ListBox" parent="GtkComboBox"
......
......@@ -917,9 +917,13 @@ BitmapEx SvxBitmapCtl::GetBitmapEx()
return BitmapEx(aRetval);
}
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeColorLB(Window *pParent, VclBuilder::stringmap &)
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeColorLB(Window *pParent, VclBuilder::stringmap &rMap)
{
ColorLB *pListBox = new ColorLB(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE);
bool bDropdown = VclBuilder::extractDropdown(rMap);
WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE|WB_TABSTOP;
if (bDropdown)
nWinBits |= WB_DROPDOWN;
ColorLB *pListBox = new ColorLB(pParent, nWinBits);
pListBox->EnableAutoSize(true);
return pListBox;
}
......
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