summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx78
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx22
-rw-r--r--sc/source/ui/unoobj/datauno.cxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx27
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx491
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx56
6 files changed, 152 insertions, 525 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 3737e742b441..f5a94df0bfba 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1110,35 +1110,60 @@ sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
for (long nCol=0; nCol<nCols; nCol++)
{
const uno::Any& rElement = pColArr[nCol];
- uno::TypeClass eElemClass = rElement.getValueTypeClass();
- if ( eElemClass == uno::TypeClass_VOID )
- {
- // void = "no value"
- pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
- }
- else if ( eElemClass == uno::TypeClass_BYTE ||
- eElemClass == uno::TypeClass_SHORT ||
- eElemClass == uno::TypeClass_UNSIGNED_SHORT ||
- eElemClass == uno::TypeClass_LONG ||
- eElemClass == uno::TypeClass_UNSIGNED_LONG ||
- eElemClass == uno::TypeClass_FLOAT ||
- eElemClass == uno::TypeClass_DOUBLE )
+ switch( rElement.getValueTypeClass() )
{
+ case uno::TypeClass_VOID:
+ {
+ // void = "no value"
+ pDoc->SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE );
+ }
+ break;
+
// #87871# accept integer types because Basic passes a floating point
// variable as byte, short or long if it's an integer number.
- double fVal(0.0);
- rElement >>= fVal;
- pDoc->SetValue( nDocCol, nDocRow, nTab, fVal );
- }
- else if ( eElemClass == uno::TypeClass_STRING )
- {
- rtl::OUString aUStr;
- rElement >>= aUStr;
- if ( aUStr.getLength() )
- pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) );
+ case uno::TypeClass_BYTE:
+ case uno::TypeClass_SHORT:
+ case uno::TypeClass_UNSIGNED_SHORT:
+ case uno::TypeClass_LONG:
+ case uno::TypeClass_UNSIGNED_LONG:
+ case uno::TypeClass_FLOAT:
+ case uno::TypeClass_DOUBLE:
+ {
+ double fVal(0.0);
+ rElement >>= fVal;
+ pDoc->SetValue( nDocCol, nDocRow, nTab, fVal );
+ }
+ break;
+
+ case uno::TypeClass_STRING:
+ {
+ rtl::OUString aUStr;
+ rElement >>= aUStr;
+ if ( aUStr.getLength() )
+ pDoc->PutCell( nDocCol, nDocRow, nTab, new ScStringCell( aUStr ) );
+ }
+ break;
+
+ // accept Sequence<FormulaToken> for formula cells
+ case uno::TypeClass_SEQUENCE:
+ {
+ uno::Sequence< sheet::FormulaToken > aTokens;
+ if ( rElement >>= aTokens )
+ {
+ ScTokenArray aTokenArray;
+ ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, aTokens );
+ ScAddress aPos( nDocCol, nDocRow, nTab );
+ ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aPos, &aTokenArray );
+ pDoc->PutCell( aPos, pNewCell );
+ }
+ else
+ bError = true;
+ }
+ break;
+
+ default:
+ bError = true; // invalid type
}
- else
- bError = sal_True; // invalid type
++nDocCol;
}
@@ -5907,12 +5932,11 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue
aParam.nRow2 = aRange.aEnd.Row();
//! TODO: could we get passed a valid result set by any means?
- uno::Reference< sdbc::XResultSet > xResultSet;
pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen
ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
- aFunc.DoImport( nTab, aParam, xResultSet, NULL, sal_True, sal_False ); //! Api-Flag als Parameter
+ aFunc.DoImport( nTab, aParam, NULL, sal_True ); //! Api-Flag as parameter
}
}
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index f72141717159..42ed9179e6aa 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -108,6 +108,7 @@ const SfxItemPropertyMapEntry* lcl_GetDataPilotDescriptorBaseMap()
{
{MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_DRILLDOWN), 0, &getBooleanCppuType(), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_GRANDTOTAL_NAME),0,&getCppuType((rtl::OUString*)0), beans::PropertyAttribute::MAYBEVOID, 0 },
{MAP_CHAR_LEN(SC_UNO_IGNEMPROWS), 0, &getBooleanCppuType(), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_IMPORTDESC), 0, &getCppuType((uno::Sequence<beans::PropertyValue>*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_RPTEMPTY), 0, &getBooleanCppuType(), 0, 0 },
@@ -343,8 +344,6 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd
if ( pColl )
{
// count tables on this sheet
- // api only handles sheet data at this time
- //! allow all data sources!!!
sal_Int32 nFound = 0;
sal_uInt16 nCount = pColl->GetCount();
for (sal_uInt16 i=0; i<nCount; i++)
@@ -494,8 +493,6 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException)
if ( pColl )
{
// count tables on this sheet
- // api only handles sheet data at this time
- //! allow all data sources!!!
sal_uInt16 nFound = 0;
sal_uInt16 nCount = pColl->GetCount();
@@ -557,8 +554,6 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
if ( pColl )
{
// count tables on this sheet
- // api only handles sheet data at this time
- //! allow all data sources!!!
sal_uInt16 nFound = 0;
sal_uInt16 nCount = pColl->GetCount();
@@ -600,9 +595,6 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName )
sal_uInt16 nCount = pColl->GetCount();
for (sal_uInt16 i=0; i<nCount; i++)
{
- // api only handles sheet data at this time
- //! allow all data sources!!!
-
ScDPObject* pDPObj = (*pColl)[i];
if ( pDPObj->GetOutRange().aStart.Tab() == nTab &&
pDPObj->GetName() == aNamStr )
@@ -824,6 +816,12 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aProp
{
aNewData.SetDrillDown(::cppu::any2bool( aValue ));
}
+ else if ( aNameString.EqualsAscii( SC_UNO_GRANDTOTAL_NAME ) )
+ {
+ rtl::OUString aStrVal;
+ if ( aValue >>= aStrVal )
+ aNewData.SetGrandTotalName(aStrVal);
+ }
else if ( aNameString.EqualsAscii( SC_UNO_IMPORTDESC ) )
{
uno::Sequence<beans::PropertyValue> aArgSeq;
@@ -967,6 +965,12 @@ Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPrope
{
aRet = ::cppu::bool2any( aNewData.GetDrillDown() );
}
+ else if ( aNameString.EqualsAscii( SC_UNO_GRANDTOTAL_NAME ) )
+ {
+ const rtl::OUString* pGrandTotalName = aNewData.GetGrandTotalName();
+ if (pGrandTotalName)
+ aRet <<= *pGrandTotalName; // same behavior as in ScDPSource
+ }
else if ( aNameString.EqualsAscii( SC_UNO_IMPORTDESC ) )
{
const ScImportSourceDesc* pImportDesc = pDPObject->GetImportSourceDesc();
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 31ef83ee91db..10edb4f9d1aa 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1893,8 +1893,7 @@ void SAL_CALL ScDatabaseRangeObj::refresh() throw(uno::RuntimeException)
SCCOL nDummyCol;
SCROW nDummyRow;
pData->GetArea( nTab, nDummyCol,nDummyRow,nDummyCol,nDummyRow );
- uno::Reference< sdbc::XResultSet > xResultSet;
- bContinue = aFunc.DoImport( nTab, aImportParam, xResultSet, NULL, sal_True, sal_False ); //! Api-Flag als Parameter
+ bContinue = aFunc.DoImport( nTab, aImportParam, NULL, sal_True ); //! Api-Flag as parameter
}
// interne Operationen (sort, query, subtotal) nur, wenn kein Fehler
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 23eb1abd2d82..b47c0aac3163 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -87,6 +87,7 @@
#include "rangeutl.hxx"
#include "markdata.hxx"
#include "docoptio.hxx"
+#include "scextopt.hxx"
#include "unoguard.hxx"
#include "unonames.hxx"
#include "shapeuno.hxx"
@@ -903,6 +904,16 @@ sal_Bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection,
ScTabViewShell* pViewSh = pViewObj->GetViewShell();
if (pViewSh)
{
+ // #i95280# when printing from the shell, the view is never activated,
+ // so Excel view settings must also be evaluated here.
+ ScExtDocOptions* pExtOpt = pDocShell->GetDocument()->GetExtDocOptions();
+ if ( pExtOpt && pExtOpt->IsChanged() )
+ {
+ pViewSh->GetViewData()->ReadExtOptions(*pExtOpt); // Excel view settings
+ pViewSh->SetTabNo( pViewSh->GetViewData()->GetTabNo(), sal_True );
+ pExtOpt->SetChanged( false );
+ }
+
const ScMarkData& rViewMark = pViewSh->GetViewData()->GetMarkData();
SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
@@ -1052,7 +1063,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab );
long nTabStart = pPrintFuncCache->GetTabStart( nTab );
- (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_False, NULL, NULL );
+ (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_False, NULL );
ScRange aCellRange;
sal_Bool bWasCellRange = aFunc.GetLastSourceRange( aCellRange );
@@ -1076,11 +1087,6 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
pArray[2].Value <<= aRangeAddress;
}
- #if 0
- const ScPrintOptions& rPrintOpt =
- #endif
- // FIXME: is this for side effects ?
- SC_MOD()->GetPrintOptions();
if( ! pPrinterOptions )
pPrinterOptions = new ScPrintUIOptions;
else
@@ -1186,7 +1192,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
//<---i56629
}
- (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_True, NULL, NULL );
+ (void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, sal_True, NULL );
// resolve the hyperlinks for PDF export
@@ -1268,7 +1274,12 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
}
if ( nPage >= 0 )
- pPDFData->SetLinkDest( aIter->nLinkId, pPDFData->CreateDest( aArea, nPage ) );
+ {
+ if ( aIter->nLinkId != -1 )
+ pPDFData->SetLinkDest( aIter->nLinkId, pPDFData->CreateDest( aArea, nPage ) );
+ else
+ pPDFData->DescribeRegisteredDest( aIter->nDestId, aArea, nPage );
+ }
}
}
else
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index c5dd11977478..eac95f94d779 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -27,35 +27,24 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-#include <svl/smplhint.hxx>
+#include "notesuno.hxx"
-#include "rangelst.hxx"
+#include <svl/smplhint.hxx>
#include <editeng/unotext.hxx>
#include <svx/svdpool.hxx>
#include <svx/svdobj.hxx>
-#include "notesuno.hxx"
-#include "textuno.hxx"
-#include "cellsuno.hxx" // getParent
+#include <svx/unoshape.hxx>
+#include <svx/svdocapt.hxx>
+
+#include "postit.hxx"
+#include "cellsuno.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
#include "hints.hxx"
#include "editsrc.hxx"
#include "miscuno.hxx"
-
-// setVisible:
-#include <svx/svdundo.hxx>
-#include "drwlayer.hxx"
-#include "detfunc.hxx"
-#include "undocell.hxx"
#include "unoguard.hxx"
-#include "userdat.hxx"
-#include <editeng/outlobj.hxx>
-#include <svx/unoshape.hxx>
-#include <svx/svdocapt.hxx>
-#include <svx/svditer.hxx>
-#include <svx/svdpage.hxx>
-#include <com/sun/star/drawing/XShapeDescriptor.hpp>
using namespace com::sun::star;
@@ -75,7 +64,7 @@ const SvxItemPropertySet* lcl_GetAnnotationPropertySet()
//------------------------------------------------------------------------
SC_SIMPLE_SERVICE_INFO( ScAnnotationObj, "ScAnnotationObj", "com.sun.star.sheet.CellAnnotation" )
-SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" )
+//SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" )
//------------------------------------------------------------------------
@@ -248,7 +237,11 @@ uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape(
throw(::com::sun::star::uno::RuntimeException)
{
ScUnoGuard aGuard;
- return new ScAnnotationShapeObj(pDocShell, aCellPos);
+ uno::Reference < drawing::XShape > xShape;
+ if( const ScPostIt* pNote = ImplGetNote() )
+ if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )
+ xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
+ return xShape;
}
SvxUnoText& ScAnnotationObj::GetUnoText()
@@ -267,463 +260,5 @@ const ScPostIt* ScAnnotationObj::ImplGetNote() const
{
return pDocShell ? pDocShell->GetDocument()->GetNote( aCellPos ) : 0;
}
-//------------------------------------------------------------------------
-
-ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) :
- pDocShell( pDocSh ),
- aCellPos( rPos ),
- pUnoText( NULL )
-{
- pDocShell->GetDocument()->AddUnoObject(*this);
-
- // pUnoText is allocated on demand (GetUnoText)
- // can't be aggregated because getString/setString is handled here
-}
-
-SvxUnoText& ScAnnotationShapeObj::GetUnoText()
-{
- if (!pUnoText)
- {
- ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
- pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(),
- uno::Reference<text::XText>() );
- pUnoText->acquire();
- }
- return *pUnoText;
-}
-
-uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
-{
- if (!xShape.is())
- if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
- if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )
- xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
- return xShape;
-}
-
-ScAnnotationShapeObj::~ScAnnotationShapeObj()
-{
- if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
- if (pUnoText)
- pUnoText->release();
-}
-
-void ScAnnotationShapeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- if ( rHint.ISA( ScUpdateRefHint ) )
- {
-// const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
-
- //! Ref-Update
- }
- else if ( rHint.ISA( SfxSimpleHint ) &&
- ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
- {
- pDocShell = NULL; // ungueltig geworden
- }
-}
-
-
-// XChild
-
-uno::Reference<uno::XInterface> SAL_CALL ScAnnotationShapeObj::getParent() throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
-
- // Parent der Notiz ist die zugehoerige Zelle
- //! existierendes Objekt finden und zurueckgeben ???
-
- if (pDocShell)
- return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos );
-
- return NULL;
-}
-
-void SAL_CALL ScAnnotationShapeObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ )
- throw(lang::NoSupportException, uno::RuntimeException)
-{
- // hamma nich
- //! Exception oder so ??!
-}
-
-// XElementAccess
-uno::Type SAL_CALL ScAnnotationShapeObj::getElementType( ) throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
-
- return GetUnoText().getElementType();
-}
-
-sal_Bool SAL_CALL ScAnnotationShapeObj::hasElements( ) throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
-
- return GetUnoText().hasElements();
-}
-
-// XEnumerationAccess
-uno::Reference< container::XEnumeration > SAL_CALL ScAnnotationShapeObj::createEnumeration( ) throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
-
- return GetUnoText().createEnumeration();
-}
-
-// XTextRangeMover
-void SAL_CALL ScAnnotationShapeObj::moveTextRange( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nParagraphs )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
-
- GetUnoText().moveTextRange( xRange, nParagraphs );
-}
-
-// XText
-void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< text::XTextRange >& xRange,
- const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb )
- throw (lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
-
- GetUnoText().insertTextContent( xRange, xContent, bAbsorb );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent )
- throw (container::NoSuchElementException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
-
- GetUnoText().removeTextContent( xContent );
-}
-
-// XSimpleText
-
-uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursor()
- throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- // Notizen brauchen keine Extrawurst
- return GetUnoText().createTextCursor();
-}
-
-uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursorByRange(
- const uno::Reference<text::XTextRange>& aTextPosition )
- throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- // Notizen brauchen keine Extrawurst
- return GetUnoText().createTextCursorByRange(aTextPosition);
-}
-
-rtl::OUString SAL_CALL ScAnnotationShapeObj::getString() throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- return GetUnoText().getString();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- GetUnoText().setString(aText);
-}
-
-void SAL_CALL ScAnnotationShapeObj::insertString( const uno::Reference<text::XTextRange>& xRange,
- const rtl::OUString& aString, sal_Bool bAbsorb )
- throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- GetUnoText().insertString( xRange, aString, bAbsorb );
-}
-
-void SAL_CALL ScAnnotationShapeObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
- sal_Int16 nControlCharacter, sal_Bool bAbsorb )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb );
-}
-
-uno::Reference<text::XText> SAL_CALL ScAnnotationShapeObj::getText() throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- return GetUnoText().getText();
-}
-
-uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getStart() throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- return GetUnoText().getStart();
-}
-
-uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getEnd() throw(uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- return GetUnoText().getEnd();
-}
-
-// XShapeDescriptor
-::rtl::OUString SAL_CALL ScAnnotationShapeObj::getShapeType( )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < drawing::XShapeDescriptor > xDesc(GetXShape(), uno::UNO_QUERY);
- if (xDesc.is())
- return xDesc->getShapeType();
- return rtl::OUString();
-}
-
-// XShape
-awt::Point SAL_CALL ScAnnotationShapeObj::getPosition( )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- GetXShape();
- return xShape.is() ? xShape->getPosition() : awt::Point();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setPosition( const awt::Point& aPosition )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- GetXShape();
- if( xShape.is() )
- xShape->setPosition(aPosition);
-}
-
-awt::Size SAL_CALL ScAnnotationShapeObj::getSize( )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- GetXShape();
- return xShape.is() ? xShape->getSize() : awt::Size();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setSize( const awt::Size& aSize )
- throw (beans::PropertyVetoException, uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- GetXShape();
- if( xShape.is() )
- xShape->setSize(aSize);
-}
-
-// XPropertyState
-beans::PropertyState SAL_CALL ScAnnotationShapeObj::getPropertyState( const rtl::OUString& PropertyName )
- throw (beans::UnknownPropertyException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- return xState->getPropertyState( PropertyName );
- return beans::PropertyState();
-}
-
-uno::Sequence< beans::PropertyState > SAL_CALL ScAnnotationShapeObj::getPropertyStates(
- const uno::Sequence< rtl::OUString >& aPropertyName )
- throw (beans::UnknownPropertyException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- return xState->getPropertyStates( aPropertyName );
- return uno::Sequence< beans::PropertyState >();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setPropertyToDefault( const ::rtl::OUString& PropertyName )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- xState->setPropertyToDefault( PropertyName );
-}
-
-uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyDefault( const rtl::OUString& aPropertyName )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- return xState->getPropertyDefault( aPropertyName );
- return uno::Any();
-}
-
-// XPropertySet
-uno::Reference< beans::XPropertySetInfo > SAL_CALL ScAnnotationShapeObj::getPropertySetInfo( )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->getPropertySetInfo();
- return uno::Reference< beans::XPropertySetInfo >();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
- throw (beans::UnknownPropertyException,
- beans::PropertyVetoException,
- lang::IllegalArgumentException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->setPropertyValue( aPropertyName, aValue );
-}
-
-uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyValue( const rtl::OUString& PropertyName )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->getPropertyValue( PropertyName );
- return uno::Any();
-}
-
-void SAL_CALL ScAnnotationShapeObj::addPropertyChangeListener( const rtl::OUString& aPropertyName,
- const uno::Reference< beans::XPropertyChangeListener >& xListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->addPropertyChangeListener( aPropertyName, xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removePropertyChangeListener( const rtl::OUString& aPropertyName,
- const uno::Reference< beans::XPropertyChangeListener >& aListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->removePropertyChangeListener( aPropertyName, aListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::addVetoableChangeListener( const rtl::OUString& PropertyName,
- const uno::Reference< beans::XVetoableChangeListener >& aListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->addVetoableChangeListener( PropertyName, aListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removeVetoableChangeListener( const rtl::OUString& PropertyName,
- const uno::Reference< beans::XVetoableChangeListener >& aListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->removeVetoableChangeListener( PropertyName, aListener );
-}
-
- // XMultiPropertySet
-void SAL_CALL ScAnnotationShapeObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
- const uno::Sequence< uno::Any >& aValues )
- throw (beans::PropertyVetoException,
- lang::IllegalArgumentException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->setPropertyValues( aPropertyNames, aValues );
-}
-
-uno::Sequence< uno::Any > SAL_CALL ScAnnotationShapeObj::getPropertyValues(
- const uno::Sequence< rtl::OUString >& aPropertyNames )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->getPropertyValues( aPropertyNames );
- return uno::Sequence< uno::Any >();
-}
-
-void SAL_CALL ScAnnotationShapeObj::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames,
- const uno::Reference< beans::XPropertiesChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->addPropertiesChangeListener( aPropertyNames, xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->removePropertiesChangeListener( xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames,
- const uno::Reference< beans::XPropertiesChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->firePropertiesChangeEvent( aPropertyNames, xListener );
-}
-
- // XComponent
-void SAL_CALL ScAnnotationShapeObj::dispose( ) throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- if (xShape.is())
- xShape.clear();
-}
-
-void SAL_CALL ScAnnotationShapeObj::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
- if (xComp.is())
- xComp->addEventListener( xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw (uno::RuntimeException)
-{
- ScUnoGuard aGuard;
- uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
- if (xComp.is())
- xComp->removeEventListener( aListener );
-}
//------------------------------------------------------------------------
-
-
-
-
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index fd31c233dc19..fe77e5ef32e6 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -102,7 +102,8 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
pShapePropertySet(NULL),
pShapePropertyState(NULL),
pImplementationId(NULL),
- bIsTextShape(sal_False),
+ bIsTextShape(false),
+ bIsNoteCaption(false),
bInitializedNotifier(false)
{
comphelper::increment( m_refCount );
@@ -127,6 +128,7 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
SdrObject* pObj = GetSdrObject();
if ( pObj )
{
+ bIsNoteCaption = ScDrawLayer::IsNoteCaption( pObj );
lcl_initializeNotifier( *pObj, *this );
bInitializedNotifier = true;
}
@@ -151,6 +153,9 @@ uno::Any SAL_CALL ScShapeObj::queryInterface( const uno::Type& rType )
if ( !aRet.hasValue() && bIsTextShape )
aRet = ScShapeObj_TextBase::queryInterface( rType );
+ if ( !aRet.hasValue() && bIsNoteCaption )
+ aRet = ScShapeObj_ChildBase::queryInterface( rType );
+
if ( !aRet.hasValue() && mxShapeAgg.is() )
aRet = mxShapeAgg->queryAggregation( rType );
@@ -1261,6 +1266,48 @@ void SAL_CALL ScShapeObj::setString( const rtl::OUString& aText ) throw(uno::Run
throw uno::RuntimeException();
}
+// XChild
+
+uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent() throw (uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+
+ // receive cell position from caption object (parent of a note caption is the note cell)
+ SdrObject* pObj = GetSdrObject();
+ if( pObj )
+ {
+ ScDrawLayer* pModel = (ScDrawLayer*)pObj->GetModel();
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel )
+ {
+ ScDocument* pDoc = pModel->GetDocument();
+ if ( pDoc )
+ {
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && pObjSh->ISA(ScDocShell) )
+ {
+ ScDocShell* pDocSh = (ScDocShell*)pObjSh;
+
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ {
+ const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab );
+ if( pCaptData )
+ return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) );
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+void SAL_CALL ScShapeObj::setParent( const uno::Reference< uno::XInterface >& ) throw (lang::NoSupportException, uno::RuntimeException)
+{
+ throw lang::NoSupportException();
+}
+
// XTypeProvider
uno::Sequence<uno::Type> SAL_CALL ScShapeObj::getTypes() throw(uno::RuntimeException)
@@ -1517,5 +1564,12 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ScShapeObj::getSupportedServiceNames(
aSupported.realloc( aSupported.getLength() + 1 );
aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) );
+
+ if( bIsNoteCaption )
+ {
+ aSupported.realloc( aSupported.getLength() + 1 );
+ aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.CellAnnotationShape" ) );
+ }
+
return aSupported;
}