diff options
Diffstat (limited to 'sw/source/core/unocore/unosett.cxx')
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 291 |
1 files changed, 0 insertions, 291 deletions
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index eedb0fdbaa2d..186b0e98116e 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -90,11 +90,6 @@ namespace return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier(); } } -// Constants for the css::text::ColumnSeparatorStyle -#define API_COL_LINE_NONE 0 -#define API_COL_LINE_SOLID 1 -#define API_COL_LINE_DOTTED 2 -#define API_COL_LINE_DASHED 3 #define WID_PREFIX 0 #define WID_SUFFIX 1 @@ -2166,290 +2161,4 @@ SwXChapterNumbering::~SwXChapterNumbering() { } -OUString SwXTextColumns::getImplementationName() -{ - return "SwXTextColumns"; -} - -sal_Bool SwXTextColumns::supportsService(const OUString& rServiceName) -{ - return cppu::supportsService(this, rServiceName); -} - -Sequence< OUString > SwXTextColumns::getSupportedServiceNames() -{ - Sequence<OUString> aRet { "com.sun.star.text.TextColumns" }; - return aRet; -} - -SwXTextColumns::SwXTextColumns() : - m_nReference(0), - m_bIsAutomaticWidth(true), - m_nAutoDistance(0), - m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)), - m_nSepLineWidth(0), - m_nSepLineColor(0), //black - m_nSepLineHeightRelative(100),//full height - m_nSepLineVertAlign(style::VerticalAlignment_MIDDLE), - m_bSepLineIsOn(false), - m_nSepLineStyle(API_COL_LINE_NONE) // None -{ -} - -SwXTextColumns::SwXTextColumns(const SwFormatCol& rFormatCol) : - m_nReference(0), - m_aTextColumns(rFormatCol.GetNumCols()), - m_bIsAutomaticWidth(rFormatCol.IsOrtho()), - m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)) -{ - const sal_uInt16 nItemGutterWidth = rFormatCol.GetGutterWidth(); - m_nAutoDistance = m_bIsAutomaticWidth ? - USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : static_cast<sal_Int32>(nItemGutterWidth) - : 0; - m_nAutoDistance = convertTwipToMm100(m_nAutoDistance); - - TextColumn* pColumns = m_aTextColumns.getArray(); - const SwColumns& rCols = rFormatCol.GetColumns(); - for(sal_Int32 i = 0; i < m_aTextColumns.getLength(); ++i) - { - const SwColumn* pCol = &rCols[i]; - - pColumns[i].Width = pCol->GetWishWidth(); - m_nReference += pColumns[i].Width; - pColumns[i].LeftMargin = convertTwipToMm100(pCol->GetLeft ()); - pColumns[i].RightMargin = convertTwipToMm100(pCol->GetRight()); - } - if(!m_aTextColumns.hasElements()) - m_nReference = USHRT_MAX; - - m_nSepLineWidth = rFormatCol.GetLineWidth(); - m_nSepLineColor = rFormatCol.GetLineColor(); - m_nSepLineHeightRelative = rFormatCol.GetLineHeight(); - m_bSepLineIsOn = rFormatCol.GetLineAdj() != COLADJ_NONE; - sal_Int8 nStyle = API_COL_LINE_NONE; - switch (rFormatCol.GetLineStyle()) - { - case SvxBorderLineStyle::SOLID: nStyle = API_COL_LINE_SOLID; break; - case SvxBorderLineStyle::DOTTED: nStyle= API_COL_LINE_DOTTED; break; - case SvxBorderLineStyle::DASHED: nStyle= API_COL_LINE_DASHED; break; - default: break; - } - m_nSepLineStyle = nStyle; - switch(rFormatCol.GetLineAdj()) - { - case COLADJ_TOP: m_nSepLineVertAlign = style::VerticalAlignment_TOP; break; - case COLADJ_BOTTOM: m_nSepLineVertAlign = style::VerticalAlignment_BOTTOM; break; - case COLADJ_CENTER: - case COLADJ_NONE: m_nSepLineVertAlign = style::VerticalAlignment_MIDDLE; - } -} - -SwXTextColumns::~SwXTextColumns() -{ -} - -sal_Int32 SwXTextColumns::getReferenceValue() -{ - SolarMutexGuard aGuard; - return m_nReference; -} - -sal_Int16 SwXTextColumns::getColumnCount() -{ - SolarMutexGuard aGuard; - return static_cast< sal_Int16>( m_aTextColumns.getLength() ); -} - -void SwXTextColumns::setColumnCount(sal_Int16 nColumns) -{ - SolarMutexGuard aGuard; - if(nColumns <= 0) - throw uno::RuntimeException(); - m_bIsAutomaticWidth = true; - m_aTextColumns.realloc(nColumns); - TextColumn* pCols = m_aTextColumns.getArray(); - m_nReference = USHRT_MAX; - sal_Int32 nWidth = m_nReference / nColumns; - sal_Int32 nDiff = m_nReference - nWidth * nColumns; - sal_Int32 nDist = m_nAutoDistance / 2; - for(sal_Int16 i = 0; i < nColumns; i++) - { - pCols[i].Width = nWidth; - pCols[i].LeftMargin = i == 0 ? 0 : nDist; - pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist; - } - pCols[nColumns - 1].Width += nDiff; -} - -uno::Sequence< TextColumn > SwXTextColumns::getColumns() -{ - SolarMutexGuard aGuard; - return m_aTextColumns; -} - -void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns) -{ - SolarMutexGuard aGuard; - sal_Int32 nReferenceTemp = std::accumulate(rColumns.begin(), rColumns.end(), sal_Int32(0), - [](const sal_Int32 nSum, const TextColumn& rCol) { return nSum + rCol.Width; }); - m_bIsAutomaticWidth = false; - m_nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp; - m_aTextColumns = rColumns; -} - -uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( ) -{ - static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); - return aRef; -} - -void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue ) -{ - const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName ); - if (!pEntry) - throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pEntry->nFlags & PropertyAttribute::READONLY) - throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - - switch(pEntry->nWID) - { - case WID_TXTCOL_LINE_WIDTH: - { - sal_Int32 nTmp = 0; - aValue >>= nTmp; - if(nTmp < 0) - throw IllegalArgumentException(); - m_nSepLineWidth = convertMm100ToTwip(nTmp); - } - break; - case WID_TXTCOL_LINE_COLOR: - aValue >>= m_nSepLineColor; - break; - case WID_TXTCOL_LINE_STYLE: - { - aValue >>= m_nSepLineStyle; - } - break; - case WID_TXTCOL_LINE_REL_HGT: - { - sal_Int8 nTmp = 0; - aValue >>= nTmp; - if(nTmp < 0) - throw IllegalArgumentException(); - m_nSepLineHeightRelative = nTmp; - } - break; - case WID_TXTCOL_LINE_ALIGN: - { - style::VerticalAlignment eAlign; - if(!(aValue >>= eAlign) ) - { - sal_Int8 nTmp = 0; - if (! ( aValue >>= nTmp ) ) - throw IllegalArgumentException(); - m_nSepLineVertAlign = static_cast<style::VerticalAlignment>(nTmp); - } - else - m_nSepLineVertAlign = eAlign; - } - break; - case WID_TXTCOL_LINE_IS_ON: - m_bSepLineIsOn = *o3tl::doAccess<bool>(aValue); - break; - case WID_TXTCOL_AUTO_DISTANCE: - { - sal_Int32 nTmp = 0; - aValue >>= nTmp; - if(nTmp < 0 || nTmp >= m_nReference) - throw IllegalArgumentException(); - m_nAutoDistance = nTmp; - sal_Int32 nColumns = m_aTextColumns.getLength(); - TextColumn* pCols = m_aTextColumns.getArray(); - sal_Int32 nDist = m_nAutoDistance / 2; - for(sal_Int32 i = 0; i < nColumns; i++) - { - pCols[i].LeftMargin = i == 0 ? 0 : nDist; - pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist; - } - } - break; - } -} - -Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName ) -{ - const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName ); - if (!pEntry) - throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - - Any aRet; - switch(pEntry->nWID) - { - case WID_TXTCOL_LINE_WIDTH: - aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(m_nSepLineWidth)); - break; - case WID_TXTCOL_LINE_COLOR: - aRet <<= m_nSepLineColor; - break; - case WID_TXTCOL_LINE_STYLE: - aRet <<= m_nSepLineStyle; - break; - case WID_TXTCOL_LINE_REL_HGT: - aRet <<= m_nSepLineHeightRelative; - break; - case WID_TXTCOL_LINE_ALIGN: - aRet <<= m_nSepLineVertAlign; - break; - case WID_TXTCOL_LINE_IS_ON: - aRet <<= m_bSepLineIsOn; - break; - case WID_TXTCOL_IS_AUTOMATIC : - aRet <<= m_bIsAutomaticWidth; - break; - case WID_TXTCOL_AUTO_DISTANCE: - aRet <<= m_nAutoDistance; - break; - } - return aRet; -} - -void SwXTextColumns::addPropertyChangeListener( - const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) -{ -} - -void SwXTextColumns::removePropertyChangeListener( - const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) -{ -} - -void SwXTextColumns::addVetoableChangeListener( - const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ ) -{ -} - -void SwXTextColumns::removeVetoableChangeListener( - const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ ) -{ -} - -namespace -{ -} - -const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId() -{ - static const UnoTunnelIdInit theSwXTextColumnsUnoTunnelId; - return theSwXTextColumnsUnoTunnelId.getSeq(); -} - -sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId ) -{ - if( isUnoTunnelId<SwXTextColumns>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |