1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <com/sun/star/drawing/BitmapMode.hpp>
22 #include <com/sun/star/style/XStyle.hpp>
23 #include <com/sun/star/text/WritingMode.hpp>
24 #include <com/sun/star/table/TableBorder.hpp>
25 #include <com/sun/star/table/BorderLine2.hpp>
27 #include <comphelper/string.hxx>
29 #include <cppuhelper/supportsservice.hxx>
30 #include <cppuhelper/typeprovider.hxx>
31 #include <svl/style.hxx>
32 #include <svl/itemset.hxx>
34 #include <osl/mutex.hxx>
35 #include <vcl/svapp.hxx>
37 #include "sdr/properties/textproperties.hxx"
38 #include "editeng/outlobj.hxx"
39 #include "editeng/writingmodeitem.hxx"
40 #include "svx/svdotable.hxx"
41 #include "svx/svdoutl.hxx"
42 #include "svx/unoshtxt.hxx"
43 #include "svx/svdmodel.hxx"
45 #include "getallcharpropids.hxx"
46 #include "tableundo.hxx"
48 #include "svx/unoshprp.hxx"
49 #include "svx/unoshape.hxx"
50 #include "editeng/editobj.hxx"
51 #include "editeng/boxitem.hxx"
52 #include "svx/xflbstit.hxx"
53 #include "svx/xflbmtit.hxx"
54 #include <svx/svdpool.hxx>
58 using ::editeng::SvxBorderLine
;
59 using namespace ::com::sun::star::uno
;
60 using namespace ::com::sun::star::beans
;
61 using namespace ::com::sun::star::lang
;
62 using namespace ::com::sun::star::text
;
63 using namespace ::com::sun::star::table
;
64 using namespace ::com::sun::star::drawing
;
65 using namespace ::com::sun::star::style
;
66 using namespace ::com::sun::star::container
;
70 static const SvxItemPropertySet
* ImplGetSvxCellPropertySet()
72 // Propertymap fuer einen Outliner Text
73 static const SfxItemPropertyMapEntry aSvxCellPropertyMap
[] =
76 // { "HasLevels", OWN_ATTR_HASLEVELS, cppu::UnoType<bool>::get(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
77 { OUString("Style"), OWN_ATTR_STYLE
, cppu::UnoType
< ::com::sun::star::style::XStyle
>::get(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
78 { OUString(UNO_NAME_TEXT_WRITINGMODE
), SDRATTR_TEXTDIRECTION
, cppu::UnoType
<com::sun::star::text::WritingMode
>::get(), 0, 0},
79 { OUString(UNO_NAME_TEXT_HORZADJUST
), SDRATTR_TEXT_HORZADJUST
, cppu::UnoType
<com::sun::star::drawing::TextHorizontalAdjust
>::get(), 0, 0}, \
80 { OUString(UNO_NAME_TEXT_LEFTDIST
), SDRATTR_TEXT_LEFTDIST
, ::cppu::UnoType
<sal_Int32
>::get(), 0, SFX_METRIC_ITEM
}, \
81 { OUString(UNO_NAME_TEXT_LOWERDIST
), SDRATTR_TEXT_LOWERDIST
, ::cppu::UnoType
<sal_Int32
>::get(), 0, SFX_METRIC_ITEM
}, \
82 { OUString(UNO_NAME_TEXT_RIGHTDIST
), SDRATTR_TEXT_RIGHTDIST
, ::cppu::UnoType
<sal_Int32
>::get(), 0, SFX_METRIC_ITEM
}, \
83 { OUString(UNO_NAME_TEXT_UPPERDIST
), SDRATTR_TEXT_UPPERDIST
, ::cppu::UnoType
<sal_Int32
>::get(), 0, SFX_METRIC_ITEM
}, \
84 { OUString(UNO_NAME_TEXT_VERTADJUST
), SDRATTR_TEXT_VERTADJUST
, cppu::UnoType
<com::sun::star::drawing::TextVerticalAdjust
>::get(), 0, 0},\
85 { OUString(UNO_NAME_TEXT_WORDWRAP
), SDRATTR_TEXT_WORDWRAP
, cppu::UnoType
<bool>::get(), 0, 0}, \
87 { OUString("TableBorder"), OWN_ATTR_TABLEBORDER
, cppu::UnoType
<TableBorder
>::get(), 0, 0 }, \
88 { OUString("TopBorder"), SDRATTR_TABLE_BORDER
, cppu::UnoType
<BorderLine
>::get(), 0, TOP_BORDER
}, \
89 { OUString("BottomBorder"), SDRATTR_TABLE_BORDER
, cppu::UnoType
<BorderLine
>::get(), 0, BOTTOM_BORDER
}, \
90 { OUString("LeftBorder"), SDRATTR_TABLE_BORDER
, cppu::UnoType
<BorderLine
>::get(), 0, LEFT_BORDER
}, \
91 { OUString("RightBorder"), SDRATTR_TABLE_BORDER
, cppu::UnoType
<BorderLine
>::get(), 0, RIGHT_BORDER
}, \
93 SVX_UNOEDIT_OUTLINER_PROPERTIES
,
94 SVX_UNOEDIT_CHAR_PROPERTIES
,
95 SVX_UNOEDIT_PARA_PROPERTIES
,
96 { OUString(), 0, css::uno::Type(), 0, 0 }
99 static SvxItemPropertySet
aSvxCellPropertySet( aSvxCellPropertyMap
, SdrObject::GetGlobalDrawObjectItemPool() );
100 return &aSvxCellPropertySet
;
106 class CellTextProvider
: public svx::ITextProvider
109 explicit CellTextProvider(const sdr::table::CellRef
& rCell
);
110 virtual ~CellTextProvider();
113 virtual sal_Int32
getTextCount() const SAL_OVERRIDE
;
114 virtual SdrText
* getText(sal_Int32 nIndex
) const SAL_OVERRIDE
;
117 const sdr::table::CellRef m_xCell
;
120 CellTextProvider::CellTextProvider(const sdr::table::CellRef
& rCell
)
125 CellTextProvider::~CellTextProvider()
129 sal_Int32
CellTextProvider::getTextCount() const
134 SdrText
* CellTextProvider::getText(sal_Int32 nIndex
) const
138 return m_xCell
.get();
147 class CellProperties
: public TextProperties
150 // create a new itemset
151 SfxItemSet
* CreateObjectSpecificItemSet(SfxItemPool
& rPool
) SAL_OVERRIDE
;
153 const svx::ITextProvider
& getTextProvider() const SAL_OVERRIDE
;
157 CellProperties(SdrObject
& rObj
, sdr::table::Cell
* pCell
);
159 // constructor for copying, but using new object
160 CellProperties(const CellProperties
& rProps
, SdrObject
& rObj
, sdr::table::Cell
* pCell
);
163 virtual ~CellProperties();
165 // Clone() operator, normally just calls the local copy constructor
166 BaseProperties
& Clone(SdrObject
& rObj
) const SAL_OVERRIDE
;
168 void ForceDefaultAttributes() SAL_OVERRIDE
;
170 void ItemSetChanged(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
172 void ItemChange(const sal_uInt16 nWhich
, const SfxPoolItem
* pNewItem
) SAL_OVERRIDE
;
174 void SetStyleSheet(SfxStyleSheet
* pNewStyleSheet
, bool bDontRemoveHardAttr
) SAL_OVERRIDE
;
176 sdr::table::CellRef mxCell
;
179 const CellTextProvider maTextProvider
;
182 // create a new itemset
183 SfxItemSet
* CellProperties::CreateObjectSpecificItemSet(SfxItemPool
& rPool
)
185 return new SfxItemSet(rPool
,
187 // range from SdrAttrObj
188 SDRATTR_START
, SDRATTR_SHADOW_LAST
,
189 SDRATTR_MISC_FIRST
, SDRATTR_MISC_LAST
,
190 SDRATTR_TEXTDIRECTION
, SDRATTR_TEXTDIRECTION
,
192 // range for SdrTableObj
193 SDRATTR_TABLE_FIRST
, SDRATTR_TABLE_LAST
,
195 // range from SdrTextObj
196 EE_ITEMS_START
, EE_ITEMS_END
,
202 const svx::ITextProvider
& CellProperties::getTextProvider() const
204 return maTextProvider
;
207 CellProperties::CellProperties(SdrObject
& rObj
, sdr::table::Cell
* pCell
)
208 : TextProperties(rObj
)
210 , maTextProvider(mxCell
)
214 CellProperties::CellProperties(const CellProperties
& rProps
, SdrObject
& rObj
, sdr::table::Cell
* pCell
)
215 : TextProperties(rProps
, rObj
)
217 , maTextProvider(mxCell
)
221 CellProperties::~CellProperties()
225 BaseProperties
& CellProperties::Clone(SdrObject
& rObj
) const
227 OSL_FAIL("CellProperties::Clone(), does not work yet!");
228 return *(new CellProperties(*this, rObj
,0));
231 void CellProperties::ForceDefaultAttributes()
235 void CellProperties::ItemSetChanged(const SfxItemSet
& rSet
)
237 SdrTextObj
& rObj
= static_cast<SdrTextObj
&>(GetSdrObject());
241 OutlinerParaObject
* pParaObj
= mxCell
->GetEditOutlinerParaObject();
243 bool bOwnParaObj
= pParaObj
!= 0;
246 pParaObj
= mxCell
->GetOutlinerParaObject();
250 // handle outliner attributes
251 Outliner
* pOutliner
= 0;
253 if(mxCell
->IsTextEditActive())
255 pOutliner
= rObj
.GetTextEditOutliner();
259 pOutliner
= &rObj
.ImpGetDrawOutliner();
260 pOutliner
->SetText(*pParaObj
);
263 sal_Int32
nParaCount(pOutliner
->GetParagraphCount());
265 // if the user sets character attributes to the complete
266 // cell we want to remove all hard set character attributes
267 // with same which ids from the text
268 std::vector
<sal_uInt16
> aCharWhichIds(GetAllCharPropIds(rSet
));
270 for(sal_Int32 nPara
= 0; nPara
< nParaCount
; nPara
++)
272 SfxItemSet
aSet(pOutliner
->GetParaAttribs(nPara
));
275 for (std::vector
<sal_uInt16
>::const_iterator aI
= aCharWhichIds
.begin(); aI
!= aCharWhichIds
.end(); ++aI
)
277 pOutliner
->RemoveCharAttribs(nPara
, *aI
);
280 pOutliner
->SetParaAttribs(nPara
, aSet
);
283 if(!mxCell
->IsTextEditActive())
290 SfxItemSet
aNewSet(pOutliner
->GetParaAttribs(0L));
291 mpItemSet
->Put(aNewSet
);
294 OutlinerParaObject
* pTemp
= pOutliner
->CreateParaObject(0, nParaCount
);
297 mxCell
->SetOutlinerParaObject(pTemp
);
306 AttributeProperties::ItemSetChanged(rSet
);
309 mxCell
->notifyModified();
312 void CellProperties::ItemChange(const sal_uInt16 nWhich
, const SfxPoolItem
* pNewItem
)
314 if(pNewItem
&& (SDRATTR_TEXTDIRECTION
== nWhich
))
316 bool bVertical(com::sun::star::text::WritingMode_TB_RL
== static_cast<const SvxWritingModeItem
*>(pNewItem
)->GetValue());
318 sdr::table::SdrTableObj
& rObj
= static_cast<sdr::table::SdrTableObj
&>(GetSdrObject());
319 if( rObj
.IsVerticalWriting() != bVertical
)
320 rObj
.SetVerticalWriting(bVertical
);
322 // Set a cell vertical property
323 OutlinerParaObject
* pParaObj
= mxCell
->GetEditOutlinerParaObject();
325 pParaObj
= mxCell
->GetOutlinerParaObject();
328 pParaObj
->SetVertical(bVertical
);
334 AttributeProperties::ItemChange( nWhich
, pNewItem
);
337 void CellProperties::SetStyleSheet(SfxStyleSheet
* pNewStyleSheet
, bool bDontRemoveHardAttr
)
339 TextProperties::SetStyleSheet( pNewStyleSheet
, bDontRemoveHardAttr
);
341 } // end of namespace properties
342 } // end of namespace sdr
344 namespace sdr
{ namespace table
{
350 rtl::Reference
< Cell
> Cell::create( SdrTableObj
& rTableObj
, OutlinerParaObject
* pOutlinerParaObject
)
352 rtl::Reference
< Cell
> xCell( new Cell( rTableObj
, pOutlinerParaObject
) );
353 if( xCell
->mxTable
.is() )
355 Reference
< XEventListener
> xListener( xCell
.get() );
356 xCell
->mxTable
->addEventListener( xListener
);
363 Cell::Cell( SdrTableObj
& rTableObj
, OutlinerParaObject
* pOutlinerParaObject
) throw(css::uno::RuntimeException
)
364 : SdrText( rTableObj
, pOutlinerParaObject
)
365 , SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
366 , mpPropSet( ImplGetSvxCellPropertySet() )
367 , mpProperties( new sdr::properties::CellProperties( rTableObj
, this ) )
368 , mnCellContentType( CellContentType_EMPTY
)
374 , mxTable( rTableObj
.getTable() )
376 if( rTableObj
.GetModel() )
377 SetModel( rTableObj
.GetModel() );
382 Cell::~Cell() throw()
395 Reference
< XEventListener
> xThis( this );
396 mxTable
->removeEventListener( xThis
);
400 OSL_FAIL("Cell::dispose(), exception caught!");
410 SetOutlinerParaObject( 0 );
415 void Cell::SetModel(SdrModel
* pNewModel
)
417 SvxTextEditSource
* pTextEditSource
= dynamic_cast< SvxTextEditSource
* >( GetEditSource() );
418 if( (GetModel() != pNewModel
) || ( pNewModel
&& !pTextEditSource
) )
422 SfxItemPool
* pItemPool
= mpProperties
->GetObjectItemSet().GetPool();
424 // test for correct pool in ItemSet; move to new pool if necessary
425 if( pNewModel
&& pItemPool
&& pItemPool
!= &pNewModel
->GetItemPool())
426 mpProperties
->MoveToItemPool(pItemPool
, &pNewModel
->GetItemPool(), pNewModel
);
429 if( pTextEditSource
)
431 pTextEditSource
->ChangeModel( pNewModel
);
435 SetEditSource( new SvxTextEditSource( &GetObject(), this ) );
438 SetStyleSheet( 0, true );
439 SdrText::SetModel( pNewModel
);
440 ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT
);
446 void Cell::merge( sal_Int32 nColumnSpan
, sal_Int32 nRowSpan
)
448 if ((mnColSpan
!= nColumnSpan
) || (mnRowSpan
!= nRowSpan
) || mbMerged
)
450 mnColSpan
= nColumnSpan
;
451 mnRowSpan
= nRowSpan
;
459 void Cell::mergeContent( const CellRef
& xSourceCell
)
461 SdrTableObj
& rTableObj
= dynamic_cast< SdrTableObj
& >( GetObject() );
463 if( xSourceCell
->hasText() )
465 SdrOutliner
& rOutliner
=rTableObj
.ImpGetDrawOutliner();
466 rOutliner
.SetUpdateMode(true);
470 rOutliner
.SetText(*GetOutlinerParaObject());
471 rOutliner
.AddText(*xSourceCell
->GetOutlinerParaObject());
475 rOutliner
.SetText(*xSourceCell
->GetOutlinerParaObject());
478 SetOutlinerParaObject( rOutliner
.CreateParaObject() );
480 xSourceCell
->SetOutlinerParaObject(rOutliner
.CreateParaObject());
482 SetStyleSheet( GetStyleSheet(), true );
488 void Cell::cloneFrom( const CellRef
& xCell
)
492 replaceContentAndFormating( xCell
);
494 mnCellContentType
= xCell
->mnCellContentType
;
496 msFormula
= xCell
->msFormula
;
497 mfValue
= xCell
->mfValue
;
498 mnError
= xCell
->mnError
;
500 mbMerged
= xCell
->mbMerged
;
501 mnRowSpan
= xCell
->mnRowSpan
;
502 mnColSpan
= xCell
->mnColSpan
;
508 void Cell::replaceContentAndFormating( const CellRef
& xSourceCell
)
510 if( xSourceCell
.is() && mpProperties
)
512 mpProperties
->SetMergedItemSet( xSourceCell
->GetObjectItemSet() );
513 SetOutlinerParaObject( new OutlinerParaObject(*xSourceCell
->GetOutlinerParaObject()) );
515 SdrTableObj
& rTableObj
= dynamic_cast< SdrTableObj
& >( GetObject() );
516 SdrTableObj
& rSourceTableObj
= dynamic_cast< SdrTableObj
& >( xSourceCell
->GetObject() );
518 if(rSourceTableObj
.GetModel() != rTableObj
.GetModel())
520 SetStyleSheet( 0, true );
527 void Cell::setMerged()
538 void Cell::copyFormatFrom( const CellRef
& xSourceCell
)
540 if( xSourceCell
.is() && mpProperties
)
542 mpProperties
->SetMergedItemSet( xSourceCell
->GetObjectItemSet() );
544 SdrTableObj
& rTableObj
= dynamic_cast< SdrTableObj
& >( GetObject() );
545 SdrTableObj
& rSourceTableObj
= dynamic_cast< SdrTableObj
& >( xSourceCell
->GetObject() );
547 if(rSourceTableObj
.GetModel() != rTableObj
.GetModel())
549 SetStyleSheet( 0, true );
558 void Cell::notifyModified()
561 mxTable
->setModified( sal_True
);
565 // SdrTextShape proxy
568 bool Cell::IsTextEditActive()
570 bool isActive
= false;
571 SdrTableObj
& rTableObj
= dynamic_cast< SdrTableObj
& >( GetObject() );
572 if(rTableObj
.getActiveCell().get() == this )
574 OutlinerParaObject
* pParaObj
= rTableObj
.GetEditOutlinerParaObject();
586 bool Cell::hasText() const
588 OutlinerParaObject
* pParaObj
= GetOutlinerParaObject();
591 const EditTextObject
& rTextObj
= pParaObj
->GetTextObject();
592 if( rTextObj
.GetParagraphCount() >= 1 )
594 if( rTextObj
.GetParagraphCount() == 1 )
596 if( rTextObj
.GetText(0).isEmpty() )
608 OutlinerParaObject
* Cell::GetEditOutlinerParaObject() const
610 SdrTableObj
& rTableObj
= dynamic_cast< SdrTableObj
& >( GetObject() );
611 if( rTableObj
.getActiveCell().get() == this )
612 return rTableObj
.GetEditOutlinerParaObject();
618 void Cell::SetStyleSheet( SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
)
620 // only allow cell styles for cells
621 if( pStyleSheet
&& pStyleSheet
->GetFamily() != SFX_STYLE_FAMILY_FRAME
)
624 if( mpProperties
&& (mpProperties
->GetStyleSheet() != pStyleSheet
) )
626 mpProperties
->SetStyleSheet( pStyleSheet
, bDontRemoveHardAttr
);
632 const SfxItemSet
& Cell::GetObjectItemSet()
636 return mpProperties
->GetObjectItemSet();
640 OSL_FAIL("Cell::GetObjectItemSet(), called without properties!");
641 return GetObject().GetObjectItemSet();
645 void Cell::SetObjectItem(const SfxPoolItem
& rItem
)
649 mpProperties
->SetObjectItem( rItem
);
654 void Cell::SetMergedItem(const SfxPoolItem
& rItem
)
656 SetObjectItem(rItem
);
659 SfxStyleSheet
* Cell::GetStyleSheet() const
662 return mpProperties
->GetStyleSheet();
669 const Rectangle
& Cell::GetCurrentBoundRect() const
676 void Cell::TakeTextAnchorRect(Rectangle
& rAnchorRect
) const
678 rAnchorRect
.Left() = maCellRect
.Left() + GetTextLeftDistance();
679 rAnchorRect
.Right() = maCellRect
.Right() - GetTextRightDistance();
680 rAnchorRect
.Top() = maCellRect
.Top() + GetTextUpperDistance();
681 rAnchorRect
.Bottom() = maCellRect
.Bottom() - GetTextLowerDistance();
686 const SfxItemSet
& Cell::GetItemSet() const
688 return mpProperties
->GetObjectItemSet();
693 void Cell::SetMergedItemSetAndBroadcast(const SfxItemSet
& rSet
, bool bClearAllItems
)
697 mpProperties
->SetMergedItemSetAndBroadcast(rSet
, bClearAllItems
);
704 sal_Int32
Cell::getMinimumWidth()
706 return GetTextLeftDistance() + GetTextRightDistance() + 100;
711 sal_Int32
Cell::getMinimumHeight()
716 SdrTableObj
& rTableObj
= dynamic_cast< SdrTableObj
& >( GetObject() );
717 sal_Int32 nMinimumHeight
= 0;
720 TakeTextAnchorRect( aTextRect
);
721 Size
aSize( aTextRect
.GetSize() );
722 aSize
.Height()=0x0FFFFFFF;
724 SdrOutliner
* pEditOutliner
= rTableObj
.GetCellTextEditOutliner( *this );
727 pEditOutliner
->SetMaxAutoPaperSize(aSize
);
728 nMinimumHeight
= pEditOutliner
->GetTextHeight()+1;
730 else if ( hasText() )
732 Outliner
& rOutliner
=rTableObj
.ImpGetDrawOutliner();
733 rOutliner
.SetPaperSize(aSize
);
734 rOutliner
.SetUpdateMode(true);
735 ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT
);
737 if( GetOutlinerParaObject() )
739 rOutliner
.SetText(*GetOutlinerParaObject());
741 nMinimumHeight
=rOutliner
.GetTextHeight()+1;
745 nMinimumHeight
+= GetTextUpperDistance() + GetTextLowerDistance();
746 return nMinimumHeight
;
751 long Cell::GetTextLeftDistance() const
753 return static_cast<const SdrMetricItem
&>(GetItemSet().Get(SDRATTR_TEXT_LEFTDIST
)).GetValue();
758 long Cell::GetTextRightDistance() const
760 return static_cast<const SdrMetricItem
&>(GetItemSet().Get(SDRATTR_TEXT_RIGHTDIST
)).GetValue();
765 long Cell::GetTextUpperDistance() const
767 return static_cast<const SdrMetricItem
&>(GetItemSet().Get(SDRATTR_TEXT_UPPERDIST
)).GetValue();
772 long Cell::GetTextLowerDistance() const
774 return static_cast<const SdrMetricItem
&>(GetItemSet().Get(SDRATTR_TEXT_LOWERDIST
)).GetValue();
779 SdrTextVertAdjust
Cell::GetTextVerticalAdjust() const
781 return static_cast<const SdrTextVertAdjustItem
&>(GetItemSet().Get(SDRATTR_TEXT_VERTADJUST
)).GetValue();
786 SdrTextHorzAdjust
Cell::GetTextHorizontalAdjust() const
788 return static_cast<const SdrTextHorzAdjustItem
&>(GetItemSet().Get(SDRATTR_TEXT_HORZADJUST
)).GetValue();
793 void Cell::SetOutlinerParaObject( OutlinerParaObject
* pTextObject
)
795 SdrText::SetOutlinerParaObject( pTextObject
);
796 maSelection
.nStartPara
= EE_PARA_MAX_COUNT
;
798 if( pTextObject
== 0 )
799 ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT
);
806 SdrObject
& rObj
= GetObject();
807 if( rObj
.IsInserted() && GetModel() && GetModel()->IsUndoEnabled() )
809 CellRef
xCell( this );
810 GetModel()->AddUndo( new CellUndo( &rObj
, xCell
) );
816 sdr::properties::TextProperties
* Cell::CloneProperties( sdr::properties::TextProperties
* pProperties
, SdrObject
& rNewObj
, Cell
& rNewCell
)
819 return new sdr::properties::CellProperties( *static_cast<sdr::properties::CellProperties
*>(pProperties
), rNewObj
, &rNewCell
);
826 sdr::properties::TextProperties
* Cell::CloneProperties( SdrObject
& rNewObj
, Cell
& rNewCell
)
828 return CloneProperties(mpProperties
,rNewObj
,rNewCell
);
835 Any SAL_CALL
Cell::queryInterface( const Type
& rType
) throw(RuntimeException
, std::exception
)
837 if( rType
== cppu::UnoType
<XMergeableCell
>::get() )
838 return Any( Reference
< XMergeableCell
>( this ) );
840 if( rType
== cppu::UnoType
<XCell
>::get() )
841 return Any( Reference
< XCell
>( this ) );
843 if( rType
== cppu::UnoType
<XLayoutConstrains
>::get() )
844 return Any( Reference
< XLayoutConstrains
>( this ) );
846 if( rType
== cppu::UnoType
<XEventListener
>::get() )
847 return Any( Reference
< XEventListener
>( this ) );
849 Any
aRet( SvxUnoTextBase::queryAggregation( rType
) );
850 if( aRet
.hasValue() )
853 return ::cppu::OWeakObject::queryInterface( rType
);
858 void SAL_CALL
Cell::acquire() throw ()
860 ::cppu::OWeakObject::acquire();
865 void SAL_CALL
Cell::release() throw ()
867 ::cppu::OWeakObject::release();
874 Sequence
< Type
> SAL_CALL
Cell::getTypes( ) throw (RuntimeException
, std::exception
)
876 Sequence
< Type
> aTypes( SvxUnoTextBase::getTypes() );
878 sal_Int32 nLen
= aTypes
.getLength();
879 aTypes
.realloc(nLen
+ 2);
880 aTypes
[nLen
++] = cppu::UnoType
<XMergeableCell
>::get();
881 aTypes
[nLen
++] = cppu::UnoType
<XLayoutConstrains
>::get();
888 Sequence
< sal_Int8
> SAL_CALL
Cell::getImplementationId( ) throw (RuntimeException
, std::exception
)
890 return css::uno::Sequence
<sal_Int8
>();
894 ::com::sun::star::awt::Size SAL_CALL
Cell::getMinimumSize()
895 throw (RuntimeException
,
898 return ::com::sun::star::awt::Size( getMinimumWidth(), getMinimumHeight() );
903 ::com::sun::star::awt::Size SAL_CALL
Cell::getPreferredSize()
904 throw (RuntimeException
,
907 return getMinimumSize();
912 ::com::sun::star::awt::Size SAL_CALL
Cell::calcAdjustedSize( const ::com::sun::star::awt::Size
& aNewSize
) throw (RuntimeException
, std::exception
)
921 sal_Int32 SAL_CALL
Cell::getRowSpan() throw (RuntimeException
, std::exception
)
928 sal_Int32 SAL_CALL
Cell::getColumnSpan() throw (RuntimeException
, std::exception
)
935 sal_Bool SAL_CALL
Cell::isMerged() throw (RuntimeException
, std::exception
)
944 OUString SAL_CALL
Cell::getFormula( ) throw (RuntimeException
, std::exception
)
951 void SAL_CALL
Cell::setFormula( const OUString
& aFormula
) throw (RuntimeException
, std::exception
)
953 if( msFormula
!= aFormula
)
955 msFormula
= aFormula
;
961 double SAL_CALL
Cell::getValue( ) throw (RuntimeException
, std::exception
)
968 void SAL_CALL
Cell::setValue( double nValue
) throw (RuntimeException
, std::exception
)
970 if( mfValue
!= nValue
)
973 mnCellContentType
= CellContentType_VALUE
;
979 CellContentType SAL_CALL
Cell::getType() throw (RuntimeException
, std::exception
)
981 return mnCellContentType
;
986 sal_Int32 SAL_CALL
Cell::getError( ) throw (RuntimeException
, std::exception
)
995 Any
Cell::GetAnyForItem( SfxItemSet
& aSet
, const SfxItemPropertySimpleEntry
* pMap
)
997 Any
aAny( SvxItemPropertySet_getPropertyValue( pMap
, aSet
) );
999 if( pMap
->aType
!= aAny
.getValueType() )
1001 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
1002 if( ( pMap
->aType
== ::cppu::UnoType
<sal_Int16
>::get()) && aAny
.getValueType() == ::cppu::UnoType
<sal_Int32
>::get() )
1004 sal_Int32 nValue
= 0;
1006 aAny
<<= (sal_Int16
)nValue
;
1010 OSL_FAIL("GetAnyForItem() Returnvalue has wrong Type!" );
1017 Reference
< XPropertySetInfo
> SAL_CALL
Cell::getPropertySetInfo() throw(RuntimeException
, std::exception
)
1019 return mpPropSet
->getPropertySetInfo();
1024 void SAL_CALL
Cell::setPropertyValue( const OUString
& rPropertyName
, const Any
& rValue
) throw(UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
, RuntimeException
, std::exception
)
1026 ::SolarMutexGuard aGuard
;
1028 if( (mpProperties
== 0) || (GetModel() == 0) )
1029 throw DisposedException();
1031 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(rPropertyName
);
1034 if( (pMap
->nFlags
& PropertyAttribute::READONLY
) != 0 )
1035 throw PropertyVetoException();
1037 switch( pMap
->nWID
)
1039 case OWN_ATTR_STYLE
:
1041 Reference
< XStyle
> xStyle
;
1042 if( !( rValue
>>= xStyle
) )
1043 throw IllegalArgumentException();
1045 SfxUnoStyleSheet
* pStyle
= SfxUnoStyleSheet::getUnoStyleSheet(xStyle
);
1046 SetStyleSheet( pStyle
, true );
1049 case OWN_ATTR_TABLEBORDER
:
1051 if(rValue
.getValueType() != cppu::UnoType
<TableBorder
>::get())
1054 const TableBorder
* pBorder
= static_cast<const TableBorder
*>(rValue
.getValue());
1055 if( pBorder
== NULL
)
1058 SvxBoxItem
aBox( SDRATTR_TABLE_BORDER
);
1059 SvxBoxInfoItem
aBoxInfo( SDRATTR_TABLE_BORDER_INNER
);
1060 SvxBorderLine aLine
;
1062 bool bSet
= SvxBoxItem::LineToSvxLine(pBorder
->TopLine
, aLine
, false);
1063 aBox
.SetLine(bSet
? &aLine
: 0, SvxBoxItemLine::TOP
);
1064 aBoxInfo
.SetValid(SvxBoxInfoItemValidFlags::TOP
, pBorder
->IsTopLineValid
);
1066 bSet
= SvxBoxItem::LineToSvxLine(pBorder
->BottomLine
, aLine
, false);
1067 aBox
.SetLine(bSet
? &aLine
: 0, SvxBoxItemLine::BOTTOM
);
1068 aBoxInfo
.SetValid(SvxBoxInfoItemValidFlags::BOTTOM
, pBorder
->IsBottomLineValid
);
1070 bSet
= SvxBoxItem::LineToSvxLine(pBorder
->LeftLine
, aLine
, false);
1071 aBox
.SetLine(bSet
? &aLine
: 0, SvxBoxItemLine::LEFT
);
1072 aBoxInfo
.SetValid(SvxBoxInfoItemValidFlags::LEFT
, pBorder
->IsLeftLineValid
);
1074 bSet
= SvxBoxItem::LineToSvxLine(pBorder
->RightLine
, aLine
, false);
1075 aBox
.SetLine(bSet
? &aLine
: 0, SvxBoxItemLine::RIGHT
);
1076 aBoxInfo
.SetValid(SvxBoxInfoItemValidFlags::RIGHT
, pBorder
->IsRightLineValid
);
1078 bSet
= SvxBoxItem::LineToSvxLine(pBorder
->HorizontalLine
, aLine
, false);
1079 aBoxInfo
.SetLine(bSet
? &aLine
: 0, SvxBoxInfoItemLine::HORI
);
1080 aBoxInfo
.SetValid(SvxBoxInfoItemValidFlags::HORI
, pBorder
->IsHorizontalLineValid
);
1082 bSet
= SvxBoxItem::LineToSvxLine(pBorder
->VerticalLine
, aLine
, false);
1083 aBoxInfo
.SetLine(bSet
? &aLine
: 0, SvxBoxInfoItemLine::VERT
);
1084 aBoxInfo
.SetValid(SvxBoxInfoItemValidFlags::VERT
, pBorder
->IsVerticalLineValid
);
1086 aBox
.SetDistance(pBorder
->Distance
); //TODO
1087 aBoxInfo
.SetValid(SvxBoxInfoItemValidFlags::DISTANCE
, pBorder
->IsDistanceValid
);
1089 mpProperties
->SetObjectItem(aBox
);
1090 mpProperties
->SetObjectItem(aBoxInfo
);
1093 case OWN_ATTR_FILLBMP_MODE
:
1096 if(!(rValue
>>= eMode
) )
1098 sal_Int32 nMode
= 0;
1099 if(!(rValue
>>= nMode
))
1100 throw IllegalArgumentException();
1102 eMode
= (BitmapMode
)nMode
;
1105 mpProperties
->SetObjectItem( XFillBmpStretchItem( eMode
== BitmapMode_STRETCH
) );
1106 mpProperties
->SetObjectItem( XFillBmpTileItem( eMode
== BitmapMode_REPEAT
) );
1111 SfxItemSet
aSet( GetModel()->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1112 aSet
.Put(mpProperties
->GetItem(pMap
->nWID
));
1114 bool bSpecial
= false;
1116 switch( pMap
->nWID
)
1118 case XATTR_FILLBITMAP
:
1119 case XATTR_FILLGRADIENT
:
1120 case XATTR_FILLHATCH
:
1121 case XATTR_FILLFLOATTRANSPARENCE
:
1123 case XATTR_LINESTART
:
1124 case XATTR_LINEDASH
:
1126 if( pMap
->nMemberId
== MID_NAME
)
1129 if( rValue
>>= aApiName
)
1131 if( SvxShape::SetFillAttribute( pMap
->nWID
, aApiName
, aSet
, GetModel() ) )
1142 if( !SvxUnoTextRangeBase::SetPropertyValueHelper( aSet
, pMap
, rValue
, aSet
))
1144 if( aSet
.GetItemState( pMap
->nWID
) != SfxItemState::SET
)
1146 // Default aus ItemPool holen
1147 if(SfxItemPool::IsWhich(pMap
->nWID
))
1148 aSet
.Put(GetModel()->GetItemPool().GetDefaultItem(pMap
->nWID
));
1151 if( aSet
.GetItemState( pMap
->nWID
) == SfxItemState::SET
)
1153 SvxItemPropertySet_setPropertyValue( pMap
, rValue
, aSet
);
1158 GetModel()->SetChanged();
1159 mpProperties
->SetMergedItemSetAndBroadcast( aSet
);
1164 throw UnknownPropertyException();
1169 Any SAL_CALL
Cell::getPropertyValue( const OUString
& PropertyName
) throw(UnknownPropertyException
, WrappedTargetException
, RuntimeException
, std::exception
)
1171 ::SolarMutexGuard aGuard
;
1173 if( (mpProperties
== 0) || (GetModel() == 0) )
1174 throw DisposedException();
1176 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
1179 switch( pMap
->nWID
)
1181 case OWN_ATTR_STYLE
:
1183 return Any( Reference
< XStyle
>( dynamic_cast< SfxUnoStyleSheet
* >( GetStyleSheet() ) ) );
1185 case OWN_ATTR_TABLEBORDER
:
1187 const SvxBoxInfoItem
& rBoxInfoItem
= static_cast<const SvxBoxInfoItem
&>(mpProperties
->GetItem(SDRATTR_TABLE_BORDER_INNER
));
1188 const SvxBoxItem
& rBox
= static_cast<const SvxBoxItem
&>(mpProperties
->GetItem(SDRATTR_TABLE_BORDER
));
1190 TableBorder aTableBorder
;
1191 aTableBorder
.TopLine
= SvxBoxItem::SvxLineToLine(rBox
.GetTop(), false);
1192 aTableBorder
.IsTopLineValid
= rBoxInfoItem
.IsValid(SvxBoxInfoItemValidFlags::TOP
);
1193 aTableBorder
.BottomLine
= SvxBoxItem::SvxLineToLine(rBox
.GetBottom(), false);
1194 aTableBorder
.IsBottomLineValid
= rBoxInfoItem
.IsValid(SvxBoxInfoItemValidFlags::BOTTOM
);
1195 aTableBorder
.LeftLine
= SvxBoxItem::SvxLineToLine(rBox
.GetLeft(), false);
1196 aTableBorder
.IsLeftLineValid
= rBoxInfoItem
.IsValid(SvxBoxInfoItemValidFlags::LEFT
);
1197 aTableBorder
.RightLine
= SvxBoxItem::SvxLineToLine(rBox
.GetRight(), false);
1198 aTableBorder
.IsRightLineValid
= rBoxInfoItem
.IsValid(SvxBoxInfoItemValidFlags::RIGHT
);
1199 aTableBorder
.HorizontalLine
= SvxBoxItem::SvxLineToLine(rBoxInfoItem
.GetHori(), false);
1200 aTableBorder
.IsHorizontalLineValid
= rBoxInfoItem
.IsValid(SvxBoxInfoItemValidFlags::HORI
);
1201 aTableBorder
.VerticalLine
= SvxBoxItem::SvxLineToLine(rBoxInfoItem
.GetVert(), false);
1202 aTableBorder
.IsVerticalLineValid
= rBoxInfoItem
.IsValid(SvxBoxInfoItemValidFlags::VERT
);
1203 aTableBorder
.Distance
= rBox
.GetDistance();
1204 aTableBorder
.IsDistanceValid
= rBoxInfoItem
.IsValid(SvxBoxInfoItemValidFlags::DISTANCE
);
1206 return Any( aTableBorder
);
1208 case OWN_ATTR_FILLBMP_MODE
:
1210 const XFillBmpStretchItem
& rStretchItem
= static_cast<const XFillBmpStretchItem
&>(mpProperties
->GetItem(XATTR_FILLBMP_STRETCH
));
1211 const XFillBmpTileItem
& rTileItem
= static_cast<const XFillBmpTileItem
&>(mpProperties
->GetItem(XATTR_FILLBMP_TILE
));
1212 if( rTileItem
.GetValue() )
1214 return Any( BitmapMode_REPEAT
);
1216 else if( rStretchItem
.GetValue() )
1218 return Any( BitmapMode_STRETCH
);
1222 return Any( BitmapMode_NO_REPEAT
);
1227 SfxItemSet
aSet( GetModel()->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1228 aSet
.Put(mpProperties
->GetItem(pMap
->nWID
));
1231 if(!SvxUnoTextRangeBase::GetPropertyValueHelper( aSet
, pMap
, aAny
))
1235 // Default aus ItemPool holen
1236 if(SfxItemPool::IsWhich(pMap
->nWID
))
1237 aSet
.Put(GetModel()->GetItemPool().GetDefaultItem(pMap
->nWID
));
1241 aAny
= GetAnyForItem( aSet
, pMap
);
1248 throw UnknownPropertyException();
1253 void SAL_CALL
Cell::addPropertyChangeListener( const OUString
& /*aPropertyName*/, const Reference
< XPropertyChangeListener
>& /*xListener*/ ) throw(UnknownPropertyException
, WrappedTargetException
, RuntimeException
, std::exception
)
1259 void SAL_CALL
Cell::removePropertyChangeListener( const OUString
& /*aPropertyName*/, const Reference
< XPropertyChangeListener
>& /*aListener*/ ) throw(UnknownPropertyException
, WrappedTargetException
, RuntimeException
, std::exception
)
1265 void SAL_CALL
Cell::addVetoableChangeListener( const OUString
& /*PropertyName*/, const Reference
< XVetoableChangeListener
>& /*aListener*/ ) throw(UnknownPropertyException
, WrappedTargetException
, RuntimeException
, std::exception
)
1271 void SAL_CALL
Cell::removeVetoableChangeListener( const OUString
& /*PropertyName*/, const Reference
< XVetoableChangeListener
>& /*aListener*/ ) throw(UnknownPropertyException
, WrappedTargetException
, RuntimeException
, std::exception
)
1276 // XMultiPropertySet
1279 void SAL_CALL
Cell::setPropertyValues( const Sequence
< OUString
>& aPropertyNames
, const Sequence
< Any
>& aValues
) throw (PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
, RuntimeException
, std::exception
)
1281 ::SolarMutexGuard aSolarGuard
;
1283 if( (mpProperties
== 0) || (GetModel() == 0) )
1284 throw DisposedException();
1286 const sal_Int32 nCount
= aPropertyNames
.getLength();
1288 const OUString
* pNames
= aPropertyNames
.getConstArray();
1289 const Any
* pValues
= aValues
.getConstArray();
1291 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pValues
++ )
1295 setPropertyValue( *pNames
, *pValues
);
1297 catch( UnknownPropertyException
& )
1299 OSL_FAIL("svx::Cell::setPropertyValues(), unknown property!" );
1303 OSL_FAIL("svx::Cell::setPropertyValues(), Exception caught!" );
1310 Sequence
< Any
> SAL_CALL
Cell::getPropertyValues( const Sequence
< OUString
>& aPropertyNames
) throw (RuntimeException
, std::exception
)
1312 ::SolarMutexGuard aSolarGuard
;
1314 if( (mpProperties
== 0) || (GetModel() == 0) )
1315 throw DisposedException();
1317 const sal_Int32 nCount
= aPropertyNames
.getLength();
1318 const OUString
* pNames
= aPropertyNames
.getConstArray();
1320 Sequence
< Any
> aRet( nCount
);
1321 Any
* pValue
= aRet
.getArray();
1323 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pValue
++, pNames
++ )
1327 *pValue
= getPropertyValue( *pNames
);
1329 catch( UnknownPropertyException
& )
1331 OSL_FAIL("svx::Cell::setPropertyValues(), unknown property!" );
1335 OSL_FAIL( "svx::Cell::getPropertyValues(), Exception caught!" );
1344 void SAL_CALL
Cell::addPropertiesChangeListener( const Sequence
< OUString
>& /*aPropertyNames*/, const Reference
< XPropertiesChangeListener
>& /*xListener*/ ) throw (RuntimeException
, std::exception
)
1350 void SAL_CALL
Cell::removePropertiesChangeListener( const Reference
< XPropertiesChangeListener
>& /*xListener*/ ) throw (RuntimeException
, std::exception
)
1356 void SAL_CALL
Cell::firePropertiesChangeEvent( const Sequence
< OUString
>& /*aPropertyNames*/, const Reference
< XPropertiesChangeListener
>& /*xListener*/ ) throw (RuntimeException
, std::exception
)
1364 PropertyState SAL_CALL
Cell::getPropertyState( const OUString
& PropertyName
) throw(UnknownPropertyException
, RuntimeException
, std::exception
)
1366 ::SolarMutexGuard aGuard
;
1368 if( (mpProperties
== 0) || (GetModel() == 0) )
1369 throw DisposedException();
1371 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
1375 PropertyState eState
;
1376 switch( pMap
->nWID
)
1378 case OWN_ATTR_FILLBMP_MODE
:
1380 const SfxItemSet
& rSet
= mpProperties
->GetMergedItemSet();
1382 const bool bStretch
= rSet
.GetItemState( XATTR_FILLBMP_STRETCH
, false ) == SfxItemState::SET
;
1383 const bool bTile
= rSet
.GetItemState( XATTR_FILLBMP_TILE
, false ) == SfxItemState::SET
;
1384 if( bStretch
|| bTile
)
1386 eState
= PropertyState_DIRECT_VALUE
;
1390 eState
= PropertyState_DEFAULT_VALUE
;
1393 case OWN_ATTR_STYLE
:
1395 return PropertyState_DIRECT_VALUE
;
1397 case OWN_ATTR_TABLEBORDER
:
1399 const SfxItemSet
& rSet
= mpProperties
->GetMergedItemSet();
1400 if( (rSet
.GetItemState( SDRATTR_TABLE_BORDER_INNER
, false ) == SfxItemState::DEFAULT
) && (rSet
.GetItemState( SDRATTR_TABLE_BORDER
, false ) == SfxItemState::DEFAULT
) )
1401 return PropertyState_DEFAULT_VALUE
;
1403 return PropertyState_DIRECT_VALUE
;
1407 const SfxItemSet
& rSet
= mpProperties
->GetMergedItemSet();
1409 switch( rSet
.GetItemState( pMap
->nWID
, false ) )
1411 case SfxItemState::READONLY
:
1412 case SfxItemState::SET
:
1413 eState
= PropertyState_DIRECT_VALUE
;
1415 case SfxItemState::DEFAULT
:
1416 eState
= PropertyState_DEFAULT_VALUE
;
1419 eState
= PropertyState_AMBIGUOUS_VALUE
;
1423 // if a item is set, this doesn't mean we want it :)
1424 if( ( PropertyState_DIRECT_VALUE
== eState
) )
1426 switch( pMap
->nWID
)
1428 // the following items are disabled by changing the
1429 // fill style or the line style. so there is no need
1430 // to export items without names which should be empty
1431 case XATTR_FILLBITMAP
:
1432 case XATTR_FILLGRADIENT
:
1433 case XATTR_FILLHATCH
:
1434 case XATTR_LINEDASH
:
1436 const NameOrIndex
* pItem
= static_cast<const NameOrIndex
*>(rSet
.GetItem((sal_uInt16
)pMap
->nWID
));
1437 if( ( pItem
== NULL
) || pItem
->GetName().isEmpty() )
1438 eState
= PropertyState_DEFAULT_VALUE
;
1443 // If e.g. the LineStart is on NONE and thus the string has length 0, it still
1444 // may be a hard attribute covering the set LineStart of the parent (Style).
1446 // same is for fill float transparency
1448 case XATTR_LINESTART
:
1449 case XATTR_FILLFLOATTRANSPARENCE
:
1451 const NameOrIndex
* pItem
= static_cast<const NameOrIndex
*>(rSet
.GetItem((sal_uInt16
)pMap
->nWID
));
1453 eState
= PropertyState_DEFAULT_VALUE
;
1462 throw UnknownPropertyException();
1467 Sequence
< PropertyState
> SAL_CALL
Cell::getPropertyStates( const Sequence
< OUString
>& aPropertyName
) throw(UnknownPropertyException
, RuntimeException
, std::exception
)
1469 ::SolarMutexGuard aGuard
;
1471 if( (mpProperties
== 0) || (GetModel() == 0) )
1472 throw DisposedException();
1474 const sal_Int32 nCount
= aPropertyName
.getLength();
1476 Sequence
< PropertyState
> aRet( nCount
);
1478 const OUString
* pNames
= aPropertyName
.getConstArray();
1479 PropertyState
* pState
= aRet
.getArray();
1481 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; nIdx
++, pNames
++, pState
++ )
1485 *pState
= getPropertyState( *pNames
);
1489 *pState
= PropertyState_AMBIGUOUS_VALUE
;
1498 void SAL_CALL
Cell::setPropertyToDefault( const OUString
& PropertyName
) throw(UnknownPropertyException
, RuntimeException
, std::exception
)
1500 ::SolarMutexGuard aGuard
;
1502 if( (mpProperties
== 0) || (GetModel() == 0) )
1503 throw DisposedException();
1505 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(PropertyName
);
1508 switch( pMap
->nWID
)
1510 case OWN_ATTR_FILLBMP_MODE
:
1512 mpProperties
->ClearObjectItem( XATTR_FILLBMP_STRETCH
);
1513 mpProperties
->ClearObjectItem( XATTR_FILLBMP_TILE
);
1516 case OWN_ATTR_STYLE
:
1519 case OWN_ATTR_TABLEBORDER
:
1521 mpProperties
->ClearObjectItem( SDRATTR_TABLE_BORDER_INNER
);
1522 mpProperties
->ClearObjectItem( SDRATTR_TABLE_BORDER
);
1528 mpProperties
->ClearObjectItem( pMap
->nWID
);
1532 GetModel()->SetChanged();
1535 throw UnknownPropertyException();
1540 Any SAL_CALL
Cell::getPropertyDefault( const OUString
& aPropertyName
) throw(UnknownPropertyException
, WrappedTargetException
, RuntimeException
, std::exception
)
1542 ::SolarMutexGuard aGuard
;
1544 if( (mpProperties
== 0) || (GetModel() == 0) )
1545 throw DisposedException();
1547 const SfxItemPropertySimpleEntry
* pMap
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
1550 switch( pMap
->nWID
)
1552 case OWN_ATTR_FILLBMP_MODE
:
1553 return Any( BitmapMode_NO_REPEAT
);
1555 case OWN_ATTR_STYLE
:
1557 Reference
< XStyle
> xStyle
;
1558 return Any( xStyle
);
1561 case OWN_ATTR_TABLEBORDER
:
1563 TableBorder aBorder
;
1564 return Any( aBorder
);
1569 if( SfxItemPool::IsWhich(pMap
->nWID
) )
1571 SfxItemSet
aSet( GetModel()->GetItemPool(), pMap
->nWID
, pMap
->nWID
);
1572 aSet
.Put(GetModel()->GetItemPool().GetDefaultItem(pMap
->nWID
));
1573 return GetAnyForItem( aSet
, pMap
);
1578 throw UnknownPropertyException();
1582 // XMultiPropertyStates
1585 void SAL_CALL
Cell::setAllPropertiesToDefault()
1586 throw (RuntimeException
, std::exception
)
1588 delete mpProperties
;
1589 mpProperties
= new sdr::properties::CellProperties( static_cast< SdrTableObj
& >( GetObject() ), this );
1591 SdrOutliner
& rOutliner
= GetObject().ImpGetDrawOutliner();
1593 OutlinerParaObject
* pParaObj
= GetOutlinerParaObject();
1596 rOutliner
.SetText(*pParaObj
);
1597 sal_Int32
nParaCount(rOutliner
.GetParagraphCount());
1601 ESelection
aSelection( 0, 0, EE_PARA_ALL
, EE_TEXTPOS_ALL
);
1602 rOutliner
.RemoveAttribs(aSelection
, true, 0);
1604 OutlinerParaObject
* pTemp
= rOutliner
.CreateParaObject(0, nParaCount
);
1607 SetOutlinerParaObject(pTemp
);
1614 void SAL_CALL
Cell::setPropertiesToDefault( const Sequence
< OUString
>& aPropertyNames
) throw (UnknownPropertyException
, RuntimeException
, std::exception
)
1616 sal_Int32 nCount
= aPropertyNames
.getLength();
1617 const OUString
* pName
= aPropertyNames
.getConstArray();
1620 setPropertyToDefault( *pName
++ );
1625 Sequence
< Any
> SAL_CALL
Cell::getPropertyDefaults( const Sequence
< OUString
>& aPropertyNames
) throw (UnknownPropertyException
, WrappedTargetException
, RuntimeException
, std::exception
)
1627 sal_Int32 nCount
= aPropertyNames
.getLength();
1628 Sequence
< Any
> aDefaults( nCount
);
1629 Any
* pDefaults
= aDefaults
.getArray();
1630 const OUString
* pName
= aPropertyNames
.getConstArray();
1633 *pDefaults
++ = getPropertyDefault( *pName
++ );
1642 void SAL_CALL
Cell::insertTextContent( const Reference
< XTextRange
>& xRange
, const Reference
< XTextContent
>& xContent
, sal_Bool bAbsorb
) throw (IllegalArgumentException
, RuntimeException
, std::exception
)
1644 SvxUnoTextBase::insertTextContent( xRange
, xContent
, bAbsorb
);
1650 void SAL_CALL
Cell::removeTextContent( const Reference
< XTextContent
>& xContent
) throw (NoSuchElementException
, RuntimeException
, std::exception
)
1652 SvxUnoTextBase::removeTextContent( xContent
);
1660 Reference
< XTextCursor
> SAL_CALL
Cell::createTextCursor( ) throw (RuntimeException
, std::exception
)
1662 return SvxUnoTextBase::createTextCursor();
1667 Reference
< XTextCursor
> SAL_CALL
Cell::createTextCursorByRange( const Reference
< XTextRange
>& aTextPosition
) throw (RuntimeException
, std::exception
)
1669 return SvxUnoTextBase::createTextCursorByRange( aTextPosition
);
1674 void SAL_CALL
Cell::insertString( const Reference
< XTextRange
>& xRange
, const OUString
& aString
, sal_Bool bAbsorb
) throw (RuntimeException
, std::exception
)
1676 SvxUnoTextBase::insertString( xRange
, aString
, bAbsorb
);
1682 void SAL_CALL
Cell::insertControlCharacter( const Reference
< XTextRange
>& xRange
, sal_Int16 nControlCharacter
, sal_Bool bAbsorb
) throw (IllegalArgumentException
, RuntimeException
, std::exception
)
1684 SvxUnoTextBase::insertControlCharacter( xRange
, nControlCharacter
, bAbsorb
);
1692 Reference
< XText
> SAL_CALL
Cell::getText( ) throw (RuntimeException
, std::exception
)
1694 return SvxUnoTextBase::getText();
1699 Reference
< XTextRange
> SAL_CALL
Cell::getStart( ) throw (RuntimeException
, std::exception
)
1701 return SvxUnoTextBase::getStart();
1706 Reference
< XTextRange
> SAL_CALL
Cell::getEnd( ) throw (RuntimeException
, std::exception
)
1708 return SvxUnoTextBase::getEnd();
1713 OUString SAL_CALL
Cell::getString( ) throw (RuntimeException
, std::exception
)
1715 maSelection
.nStartPara
= EE_PARA_MAX_COUNT
;
1716 return SvxUnoTextBase::getString();
1721 void SAL_CALL
Cell::setString( const OUString
& aString
) throw (RuntimeException
, std::exception
)
1723 SvxUnoTextBase::setString( aString
);
1728 void SAL_CALL
Cell::disposing( const EventObject
& /*Source*/ ) throw (RuntimeException
, std::exception
)
1736 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */