[Libreoffice-commits] core.git: 3 commits - extras/source sd/AllLangResTarget_sd.mk sd/Library_sd.mk sd/source sd/uiconfig sd/UIConfig_sdraw.mk sd/UIConfig_simpress.mk
Caolán McNamara
caolanm at redhat.com
Fri Nov 15 01:47:32 PST 2013
extras/source/glade/libreoffice-catalog.xml.in | 3
sd/AllLangResTarget_sd.mk | 1
sd/Library_sd.mk | 1
sd/UIConfig_sdraw.mk | 1
sd/UIConfig_simpress.mk | 1
sd/source/ui/sidebar/PanelFactory.cxx | 9
sd/source/ui/sidebar/TableDesignPanel.cxx | 8
sd/source/ui/table/TableDesignPane.cxx | 414 ++++++++-----------------
sd/source/ui/table/TableDesignPane.hrc | 44 --
sd/source/ui/table/TableDesignPane.hxx | 75 ++--
sd/source/ui/table/TableDesignPane.src | 149 --------
sd/uiconfig/sdraw/ui/tabledesigndialog.ui | 212 ++++++++++++
sd/uiconfig/simpress/ui/tabledesignpanel.ui | 143 ++++++++
13 files changed, 559 insertions(+), 502 deletions(-)
New commits:
commit b3a10e1e62285e80c7e425c4e293f02fc242f161
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 15 09:40:22 2013 +0000
rework to get panel and dialog working at the same time
Change-Id: I0a2adcd606842c6b39665ecc641d2fd92c4eb7e7
diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk
index 88578a8..8cb5727 100644
--- a/sd/AllLangResTarget_sd.mk
+++ b/sd/AllLangResTarget_sd.mk
@@ -53,7 +53,6 @@ $(eval $(call gb_SrsTarget_add_files,sd/res,\
sd/source/ui/dlg/tpaction.src \
sd/source/ui/dlg/vectdlg.src \
sd/source/ui/slideshow/slideshow.src \
- sd/source/ui/table/TableDesignPane.src \
sd/source/ui/view/DocumentRenderer.src \
))
diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx
index 6654986..a14e852 100644
--- a/sd/source/ui/table/TableDesignPane.cxx
+++ b/sd/source/ui/table/TableDesignPane.cxx
@@ -44,7 +44,6 @@
#include <svx/sdr/table/tabledesign.hxx>
#include "TableDesignPane.hxx"
-#include <svtools/valueset.hxx>
#include "DrawDocShell.hxx"
#include "ViewShellBase.hxx"
@@ -92,17 +91,14 @@ static const OUString* getPropertyNames()
}
// --------------------------------------------------------------------
-TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase,
- bool bModal )
- : PanelLayout(pParent, "TableDesignPanel",
- "modules/simpress/ui/tabledesignpanel.ui", cssu::Reference<css::frame::XFrame>())
- , mrBase( rBase )
- , msTableTemplate( "TableTemplate" )
- , mbModal( bModal )
- , mbStyleSelected( false )
- , mbOptionsChanged( false )
+TableDesignWidget::TableDesignWidget( VclBuilderContainer* pParent, ViewShellBase& rBase, bool bModal )
+ : mrBase(rBase)
+ , msTableTemplate("TableTemplate")
+ , mbModal(bModal)
+ , mbStyleSelected(false)
+ , mbOptionsChanged(false)
{
- get(m_pValueSet, "previews");
+ pParent->get(m_pValueSet, "previews");
m_pValueSet->SetStyle(m_pValueSet->GetStyle() | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_ITEMBORDER);
m_pValueSet->SetExtraSpacing(8);
m_pValueSet->setModal(mbModal);
@@ -115,13 +111,13 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase,
m_pValueSet->SetColor( Color( COL_WHITE ) );
m_pValueSet->SetBackground( Color( COL_WHITE ) );
}
- m_pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl));
+ m_pValueSet->SetSelectHdl (LINK(this, TableDesignWidget, implValueSetHdl));
const OUString* pPropNames = getPropertyNames();
for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i)
{
- get(m_aCheckBoxes[i], OUStringToOString(pPropNames[i], RTL_TEXTENCODING_UTF8));
- m_aCheckBoxes[i]->SetClickHdl( LINK( this, TableDesignPane, implCheckBoxHdl ) );
+ pParent->get(m_aCheckBoxes[i], OUStringToOString(pPropNames[i], RTL_TEXTENCODING_UTF8));
+ m_aCheckBoxes[i]->SetClickHdl( LINK( this, TableDesignWidget, implCheckBoxHdl ) );
}
// get current controller and initialize listeners
@@ -147,20 +143,13 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase,
// --------------------------------------------------------------------
-TableDesignPane::~TableDesignPane()
+TableDesignWidget::~TableDesignWidget()
{
removeListener();
}
// --------------------------------------------------------------------
-void TableDesignPane::DataChanged( const DataChangedEvent& /*rDCEvt*/ )
-{
- m_pValueSet->updateSettings();
-}
-
-// --------------------------------------------------------------------
-
static SfxBindings* getBindings( ViewShellBase& rBase )
{
if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() )
@@ -181,7 +170,7 @@ static SfxDispatcher* getDispatcher( ViewShellBase& rBase )
// --------------------------------------------------------------------
-IMPL_LINK_NOARG(TableDesignPane, implValueSetHdl)
+IMPL_LINK_NOARG(TableDesignWidget, implValueSetHdl)
{
mbStyleSelected = true;
if( !mbModal )
@@ -191,7 +180,7 @@ IMPL_LINK_NOARG(TableDesignPane, implValueSetHdl)
// --------------------------------------------------------------------
-void TableDesignPane::ApplyStyle()
+void TableDesignWidget::ApplyStyle()
{
try
{
@@ -236,13 +225,13 @@ void TableDesignPane::ApplyStyle()
}
catch( Exception& )
{
- OSL_FAIL("TableDesignPane::implValueSetHdl(), exception caught!");
+ OSL_FAIL("TableDesignWidget::implValueSetHdl(), exception caught!");
}
}
// --------------------------------------------------------------------
-IMPL_LINK_NOARG(TableDesignPane, implCheckBoxHdl)
+IMPL_LINK_NOARG(TableDesignWidget, implCheckBoxHdl)
{
mbOptionsChanged = true;
@@ -255,7 +244,7 @@ IMPL_LINK_NOARG(TableDesignPane, implCheckBoxHdl)
// --------------------------------------------------------------------
-void TableDesignPane::ApplyOptions()
+void TableDesignWidget::ApplyOptions()
{
static const sal_uInt16 gParamIds[CB_COUNT] =
{
@@ -293,7 +282,7 @@ void TableDesignPane::ApplyOptions()
// --------------------------------------------------------------------
-void TableDesignPane::onSelectionChanged()
+void TableDesignWidget::onSelectionChanged()
{
Reference< XPropertySet > xNewSelection;
@@ -325,7 +314,7 @@ void TableDesignPane::onSelectionChanged()
}
catch( Exception& )
{
- OSL_FAIL( "sd::TableDesignPane::onSelectionChanged(), Exception caught!" );
+ OSL_FAIL( "sd::TableDesignWidget::onSelectionChanged(), Exception caught!" );
}
if( mxSelectedTable != xNewSelection )
@@ -381,6 +370,11 @@ TableValueSet::TableValueSet(Window *pParent, WinBits nStyle)
{
}
+void TableValueSet::DataChanged( const DataChangedEvent& /*rDCEvt*/ )
+{
+ updateSettings();
+}
+
void TableValueSet::updateSettings()
{
if( !m_bModal )
@@ -408,7 +402,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT ::Window* SAL_CALL makeTableValueSet(::Window *p
// --------------------------------------------------------------------
-void TableDesignPane::updateControls()
+void TableDesignWidget::updateControls()
{
static const sal_Bool gDefaults[CB_COUNT] = { sal_True, sal_False, sal_True, sal_False, sal_False, sal_False };
@@ -424,7 +418,7 @@ void TableDesignPane::updateControls()
}
catch( Exception& )
{
- OSL_FAIL("sd::TableDesignPane::updateControls(), exception caught!");
+ OSL_FAIL("sd::TableDesignWidget::updateControls(), exception caught!");
}
m_aCheckBoxes[i]->Check(bUse ? true : false);
m_aCheckBoxes[i]->Enable(bHasTable ? true : false);
@@ -463,9 +457,9 @@ void TableDesignPane::updateControls()
// --------------------------------------------------------------------
-void TableDesignPane::addListener()
+void TableDesignWidget::addListener()
{
- Link aLink( LINK(this,TableDesignPane,EventMultiplexerListener) );
+ Link aLink( LINK(this,TableDesignWidget,EventMultiplexerListener) );
mrBase.GetEventMultiplexer()->AddEventListener (
aLink,
tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
@@ -477,15 +471,15 @@ void TableDesignPane::addListener()
// --------------------------------------------------------------------
-void TableDesignPane::removeListener()
+void TableDesignWidget::removeListener()
{
- Link aLink( LINK(this,TableDesignPane,EventMultiplexerListener) );
+ Link aLink( LINK(this,TableDesignWidget,EventMultiplexerListener) );
mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
}
// --------------------------------------------------------------------
-IMPL_LINK(TableDesignPane,EventMultiplexerListener,
+IMPL_LINK(TableDesignWidget,EventMultiplexerListener,
tools::EventMultiplexerEvent*,pEvent)
{
switch (pEvent->meEventId)
@@ -785,7 +779,7 @@ const Bitmap CreateDesignPreview( const Reference< XIndexAccess >& xTableStyle,
return aPreviewBmp;
}
-void TableDesignPane::FillDesignPreviewControl()
+void TableDesignWidget::FillDesignPreviewControl()
{
sal_uInt16 nSelectedItem = m_pValueSet->GetSelectItemId();
m_pValueSet->Clear();
@@ -822,52 +816,48 @@ void TableDesignPane::FillDesignPreviewControl()
}
catch( Exception& )
{
- OSL_FAIL("sd::TableDesignPane::FillDesignPreviewControl(), exception caught!");
+ OSL_FAIL("sd::TableDesignWidget::FillDesignPreviewControl(), exception caught!");
}
- m_pValueSet->SetColCount(3);
- m_pValueSet->SetLineCount((nCount+2)/3);
+ sal_Int32 nCols = 3;
+ sal_Int32 nRows = (nCount+2)/3;
+ m_pValueSet->SetColCount(nCols);
+ m_pValueSet->SetLineCount(nRows);
+ WinBits nStyle = m_pValueSet->GetStyle() & ~(WB_VSCROLL);
+ m_pValueSet->SetStyle(nStyle);
Size aSize(m_pValueSet->GetOptimalSize());
+ aSize.Width() += (10 * nCols);
+ aSize.Height() += (10 * nRows);
m_pValueSet->set_width_request(aSize.Width());
m_pValueSet->set_height_request(aSize.Height());
}
catch( Exception& )
{
- OSL_FAIL("sd::TableDesignPane::FillDesignPreviewControl(), exception caught!");
+ OSL_FAIL("sd::TableDesignWidget::FillDesignPreviewControl(), exception caught!");
}
m_pValueSet->SelectItem(nSelectedItem);
}
// ====================================================================
-TableDesignDialog::TableDesignDialog(::Window* pParent, ViewShellBase& rBase )
- : ModalDialog(pParent, "TableDesignDialog",
- "modules/sdraw/ui/tabledesigndialog.ui")
-{
- mxDesignPane.reset( new TableDesignPane( get_content_area(), rBase, true ) );
- mxDesignPane->Hide();
-}
-
-// --------------------------------------------------------------------
-
short TableDesignDialog::Execute()
{
if( ModalDialog::Execute() )
{
- if( mxDesignPane->isStyleChanged() )
- mxDesignPane->ApplyStyle();
+ if( aImpl.isStyleChanged() )
+ aImpl.ApplyStyle();
- if( mxDesignPane->isOptionsChanged() )
- mxDesignPane->ApplyOptions();
- return sal_True;
+ if( aImpl.isOptionsChanged() )
+ aImpl.ApplyOptions();
+ return true;
}
- return sal_False;
+ return false;
}
// ====================================================================
::Window * createTableDesignPanel( ::Window* pParent, ViewShellBase& rBase )
{
- return new TableDesignPane( pParent, rBase, false );
+ return new TableDesignPane( pParent, rBase );
}
// ====================================================================
diff --git a/sd/source/ui/table/TableDesignPane.hrc b/sd/source/ui/table/TableDesignPane.hrc
deleted file mode 100644
index 914b3e9..0000000
--- a/sd/source/ui/table/TableDesignPane.hrc
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- 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 .
- */
-
-#ifndef _SD_TABLEDESIGNPANE_HRC
-#define _SD_TABLEDESIGNPANE_HRC
-
-#define FL_STYLE_OPTIONS 0
-#define CB_HEADER_ROW 1
-#define CB_TOTAL_ROW 2
-#define CB_BANDED_ROWS 3
-#define CB_FIRST_COLUMN 4
-#define CB_LAST_COLUMN 5
-#define CB_BANDED_COLUMNS 6
-
-#define FL_TABLE_STYLES 7
-#define CT_TABLE_STYLES 8
-
-#define DESIGNPANE_CONTROL_COUNT 9
-
-#endif // _SD_TABLEDESIGNPANE_HRC
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx
index 9ef735b..9ec8f45 100644
--- a/sd/source/ui/table/TableDesignPane.hxx
+++ b/sd/source/ui/table/TableDesignPane.hxx
@@ -60,21 +60,20 @@ private:
public:
TableValueSet(Window *pParent, WinBits nStyle);
virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
void updateSettings();
void setModal(bool bModal) { m_bModal = bModal; }
};
-class TableDesignPane : public PanelLayout
+class TableDesignWidget
{
public:
- TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
- virtual ~TableDesignPane();
+ TableDesignWidget( VclBuilderContainer* pParent, ViewShellBase& rBase, bool bModal );
+ virtual ~TableDesignWidget();
// callbacks
void onSelectionChanged();
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
-
void ApplyOptions();
void ApplyStyle();
@@ -109,16 +108,33 @@ private:
bool mbOptionsChanged;
};
+class TableDesignPane : public PanelLayout
+{
+private:
+ TableDesignWidget aImpl;
+public:
+ TableDesignPane( ::Window* pParent, ViewShellBase& rBase )
+ : PanelLayout(pParent, "TableDesignPanel",
+ "modules/simpress/ui/tabledesignpanel.ui", com::sun::star::uno::Reference<css::frame::XFrame>())
+ , aImpl(this, rBase, false)
+ {
+ }
+};
+
// --------------------------------------------------------------------
class TableDesignDialog : public ModalDialog
{
+private:
+ TableDesignWidget aImpl;
public:
- TableDesignDialog( ::Window* pParent, ViewShellBase& rBase );
-
+ TableDesignDialog( ::Window* pParent, ViewShellBase& rBase )
+ : ModalDialog(pParent, "TableDesignDialog",
+ "modules/sdraw/ui/tabledesigndialog.ui")
+ , aImpl(this, rBase, true)
+ {
+ }
virtual short Execute();
-private:
- boost::scoped_ptr< TableDesignPane > mxDesignPane;
};
}
diff --git a/sd/source/ui/table/TableDesignPane.src b/sd/source/ui/table/TableDesignPane.src
deleted file mode 100644
index 0be0bca..0000000
--- a/sd/source/ui/table/TableDesignPane.src
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- 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 .
- */
-
-#include "TableDesignPane.hrc"
-#include "glob.hrc"
-
-Control DLG_TABLEDESIGNPANE
-{
- OutputSize = TRUE;
- DialogControl = TRUE;
- Border = FALSE;
-
- Size = MAP_APPFONT( 264, 134 );
- Text [ en-US ] = "Table Design";
-
- FixedLine FL_STYLE_OPTIONS+1
- {
- Pos = MAP_APPFONT ( 143, 3 ) ;
- Size = MAP_APPFONT ( 120, 10 ) ;
- OutputSize = TRUE;
- Text [ en-US ] = "Show";
- };
-
- CheckBox CB_HEADER_ROW+1
- {
- Pos = MAP_APPFONT ( 146, 3 ) ;
- Size = MAP_APPFONT ( 120 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Header Row" ;
- };
-
- CheckBox CB_TOTAL_ROW+1
- {
- Pos = MAP_APPFONT ( 146, 16 ) ;
- Size = MAP_APPFONT ( 120 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Tot~al Row" ;
- };
-
- CheckBox CB_BANDED_ROWS+1
- {
- Pos = MAP_APPFONT ( 146, 29 ) ;
- Size = MAP_APPFONT ( 120 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Banded Rows" ;
- };
-
- CheckBox CB_FIRST_COLUMN+1
- {
- Pos = MAP_APPFONT ( 146, 42 ) ;
- Size = MAP_APPFONT ( 120 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Fi~rst Column" ;
- };
-
- CheckBox CB_LAST_COLUMN+1
- {
- Pos = MAP_APPFONT ( 146, 55 ) ;
- Size = MAP_APPFONT ( 120 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Last Column" ;
- };
-
- CheckBox CB_BANDED_COLUMNS+1
- {
- Pos = MAP_APPFONT ( 146, 68 ) ;
- Size = MAP_APPFONT ( 120 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Ba~nded Columns" ;
- };
-
- FixedLine FL_TABLE_STYLES+1
- {
- Pos = MAP_APPFONT ( 6, 3 ) ;
- Size = MAP_APPFONT( 120, 8 );
- OutputSize = TRUE;
- Text [ en-US ] = "Styles";
- };
-
- Control CT_TABLE_STYLES+1
- {
- Pos = MAP_APPFONT ( 4, 3 ) ;
- Size = MAP_APPFONT( 120, 143 );
- Border = TRUE ;
- TabStop = TRUE ;
- };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/uiconfig/sdraw/ui/tabledesigndialog.ui b/sd/uiconfig/sdraw/ui/tabledesigndialog.ui
index 95427a6..246c882 100644
--- a/sd/uiconfig/sdraw/ui/tabledesigndialog.ui
+++ b/sd/uiconfig/sdraw/ui/tabledesigndialog.ui
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <!-- interface-requires LibreOffice 1.0 -->
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="TableDesignDialog">
<property name="can_focus">False</property>
@@ -69,7 +70,136 @@
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <property name="column_homogeneous">True</property>
+ <child>
+ <object class="GtkCheckButton" id="UseFirstRowStyle">
+ <property name="label" translatable="yes">_Header Row</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="UseLastRowStyle">
+ <property name="label" translatable="yes">Tot_al Row</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <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>
+ <object class="GtkCheckButton" id="UseBandingRowStyle">
+ <property name="label" translatable="yes">_Banded Rows</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="UseFirstColumnStyle">
+ <property name="label" translatable="yes">Fi_rst Column</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <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>
+ <object class="GtkCheckButton" id="UseLastColumnStyle">
+ <property name="label" translatable="yes">_Last Column</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="UseBandingColumnStyle">
+ <property name="label" translatable="yes">Ba_nded Columns</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="sdlo-TableValueSet" id="previews:border">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">6</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</child>
commit ecca93071c9cf02476261c820739677395f9af50
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 14 12:45:25 2013 +0000
convert impress table design panel to .ui
Change-Id: I4ed28ad5ba94c055fbab51148d9258624dcfdb14
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 487ff00c..d4b88a0 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -281,6 +281,9 @@
<glade-widget-class title="ValueSet" name="swuilo-ColumnValueSet"
generic-name="Set of Value Options" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
+ <glade-widget-class title="TableValueSet" name="sdlo-TableValueSet"
+ generic-name="Set of Table Value Options" parent="GtkDrawingArea"
+ icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="CsvTableBox" name="sclo-ScCsvTableBox"
generic-name="CSV Table Box" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 3f93c75..98f1223 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -338,6 +338,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/sidebar/RecentlyUsedMasterPages \
sd/source/ui/sidebar/RecentMasterPagesSelector \
sd/source/ui/sidebar/SlideTransitionPanel \
+ sd/source/ui/sidebar/TableDesignPanel \
sd/source/ui/slideshow/PaneHider \
sd/source/ui/slideshow/SlideShowRestarter \
sd/source/ui/slideshow/showwin \
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index f6a12f8..2bea235 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
sd/uiconfig/simpress/ui/prntopts \
sd/uiconfig/simpress/ui/sdviewpage \
sd/uiconfig/simpress/ui/slidetransitionspanel \
+ sd/uiconfig/simpress/ui/tabledesignpanel \
sd/uiconfig/simpress/ui/templatedialog \
))
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index 63983ba..cce5f9e 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -26,8 +26,9 @@
#include "RecentMasterPagesSelector.hxx"
#include "AllMasterPagesSelector.hxx"
#include "CustomAnimationPanel.hxx"
-#include "SlideTransitionPanel.hxx"
#include "NavigatorWrapper.hxx"
+#include "SlideTransitionPanel.hxx"
+#include "TableDesignPanel.hxx"
#include <sfx2/viewfrm.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
@@ -40,10 +41,6 @@ using namespace cssu;
using namespace ::sd::framework;
using ::rtl::OUString;
-namespace sd {
- extern ::Window * createTableDesignPanel (::Window* pParent, ViewShellBase& rBase);
-}
-
namespace sd { namespace sidebar {
namespace {
@@ -181,7 +178,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions))
pControl = new SlideTransitionPanel(pParentWindow, *pBase, xFrame);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign))
- pControl = createTableDesignPanel(pParentWindow, *pBase);
+ pControl = new TableDesignPanel(pParentWindow, *pBase);
else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator))
pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings);
#undef EndsWith
diff --git a/sd/source/ui/sidebar/TableDesignPanel.cxx b/sd/source/ui/sidebar/TableDesignPanel.cxx
index c9b45a2..8379bac 100644
--- a/sd/source/ui/sidebar/TableDesignPanel.cxx
+++ b/sd/source/ui/sidebar/TableDesignPanel.cxx
@@ -16,7 +16,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "precompiled_sd.hxx"
#include "TableDesignPanel.hxx"
@@ -61,10 +60,11 @@ TableDesignPanel::~TableDesignPanel (void)
-css::ui::LayoutSize TableDesignPanel::GetHeightForWidth (const sal_Int32 nWidth)
+css::ui::LayoutSize TableDesignPanel::GetHeightForWidth (const sal_Int32 /*nWidth*/)
{
- //TODO: make the sizes depend on the font size.
- return css::ui::LayoutSize(350,-1, 400);
+ Window *pControl = mpWrappedControl.get();
+ sal_Int32 nMinimumHeight = pControl ? pControl->get_preferred_size().Height() : 0;
+ return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight);
}
} } // end of namespace sd::sidebar
diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx
index 5247d6e..6654986 100644
--- a/sd/source/ui/table/TableDesignPane.cxx
+++ b/sd/source/ui/table/TableDesignPane.cxx
@@ -69,12 +69,17 @@ namespace sd {
static const sal_Int32 nPreviewColumns = 5;
static const sal_Int32 nPreviewRows = 5;
+static const sal_Int32 nCellWidth = 12; // one pixel is shared with the next cell!
+static const sal_Int32 nCellHeight = 7; // one pixel is shared with the next cell!
+static const sal_Int32 nBitmapWidth = (nCellWidth * nPreviewColumns) - (nPreviewColumns - 1);
+static const sal_Int32 nBitmapHeight = (nCellHeight * nPreviewRows) - (nPreviewRows - 1);
+
// --------------------------------------------------------------------
static const OUString* getPropertyNames()
{
- static const OUString gPropNames[ CB_BANDED_COLUMNS-CB_HEADER_ROW+1 ] =
+ static const OUString gPropNames[ CB_COUNT ] =
{
OUString("UseFirstRowStyle") ,
OUString("UseLastRowStyle") ,
@@ -87,50 +92,36 @@ static const OUString* getPropertyNames()
}
// --------------------------------------------------------------------
-TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal )
-: Control( pParent, SdResId(DLG_TABLEDESIGNPANE) )
-, mrBase( rBase )
-, msTableTemplate( "TableTemplate" )
-, mbModal( bModal )
-, mbStyleSelected( false )
-, mbOptionsChanged( false )
+TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase,
+ bool bModal )
+ : PanelLayout(pParent, "TableDesignPanel",
+ "modules/simpress/ui/tabledesignpanel.ui", cssu::Reference<css::frame::XFrame>())
+ , mrBase( rBase )
+ , msTableTemplate( "TableTemplate" )
+ , mbModal( bModal )
+ , mbStyleSelected( false )
+ , mbOptionsChanged( false )
{
- Window* pControlParent = mbModal ? pParent : this;
-
- // mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) );
-
- ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_TABLE_STYLES+1 ) );
- mxControls[CT_TABLE_STYLES].reset( pValueSet );
+ get(m_pValueSet, "previews");
+ m_pValueSet->SetStyle(m_pValueSet->GetStyle() | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_ITEMBORDER);
+ m_pValueSet->SetExtraSpacing(8);
+ m_pValueSet->setModal(mbModal);
if( !mbModal )
{
- pValueSet->SetStyle( (pValueSet->GetStyle() & ~(WB_ITEMBORDER|WB_BORDER)) | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_NOBORDER );
- pValueSet->SetColor();
- pValueSet->SetExtraSpacing(8);
+ m_pValueSet->SetColor();
}
else
{
- pValueSet->SetColor( Color( COL_WHITE ) );
- pValueSet->SetBackground( Color( COL_WHITE ) );
- }
- pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl));
-
- // mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) );
- sal_uInt16 i;
- for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
- {
- CheckBox *pCheckBox = new CheckBox( pControlParent, SdResId( i+1 ) );
- mxControls[i].reset( pCheckBox );
- pCheckBox->SetClickHdl( LINK( this, TableDesignPane, implCheckBoxHdl ) );
+ m_pValueSet->SetColor( Color( COL_WHITE ) );
+ m_pValueSet->SetBackground( Color( COL_WHITE ) );
}
+ m_pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl));
- for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ )
+ const OUString* pPropNames = getPropertyNames();
+ for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i)
{
- if (mxControls[i])
- mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y();
- else if (i > 0)
- mnOrgOffsetY[i] = mnOrgOffsetY[i-1];
- else
- mnOrgOffsetY[i] = 0;
+ get(m_aCheckBoxes[i], OUStringToOString(pPropNames[i], RTL_TEXTENCODING_UTF8));
+ m_aCheckBoxes[i]->SetClickHdl( LINK( this, TableDesignPane, implCheckBoxHdl ) );
}
// get current controller and initialize listeners
@@ -144,17 +135,14 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool
Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
const OUString sFamilyName( "table" );
mxTableFamily = Reference< XIndexAccess >( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
-
}
- catch( Exception& )
+ catch (const Exception&)
{
OSL_FAIL( "sd::CustomAnimationPane::CustomAnimationPane(), Exception caught!" );
}
onSelectionChanged();
updateControls();
-
- FreeResource();
}
// --------------------------------------------------------------------
@@ -168,70 +156,9 @@ TableDesignPane::~TableDesignPane()
void TableDesignPane::DataChanged( const DataChangedEvent& /*rDCEvt*/ )
{
- updateLayout();
-}
-
-// --------------------------------------------------------------------
-
-void TableDesignPane::Resize()
-{
- updateLayout();
-}
-
-
-
-
-LayoutSize TableDesignPane::GetHeightForWidth (const sal_Int32 nWidth)
-{
- if ( ! IsVisible() || nWidth<=0)
- return LayoutSize(0,0,0);
-
- // Initialize the height with the offset above and below the value
- // set and below the check boxes.
- const Point aOffset (LogicToPixel( Point(3,3), MAP_APPFONT));
- sal_Int32 nHeight (3 * aOffset.Y());
-
- // Add the height for the check boxes.
- nHeight += mnOrgOffsetY[CB_BANDED_COLUMNS] - mnOrgOffsetY[CB_HEADER_ROW]
- + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height();
-
- // Setup minimal and maximal heights that include all check boxes
- // and a small or large value set.
- const sal_Int32 nMinimalHeight (nHeight+100);
- const sal_Int32 nMaximalHeight (nHeight+450);
-
- // Calculate the number of rows and columns and then add the
- // preferred size of the value set.
- ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
- if (pValueSet->GetItemCount() > 0)
- {
- Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0));
- Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel());
- aItemSize.Width() += 10;
- aItemSize.Height() += 10;
-
- int nColumnCount = (pValueSet->GetSizePixel().Width() - pValueSet->GetScrollWidth()) / aItemSize.Width();
- if (nColumnCount < 1)
- nColumnCount = 1;
-
- int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount;
- if (nRowCount < 1)
- nRowCount = 1;
-
- nHeight += nRowCount * aItemSize.Height();
- }
-
- // Clip the requested height.
- if (nHeight<nMinimalHeight)
- nHeight = nMinimalHeight;
- else if (nHeight>nMaximalHeight)
- nHeight = nMaximalHeight;
- return LayoutSize(nMinimalHeight, nMaximalHeight, nHeight);
+ m_pValueSet->updateSettings();
}
-
-
-
// --------------------------------------------------------------------
static SfxBindings* getBindings( ViewShellBase& rBase )
@@ -269,8 +196,7 @@ void TableDesignPane::ApplyStyle()
try
{
OUString sStyleName;
- ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
- sal_Int32 nIndex = static_cast< sal_Int32 >( pValueSet->GetSelectItemId() ) - 1;
+ sal_Int32 nIndex = static_cast< sal_Int32 >( m_pValueSet->GetSelectItemId() ) - 1;
if( (nIndex >= 0) && (nIndex < mxTableFamily->getCount()) )
{
@@ -331,7 +257,7 @@ IMPL_LINK_NOARG(TableDesignPane, implCheckBoxHdl)
void TableDesignPane::ApplyOptions()
{
- static const sal_uInt16 gParamIds[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] =
+ static const sal_uInt16 gParamIds[CB_COUNT] =
{
ID_VAL_USEFIRSTROWSTYLE, ID_VAL_USELASTROWSTYLE, ID_VAL_USEBANDINGROWSTYLE,
ID_VAL_USEFIRSTCOLUMNSTYLE, ID_VAL_USELASTCOLUMNSTYLE, ID_VAL_USEBANDINGCOLUMNSTYLE
@@ -341,9 +267,9 @@ void TableDesignPane::ApplyOptions()
{
SfxRequest aReq( SID_TABLE_STYLE_SETTINGS, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() );
- for( sal_uInt16 i = 0; i < (CB_BANDED_COLUMNS-CB_HEADER_ROW+1); ++i )
+ for( sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
{
- aReq.AppendItem( SfxBoolItem( gParamIds[i], static_cast< CheckBox* >( mxControls[CB_HEADER_ROW+i].get() )->IsChecked() ) );
+ aReq.AppendItem( SfxBoolItem( gParamIds[i], m_aCheckBoxes[i]->IsChecked() ) );
}
SdrView* pView = mrBase.GetDrawView();
@@ -411,127 +337,87 @@ void TableDesignPane::onSelectionChanged()
// --------------------------------------------------------------------
-void TableDesignPane::updateLayout()
+void TableValueSet::Resize()
{
- ::Size aPaneSize( GetSizePixel() );
- if(IsVisible() && aPaneSize.Width() > 0)
+ ValueSet::Resize();
+ // Calculate the number of rows and columns.
+ if( GetItemCount() > 0 )
{
- Point aOffset( LogicToPixel( Point(3,3), MAP_APPFONT ) );
+ Size aValueSetSize = GetSizePixel();
- ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
+ Image aImage = GetItemImage(GetItemId(0));
+ Size aItemSize = aImage.GetSizePixel();
- Size aValueSetSize;
-
- if( !mbModal )
- {
- const long nOptionsHeight = mnOrgOffsetY[CB_BANDED_COLUMNS] + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height() + aOffset.Y();
+ aItemSize.Width() += 10;
+ aItemSize.Height() += 10;
+ int nColumnCount = (aValueSetSize.Width() - GetScrollWidth()) / aItemSize.Width();
+ if (nColumnCount < 1)
+ nColumnCount = 1;
- const long nStylesHeight = aPaneSize.Height() - nOptionsHeight;
+ int nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount;
+ if (nRowCount < 1)
+ nRowCount = 1;
- // set width of controls to size of pane
- for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId )
- {
- if (mxControls[nId])
- {
- Size aSize( mxControls[nId]->GetSizePixel() );
- aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X();
- mxControls[nId]->SetSizePixel( aSize );
- mxControls[nId]->SetPaintTransparent(sal_True);
- mxControls[nId]->SetBackground();
- }
- }
- aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight );
- }
- else
- {
- aValueSetSize = pValueSet->GetSizePixel();
- }
+ int nVisibleRowCount = (aValueSetSize.Height()+2) / aItemSize.Height();
+ SetColCount ((sal_uInt16)nColumnCount);
+ SetLineCount ((sal_uInt16)nRowCount);
- // Calculate the number of rows and columns.
- if( pValueSet->GetItemCount() > 0 )
+ if( !m_bModal )
{
- Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0));
- Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel());
- pValueSet->SetItemWidth( aItemSize.Width() );
- pValueSet->SetItemHeight( aItemSize.Height() );
-
- aItemSize.Width() += 10;
- aItemSize.Height() += 10;
- int nColumnCount = (aValueSetSize.Width() - pValueSet->GetScrollWidth()) / aItemSize.Width();
- if (nColumnCount < 1)
- nColumnCount = 1;
-
- int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount;
- if (nRowCount < 1)
- nRowCount = 1;
-
- int nVisibleRowCount = (aValueSetSize.Height()+2) / aItemSize.Height();
-
- pValueSet->SetLineCount ( (nRowCount < nVisibleRowCount) ? (sal_uInt16)nRowCount : 0 );
-
- pValueSet->SetColCount ((sal_uInt16)nColumnCount);
- pValueSet->SetLineCount ((sal_uInt16)nRowCount);
-
- if( !mbModal )
+ WinBits nStyle = GetStyle() & ~(WB_VSCROLL);
+ if( nRowCount > nVisibleRowCount )
{
- WinBits nStyle = pValueSet->GetStyle() & ~(WB_VSCROLL);
- if( nRowCount < nVisibleRowCount )
- {
- aValueSetSize.Height() = nRowCount * aItemSize.Height();
- }
- else if( nRowCount > nVisibleRowCount )
- {
- nStyle |= WB_VSCROLL;
- }
- pValueSet->SetStyle( nStyle );
+ nStyle |= WB_VSCROLL;
}
- }
+ SetStyle( nStyle );
+ }
+ }
+}
- if( !mbModal )
- {
- pValueSet->SetSizePixel( aValueSetSize );
- pValueSet->SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
- pValueSet->SetColor( GetSettings().GetStyleSettings().GetWindowColor() );
+TableValueSet::TableValueSet(Window *pParent, WinBits nStyle)
+ : ValueSet(pParent, nStyle)
+ , m_bModal(false)
+{
+}
- Point aPos( pValueSet->GetPosPixel() );
+void TableValueSet::updateSettings()
+{
+ if( !m_bModal )
+ {
+ SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
+ SetColor( GetSettings().GetStyleSettings().GetWindowColor() );
+ SetExtraSpacing(8);
+ }
+}
- // The following line may look like a no-op but without it the
- // control is placed off-screen when RTL is active.
- pValueSet->SetPosPixel(pValueSet->GetPosPixel());
+extern "C" SAL_DLLPUBLIC_EXPORT ::Window* SAL_CALL makeTableValueSet(::Window *pParent, VclBuilder::stringmap &rMap)
+{
+ WinBits nWinBits = WB_TABSTOP;
- // shift show options section down
- const long nOptionsPos = aPos.Y() + aValueSetSize.Height();
- sal_Int32 nMaxY (0);
- for( sal_Int32 nId = FL_STYLE_OPTIONS+1; nId <= CB_BANDED_COLUMNS; ++nId )
- {
- if (mxControls[nId])
- {
- Point aCPos( mxControls[nId]->GetPosPixel() );
- aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X();
- aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos;
- mxControls[nId]->SetPosPixel( aCPos );
- const sal_Int32 nBottom (aCPos.Y() + mxControls[nId]->GetSizePixel().Height());
- if (nBottom > nMaxY)
- nMaxY = nBottom;
- }
- }
- }
+ VclBuilder::stringmap::iterator aFind = rMap.find(OString("border"));
+ if (aFind != rMap.end())
+ {
+ if (toBool(aFind->second))
+ nWinBits |= WB_BORDER;
+ rMap.erase(aFind);
}
+
+ return new TableValueSet(pParent, nWinBits);
}
// --------------------------------------------------------------------
void TableDesignPane::updateControls()
{
- static const sal_Bool gDefaults[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] = { sal_True, sal_False, sal_True, sal_False, sal_False, sal_False };
+ static const sal_Bool gDefaults[CB_COUNT] = { sal_True, sal_False, sal_True, sal_False, sal_False, sal_False };
const bool bHasTable = mxSelectedTable.is();
const OUString* pPropNames = getPropertyNames();
- for( sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i )
+ for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i)
{
- sal_Bool bUse = gDefaults[i-CB_HEADER_ROW];
+ sal_Bool bUse = gDefaults[i];
if( bHasTable ) try
{
mxSelectedTable->getPropertyValue( *pPropNames++ ) >>= bUse;
@@ -540,12 +426,13 @@ void TableDesignPane::updateControls()
{
OSL_FAIL("sd::TableDesignPane::updateControls(), exception caught!");
}
- static_cast< CheckBox* >( mxControls[i].get() )->Check( bUse ? sal_True : sal_False );
- mxControls[i]->Enable(bHasTable ? sal_True : sal_False );
+ m_aCheckBoxes[i]->Check(bUse ? true : false);
+ m_aCheckBoxes[i]->Enable(bHasTable ? true : false);
}
FillDesignPreviewControl();
- updateLayout();
+ m_pValueSet->updateSettings();
+ m_pValueSet->Resize();
sal_uInt16 nSelection = 0;
@@ -571,8 +458,7 @@ void TableDesignPane::updateControls()
}
}
}
- ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
- pValueSet->SelectItem( nSelection );
+ m_pValueSet->SelectItem( nSelection );
}
// --------------------------------------------------------------------
@@ -798,10 +684,7 @@ const Bitmap CreateDesignPreview( const Reference< XIndexAccess >& xTableStyle,
// bbbbbbbbbbbb
- const sal_Int32 nCellWidth = 12; // one pixel is shared with the next cell!
- const sal_Int32 nCellHeight = 7; // one pixel is shared with the next cell!
-
- Bitmap aPreviewBmp( Size( (nCellWidth * nPreviewColumns) - (nPreviewColumns - 1), (nCellHeight * nPreviewRows) - (nPreviewRows - 1)), 24, NULL );
+ Bitmap aPreviewBmp( Size( nBitmapWidth, nBitmapHeight), 24, NULL );
BitmapWriteAccess* pAccess = aPreviewBmp.AcquireWriteAccess();
if( pAccess )
{
@@ -904,21 +787,19 @@ const Bitmap CreateDesignPreview( const Reference< XIndexAccess >& xTableStyle,
void TableDesignPane::FillDesignPreviewControl()
{
- ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() );
-
- sal_uInt16 nSelectedItem = pValueSet->GetSelectItemId();
- pValueSet->Clear();
+ sal_uInt16 nSelectedItem = m_pValueSet->GetSelectItemId();
+ m_pValueSet->Clear();
try
{
TableStyleSettings aSettings;
if( mxSelectedTable.is() )
{
- aSettings.mbUseFirstRow = static_cast< CheckBox* >(mxControls[CB_HEADER_ROW].get())->IsChecked();
- aSettings.mbUseLastRow = static_cast< CheckBox* >(mxControls[CB_TOTAL_ROW].get())->IsChecked();
- aSettings.mbUseRowBanding = static_cast< CheckBox* >(mxControls[CB_BANDED_ROWS].get())->IsChecked();
- aSettings.mbUseFirstColumn = static_cast< CheckBox* >(mxControls[CB_FIRST_COLUMN].get())->IsChecked();
- aSettings.mbUseLastColumn = static_cast< CheckBox* >(mxControls[CB_LAST_COLUMN].get())->IsChecked();
- aSettings.mbUseColumnBanding = static_cast< CheckBox* >(mxControls[CB_BANDED_COLUMNS].get())->IsChecked();
+ aSettings.mbUseFirstRow = m_aCheckBoxes[CB_HEADER_ROW]->IsChecked();
+ aSettings.mbUseLastRow = m_aCheckBoxes[CB_TOTAL_ROW]->IsChecked();
+ aSettings.mbUseRowBanding = m_aCheckBoxes[CB_BANDED_ROWS]->IsChecked();
+ aSettings.mbUseFirstColumn = m_aCheckBoxes[CB_FIRST_COLUMN]->IsChecked();
+ aSettings.mbUseLastColumn = m_aCheckBoxes[CB_LAST_COLUMN]->IsChecked();
+ aSettings.mbUseColumnBanding = m_aCheckBoxes[CB_BANDED_COLUMNS]->IsChecked();
}
sal_Bool bIsPageDark = sal_False;
@@ -932,22 +813,28 @@ void TableDesignPane::FillDesignPreviewControl()
}
}
- for( sal_Int32 nIndex = 0; nIndex < mxTableFamily->getCount(); nIndex++ ) try
+ sal_Int32 nCount = mxTableFamily->getCount();
+ for( sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex ) try
{
Reference< XIndexAccess > xTableStyle( mxTableFamily->getByIndex( nIndex ), UNO_QUERY );
if( xTableStyle.is() )
- pValueSet->InsertItem( sal::static_int_cast<sal_uInt16>( nIndex + 1 ), Image( CreateDesignPreview( xTableStyle, aSettings, bIsPageDark ) ) );
+ m_pValueSet->InsertItem( sal::static_int_cast<sal_uInt16>( nIndex + 1 ), Image( CreateDesignPreview( xTableStyle, aSettings, bIsPageDark ) ) );
}
catch( Exception& )
{
OSL_FAIL("sd::TableDesignPane::FillDesignPreviewControl(), exception caught!");
}
+ m_pValueSet->SetColCount(3);
+ m_pValueSet->SetLineCount((nCount+2)/3);
+ Size aSize(m_pValueSet->GetOptimalSize());
+ m_pValueSet->set_width_request(aSize.Width());
+ m_pValueSet->set_height_request(aSize.Height());
}
catch( Exception& )
{
OSL_FAIL("sd::TableDesignPane::FillDesignPreviewControl(), exception caught!");
}
- pValueSet->SelectItem(nSelectedItem);
+ m_pValueSet->SelectItem(nSelectedItem);
}
// ====================================================================
diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx
index 50831e9..9ef735b 100644
--- a/sd/source/ui/table/TableDesignPane.hxx
+++ b/sd/source/ui/table/TableDesignPane.hxx
@@ -26,15 +26,14 @@
#include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
+#include <svtools/valueset.hxx>
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
-#include <sfx2/sidebar/ILayoutableWindow.hxx>
+#include <svx/sidebar/PanelLayout.hxx>
#include <boost/scoped_ptr.hpp>
-#include "TableDesignPane.hrc"
-
namespace sd
{
@@ -46,7 +45,26 @@ class ViewShellBase;
// --------------------------------------------------------------------
-class TableDesignPane : public Control, public sfx2::sidebar::ILayoutableWindow
+#define CB_HEADER_ROW 0
+#define CB_TOTAL_ROW 1
+#define CB_BANDED_ROWS 2
+#define CB_FIRST_COLUMN 3
+#define CB_LAST_COLUMN 4
+#define CB_BANDED_COLUMNS 5
+#define CB_COUNT CB_BANDED_COLUMNS-CB_HEADER_ROW+1
+
+class TableValueSet : public ValueSet
+{
+private:
+ bool m_bModal;
+public:
+ TableValueSet(Window *pParent, WinBits nStyle);
+ virtual void Resize();
+ void updateSettings();
+ void setModal(bool bModal) { m_bModal = bModal; }
+};
+
+class TableDesignPane : public PanelLayout
{
public:
TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal );
@@ -55,12 +73,6 @@ public:
// callbacks
void onSelectionChanged();
- // Control
- virtual void Resize();
-
- // ILayoutableWindow
- virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth);
-
virtual void DataChanged( const DataChangedEvent& rDCEvt );
void ApplyOptions();
@@ -72,7 +84,6 @@ public:
private:
void addListener();
void removeListener();
- void updateLayout();
void updateControls();
void FillDesignPreviewControl();
@@ -85,8 +96,8 @@ private:
ViewShellBase& mrBase;
const OUString msTableTemplate;
- boost::scoped_ptr< Control > mxControls[DESIGNPANE_CONTROL_COUNT];
- int mnOrgOffsetY[DESIGNPANE_CONTROL_COUNT];
+ TableValueSet* m_pValueSet;
+ CheckBox* m_aCheckBoxes[CB_COUNT];
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSelectedTable;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
diff --git a/sd/uiconfig/simpress/ui/tabledesignpanel.ui b/sd/uiconfig/simpress/ui/tabledesignpanel.ui
new file mode 100644
index 0000000..3f935c2
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/tabledesignpanel.ui
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <!-- interface-requires LibreOffice 1.0 -->
+ <object class="GtkBox" id="TableDesignPanel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="UseFirstRowStyle">
+ <property name="label" translatable="yes">_Header Row</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <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>
+ <object class="GtkCheckButton" id="UseLastRowStyle">
+ <property name="label" translatable="yes">Tot_al Row</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <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>
+ <object class="GtkCheckButton" id="UseBandingRowStyle">
+ <property name="label" translatable="yes">_Banded Rows</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <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>
+ <object class="GtkCheckButton" id="UseFirstColumnStyle">
+ <property name="label" translatable="yes">Fi_rst Column</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="UseLastColumnStyle">
+ <property name="label" translatable="yes">_Last Column</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="UseBandingColumnStyle">
+ <property name="label" translatable="yes">Ba_nded Columns</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="sdlo-TableValueSet" id="previews:border">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </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>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>
commit e34263af775118ccea4b69a641e618dbe13df15b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 14 12:28:52 2013 +0000
convert draw table design dialog to .ui
Change-Id: Ieb9e7f9d2b8ff89aa83e44f4f1d3f634adf71b25
diff --git a/sd/UIConfig_sdraw.mk b/sd/UIConfig_sdraw.mk
index 1f924e8..90c2448 100644
--- a/sd/UIConfig_sdraw.mk
+++ b/sd/UIConfig_sdraw.mk
@@ -79,6 +79,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/sdraw,\
sd/uiconfig/sdraw/ui/namedesign \
sd/uiconfig/sdraw/ui/paranumberingtab \
sd/uiconfig/sdraw/ui/printeroptions \
+ sd/uiconfig/sdraw/ui/tabledesigndialog \
))
# vim: set noet sw=4 ts=4:
diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx
index adeecf6..5247d6e 100644
--- a/sd/source/ui/table/TableDesignPane.cxx
+++ b/sd/source/ui/table/TableDesignPane.cxx
@@ -29,6 +29,7 @@
#include <comphelper/processfactory.hxx>
#include <sfx2/viewfrm.hxx>
#include <vcl/bmpacc.hxx>
+#include <vcl/layout.hxx>
#include <svl/style.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/app.hxx>
@@ -952,17 +953,11 @@ void TableDesignPane::FillDesignPreviewControl()
// ====================================================================
TableDesignDialog::TableDesignDialog(::Window* pParent, ViewShellBase& rBase )
-: ModalDialog( pParent, SdResId( DLG_TABLEDESIGNPANE ))
+ : ModalDialog(pParent, "TableDesignDialog",
+ "modules/sdraw/ui/tabledesigndialog.ui")
{
- mxFlSep1.reset( new FixedLine( this, SdResId( FL_SEP1 ) ) );
- mxFlSep2.reset( new FixedLine( this, SdResId( FL_SEP2 ) ) );
- mxHelpButton.reset( new HelpButton( this, SdResId( BTN_HELP ) ) );
- mxOkButton.reset( new OKButton( this, SdResId( BTN_OK ) ) );
- mxCancelButton.reset( new CancelButton( this, SdResId( BTN_CANCEL ) ) );
- FreeResource();
-
- mpDesignPane.reset( new TableDesignPane( this, rBase, true ) );
- mpDesignPane->Hide();
+ mxDesignPane.reset( new TableDesignPane( get_content_area(), rBase, true ) );
+ mxDesignPane->Hide();
}
// --------------------------------------------------------------------
@@ -971,11 +966,11 @@ short TableDesignDialog::Execute()
{
if( ModalDialog::Execute() )
{
- if( mpDesignPane->isStyleChanged() )
- mpDesignPane->ApplyStyle();
+ if( mxDesignPane->isStyleChanged() )
+ mxDesignPane->ApplyStyle();
- if( mpDesignPane->isOptionsChanged() )
- mpDesignPane->ApplyOptions();
+ if( mxDesignPane->isOptionsChanged() )
+ mxDesignPane->ApplyOptions();
return sal_True;
}
return sal_False;
diff --git a/sd/source/ui/table/TableDesignPane.hrc b/sd/source/ui/table/TableDesignPane.hrc
index 10c087f..914b3e9 100644
--- a/sd/source/ui/table/TableDesignPane.hrc
+++ b/sd/source/ui/table/TableDesignPane.hrc
@@ -33,12 +33,6 @@
#define DESIGNPANE_CONTROL_COUNT 9
-#define FL_SEP1 10
-#define FL_SEP2 11
-#define BTN_HELP 12
-#define BTN_OK 13
-#define BTN_CANCEL 14
-
#endif // _SD_TABLEDESIGNPANE_HRC
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx
index 34e6c3e..50831e9 100644
--- a/sd/source/ui/table/TableDesignPane.hxx
+++ b/sd/source/ui/table/TableDesignPane.hxx
@@ -107,13 +107,7 @@ public:
virtual short Execute();
private:
- boost::scoped_ptr< TableDesignPane > mpDesignPane;
-
- boost::scoped_ptr< FixedLine > mxFlSep1;
- boost::scoped_ptr< FixedLine > mxFlSep2;
- boost::scoped_ptr< HelpButton > mxHelpButton;
- boost::scoped_ptr< OKButton > mxOkButton;
- boost::scoped_ptr< CancelButton > mxCancelButton;
+ boost::scoped_ptr< TableDesignPane > mxDesignPane;
};
}
diff --git a/sd/source/ui/table/TableDesignPane.src b/sd/source/ui/table/TableDesignPane.src
index c058d63..0be0bca 100644
--- a/sd/source/ui/table/TableDesignPane.src
+++ b/sd/source/ui/table/TableDesignPane.src
@@ -102,48 +102,4 @@ Control DLG_TABLEDESIGNPANE
};
};
-ModalDialog DLG_TABLEDESIGNPANE
-{
- HelpID = "sd:ModalDialog:DLG_TABLEDESIGNPANE";
- OutputSize = TRUE;
- SVLook = TRUE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Size = MAP_APPFONT( 272, 198 );
-
- Text [ en-US ] = "Table Design";
-
- FixedLine FL_SEP1
- {
- Pos = MAP_APPFONT( 135, 14 );
- Size = MAP_APPFONT( 8, 143 );
- Vert = TRUE ;
- };
- FixedLine FL_SEP2
- {
- Pos = MAP_APPFONT ( 0 , 160 ) ;
- Size = MAP_APPFONT ( 272 , 12 ) ;
- };
-
- HelpButton BTN_HELP
- {
- Pos = MAP_APPFONT ( 6 , 176 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- OKButton BTN_OK
- {
- Pos = MAP_APPFONT ( 158 , 176 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton BTN_CANCEL
- {
- Pos = MAP_APPFONT ( 211 , 176 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/uiconfig/sdraw/ui/tabledesigndialog.ui b/sd/uiconfig/sdraw/ui/tabledesigndialog.ui
new file mode 100644
index 0000000..95427a6
--- /dev/null
+++ b/sd/uiconfig/sdraw/ui/tabledesigndialog.ui
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkDialog" id="TableDesignDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Table Design</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="margin_top">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">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="cancel">
+ <property name="label">gtk-cancel</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">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">help</action-widget>
+ </action-widgets>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list