Kaydet (Commit) 2f527738 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Set the default cell border line width to 0.75 pt in Calc.

0.75 pt provides a better interop with Excel documents.

Change-Id: Ic1d2cbbe4e35dc0793a0e35d3836261d91138f7c
üst d3f96d74
......@@ -41,6 +41,7 @@
#include <sfx2/request.hxx>
#include <svl/intitem.hxx>
#include <svl/ilstitem.hxx>
#include <svl/int64item.hxx>
#include <sfx2/itemconnect.hxx>
#include <sal/macros.h>
#include "borderconn.hxx"
......@@ -167,6 +168,13 @@ SvxBorderTabPage::SvxBorderTabPage(Window* pParent, const SfxItemSet& rCoreAttrs
maUsedBorderStyles.insert(static_cast<sal_Int16>(aUsedStyles[i]));
}
if (rCoreAttrs.HasItem(SID_ATTR_BORDER_DEFAULT_WIDTH, &pItem))
{
// The caller specifies default line width. Honor it.
const SfxInt64Item* p = static_cast<const SfxInt64Item*>(pItem);
m_pLineWidthMF->SetValue(p->GetValue());
}
// set metric
FieldUnit eFUnit = GetModuleFieldUnit( rCoreAttrs );
......
/* -*- 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/.
*/
#ifndef INCLUDED_SVL_INT64ITEM_HXX
#define INCLUDED_SVL_INT64ITEM_HXX
#include <svl/poolitem.hxx>
#include <svl/svldllapi.h>
class SVL_DLLPUBLIC SfxInt64Item : public SfxPoolItem
{
sal_Int64 mnValue;
public:
SfxInt64Item( sal_uInt16 nWhich = 0, sal_Int64 nVal = 0 );
SfxInt64Item( sal_uInt16 nWhich, SvStream & rStream );
SfxInt64Item( const SfxInt64Item& rItem );
virtual ~SfxInt64Item();
virtual bool operator== ( const SfxPoolItem& rItem ) const;
virtual int Compare( const SfxPoolItem& r ) const;
virtual int Compare( const SfxPoolItem& r, const IntlWrapper& rIntlWrapper ) const;
virtual SfxItemPresentation GetPresentation(
SfxItemPresentation, SfxMapUnit, SfxMapUnit,
OUString& rText, const IntlWrapper* pIntlWrapper = NULL ) const;
virtual bool QueryValue(
com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
virtual bool PutValue(
const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nItemVersion ) const;
virtual SvStream& Store( SvStream& rStream, sal_uInt16 nItemVersion ) const;
virtual SfxPoolItem* Clone( SfxItemPool* pOther = NULL ) const;
sal_Int64 GetValue() const;
void SetValue( sal_Int64 nVal );
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -958,10 +958,11 @@
#define SID_SW_ATTR_FILL_GRADIENT ( SID_SVX_START + 1139 )
#define SID_ATTR_BORDER_STYLES ( SID_SVX_START + 1140 )
#define SID_ATTR_BORDER_DEFAULT_WIDTH ( SID_SVX_START + 1141 )
// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
#define SID_SVX_FIRSTFREE (SID_ATTR_BORDER_STYLES + 1)
#define SID_SVX_FIRSTFREE (SID_ATTR_BORDER_DEFAULT_WIDTH + 1)
// Overflow check for slot IDs
......
......@@ -25,6 +25,7 @@
#include <svx/numinf.hxx>
#include <svl/srchitem.hxx>
#include <svl/ilstitem.hxx>
#include <svl/int64item.hxx>
#include <svx/zoomslideritem.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
......@@ -480,6 +481,8 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
boost::scoped_ptr<SfxItemSet> pOldSet(new SfxItemSet(pOldAttrs->GetItemSet()));
boost::scoped_ptr<SvxNumberInfoItem> pNumberInfoItem;
pOldSet->MergeRange(SID_ATTR_BORDER_STYLES, SID_ATTR_BORDER_DEFAULT_WIDTH);
// We only allow these border line types.
std::vector<sal_Int32> aBorderStyles;
aBorderStyles.reserve(5);
......@@ -490,9 +493,12 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
aBorderStyles.push_back(table::BorderLineStyle::DOUBLE);
SfxIntegerListItem aBorderStylesItem(SID_ATTR_BORDER_STYLES, aBorderStyles);
pOldSet->MergeRange(SID_ATTR_BORDER_STYLES, SID_ATTR_BORDER_STYLES);
pOldSet->Put(aBorderStylesItem);
// Set the default border width to 0.75 points.
SfxInt64Item aBorderWidthItem(SID_ATTR_BORDER_DEFAULT_WIDTH, 75);
pOldSet->Put(aBorderWidthItem);
// Get border items and put them in the set:
GetSelectionFrame( aLineOuter, aLineInner );
//Fix border incorrect for RTL fdo#62399
......
......@@ -75,6 +75,7 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
svl/source/items/ilstitem \
svl/source/items/imageitm \
svl/source/items/intitem \
svl/source/items/int64item \
svl/source/items/itemiter \
svl/source/items/itempool \
svl/source/items/itemprop \
......
/* -*- 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/.
*/
#include <svl/int64item.hxx>
#include <tools/stream.hxx>
SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal ) :
SfxPoolItem(nWhich), mnValue(nVal)
{
}
SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, SvStream& rStream ) :
SfxPoolItem(nWhich)
{
rStream.ReadInt64(mnValue);
}
SfxInt64Item::SfxInt64Item( const SfxInt64Item& rItem ) :
SfxPoolItem(rItem), mnValue(rItem.mnValue)
{
}
SfxInt64Item::~SfxInt64Item() {}
bool SfxInt64Item::operator== ( const SfxPoolItem& rItem ) const
{
return mnValue == static_cast<const SfxInt64Item&>(rItem).mnValue;
}
int SfxInt64Item::Compare( const SfxPoolItem& r ) const
{
sal_Int64 nOther = static_cast<const SfxInt64Item&>(r).mnValue;
if (mnValue < nOther)
return -1;
if (mnValue > nOther)
return 1;
return 0;
}
int SfxInt64Item::Compare( const SfxPoolItem& r, const IntlWrapper& /*rIntlWrapper*/ ) const
{
return Compare(r);
}
SfxItemPresentation SfxInt64Item::GetPresentation(
SfxItemPresentation, SfxMapUnit, SfxMapUnit, OUString& rText,
const IntlWrapper* /*pIntlWrapper*/ ) const
{
rText = OUString::number(mnValue);
return SFX_ITEM_PRESENTATION_NAMELESS;
}
bool SfxInt64Item::QueryValue(
com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
{
rVal <<= mnValue;
return true;
}
bool SfxInt64Item::PutValue(
const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
{
sal_Int64 nVal;
if (rVal >>= nVal)
{
mnValue = nVal;
return true;
}
return false;
}
SfxPoolItem* SfxInt64Item::Create( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const
{
return new SfxInt64Item(Which(), rStream);
}
SvStream& SfxInt64Item::Store( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const
{
return rStream.WriteInt64(mnValue);
}
SfxPoolItem* SfxInt64Item::Clone( SfxItemPool* /*pOther*/ ) const
{
return new SfxInt64Item(*this);
}
sal_Int64 SfxInt64Item::GetValue() const
{
return mnValue;
}
void SfxInt64Item::SetValue( sal_Int64 nVal )
{
mnValue = nVal;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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