Version: 1.5rc1 (using KDE KDE 3.5.1) Installed from: Fedora RPMs Thanks for fixing Bug #75118. However, a default cell height of 0.53 still looks wrong for some sheets, depending on how you set fonts, etc. A way for the user to configure the default cell height is needed. I tried all of the following: * Settings -> Configure KSpread * Format -> Style Manager -> Modify(Default) * Format -> Sheet -> Sheet Properties None of these seem to permit you to change the default cell height or width.
SVN commit 566848 by nikolaus: Style Make the default column width and row height configurable via Style Manager -> "Default" -> Position. Note: KSpread 2.0 CCBUGS: 125749 M +1 -1 Border.cpp M +4 -4 Format.cpp M +3 -3 View.cpp M +15 -1 dialogs/LayoutDialog.cpp --- trunk/koffice/kspread/Border.cpp #566847:566848 @@ -1347,7 +1347,7 @@ xPos = xPos - m_pCanvas->xOffset(); } - int height = m_pCanvas->d->view->doc()->zoomItYOld( Format::globalRowHeight() + 2 ); + int height = m_pCanvas->d->view->doc()->zoomItYOld( painter.font().pointSizeF() + 5 ); if ( sheet->layoutDirection()==Sheet::RightToLeft ) --- trunk/koffice/kspread/Format.cpp #566847:566848 @@ -2564,9 +2564,9 @@ return 0.0; if ( _canvas ) - return _canvas->zoom() * m_fHeight; + return _canvas->zoom() * (m_iRow == 0) ? s_rowHeight : m_fHeight; else - return m_fHeight; + return (m_iRow == 0) ? s_rowHeight : m_fHeight; } double RowFormat::mmHeight() const @@ -2806,9 +2806,9 @@ return 0.0; if ( _canvas ) - return _canvas->zoom() * m_fWidth; + return _canvas->zoom() * (m_iColumn == 0) ? s_columnWidth : m_fWidth; else - return m_fWidth; + return (m_iColumn == 0) ? s_columnWidth : m_fWidth; } double ColumnFormat::mmWidth() const --- trunk/koffice/kspread/View.cpp #566847:566848 @@ -1711,6 +1711,8 @@ d->hBorderWidget = new HBorder( this, d->canvas,this ); d->vBorderWidget = new VBorder( this, d->canvas ,this ); + d->hBorderWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); + d->vBorderWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ); d->canvas->setFocusPolicy( Qt::StrongFocus ); QWidget::setFocusPolicy( Qt::StrongFocus ); @@ -5307,9 +5309,7 @@ d->canvas->updatePosWidget(); - d->hBorderWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); - d->hBorderWidget->setMinimumHeight( doc()->zoomItYOld( Format::globalRowHeight() + 2 ) ); - d->vBorderWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ); + d->hBorderWidget->setMinimumHeight( doc()->zoomItYOld( KoGlobal::defaultFont().pointSizeF() + 5 ) ); d->vBorderWidget->setMinimumWidth( doc()->zoomItXOld( YBORDER_WIDTH ) ); Sheet::LayoutDirection sheetDir = sheet->layoutDirection(); --- trunk/koffice/kspread/dialogs/LayoutDialog.cpp #566847:566848 @@ -2340,7 +2340,8 @@ // in case we're editing a style, we disable the cell size settings if (dlg->getStyle()) { - sizeCellGroup->setEnabled(false); + defaultHeight->setEnabled(false); + defaultWidth->setEnabled(false); } connect(defaultWidth , SIGNAL(clicked() ),this, SLOT(slotChangeWidthState())); @@ -2462,6 +2463,19 @@ if ( m_indent->isEnabled() && dlg->indent != m_indent->value() ) style->changeIndent( m_indent->value() ); + + // setting the default column width and row height + if ( dlg->getStyle()->type() == Style::BUILTIN && dlg->getStyle()->name() == "Default" ) + { + if ( (int) height->value() != (int) dlg->heightSize ) + { + Format::setGlobalRowHeight( height->value() ); + } + if ( (int) width->value() != (int) dlg->widthSize ) + { + Format::setGlobalColWidth( width->value() ); + } + } } void CellFormatPagePosition::apply(FormatManipulator* _obj)
SVN commit 566856 by nikolaus: backport SVN commit 566848 by nikolaus: Style Make the default column width and row height configurable via Style Manager -> "Default" -> Position. -------------------------------------------------------------------------------- backport SVN commit 566828 by nikolaus: OpenDocument Fix the loading of the column width. [not ported, is already in] Format Use static variables for the default col width/row height. Cleanup Removing superflous preprocessor defines. -------------------------------------------------------------------------------- FEATURE: 125749 M +17 -2 dialogs/kspread_dlg_layout.cc M +1 -1 kspread_canvas.cc M +15 -17 kspread_format.cc M +4 -0 kspread_format.h M +3 -12 kspread_global.h M +3 -3 kspread_view.cc --- branches/koffice/1.6/koffice/kspread/dialogs/kspread_dlg_layout.cc #566855:566856 @@ -983,6 +983,7 @@ positionPage->apply( m_style ); patternPage->apply( m_style ); protectPage->apply( m_style ); + m_pView->refreshView(); } void CellFormatDialog::slotApply() @@ -2302,7 +2303,8 @@ // in case we're editing a style, we disable the cell size settings if (dlg->getStyle()) { - sizeCellGroup->setEnabled(false); + defaultHeight->setEnabled(false); + defaultWidth->setEnabled(false); } connect(defaultWidth , SIGNAL(clicked() ),this, SLOT(slotChangeWidthState())); @@ -2424,6 +2426,19 @@ if ( m_indent->isEnabled() && dlg->indent != m_indent->value() ) style->changeIndent( m_indent->value() ); + + // setting the default column width and row height + if ( dlg->getStyle()->type() == Style::BUILTIN && dlg->getStyle()->name() == "Default" ) + { + if ( (int) height->value() != (int) dlg->heightSize ) + { + Format::setGlobalRowHeight( height->value() ); + } + if ( (int) width->value() != (int) dlg->widthSize ) + { + Format::setGlobalColWidth( width->value() ); + } + } } void CellFormatPagePosition::apply(FormatManipulator* _obj) @@ -2966,7 +2981,7 @@ void CellFormatPageBorder::loadIcon( QString _pix, BorderButton *_button) { - _button->setPixmap( QPixmap( KSBarIcon(_pix) ) ); + _button->setPixmap( QPixmap( BarIcon(_pix, Factory::global()) ) ); } void CellFormatPageBorder::apply(FormatManipulator* obj) --- branches/koffice/1.6/koffice/kspread/kspread_canvas.cc #566855:566856 @@ -5824,7 +5824,7 @@ xPos = xPos - m_pCanvas->xOffset(); } - int height = m_pCanvas->d->view->doc()->zoomItY( Format::globalRowHeight() + 2 ); + int height = m_pCanvas->d->view->doc()->zoomItY( painter.font().pointSizeFloat() + 5 ); QFont normalFont = painter.font(); if ( m_pCanvas->d->view->doc()->zoom() < 100 ) --- branches/koffice/1.6/koffice/kspread/kspread_format.cc #566855:566856 @@ -48,14 +48,7 @@ #include "kspread_format.h" -namespace format_LNS -{ - double g_colWidth = colWidth; - double g_rowHeight = heightOfRow; -} - using namespace std; -using namespace format_LNS; using namespace KSpread; /***************************************************************************** @@ -64,6 +57,11 @@ * *****************************************************************************/ +// static variable construction +// NOTE Stefan: These values are always overridden by the Doc c'tor. +double Format::s_columnWidth = 100.0; +double Format::s_rowHeight = 20.0; + Format::Format( Sheet * _sheet, Style * _style ) : m_pSheet( _sheet ), m_pStyle( _style ), @@ -95,22 +93,22 @@ void Format::setGlobalColWidth( double width ) { - g_colWidth = width; + s_columnWidth = width; } void Format::setGlobalRowHeight( double height ) { - g_rowHeight = height; + s_rowHeight = height; } double Format::globalRowHeight() { - return g_rowHeight; + return s_rowHeight; } double Format::globalColWidth() { - return g_colWidth; + return s_columnWidth; } void Format::copy( const Format & _l ) @@ -2499,7 +2497,7 @@ m_prev = 0; m_bDisplayDirtyFlag = false; - m_fHeight = g_rowHeight; + m_fHeight = s_rowHeight; m_iRow = _row; m_bDefault = false; m_bHide = false; @@ -2571,9 +2569,9 @@ return 0.0; if ( _canvas ) - return _canvas->zoom() * m_fHeight; + return _canvas->zoom() * (m_iRow == 0) ? s_rowHeight : m_fHeight; else - return m_fHeight; + return (m_iRow == 0) ? s_rowHeight : m_fHeight; } double RowFormat::mmHeight() const @@ -2747,7 +2745,7 @@ : Format( _sheet, _sheet->doc()->styleManager()->defaultStyle() ) { m_bDisplayDirtyFlag = false; - m_fWidth = g_colWidth; + m_fWidth = s_columnWidth; m_iColumn = _column; m_bDefault=false; m_bHide=false; @@ -2820,9 +2818,9 @@ return 0.0; if ( _canvas ) - return _canvas->zoom() * m_fWidth; + return _canvas->zoom() * (m_iColumn == 0) ? s_columnWidth : m_fWidth; else - return m_fWidth; + return (m_iColumn == 0) ? s_columnWidth : m_fWidth; } double ColumnFormat::mmWidth() const --- branches/koffice/1.6/koffice/kspread/kspread_format.h #566855:566856 @@ -434,6 +434,10 @@ */ QString * m_strComment; + // default column width and row height + static double s_columnWidth; + static double s_rowHeight; + private: void setProperty( Properties p ); --- branches/koffice/1.6/koffice/kspread/kspread_global.h #566855:566856 @@ -1,27 +1,18 @@ #ifndef KSPREAD_GLOBAL_H #define KSPREAD_GLOBAL_H +#include <qdatetime.h> + +#include <kdebug.h> #include <kiconloader.h> #include "kspread_factory.h" -#include <qdatetime.h> -#include <kdebug.h> - - -#define KSBarIcon( x ) BarIcon( x, Factory::global() ) -#define colWidth 60.0 -#define heightOfRow 20.0 - /* Definition of maximal supported rows - please check kspread_util (columnName) and kspread_cluster also */ #define KS_rowMax 0x7FFF /* Definition of maximal supported columns - please check kspread_util (columnName) and kspread_cluster also */ #define KS_colMax 0x7FFF -/* Currently used by StyleCluster for the Quad tree - question is, if we can make the spreadsheet this big in general? - We need this value to be the smallest number which is a power of 2 and more than both KS_rowMax and KS_colMax*/ -#define KS_Max_Quad 0x8000 - /* Definition of maximal supported columns/rows, which can be merged */ #define KS_spanMax 0xFFF --- branches/koffice/1.6/koffice/kspread/kspread_view.cc #566855:566856 @@ -1967,6 +1967,8 @@ d->hBorderWidget = new HBorder( this, d->canvas,this ); d->vBorderWidget = new VBorder( this, d->canvas ,this ); + d->hBorderWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); + d->vBorderWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ); d->canvas->setFocusPolicy( QWidget::StrongFocus ); QWidget::setFocusPolicy( QWidget::StrongFocus ); @@ -5593,9 +5595,7 @@ d->canvas->updatePosWidget(); - d->hBorderWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); - d->hBorderWidget->setMinimumHeight( doc()->zoomItY( Format::globalRowHeight() + 2 ) ); - d->vBorderWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ); + d->hBorderWidget->setMinimumHeight( doc()->zoomItY( KoGlobal::defaultFont().pointSizeFloat() + 5 ) ); d->vBorderWidget->setMinimumWidth( doc()->zoomItX( YBORDER_WIDTH ) ); Sheet::LayoutDirection sheetDir = sheet->layoutDirection();
You need to log in before you can comment on or make changes to this bug.