22 #include <osl/diagnose.h>
29 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
30 #include <com/sun/star/table/TableBorder.hpp>
31 #include <com/sun/star/table/CellHoriJustify.hpp>
32 #include <com/sun/star/table/CellOrientation.hpp>
33 #include <com/sun/star/table/TableBorder2.hpp>
34 #include <com/sun/star/awt/FontSlant.hpp>
41 #include <unonames.hxx>
47 #define SC_AF_FIELD_COUNT 16
61 {
u"", 0, css::uno::Type(), 0, 0 }
63 return aAutoFormatMap_Impl;
120 {
u"", 0, css::uno::Type(), 0, 0 }
122 return aAutoFieldMap_Impl;
125 #define SCAUTOFORMATSOBJ_SERVICE "com.sun.star.sheet.TableAutoFormats"
138 if ( aEntryName == rName )
140 size_t nPos = std::distance(itBeg, it);
158 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
192 uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY);
193 if ( xInterface.is() )
195 ScAutoFormatObj* pFormatObj = comphelper::getUnoTunnelImplementation<ScAutoFormatObj>( xInterface );
196 if ( pFormatObj && !pFormatObj->
IsInserted() )
203 throw container::ElementExistException();
207 pNew->SetName( aName );
209 if (pFormats->
insert(std::move(pNew)) != pFormats->
end())
214 sal_uInt16 nNewIndex;
223 OSL_FAIL(
"AutoFormat could not be inserted");
224 throw uno::RuntimeException();
232 throw lang::IllegalArgumentException();
250 if (it == pFormats->
end())
252 throw container::NoSuchElementException();
282 throw lang::IndexOutOfBoundsException();
283 return uno::makeAny(xFormat);
305 throw container::NoSuchElementException();
306 return uno::makeAny(xFormat);
313 uno::Sequence<OUString>
aSeq(pFormats->
size());
314 OUString* pAry =
aSeq.getArray();
316 for (
const auto& rEntry : *pFormats)
318 pAry[i] = rEntry.second->GetName();
334 nFormatIndex( nIndex )
396 if ( nIndex < 0 || nIndex >=
getCount() )
397 throw lang::IndexOutOfBoundsException();
400 return uno::makeAny(uno::Reference< beans::XPropertySet >(
GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex))));
438 throw uno::RuntimeException();
444 OSL_ENSURE(pData,
"AutoFormat data not available");
447 pNew->SetName( aNewName );
450 it = pFormats->
insert(std::move(pNew));
451 if (it != pFormats->
end())
461 OSL_FAIL(
"AutoFormat could not be inserted");
476 const OUString& aPropertyName,
const uno::Any& aValue )
484 OSL_ENSURE(pData,
"AutoFormat data not available");
515 OSL_ENSURE(pData,
"AutoFormat data not available");
546 nFormatIndex( nFormat ),
547 nFieldIndex( nField )
565 const OUString& aPropertyName,
const uno::Any& aValue )
572 if ( !(pEntry && pEntry->
nWID && nFormatIndex < pFormats->
size()) )
583 switch( pEntry->
nWID )
587 table::CellOrientation eOrient;
588 if( aValue >>= eOrient )
592 case table::CellOrientation_STANDARD:
595 case table::CellOrientation_TOPBOTTOM:
599 case table::CellOrientation_BOTTOMTOP:
603 case table::CellOrientation_STACKED:
616 std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
617 bDone = pNewItem->PutValue( aValue, pEntry->
nMemberId );
629 switch (pEntry->
nWID)
633 table::TableBorder aBorder;
634 if ( aValue >>= aBorder )
648 table::TableBorder2 aBorder2;
649 if ( aValue >>= aBorder2 )
674 if ( pEntry && pEntry->
nWID && nFormatIndex < pFormats->
size() )
682 switch( pEntry->
nWID )
693 pItem->QueryValue( aVal, pEntry->
nMemberId );
699 switch (pEntry->
nWID)
707 SvxBoxItem aOuter(*static_cast<const SvxBoxItem*>(pItem));
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ScAutoFormatsObj_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
#define SC_UNONAME_TBLBORD
#define SC_UNO_CJK_CFSTYLE
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
const SfxItemPropertySimpleEntry * getByName(std::u16string_view rName) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
#define SC_UNONAME_PLMARGIN
#define SC_UNONAME_INCWIDTH
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
std::unique_ptr< ContentProperties > pData
#define SC_UNONAME_INCBORD
#define SC_UNO_CTL_CFFAMIL
#define SC_UNONAME_PRMARGIN
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
#define SC_UNONAME_CUNDER
#define SC_WID_UNO_TBLBORD2
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
#define MID_GRAPHIC_TRANSPARENT
#define MID_MARGIN_LO_MARGIN
#define SC_UNO_CJK_CFNAME
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
static void FillBoxItems(SvxBoxItem &rOuter, SvxBoxInfoItem &rInner, const css::table::TableBorder &rBorder)
#define SC_UNONAME_PTMARGIN
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
#define SC_UNONAME_CCOLOR
#define SC_UNONAME_CWEIGHT
#define SC_UNONAME_CELLBACK
static void AssignTableBorder2ToAny(css::uno::Any &rAny, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner, bool bInvalidateHorVerDist=false)
static void AssignTableBorderToAny(css::uno::Any &rAny, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner, bool bInvalidateHorVerDist=false)
#define SC_UNO_CJK_CFPITCH
static SC_DLLPUBLIC ScAutoFormat * GetAutoFormat()
#define MID_MARGIN_R_MARGIN
#define SC_UNONAME_INCFONT
#define SC_UNONAME_CELLHJUS_METHOD
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
#define SC_UNO_CTL_CFCHARS
#define MID_FONT_FAMILY_NAME
#define SC_UNO_CJK_CFFAMIL
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_HOR_JUSTIFY_METHOD(130)
#define SC_UNONAME_ROTREF
#define SC_UNONAME_INCJUST
#define SC_UNO_CTL_CFNAME
#define SC_UNONAME_CFNAME
#define SC_UNO_CTL_CFSTYLE
#define SC_UNONAME_INCNUM
#define SC_UNONAME_CHEIGHT
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
#define MID_MARGIN_L_MARGIN
#define SC_UNONAME_CFPITCH
#define SC_UNONAME_INCBACK
#define SC_UNONAME_CFCHARS
static const SfxItemPropertyMapEntry * lcl_GetAutoFieldMap()
number format (String/Language) ??? (in XNumberFormat only ReadOnly) table::TableBorder ...
#define SC_UNO_CTL_CWEIGHT
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
#define SC_UNO_CJK_CHEIGHT
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
#define SC_AF_FIELD_COUNT
static const SfxItemPropertyMapEntry * lcl_GetAutoFormatMap()
#define SC_UNONAME_CSHADD
const SfxItemPropertyMap & getPropertyMap() const
UNO3_GETIMPLEMENTATION_IMPL(ScAutoFormatObj)
#define SC_UNONAME_CELLVJUS_METHOD
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
#define SC_UNONAME_CELLHJUS
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
#define MID_MARGIN_UP_MARGIN
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
#define SC_UNONAME_CFSTYLE
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
#define SC_WID_UNO_TBLBORD
#define MID_FONT_STYLE_NAME
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_VER_JUSTIFY_METHOD(133)
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
bool IsScItemWid(sal_uInt16 nWid)
#define SC_AFMTOBJ_INVALID
constexpr TypedWhichId< SvxOverlineItem > ATTR_FONT_OVERLINE(105)
#define SC_UNO_CJK_CWEIGHT
#define SCAUTOFORMATSOBJ_SERVICE
#define SC_UNONAME_CFFAMIL
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
#define SC_UNONAME_ROTANG
#define SC_UNONAME_CELLORI
#define SC_UNONAME_CELLVJUS
#define SC_UNONAME_PBMARGIN
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
Degree100 GetValue() const
Sequence< sal_Int8 > aSeq
#define SC_UNO_CTL_CHEIGHT
#define SC_UNONAME_TBLBORD2
#define SC_UNONAME_CELLTRAN
static SC_DLLPUBLIC ScAutoFormat * GetOrCreateAutoFormat()
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
#define SC_UNO_CTL_CFPITCH
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
static bool lcl_FindAutoFormatIndex(const ScAutoFormat &rFormats, std::u16string_view rName, sal_uInt16 &rOutIndex)
#define SC_UNO_CJK_CFCHARS
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
#define MID_FONT_CHAR_SET
#define SC_UNONAME_CCROSS