Kaydet (Commit) 9dc75d5a authored tarafından Markus Mohrhard's avatar Markus Mohrhard

integrate new conditional format list into normal UNO stuff

Change-Id: I04ccc7cee4052e5f8e06423216e7d041cd95e2b6
üst 6898506d
......@@ -179,6 +179,7 @@
#define SC_UNONAME_TABLAYOUT "TableLayout"
#define SC_UNONAME_AUTOPRINT "AutomaticPrintArea"
#define SC_UNONAME_TABCOLOR "TabColor"
#define SC_UNONAME_CONDFORMAT "ConditionalFormats"
#define SC_UNONAME_VISFLAG "VisibleFlag"
......
......@@ -71,7 +71,8 @@
#define SC_WID_UNO_TABCOLOR ( SC_WID_UNO_START + 41 )
#define SC_WID_UNO_NAMES ( SC_WID_UNO_START + 42 )
#define SC_WID_UNO_TBLBORD2 ( SC_WID_UNO_START + 43 )
#define SC_WID_UNO_END ( SC_WID_UNO_START + 43 )
#define SC_WID_UNO_CONDFORMAT ( SC_WID_UNO_START + 44 )
#define SC_WID_UNO_END ( SC_WID_UNO_START + 44 )
inline bool IsScUnoWid( sal_uInt16 nWid )
{
......
......@@ -20,7 +20,7 @@
#include <com/sun/star/sheet/XDataBarEntry.hpp>
#include <com/sun/star/sheet/XIconSetEntry.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase1.hxx>
#include <svl/itemprop.hxx>
class ScDocument;
......@@ -43,14 +43,15 @@ class XSheetCellRanges;
} } }
class ScCondFormatsObj : public com::sun::star::sheet::XConditionalFormats,
public cppu::OWeakObject
class ScCondFormatsObj : public cppu::WeakImplHelper1<com::sun::star::sheet::XConditionalFormats>
{
public:
ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab);
ScCondFormatsObj(ScDocument& rDoc, SCTAB nTab);
virtual ~ScCondFormatsObj();
static ScCondFormatsObj* getImplementation( uno::Reference< com::sun::star::sheet::XConditionalFormats > xCondFormat );
// XConditionalFormats
virtual sal_Int32 SAL_CALL addByRange( const uno::Reference< sheet::XConditionalFormat >& xCondFormat,
const uno::Reference<sheet::XSheetCellRanges>& xRanges)
......@@ -70,7 +71,9 @@ public:
std::exception) SAL_OVERRIDE;
private:
ScConditionalFormatList* mpFormatList;
ScConditionalFormatList* getCoreObject();
SCTAB mnTab;
ScDocument& mrDoc;
};
class ScCondFormatObj : public com::sun::star::sheet::XConditionalFormat,
......@@ -82,6 +85,8 @@ public:
virtual ~ScCondFormatObj();
static ScCondFormatObj* getImplementation( uno::Reference<sheet::XConditionalFormat> XCondFormat);
// XConditionalFormat
virtual void SAL_CALL addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry)
throw(::com::sun::star::uno::RuntimeException,
......@@ -146,6 +151,8 @@ public:
ScConditionEntryObj();
virtual ~ScConditionEntryObj();
static ScConditionEntryObj* getImplementation(uno::Reference<sheet::XConditionEntry> xCondition);
// XConditionEntry
virtual sal_Int32 SAL_CALL getType()
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......@@ -204,6 +211,8 @@ public:
ScColorScaleFormatObj();
virtual ~ScColorScaleFormatObj();
static ScColorScaleFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
SAL_CALL getPropertySetInfo()
......@@ -257,6 +266,8 @@ public:
ScDataBarFormatObj();
virtual ~ScDataBarFormatObj();
static ScDataBarFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
SAL_CALL getPropertySetInfo()
......@@ -310,6 +321,8 @@ public:
ScIconSetFormatObj();
virtual ~ScIconSetFormatObj();
static ScIconSetFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
SAL_CALL getPropertySetInfo()
......
......@@ -60,6 +60,7 @@
#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/textfield/Type.hpp>
#include <com/sun/star/sheet/XConditionalFormats.hpp>
#include "autoform.hxx"
#include "cellmergeoption.hxx"
......@@ -126,6 +127,7 @@
#include "stylehelper.hxx"
#include "dputil.hxx"
#include <sortparam.hxx>
#include "condformatuno.hxx"
#include <list>
#include <boost/scoped_array.hpp>
......@@ -816,6 +818,7 @@ static const SfxItemPropertySet* lcl_GetSheetPropertySet()
{OUString(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, cppu::UnoType<table::TableBorder>::get(), 0, 0 | CONVERT_TWIPS },
{OUString(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, cppu::UnoType<table::TableBorder2>::get(), 0, 0 | CONVERT_TWIPS },
{OUString(SC_UNONAME_TABLAYOUT),SC_WID_UNO_TABLAYOUT,cppu::UnoType<sal_Int16>::get(), 0, 0 },
{OUString(SC_UNONAME_CONDFORMAT), SC_WID_UNO_CONDFORMAT, cppu::UnoType<sheet::XConditionalFormats>::get(), 0, 0},
{OUString(SC_UNONAME_TOPBORDER),ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER | CONVERT_TWIPS },
{OUString(SC_UNONAME_TOPBORDER2),ATTR_BORDER, ::cppu::UnoType<table::BorderLine2>::get(), 0, TOP_BORDER | CONVERT_TWIPS },
{OUString(SC_UNONAME_USERDEF), ATTR_USERDEF, cppu::UnoType<container::XNameContainer>::get(), 0, 0 },
......@@ -8441,6 +8444,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
pDocSh->GetDocument().SetCodeName( GetTab_Impl(), aCodeName );
}
}
else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
{
uno::Reference<sheet::XConditionalFormats> xCondFormat;
if (aValue >>= xCondFormat)
{
// how to set the format correctly
}
}
else
ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
}
......@@ -8595,6 +8606,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
pDocSh->GetDocument().GetCodeName( GetTab_Impl(), aCodeName );
rAny <<= OUString( aCodeName );
}
else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
{
rAny <<= uno::Reference<sheet::XConditionalFormats>(new ScCondFormatsObj(pDocSh->GetDocument(), nTab));
}
else
ScCellRangeObj::GetOnePropertyValue(pEntry, rAny);
}
......
......@@ -13,6 +13,7 @@
#include "conditio.hxx"
#include "colorscale.hxx"
#include "docsh.hxx"
#include "miscuno.hxx"
#include "cellsuno.hxx"
......@@ -70,10 +71,11 @@ struct ConditionEntryApiMap
sal_Int32 nApiMode;
};
/*
ConditionEntryApiMap aConditionEntryMap[] =
{
};
*/
enum ColorScaleProperties
{
......@@ -184,8 +186,9 @@ const IconSetTypeApiMap aIconSetApiMap[] =
}
ScCondFormatsObj::ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab):
mpFormatList(pDoc->GetCondFormList(nTab))
ScCondFormatsObj::ScCondFormatsObj(ScDocument& rDoc, SCTAB nTab):
mnTab(nTab),
mrDoc(rDoc)
{
}
......@@ -194,16 +197,27 @@ ScCondFormatsObj::~ScCondFormatsObj()
}
sal_Int32 ScCondFormatsObj::addByRange(const uno::Reference< sheet::XConditionalFormat >& xCondFormat,
const uno::Reference< sheet::XSheetCellRanges >& xRanges)
const uno::Reference< sheet::XSheetCellRanges >& /*xRanges*/)
throw(uno::RuntimeException, std::exception)
{
if (!xCondFormat.is())
return 0;
SolarMutexGuard aGuard;
/*
ScCondFormatObj* pFormatObj = ScCondFormatObj::getImplementation(xCondFormat);
ScConditionalFormat* pFormat = pFormatObj->getCoreObject();
mpFormatList->InsertNew(pFormat);
*/
return 0;
}
void ScCondFormatsObj::removeByID(const sal_Int32 nID)
throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
ScConditionalFormatList* pFormatList = getCoreObject();;
pFormatList->erase(nID);
}
uno::Sequence<uno::Reference<sheet::XConditionalFormat> > ScCondFormatsObj::getConditionalFormats()
......@@ -216,10 +230,20 @@ sal_Int32 ScCondFormatsObj::getLength()
throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
return mpFormatList->size();;
ScConditionalFormatList* pFormatList = getCoreObject();;
return pFormatList->size();;
}
ScConditionalFormatList* ScCondFormatsObj::getCoreObject()
{
ScConditionalFormatList* pList = mrDoc.GetCondFormList(mnTab);
if (!pList)
throw uno::RuntimeException();
return pList;
}
ScCondFormatObj::ScCondFormatObj(ScDocument* pDoc, ScConditionalFormat* pFormat):
ScCondFormatObj::ScCondFormatObj(ScDocument* /*pDoc*/, ScConditionalFormat* pFormat):
mpFormat(pFormat),
maPropSet(getCondFormatPropset())
{
......@@ -229,12 +253,12 @@ ScCondFormatObj::~ScCondFormatObj()
{
}
void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry)
void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& /*xEntry*/)
throw(uno::RuntimeException, std::exception)
{
}
void ScCondFormatObj::removeByIndex(const sal_Int32 nIndex)
void ScCondFormatObj::removeByIndex(const sal_Int32 /*nIndex*/)
throw(uno::RuntimeException, std::exception)
{
}
......@@ -249,7 +273,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCondFormatObj::getPropertySet
}
void SAL_CALL ScCondFormatObj::setPropertyValue(
const OUString& aPropertyName, const uno::Any& aValue )
const OUString& aPropertyName, const uno::Any& /*aValue*/ )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException, std::exception)
......@@ -345,6 +369,12 @@ ScConditionEntryObj::~ScConditionEntryObj()
{
}
sal_Int32 ScConditionEntryObj::getType()
throw(uno::RuntimeException, std::exception)
{
return 0;
}
uno::Reference<beans::XPropertySetInfo> SAL_CALL ScConditionEntryObj::getPropertySetInfo()
throw(uno::RuntimeException, std::exception)
{
......@@ -354,7 +384,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScConditionEntryObj::getPropert
}
void SAL_CALL ScConditionEntryObj::setPropertyValue(
const OUString& aPropertyName, const uno::Any& aValue )
const OUString& aPropertyName, const uno::Any& /*aValue*/ )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException, std::exception)
......@@ -473,7 +503,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScColorScaleFormatObj::getPrope
}
void SAL_CALL ScColorScaleFormatObj::setPropertyValue(
const OUString& aPropertyName, const uno::Any& aValue )
const OUString& aPropertyName, const uno::Any& /*aValue*/ )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
uno::RuntimeException, std::exception)
......
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