summaryrefslogtreecommitdiffstats
path: root/writerfilter/source
diff options
context:
space:
mode:
authorVitaliy Anderson <vanderson@smartru.com>2017-04-11 14:41:42 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-04-13 09:56:30 +0200
commitd9febd5d725f1a17e7b64e2c44de189144ab4f9c (patch)
tree453578f24bb4226bf52998f58049afae5c67b25f /writerfilter/source
parentVBA tests - INSTRREV, INT test case (diff)
downloadcore-d9febd5d725f1a17e7b64e2c44de189144ab4f9c.tar.gz
core-d9febd5d725f1a17e7b64e2c44de189144ab4f9c.zip
PropertyMap.cxx: Indents and formatting
Change-Id: Ibd27ecf4d06f3982ae703f5e2fd01f063ce8f409 Reviewed-on: https://gerrit.libreoffice.org/36444 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx1473
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx646
2 files changed, 1043 insertions, 1076 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 907bb43cde55..6dd001acc3bb 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -48,129 +48,110 @@
#include <comphelper/propertyvalue.hxx>
#include "PropertyMapHelper.hxx"
-using namespace ::com::sun::star;
+using namespace com::sun::star;
namespace writerfilter {
-namespace dmapper{
+namespace dmapper {
-
-PropertyMap::PropertyMap()
-{
-}
-
-
-PropertyMap::~PropertyMap()
-{
-}
-
-
-uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharGrabBag)
+uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues( bool bCharGrabBag )
{
using comphelper::makePropertyValue;
- if(m_aValues.empty() && !m_vMap.empty())
+
+ if ( m_aValues.empty() && !m_vMap.empty() )
{
size_t nCharGrabBag = 0;
size_t nParaGrabBag = 0;
size_t nCellGrabBag = 0;
- size_t nRowGrabBag = 0;
- for (MapIterator i = m_vMap.begin(); i != m_vMap.end(); ++i)
+ size_t nRowGrabBag = 0;
+
+ const PropValue* pParaStyleProp = nullptr;
+ const PropValue* pCharStyleProp = nullptr;
+ const PropValue* pNumRuleProp = nullptr;
+
+ for ( const auto& rPropPair : m_vMap )
{
- if ( i->second.getGrabBagType() == CHAR_GRAB_BAG )
+ if ( rPropPair.second.getGrabBagType() == CHAR_GRAB_BAG )
nCharGrabBag++;
- else if ( i->second.getGrabBagType() == PARA_GRAB_BAG )
+ else if ( rPropPair.second.getGrabBagType() == PARA_GRAB_BAG )
nParaGrabBag++;
- else if ( i->second.getGrabBagType() == CELL_GRAB_BAG )
+ else if ( rPropPair.second.getGrabBagType() == CELL_GRAB_BAG )
nCellGrabBag++;
- else if ( i->first == PROP_CELL_INTEROP_GRAB_BAG)
+ else if ( rPropPair.first == PROP_CELL_INTEROP_GRAB_BAG )
{
- uno::Sequence<beans::PropertyValue> aSeq;
- i->second.getValue() >>= aSeq;
+ uno::Sequence< beans::PropertyValue > aSeq;
+ rPropPair.second.getValue() >>= aSeq;
nCellGrabBag += aSeq.getLength();
}
- else if ( i->second.getGrabBagType() == ROW_GRAB_BAG )
+ else if ( rPropPair.second.getGrabBagType() == ROW_GRAB_BAG )
nRowGrabBag++;
- }
- //style names have to be the first elements within the property sequence
- //otherwise they will overwrite 'hard' attributes
- MapIterator aParaStyleIter = m_vMap.find(PROP_PARA_STYLE_NAME);
- if( aParaStyleIter != m_vMap.end())
- {
- m_aValues.push_back( makePropertyValue(
- getPropertyName( aParaStyleIter->first ),
- aParaStyleIter->second.getValue()
- ) );
+ if ( rPropPair.first == PROP_PARA_STYLE_NAME ) pParaStyleProp = &rPropPair.second;
+ if ( rPropPair.first == PROP_CHAR_STYLE_NAME ) pCharStyleProp = &rPropPair.second;
+ if ( rPropPair.first == PROP_NUMBERING_RULES ) pNumRuleProp = &rPropPair.second;
}
- MapIterator aCharStyleIter = m_vMap.find(PROP_CHAR_STYLE_NAME);
- if( aCharStyleIter != m_vMap.end())
- {
- m_aValues.push_back( makePropertyValue(
- getPropertyName( aCharStyleIter->first ),
- aCharStyleIter->second.getValue()
- ) );
- }
- MapIterator aNumRuleIter = m_vMap.find(PROP_NUMBERING_RULES);
- if( aNumRuleIter != m_vMap.end())
- {
- m_aValues.push_back( makePropertyValue(
- getPropertyName( aNumRuleIter->first ),
- aNumRuleIter->second.getValue()
- ) );
- }
+ // Style names have to be the first elements within the property sequence
+ // otherwise they will overwrite 'hard' attributes
+ if ( pParaStyleProp != nullptr )
+ m_aValues.push_back( makePropertyValue( getPropertyName( PROP_PARA_STYLE_NAME ), pParaStyleProp->getValue() ) );
+ if ( pCharStyleProp != nullptr )
+ m_aValues.push_back( makePropertyValue( getPropertyName( PROP_CHAR_STYLE_NAME ), pCharStyleProp->getValue() ) );
+ if ( pNumRuleProp != nullptr )
+ m_aValues.push_back( makePropertyValue(getPropertyName( PROP_NUMBERING_RULES ), pNumRuleProp->getValue() ) );
// If there are any grab bag properties, we need one slot for them.
- uno::Sequence<beans::PropertyValue> aCharGrabBagValues(nCharGrabBag);
- uno::Sequence<beans::PropertyValue> aParaGrabBagValues(nParaGrabBag);
- uno::Sequence<beans::PropertyValue> aCellGrabBagValues(nCellGrabBag);
- uno::Sequence<beans::PropertyValue> aRowGrabBagValues(nRowGrabBag);
+ uno::Sequence< beans::PropertyValue > aCharGrabBagValues( nCharGrabBag );
+ uno::Sequence< beans::PropertyValue > aParaGrabBagValues( nParaGrabBag );
+ uno::Sequence< beans::PropertyValue > aCellGrabBagValues( nCellGrabBag );
+ uno::Sequence< beans::PropertyValue > aRowGrabBagValues ( nRowGrabBag );
beans::PropertyValue* pCharGrabBagValues = aCharGrabBagValues.getArray();
beans::PropertyValue* pParaGrabBagValues = aParaGrabBagValues.getArray();
beans::PropertyValue* pCellGrabBagValues = aCellGrabBagValues.getArray();
- beans::PropertyValue* pRowGrabBagValues = aRowGrabBagValues.getArray();
+ beans::PropertyValue* pRowGrabBagValues = aRowGrabBagValues.getArray();
// Record index for the next property to be added in each grab bag.
- sal_Int32 nRowGrabBagValue = 0;
+ sal_Int32 nRowGrabBagValue = 0;
sal_Int32 nCellGrabBagValue = 0;
sal_Int32 nParaGrabBagValue = 0;
sal_Int32 nCharGrabBagValue = 0;
- MapIterator aMapIter = m_vMap.begin();
- for( ; aMapIter != m_vMap.end(); ++aMapIter )
+ for ( const auto& rPropPair : m_vMap )
{
- if( aMapIter != aParaStyleIter && aMapIter != aCharStyleIter && aMapIter != aNumRuleIter )
+ if ( rPropPair.first != PROP_PARA_STYLE_NAME &&
+ rPropPair.first != PROP_CHAR_STYLE_NAME &&
+ rPropPair.first != PROP_NUMBERING_RULES )
{
- if ( aMapIter->second.getGrabBagType() == CHAR_GRAB_BAG )
+ if ( rPropPair.second.getGrabBagType() == CHAR_GRAB_BAG )
{
- if (bCharGrabBag)
+ if ( bCharGrabBag )
{
- pCharGrabBagValues[nCharGrabBagValue].Name = getPropertyName( aMapIter->first );
- pCharGrabBagValues[nCharGrabBagValue].Value = aMapIter->second.getValue();
+ pCharGrabBagValues[nCharGrabBagValue].Name = getPropertyName( rPropPair.first );
+ pCharGrabBagValues[nCharGrabBagValue].Value = rPropPair.second.getValue();
++nCharGrabBagValue;
}
}
- else if ( aMapIter->second.getGrabBagType() == PARA_GRAB_BAG )
+ else if ( rPropPair.second.getGrabBagType() == PARA_GRAB_BAG )
{
- pParaGrabBagValues[nParaGrabBagValue].Name = getPropertyName( aMapIter->first );
- pParaGrabBagValues[nParaGrabBagValue].Value = aMapIter->second.getValue();
+ pParaGrabBagValues[nParaGrabBagValue].Name = getPropertyName( rPropPair.first );
+ pParaGrabBagValues[nParaGrabBagValue].Value = rPropPair.second.getValue();
++nParaGrabBagValue;
}
- else if ( aMapIter->second.getGrabBagType() == CELL_GRAB_BAG )
+ else if ( rPropPair.second.getGrabBagType() == CELL_GRAB_BAG )
{
- pCellGrabBagValues[nCellGrabBagValue].Name = getPropertyName( aMapIter->first );
- pCellGrabBagValues[nCellGrabBagValue].Value = aMapIter->second.getValue();
+ pCellGrabBagValues[nCellGrabBagValue].Name = getPropertyName( rPropPair.first );
+ pCellGrabBagValues[nCellGrabBagValue].Value = rPropPair.second.getValue();
++nCellGrabBagValue;
}
- else if ( aMapIter->second.getGrabBagType() == ROW_GRAB_BAG )
+ else if ( rPropPair.second.getGrabBagType() == ROW_GRAB_BAG )
{
- pRowGrabBagValues[nRowGrabBagValue].Name = getPropertyName( aMapIter->first );
- pRowGrabBagValues[nRowGrabBagValue].Value = aMapIter->second.getValue();
+ pRowGrabBagValues[nRowGrabBagValue].Name = getPropertyName( rPropPair.first );
+ pRowGrabBagValues[nRowGrabBagValue].Value = rPropPair.second.getValue();
++nRowGrabBagValue;
}
- else if (aMapIter->first == PROP_CELL_INTEROP_GRAB_BAG)
+ else if ( rPropPair.first == PROP_CELL_INTEROP_GRAB_BAG )
{
- uno::Sequence<beans::PropertyValue> aSeq;
- aMapIter->second.getValue() >>= aSeq;
- for (sal_Int32 i = 0; i < aSeq.getLength(); ++i)
+ uno::Sequence< beans::PropertyValue > aSeq;
+ rPropPair.second.getValue() >>= aSeq;
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i )
{
pCellGrabBagValues[nCellGrabBagValue] = aSeq[i];
++nCellGrabBagValue;
@@ -178,68 +159,61 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues(bool bCharG
}
else
{
- m_aValues.push_back( makePropertyValue(
- getPropertyName( aMapIter->first ),
- aMapIter->second.getValue()
- ) );
+ m_aValues.push_back( makePropertyValue( getPropertyName( rPropPair.first ), rPropPair.second.getValue() ) );
}
}
}
- if (nCharGrabBag && bCharGrabBag)
- {
- m_aValues.push_back( makePropertyValue( "CharInteropGrabBag",
- uno::makeAny(aCharGrabBagValues))
- );
- }
- if (nParaGrabBag)
- {
- m_aValues.push_back( makePropertyValue( "ParaInteropGrabBag",
- uno::makeAny(aParaGrabBagValues))
- );
- }
- if (nCellGrabBag)
- {
- m_aValues.push_back( makePropertyValue( "CellInteropGrabBag",
- uno::makeAny(aCellGrabBagValues))
- );
- }
- if (nRowGrabBag)
- {
- m_aValues.push_back( makePropertyValue( "RowInteropGrabBag",
- uno::makeAny(aRowGrabBagValues))
- );
- }
+
+ if ( nCharGrabBag && bCharGrabBag )
+ m_aValues.push_back( makePropertyValue( "CharInteropGrabBag", uno::makeAny( aCharGrabBagValues ) ) );
+
+ if ( nParaGrabBag )
+ m_aValues.push_back( makePropertyValue( "ParaInteropGrabBag", uno::makeAny( aParaGrabBagValues ) ) );
+
+ if ( nCellGrabBag )
+ m_aValues.push_back( makePropertyValue( "CellInteropGrabBag", uno::makeAny( aCellGrabBagValues ) ) );
+
+ if ( nRowGrabBag )
+ m_aValues.push_back( makePropertyValue( "RowInteropGrabBag", uno::makeAny( aRowGrabBagValues ) ) );
}
- return comphelper::containerToSequence(m_aValues);
+
+ return comphelper::containerToSequence( m_aValues );
}
#ifdef DEBUG_WRITERFILTER
-static void lcl_AnyToTag(const uno::Any & rAny)
+static void lcl_AnyToTag( const uno::Any& rAny )
{
try {
sal_Int32 aInt = 0;
- if (rAny >>= aInt) {
- TagLogger::getInstance().attribute("value", rAny);
- } else {
- TagLogger::getInstance().attribute("unsignedValue", 0);
+ if ( rAny >>= aInt )
+ {
+ TagLogger::getInstance().attribute( "value", rAny );
+ }
+ else
+ {
+ TagLogger::getInstance().attribute( "unsignedValue", 0 );
}
sal_uInt32 auInt = 0;
rAny >>= auInt;
- TagLogger::getInstance().attribute("unsignedValue", auInt);
+ TagLogger::getInstance().attribute( "unsignedValue", auInt );
float aFloat = 0.0f;
- if (rAny >>= aFloat) {
- TagLogger::getInstance().attribute("floatValue", rAny);
- } else {
- TagLogger::getInstance().attribute("unsignedValue", 0);
+ if ( rAny >>= aFloat )
+ {
+ TagLogger::getInstance().attribute( "floatValue", rAny );
+ }
+ else
+ {
+ TagLogger::getInstance().attribute( "unsignedValue", 0 );
}
OUString aStr;
rAny >>= aStr;
- TagLogger::getInstance().attribute("stringValue", aStr);
+ TagLogger::getInstance().attribute( "stringValue", aStr );
}
- catch (...) {
+ catch ( ... )
+ {
}
}
#endif
@@ -255,7 +229,7 @@ void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite
TagLogger::getInstance().endElement();
#endif
- if (!bOverwrite)
+ if ( !bOverwrite )
m_vMap.insert(std::make_pair(eId, PropValue(rAny, i_GrabBagType)));
else
m_vMap[eId] = PropValue(rAny, i_GrabBagType);
@@ -265,86 +239,84 @@ void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite
void PropertyMap::Erase( PropertyIds eId )
{
- //Safe call to erase, it throws no exceptions, even if eId is not in m_vMap
+ // Safe call to erase, it throws no exceptions, even if eId is not in m_vMap
m_vMap.erase(eId);
Invalidate();
}
-boost::optional<PropertyMap::Property> PropertyMap::getProperty( PropertyIds eId ) const
+boost::optional< PropertyMap::Property > PropertyMap::getProperty( PropertyIds eId ) const
{
- MapIterator aIter = m_vMap.find(eId);
- if (aIter==m_vMap.end())
+ std::map< PropertyIds, PropValue >::const_iterator aIter = m_vMap.find( eId );
+ if ( aIter == m_vMap.end() )
return boost::optional<Property>();
else
- return std::make_pair( eId, aIter->second.getValue() ) ;
+ return std::make_pair( eId, aIter->second.getValue() );
}
bool PropertyMap::isSet( PropertyIds eId) const
{
- return m_vMap.find(eId)!=m_vMap.end();
+ return m_vMap.find( eId ) != m_vMap.end();
}
#ifdef DEBUG_WRITERFILTER
void PropertyMap::dumpXml() const
{
- TagLogger::getInstance().startElement("PropertyMap");
+ TagLogger::getInstance().startElement( "PropertyMap" );
- MapIterator aMapIter = m_vMap.begin();
- while (aMapIter != m_vMap.end())
+ for ( const auto& rPropPair : m_vMap )
{
- TagLogger::getInstance().startElement("property");
+ TagLogger::getInstance().startElement( "property" );
- TagLogger::getInstance().attribute("name", getPropertyName( aMapIter->first ));
+ TagLogger::getInstance().attribute( "name", getPropertyName( rPropPair.first ) );
- switch (aMapIter->first)
+ switch ( rPropPair.first )
{
case PROP_TABLE_COLUMN_SEPARATORS:
- lcl_DumpTableColumnSeparators(aMapIter->second.getValue());
+ lcl_DumpTableColumnSeparators( rPropPair.second.getValue() );
break;
default:
{
- try {
+ try
+ {
sal_Int32 aInt = 0;
- aMapIter->second.getValue() >>= aInt;
- TagLogger::getInstance().attribute("value", aInt);
+ rPropPair.second.getValue() >>= aInt;
+ TagLogger::getInstance().attribute( "value", aInt );
sal_uInt32 auInt = 0;
- aMapIter->second.getValue() >>= auInt;
- TagLogger::getInstance().attribute("unsignedValue", auInt);
+ rPropPair.second.getValue() >>= auInt;
+ TagLogger::getInstance().attribute( "unsignedValue", auInt );
float aFloat = 0.0;
- aMapIter->second.getValue() >>= aFloat;
- TagLogger::getInstance().attribute("floatValue", aFloat);
+ rPropPair.second.getValue() >>= aFloat;
+ TagLogger::getInstance().attribute( "floatValue", aFloat );
OUString aStr;
- aMapIter->second.getValue() >>= auInt;
- TagLogger::getInstance().attribute("stringValue", aStr);
+ rPropPair.second.getValue() >>= auInt;
+ TagLogger::getInstance().attribute( "stringValue", aStr );
}
- catch (...) {
+ catch ( ... )
+ {
}
}
- break;
+ break;
}
TagLogger::getInstance().endElement();
-
- ++aMapIter;
}
TagLogger::getInstance().endElement();
}
#endif
-void PropertyMap::InsertProps(const PropertyMapPtr& rMap)
+void PropertyMap::InsertProps( const PropertyMapPtr& rMap )
{
- if (rMap)
+ if ( rMap )
{
- MapIterator pEnd = rMap->m_vMap.end();
- for ( MapIterator iter = rMap->m_vMap.begin(); iter!=pEnd; ++iter )
- m_vMap[iter->first] = iter->second;
+ for ( const auto& rPropPair : rMap->m_vMap )
+ m_vMap[rPropPair.first] = rPropPair.second;
- insertTableProperties(rMap.get());
+ insertTableProperties( rMap.get() );
Invalidate();
}
@@ -353,35 +325,33 @@ void PropertyMap::InsertProps(const PropertyMapPtr& rMap)
void PropertyMap::insertTableProperties( const PropertyMap* )
{
#ifdef DEBUG_WRITERFILTER
- TagLogger::getInstance().element("PropertyMap.insertTableProperties");
+ TagLogger::getInstance().element( "PropertyMap.insertTableProperties" );
#endif
}
void PropertyMap::printProperties()
{
#ifdef DEBUG_WRITERFILTER
- TagLogger::getInstance().startElement("properties");
+ TagLogger::getInstance().startElement( "properties" );
- MapIterator aMapIter = m_vMap.begin();
- MapIterator aEndIter = m_vMap.end();
- for( ; aMapIter != aEndIter; ++aMapIter )
+ for ( const auto& rPropPair : m_vMap )
{
- SAL_INFO("writerfilter", getPropertyName(aMapIter->first));
+ SAL_INFO( "writerfilter", getPropertyName( rPropPair.first ) );
table::BorderLine2 aLine;
sal_Int32 nColor;
- if ( aMapIter->second.getValue() >>= aLine )
+ if ( rPropPair.second.getValue() >>= aLine )
{
- TagLogger::getInstance().startElement("borderline");
- TagLogger::getInstance().attribute("color", aLine.Color);
- TagLogger::getInstance().attribute("inner", aLine.InnerLineWidth);
- TagLogger::getInstance().attribute("outer", aLine.OuterLineWidth);
+ TagLogger::getInstance().startElement( "borderline" );
+ TagLogger::getInstance().attribute( "color", aLine.Color );
+ TagLogger::getInstance().attribute( "inner", aLine.InnerLineWidth );
+ TagLogger::getInstance().attribute( "outer", aLine.OuterLineWidth );
TagLogger::getInstance().endElement();
}
- else if ( aMapIter->second.getValue() >>= nColor )
+ else if ( rPropPair.second.getValue() >>= nColor )
{
- TagLogger::getInstance().startElement("color");
- TagLogger::getInstance().attribute("number", nColor);
+ TagLogger::getInstance().startElement( "color" );
+ TagLogger::getInstance().attribute( "number", nColor );
TagLogger::getInstance().endElement();
}
}
@@ -392,237 +362,232 @@ void PropertyMap::printProperties()
#endif
}
-SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
- m_bIsFirstSection( bIsFirstSection )
- ,m_nBorderParams( 0 )
- ,m_bTitlePage( false )
- ,m_nColumnCount( 0 )
- ,m_nColumnDistance( 1249 )
- ,m_xColumnContainer( nullptr )
- ,m_bSeparatorLineIsOn( false )
- ,m_bEvenlySpaced( false )
- ,m_bIsLandscape( false )
- ,m_bPageNoRestart( false )
- ,m_nPageNumber( -1 )
- ,m_nPageNumberType(-1)
- ,m_nBreakType( -1 )
- ,m_nPaperBin( -1 )
- ,m_nFirstPaperBin( -1 )
- ,m_nLeftMargin( 3175 ) //page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
- ,m_nRightMargin( 3175 )//page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
- ,m_nTopMargin( 2540 )
- ,m_nBottomMargin( 2540 )
- ,m_nHeaderTop( 1270 ) //720 twip
- ,m_nHeaderBottom( 1270 )//720 twip
- ,m_nDzaGutter( 0 )
- ,m_nGridType(0)
- ,m_nGridLinePitch( 1 )
- ,m_nDxtCharSpace( 0 )
- ,m_bGridSnapToChars(true)
- ,m_nLnnMod( 0 )
- ,m_nLnc( 0 )
- ,m_ndxaLnn( 0 )
- ,m_nLnnMin( 0 )
- ,m_bDefaultHeaderLinkToPrevious(true)
- ,m_bEvenPageHeaderLinkToPrevious(true)
- ,m_bFirstPageHeaderLinkToPrevious(true)
- ,m_bDefaultFooterLinkToPrevious(true)
- ,m_bEvenPageFooterLinkToPrevious(true)
- ,m_bFirstPageFooterLinkToPrevious(true)
+SectionPropertyMap::SectionPropertyMap( bool bIsFirstSection )
+ : m_bIsFirstSection( bIsFirstSection )
+ , m_nBorderParams( 0 )
+ , m_bTitlePage( false )
+ , m_nColumnCount( 0 )
+ , m_nColumnDistance( 1249 )
+ , m_xColumnContainer( nullptr )
+ , m_bSeparatorLineIsOn( false )
+ , m_bEvenlySpaced( false )
+ , m_bIsLandscape( false )
+ , m_bPageNoRestart( false )
+ , m_nPageNumber( -1 )
+ , m_nPageNumberType( -1 )
+ , m_nBreakType( -1 )
+ , m_nPaperBin( -1 )
+ , m_nFirstPaperBin( -1 )
+ , m_nLeftMargin( 3175 ) // page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
+ , m_nRightMargin( 3175 ) // page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
+ , m_nTopMargin( 2540 )
+ , m_nBottomMargin( 2540 )
+ , m_nHeaderTop( 1270 ) // 720 twip
+ , m_nHeaderBottom( 1270 ) // 720 twip
+ , m_nDzaGutter( 0 )
+ , m_nGridType( 0 )
+ , m_nGridLinePitch( 1 )
+ , m_nDxtCharSpace( 0 )
+ , m_bGridSnapToChars( true )
+ , m_nLnnMod( 0 )
+ , m_nLnc( 0 )
+ , m_ndxaLnn( 0 )
+ , m_nLnnMin( 0 )
+ , m_bDefaultHeaderLinkToPrevious( true )
+ , m_bEvenPageHeaderLinkToPrevious( true )
+ , m_bFirstPageHeaderLinkToPrevious( true )
+ , m_bDefaultFooterLinkToPrevious( true )
+ , m_bEvenPageFooterLinkToPrevious( true )
+ , m_bFirstPageFooterLinkToPrevious( true )
{
+#ifdef DEBUG_WRITERFILTER
static sal_Int32 nNumber = 0;
- nSectionNumber = nNumber++;
- for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder )
+ m_nDebugSectionNumber = nNumber++;
+#endif
+
+ for ( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder )
{
- m_nBorderDistances[ nBorder ] = -1;
+ m_nBorderDistances[nBorder] = -1;
m_bBorderShadows[nBorder] = false;
}
- //todo: set defaults in ApplyPropertiesToPageStyles
- //initialize defaults
- PaperInfo aLetter(PAPER_LETTER);
- //page height, 1/100mm
- Insert( PROP_HEIGHT, uno::makeAny( (sal_Int32) aLetter.getHeight() ) );
- //page width, 1/100mm
- Insert( PROP_WIDTH, uno::makeAny( (sal_Int32) aLetter.getWidth() ) );
- //page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
- Insert( PROP_LEFT_MARGIN, uno::makeAny( (sal_Int32) 3175 ) );
- //page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
- Insert( PROP_RIGHT_MARGIN, uno::makeAny( (sal_Int32) 3175 ) );
- //page top margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
+ // todo: set defaults in ApplyPropertiesToPageStyles
+ // initialize defaults
+ PaperInfo aLetter( PAPER_LETTER );
+ // page height, 1/100mm
+ Insert( PROP_HEIGHT, uno::makeAny( (sal_Int32)aLetter.getHeight() ) );
+ // page width, 1/100mm
+ Insert( PROP_WIDTH, uno::makeAny( (sal_Int32)aLetter.getWidth() ) );
+ // page left margin, default 0x708 (1800) twip -> 3175 1/100 mm
+ Insert( PROP_LEFT_MARGIN, uno::makeAny( (sal_Int32)3175 ) );
+ // page right margin, default 0x708 (1800) twip -> 3175 1/100 mm
+ Insert( PROP_RIGHT_MARGIN, uno::makeAny( (sal_Int32)3175 ) );
+ // page top margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
Insert( PROP_TOP_MARGIN, uno::makeAny( (sal_Int32)2540 ) );
- //page bottom margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
- Insert( PROP_BOTTOM_MARGIN, uno::makeAny( (sal_Int32) 2540 ) );
- //page style layout
- Insert(PROP_PAGE_STYLE_LAYOUT, uno::makeAny(style::PageStyleLayout_ALL));
- uno::Any aFalse( ::uno::makeAny( false ) );
- Insert( PROP_GRID_DISPLAY, aFalse);
- Insert( PROP_GRID_PRINT, aFalse);
- Insert( PROP_GRID_MODE, uno::makeAny(text::TextGridMode::NONE));
-
-
- if( m_bIsFirstSection )
+ // page bottom margin, default 0x5a0 (1440) twip -> 2540 1/100 mm
+ Insert( PROP_BOTTOM_MARGIN, uno::makeAny( (sal_Int32)2540 ) );
+ // page style layout
+ Insert( PROP_PAGE_STYLE_LAYOUT, uno::makeAny( style::PageStyleLayout_ALL ) );
+ uno::Any aFalse( uno::makeAny( false ) );
+ Insert( PROP_GRID_DISPLAY, aFalse );
+ Insert( PROP_GRID_PRINT, aFalse );
+ Insert( PROP_GRID_MODE, uno::makeAny( text::TextGridMode::NONE ) );
+
+ if ( m_bIsFirstSection )
{
m_sFirstPageStyleName = getPropertyName( PROP_FIRST_PAGE );
m_sFollowPageStyleName = getPropertyName( PROP_STANDARD );
}
}
-
-SectionPropertyMap::~SectionPropertyMap()
-{
-}
-
-
-OUString lcl_FindUnusedPageStyleName(const uno::Sequence< OUString >& rPageStyleNames)
+OUString lcl_FindUnusedPageStyleName( const uno::Sequence< OUString >& rPageStyleNames )
{
static const char DEFAULT_STYLE[] = "Converted";
- //find the highest number x in each style with the name "DEFAULT_STYLE+x" and
- //return an incremented name
- sal_Int32 nMaxIndex = 0;
+ sal_Int32 nMaxIndex = 0;
+ // find the highest number x in each style with the name "DEFAULT_STYLE+x" and
+ // return an incremented name
const OUString* pStyleNames = rPageStyleNames.getConstArray();
- for( sal_Int32 nStyle = 0; nStyle < rPageStyleNames.getLength(); ++nStyle)
+ for ( sal_Int32 nStyle = 0; nStyle < rPageStyleNames.getLength(); ++nStyle )
{
- if( pStyleNames[nStyle].startsWith(DEFAULT_STYLE) )
+ if ( pStyleNames[nStyle].startsWith( DEFAULT_STYLE ) )
{
- sal_Int32 nIndex = pStyleNames[nStyle].copy( strlen(DEFAULT_STYLE) ).toInt32();
- if( nIndex > nMaxIndex)
+ sal_Int32 nIndex = pStyleNames[nStyle].copy( strlen( DEFAULT_STYLE ) ).toInt32();
+ if ( nIndex > nMaxIndex )
nMaxIndex = nIndex;
}
}
- return DEFAULT_STYLE + OUString::number( nMaxIndex + 1);
-}
+ return DEFAULT_STYLE + OUString::number( nMaxIndex + 1 );
+}
-uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
- const uno::Reference< container::XNameContainer >& xPageStyles,
- const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
- bool bFirst )
+uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( const uno::Reference< container::XNameContainer >& xPageStyles,
+ const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
+ bool bFirst )
{
uno::Reference< beans::XPropertySet > xRet;
try
{
- if( bFirst )
+ if ( bFirst )
{
- if( m_sFirstPageStyleName.isEmpty() && xPageStyles.is() )
+ if ( m_sFirstPageStyleName.isEmpty() && xPageStyles.is() )
{
uno::Sequence< OUString > aPageStyleNames = xPageStyles->getElementNames();
- m_sFirstPageStyleName = lcl_FindUnusedPageStyleName(aPageStyleNames);
- m_aFirstPageStyle.set( xTextFactory->createInstance("com.sun.star.style.PageStyle"),
- uno::UNO_QUERY);
+ m_sFirstPageStyleName = lcl_FindUnusedPageStyleName( aPageStyleNames );
+ m_aFirstPageStyle.set( xTextFactory->createInstance( "com.sun.star.style.PageStyle" ),
+ uno::UNO_QUERY );
// Call insertByName() before GetPageStyle(), otherwise the
// first and the follow page style will have the same name, and
// insertByName() will fail.
- if (xPageStyles.is())
- xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) );
+ if ( xPageStyles.is() )
+ xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny( m_aFirstPageStyle ) );
// Ensure that m_aFollowPageStyle has been created
GetPageStyle( xPageStyles, xTextFactory, false );
// Chain m_aFollowPageStyle to be after m_aFirstPageStyle
- m_aFirstPageStyle->setPropertyValue("FollowStyle",
- uno::makeAny(m_sFollowPageStyleName));
+ m_aFirstPageStyle->setPropertyValue( "FollowStyle",
+ uno::makeAny( m_sFollowPageStyleName ) );
}
- else if( !m_aFirstPageStyle.is() && xPageStyles.is() )
+ else if ( !m_aFirstPageStyle.is() && xPageStyles.is() )
{
- xPageStyles->getByName(m_sFirstPageStyleName) >>= m_aFirstPageStyle;
+ xPageStyles->getByName( m_sFirstPageStyleName ) >>= m_aFirstPageStyle;
}
xRet = m_aFirstPageStyle;
}
else
{
- if( m_sFollowPageStyleName.isEmpty() && xPageStyles.is() )
+ if ( m_sFollowPageStyleName.isEmpty() && xPageStyles.is() )
{
uno::Sequence< OUString > aPageStyleNames = xPageStyles->getElementNames();
- m_sFollowPageStyleName = lcl_FindUnusedPageStyleName(aPageStyleNames);
- m_aFollowPageStyle.set( xTextFactory->createInstance("com.sun.star.style.PageStyle"),
- uno::UNO_QUERY);
- xPageStyles->insertByName( m_sFollowPageStyleName, uno::makeAny(m_aFollowPageStyle) );
+ m_sFollowPageStyleName = lcl_FindUnusedPageStyleName( aPageStyleNames );
+ m_aFollowPageStyle.set( xTextFactory->createInstance( "com.sun.star.style.PageStyle" ),
+ uno::UNO_QUERY );
+ xPageStyles->insertByName( m_sFollowPageStyleName, uno::makeAny( m_aFollowPageStyle ) );
}
- else if(!m_aFollowPageStyle.is() && xPageStyles.is() )
+ else if ( !m_aFollowPageStyle.is() && xPageStyles.is() )
{
- xPageStyles->getByName(m_sFollowPageStyleName) >>= m_aFollowPageStyle;
+ xPageStyles->getByName( m_sFollowPageStyleName ) >>= m_aFollowPageStyle;
}
xRet = m_aFollowPageStyle;
}
}
- catch( const uno::Exception& rException )
+ catch ( const uno::Exception& rException )
{
- SAL_WARN("writerfilter", "SectionPropertyMap::GetPageStyle() failed: " << rException.Message);
+ SAL_WARN( "writerfilter", "SectionPropertyMap::GetPageStyle() failed: " << rException.Message );
}
return xRet;
}
-
void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const table::BorderLine2& rBorderLine, bool bShadow )
{
- m_oBorderLines[ePos] = rBorderLine;
+ m_oBorderLines[ePos] = rBorderLine;
m_nBorderDistances[ePos] = nLineDistance;
- m_bBorderShadows[ePos] = bShadow;
+ m_bBorderShadows[ePos] = bShadow;
}
-
-void SectionPropertyMap::ApplyBorderToPageStyles(
- const uno::Reference< container::XNameContainer >& xPageStyles,
- const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
- sal_Int32 nValue )
+void SectionPropertyMap::ApplyBorderToPageStyles( const uno::Reference< container::XNameContainer >& xPageStyles,
+ const uno::Reference < lang::XMultiServiceFactory >& xTextFactory,
+ sal_Int32 nValue )
{
- /*
- page border applies to:
- nIntValue & 0x07 ->
- 0 all pages in this section
- 1 first page in this section
- 2 all pages in this section but first
- 3 whole document (all sections)
- nIntValue & 0x18 -> page border depth 0 - in front 1- in back
- nIntValue & 0xe0 ->
- page border offset from:
- 0 offset from text
- 1 offset from edge of page
- */
- uno::Reference< beans::XPropertySet > xFirst;
- uno::Reference< beans::XPropertySet > xSecond;
+ /*
+ page border applies to:
+ nIntValue & 0x07 ->
+ 0 all pages in this section
+ 1 first page in this section
+ 2 all pages in this section but first
+ 3 whole document (all sections)
+ nIntValue & 0x18 -> page border depth 0 - in front 1- in back
+ nIntValue & 0xe0 ->
+ page border offset from:
+ 0 offset from text
+ 1 offset from edge of page
+ */
+ uno::Reference< beans::XPropertySet > xFirst;
+ uno::Reference< beans::XPropertySet > xSecond;
sal_Int32 nOffsetFrom = (nValue & 0x00E0) >> 5;
- //todo: negative spacing (from ww8par6.cxx)
- switch( nValue & 0x07)
+ // todo: negative spacing (from ww8par6.cxx)
+ switch ( nValue & 0x07 )
{
- case 0: /*all styles*/
+ case 0: // all styles
if ( !m_sFollowPageStyleName.isEmpty() )
xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
if ( !m_sFirstPageStyleName.isEmpty() )
xSecond = GetPageStyle( xPageStyles, xTextFactory, true );
- break;
- case 1: /*first page*/
+ break;
+ case 1: // first page
if ( !m_sFirstPageStyleName.isEmpty() )
xFirst = GetPageStyle( xPageStyles, xTextFactory, true );
- break;
- case 2: /*left and right*/
+ break;
+ case 2: // left and right
if ( !m_sFollowPageStyleName.isEmpty() )
- xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
- break;
- case 3: //whole document?
- //todo: how to apply a border to the whole document - find all sections or access all page styles?
+ xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
+ break;
+ case 3: // whole document?
+ // todo: how to apply a border to the whole document - find all sections or access all page styles?
default:
return;
}
- //has to be sorted like enum BorderPosition: l-r-t-b
- static const PropertyIds aBorderIds[4] =
+
+ // has to be sorted like enum BorderPosition: l-r-t-b
+ const PropertyIds aBorderIds[4] =
{
PROP_LEFT_BORDER,
PROP_RIGHT_BORDER,
PROP_TOP_BORDER,
PROP_BOTTOM_BORDER
};
- static const PropertyIds aBorderDistanceIds[4] =
+
+ const PropertyIds aBorderDistanceIds[4] =
{
PROP_LEFT_BORDER_DISTANCE,
PROP_RIGHT_BORDER_DISTANCE,
PROP_TOP_BORDER_DISTANCE,
PROP_BOTTOM_BORDER_DISTANCE
};
- static const PropertyIds aMarginIds[4] =
+
+ const PropertyIds aMarginIds[4] =
{
PROP_LEFT_MARGIN,
PROP_RIGHT_MARGIN,
@@ -630,58 +595,62 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
PROP_BOTTOM_MARGIN
};
- for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
+ for ( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder )
{
- if( m_oBorderLines[nBorder] )
+ if ( m_oBorderLines[nBorder] )
{
const OUString sBorderName = getPropertyName( aBorderIds[nBorder] );
- if (xFirst.is())
- xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ));
- if(xSecond.is())
- xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ));
+ if ( xFirst.is() )
+ xFirst->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ) );
+ if ( xSecond.is() )
+ xSecond->setPropertyValue( sBorderName, uno::makeAny( *m_oBorderLines[nBorder] ) );
}
- if( m_nBorderDistances[nBorder] >= 0 )
+ if ( m_nBorderDistances[nBorder] >= 0 )
{
sal_uInt32 nLineWidth = 0;
- if (m_oBorderLines[nBorder])
+ if ( m_oBorderLines[nBorder] )
nLineWidth = m_oBorderLines[nBorder]->LineWidth;
- if(xFirst.is())
+ if ( xFirst.is() )
SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
- m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
- if(xSecond.is())
+ m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
+ if ( xSecond.is() )
SetBorderDistance( xSecond, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
- m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
+ m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth );
}
}
- if (m_bBorderShadows[BORDER_RIGHT])
+ if ( m_bBorderShadows[BORDER_RIGHT] )
{
- table::ShadowFormat aFormat = getShadowFromBorder(*m_oBorderLines[BORDER_RIGHT]);
- if (xFirst.is())
- xFirst->setPropertyValue(getPropertyName(PROP_SHADOW_FORMAT), uno::makeAny(aFormat));
- if (xSecond.is())
- xSecond->setPropertyValue(getPropertyName(PROP_SHADOW_FORMAT), uno::makeAny(aFormat));
+ table::ShadowFormat aFormat = getShadowFromBorder( *m_oBorderLines[BORDER_RIGHT] );
+ if ( xFirst.is() )
+ xFirst->setPropertyValue( getPropertyName( PROP_SHADOW_FORMAT ), uno::makeAny( aFormat ) );
+ if ( xSecond.is() )
+ xSecond->setPropertyValue( getPropertyName( PROP_SHADOW_FORMAT ), uno::makeAny( aFormat ) );
}
}
-table::ShadowFormat PropertyMap::getShadowFromBorder(const table::BorderLine2& rBorder)
+table::ShadowFormat PropertyMap::getShadowFromBorder( const table::BorderLine2& rBorder )
{
// In Word UI, shadow is a boolean property, in OOXML, it's a boolean
// property of each 4 border type, finally in Writer the border is a
// property of the page style, with shadow location, distance and
// color. See SwWW8ImplReader::SetShadow().
table::ShadowFormat aFormat;
- aFormat.Color = COL_BLACK;
- aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT;
+ aFormat.Color = COL_BLACK;
+ aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT;
aFormat.ShadowWidth = rBorder.LineWidth;
return aFormat;
}
-void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > const& xStyle,
- PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth )
+void SectionPropertyMap::SetBorderDistance( const uno::Reference< beans::XPropertySet >& xStyle,
+ PropertyIds eMarginId,
+ PropertyIds eDistId,
+ sal_Int32 nDistance,
+ sal_Int32 nOffsetFrom,
+ sal_uInt32 nLineWidth )
{
sal_Int32 nDist = nDistance;
- if( nOffsetFrom == 1 ) // From page
+ if ( nOffsetFrom == 1 ) // From page
{
const OUString sMarginName = getPropertyName( eMarginId );
uno::Any aMargin = xStyle->getPropertyValue( sMarginName );
@@ -695,45 +664,45 @@ void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet
nDist = nMargin - nDistance - nLineWidth;
}
const OUString sBorderDistanceName = getPropertyName( eDistId );
- if (xStyle.is())
- xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ));
+ if ( xStyle.is() )
+ xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ) );
}
void SectionPropertyMap::DontBalanceTextColumns()
{
try
{
- if( m_xColumnContainer.is() )
- m_xColumnContainer->setPropertyValue("DontBalanceTextColumns", uno::makeAny(true));
+ if ( m_xColumnContainer.is() )
+ m_xColumnContainer->setPropertyValue( "DontBalanceTextColumns", uno::makeAny( true ) );
}
- catch( const uno::Exception& )
+ catch ( const uno::Exception& )
{
- OSL_FAIL( "Exception in SectionPropertyMap::DontBalanceTextColumns");
+ OSL_FAIL( "Exception in SectionPropertyMap::DontBalanceTextColumns" );
}
}
-uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
- uno::Reference< beans::XPropertySet > const& xColumnContainer, DomainMapper_Impl& rDM_Impl )
+uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties( const uno::Reference< beans::XPropertySet >& xColumnContainer,
+ DomainMapper_Impl& rDM_Impl )
{
uno::Reference< text::XTextColumns > xColumns;
try
{
const OUString sTextColumns = getPropertyName( PROP_TEXT_COLUMNS );
- if (xColumnContainer.is())
- xColumnContainer->getPropertyValue(sTextColumns) >>= xColumns;
+ if ( xColumnContainer.is() )
+ xColumnContainer->getPropertyValue( sTextColumns ) >>= xColumns;
uno::Reference< beans::XPropertySet > xColumnPropSet( xColumns, uno::UNO_QUERY_THROW );
- if( !m_bEvenlySpaced &&
- (sal_Int32(m_aColWidth.size()) == (m_nColumnCount + 1 )) &&
- ((sal_Int32(m_aColDistance.size()) == m_nColumnCount) || (sal_Int32(m_aColDistance.size()) == m_nColumnCount + 1)) )
+ if ( !m_bEvenlySpaced &&
+ ( sal_Int32(m_aColWidth.size()) == (m_nColumnCount + 1) ) &&
+ ( (sal_Int32(m_aColDistance.size()) == m_nColumnCount) || (sal_Int32(m_aColDistance.size()) == m_nColumnCount + 1) ) )
{
- //the column width in word is an absolute value, in OOo it's relative
- //the distances are both absolute
+ // the column width in word is an absolute value, in OOo it's relative
+ // the distances are both absolute
sal_Int32 nColSum = 0;
- for( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol)
+ for ( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol )
{
nColSum += m_aColWidth[nCol];
- if(nCol)
- nColSum += m_aColDistance[nCol -1];
+ if ( nCol )
+ nColSum += m_aColDistance[nCol - 1];
}
sal_Int32 nRefValue = xColumns->getReferenceValue();
@@ -742,109 +711,106 @@ uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
text::TextColumn* pColumn = aColumns.getArray();
nColSum = 0;
- for( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol)
+ for ( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol )
{
- pColumn[nCol].LeftMargin = nCol ? m_aColDistance[nCol - 1 ] / 2 : 0;
+ pColumn[nCol].LeftMargin = nCol ? m_aColDistance[nCol - 1] / 2 : 0;
pColumn[nCol].RightMargin = nCol == m_nColumnCount ? 0 : m_aColDistance[nCol] / 2;
- pColumn[nCol].Width = sal_Int32((double( m_aColWidth[nCol] + pColumn[nCol].RightMargin + pColumn[nCol].LeftMargin ) + 0.5 ) * fRel );
+ pColumn[nCol].Width = sal_Int32( (double( m_aColWidth[nCol] + pColumn[nCol].RightMargin + pColumn[nCol].LeftMargin ) + 0.5) * fRel );
nColSum += pColumn[nCol].Width;
}
- if( nColSum != nRefValue )
- pColumn[m_nColumnCount].Width -= ( nColSum - nRefValue );
+ if ( nColSum != nRefValue )
+ pColumn[m_nColumnCount].Width -= (nColSum - nRefValue);
xColumns->setColumns( aColumns );
}
else
{
xColumns->setColumnCount( m_nColumnCount + 1 );
- xColumnPropSet->setPropertyValue( getPropertyName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( m_nColumnDistance ));
+ xColumnPropSet->setPropertyValue( getPropertyName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( m_nColumnDistance ) );
}
- if(m_bSeparatorLineIsOn)
+ if ( m_bSeparatorLineIsOn )
{
- xColumnPropSet->setPropertyValue("SeparatorLineIsOn", uno::makeAny(true));
- xColumnPropSet->setPropertyValue("SeparatorLineVerticalAlignment", uno::makeAny(style::VerticalAlignment_TOP));
- xColumnPropSet->setPropertyValue("SeparatorLineRelativeHeight", uno::makeAny(static_cast<sal_Int8>(100)));
- xColumnPropSet->setPropertyValue("SeparatorLineColor", uno::makeAny(static_cast<sal_Int32>(COL_BLACK)));
+ xColumnPropSet->setPropertyValue( "SeparatorLineIsOn", uno::makeAny( true ) );
+ xColumnPropSet->setPropertyValue( "SeparatorLineVerticalAlignment", uno::makeAny( style::VerticalAlignment_TOP ) );
+ xColumnPropSet->setPropertyValue( "SeparatorLineRelativeHeight", uno::makeAny( static_cast<sal_Int8>(100) ) );
+ xColumnPropSet->setPropertyValue( "SeparatorLineColor", uno::makeAny( static_cast<sal_Int32>(COL_BLACK) ) );
// 1 twip -> 2 mm100.
- xColumnPropSet->setPropertyValue("SeparatorLineWidth", uno::makeAny(static_cast<sal_Int32>(2)));
+ xColumnPropSet->setPropertyValue( "SeparatorLineWidth", uno::makeAny( static_cast<sal_Int32>(2) ) );
}
xColumnContainer->setPropertyValue( sTextColumns, uno::makeAny( xColumns ) );
// Set the columns to be unbalanced if that compatibility option is set or this is the last section.
m_xColumnContainer = xColumnContainer;
- if (rDM_Impl.GetSettingsTable()->GetNoColumnBalance() || rDM_Impl.GetIsLastSectionGroup())
+ if ( rDM_Impl.GetSettingsTable()->GetNoColumnBalance() || rDM_Impl.GetIsLastSectionGroup() )
DontBalanceTextColumns();
}
- catch( const uno::Exception& )
+ catch ( const uno::Exception& )
{
- OSL_FAIL( "Exception in SectionPropertyMap::ApplyColumnProperties");
+ OSL_FAIL( "Exception in SectionPropertyMap::ApplyColumnProperties" );
}
return xColumns;
}
-
-bool SectionPropertyMap::HasHeader(bool bFirstPage) const
+bool SectionPropertyMap::HasHeader( bool bFirstPage ) const
{
bool bRet = false;
- if( (bFirstPage && m_aFirstPageStyle.is()) ||( !bFirstPage && m_aFollowPageStyle.is()) )
+ if ( (bFirstPage && m_aFirstPageStyle.is()) || (!bFirstPage && m_aFollowPageStyle.is()) )
{
- if( bFirstPage )
+ if ( bFirstPage )
m_aFirstPageStyle->getPropertyValue(
- getPropertyName(PROP_HEADER_IS_ON) ) >>= bRet;
+ getPropertyName( PROP_HEADER_IS_ON ) ) >>= bRet;
else
m_aFollowPageStyle->getPropertyValue(
- getPropertyName(PROP_HEADER_IS_ON) ) >>= bRet;
+ getPropertyName( PROP_HEADER_IS_ON ) ) >>= bRet;
}
return bRet;
}
-
-bool SectionPropertyMap::HasFooter(bool bFirstPage) const
+bool SectionPropertyMap::HasFooter( bool bFirstPage ) const
{
bool bRet = false;
- if( (bFirstPage && m_aFirstPageStyle.is()) ||( !bFirstPage && m_aFollowPageStyle.is()) )
+ if ( (bFirstPage && m_aFirstPageStyle.is()) || (!bFirstPage && m_aFollowPageStyle.is()) )
{
- if( bFirstPage )
- m_aFirstPageStyle->getPropertyValue( getPropertyName(PROP_FOOTER_IS_ON) ) >>= bRet;
+ if ( bFirstPage )
+ m_aFirstPageStyle->getPropertyValue( getPropertyName( PROP_FOOTER_IS_ON ) ) >>= bRet;
else
- m_aFollowPageStyle->getPropertyValue( getPropertyName(PROP_FOOTER_IS_ON) ) >>= bRet;
+ m_aFollowPageStyle->getPropertyValue( getPropertyName( PROP_FOOTER_IS_ON ) ) >>= bRet;
}
return bRet;
}
+#define MIN_HEAD_FOOT_HEIGHT 100 // minimum header/footer height
-#define MIN_HEAD_FOOT_HEIGHT 100 //minimum header/footer height
-
-void SectionPropertyMap::CopyHeaderFooterTextProperty (
- const uno::Reference< beans::XPropertySet >& xPrevStyle,
- const uno::Reference< beans::XPropertySet >& xStyle,
- PropertyIds ePropId )
+void SectionPropertyMap::CopyHeaderFooterTextProperty( const uno::Reference< beans::XPropertySet >& xPrevStyle,
+ const uno::Reference< beans::XPropertySet >& xStyle,
+ PropertyIds ePropId )
{
try {
OUString sName = getPropertyName( ePropId );
- SAL_INFO("writerfilter", "Copying " << sName);
+ SAL_INFO( "writerfilter", "Copying " << sName );
uno::Reference< text::XTextCopy > xTxt;
- if (xStyle.is())
- xTxt.set(xStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
+ if ( xStyle.is() )
+ xTxt.set( xStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
uno::Reference< text::XTextCopy > xPrevTxt;
- if (xPrevStyle.is())
- xPrevTxt.set(xPrevStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
+ if ( xPrevStyle.is() )
+ xPrevTxt.set( xPrevStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
xTxt->copyText( xPrevTxt );
}
catch ( const uno::Exception& e )
{
- SAL_INFO("writerfilter", "An exception occurred in SectionPropertyMap::CopyHeaderFooterTextProperty( ) - " << e.Message);
+ SAL_INFO( "writerfilter", "An exception occurred in SectionPropertyMap::CopyHeaderFooterTextProperty( ) - " << e.Message );
}
}
// Copy headers and footers from the previous page style.
-void SectionPropertyMap::CopyHeaderFooter(
- const uno::Reference< beans::XPropertySet >& xPrevStyle,
- const uno::Reference< beans::XPropertySet >& xStyle,
- bool bOmitRightHeader, bool bOmitLeftHeader,
- bool bOmitRightFooter, bool bOmitLeftFooter)
+void SectionPropertyMap::CopyHeaderFooter( const uno::Reference< beans::XPropertySet >& xPrevStyle,
+ const uno::Reference< beans::XPropertySet >& xStyle,
+ bool bOmitRightHeader,
+ bool bOmitLeftHeader,
+ bool bOmitRightFooter,
+ bool bOmitLeftFooter )
{
bool bHasPrevHeader = false;
bool bHeaderIsShared = true;
@@ -859,16 +825,16 @@ void SectionPropertyMap::CopyHeaderFooter(
if ( bHasPrevHeader )
{
xStyle->setPropertyValue( sHeaderIsOn, uno::makeAny( true ) );
- xStyle->setPropertyValue( sHeaderIsShared, uno::makeAny(bHeaderIsShared));
+ xStyle->setPropertyValue( sHeaderIsShared, uno::makeAny( bHeaderIsShared ) );
if ( !bOmitRightHeader )
{
CopyHeaderFooterTextProperty( xPrevStyle, xStyle,
- PROP_HEADER_TEXT );
+ PROP_HEADER_TEXT );
}
if ( !bHeaderIsShared && !bOmitLeftHeader )
{
CopyHeaderFooterTextProperty( xPrevStyle, xStyle,
- PROP_HEADER_TEXT_LEFT );
+ PROP_HEADER_TEXT_LEFT );
}
}
@@ -885,16 +851,16 @@ void SectionPropertyMap::CopyHeaderFooter(
if ( bHasPrevFooter )
{
xStyle->setPropertyValue( sFooterIsOn, uno::makeAny( true ) );
- xStyle->setPropertyValue( sFooterIsShared, uno::makeAny(bFooterIsShared) );
+ xStyle->setPropertyValue( sFooterIsShared, uno::makeAny( bFooterIsShared ) );
if ( !bOmitRightFooter )
{
CopyHeaderFooterTextProperty( xPrevStyle, xStyle,
- PROP_FOOTER_TEXT );
+ PROP_FOOTER_TEXT );
}
if ( !bFooterIsShared && !bOmitLeftFooter )
{
CopyHeaderFooterTextProperty( xPrevStyle, xStyle,
- PROP_FOOTER_TEXT_LEFT );
+ PROP_FOOTER_TEXT_LEFT );
}
}
}
@@ -907,148 +873,146 @@ void SectionPropertyMap::CopyHeaderFooter(
// across page styles so we just copy the content from the previous section.
void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl )
{
- SAL_INFO("writerfilter", "START>>> SectionPropertyMap::CopyLastHeaderFooter()");
- SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext( );
+ SAL_INFO( "writerfilter", "START>>> SectionPropertyMap::CopyLastHeaderFooter()" );
+ SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
if ( pLastContext )
{
- uno::Reference< beans::XPropertySet > xPrevStyle = pLastContext->GetPageStyle(
- rDM_Impl.GetPageStyles(),
- rDM_Impl.GetTextFactory(),
- bFirstPage );
- uno::Reference< beans::XPropertySet > xStyle = GetPageStyle(
- rDM_Impl.GetPageStyles(),
- rDM_Impl.GetTextFactory(),
- bFirstPage );
-
- if (bFirstPage)
+ uno::Reference< beans::XPropertySet > xPrevStyle = pLastContext->GetPageStyle( rDM_Impl.GetPageStyles(),
+ rDM_Impl.GetTextFactory(),
+ bFirstPage );
+ uno::Reference< beans::XPropertySet > xStyle = GetPageStyle( rDM_Impl.GetPageStyles(),
+ rDM_Impl.GetTextFactory(),
+ bFirstPage );
+
+ if ( bFirstPage )
{
CopyHeaderFooter( xPrevStyle, xStyle,
- !m_bFirstPageHeaderLinkToPrevious, true,
- !m_bFirstPageFooterLinkToPrevious, true);
+ !m_bFirstPageHeaderLinkToPrevious, true,
+ !m_bFirstPageFooterLinkToPrevious, true );
}
else
{
CopyHeaderFooter( xPrevStyle, xStyle,
- !m_bDefaultHeaderLinkToPrevious,
- !m_bEvenPageHeaderLinkToPrevious,
- !m_bDefaultFooterLinkToPrevious,
- !m_bEvenPageFooterLinkToPrevious);
+ !m_bDefaultHeaderLinkToPrevious,
+ !m_bEvenPageHeaderLinkToPrevious,
+ !m_bDefaultFooterLinkToPrevious,
+ !m_bEvenPageFooterLinkToPrevious );
}
}
- SAL_INFO("writerfilter", "END>>> SectionPropertyMap::CopyLastHeaderFooter()");
+ SAL_INFO( "writerfilter", "END>>> SectionPropertyMap::CopyLastHeaderFooter()" );
}
void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
{
sal_Int32 nTopMargin = m_nTopMargin;
sal_Int32 nHeaderTop = m_nHeaderTop;
- if(HasHeader(bFirstPage))
+ if ( HasHeader( bFirstPage ) )
{
nTopMargin = nHeaderTop;
- if( m_nTopMargin > 0 && m_nTopMargin > nHeaderTop )
+ if ( m_nTopMargin > 0 && m_nTopMargin > nHeaderTop )
nHeaderTop = m_nTopMargin - nHeaderTop;
else
nHeaderTop = 0;
- //minimum header height 1mm
- if( nHeaderTop < MIN_HEAD_FOOT_HEIGHT )
+ // minimum header height 1mm
+ if ( nHeaderTop < MIN_HEAD_FOOT_HEIGHT )
nHeaderTop = MIN_HEAD_FOOT_HEIGHT;
}
- if( m_nTopMargin >= 0 ) //fixed height header -> see WW8Par6.hxx
+ if ( m_nTopMargin >= 0 ) //fixed height header -> see WW8Par6.hxx
{
- Insert(PROP_HEADER_IS_DYNAMIC_HEIGHT, uno::makeAny( true ));
- Insert(PROP_HEADER_DYNAMIC_SPACING, uno::makeAny( true ));
- Insert(PROP_HEADER_BODY_DISTANCE, uno::makeAny( nHeaderTop - MIN_HEAD_FOOT_HEIGHT ));// ULSpace.Top()
- Insert(PROP_HEADER_HEIGHT, uno::makeAny( nHeaderTop ));
+ Insert( PROP_HEADER_IS_DYNAMIC_HEIGHT, uno::makeAny( true ) );
+ Insert( PROP_HEADER_DYNAMIC_SPACING, uno::makeAny( true ) );
+ Insert( PROP_HEADER_BODY_DISTANCE, uno::makeAny( nHeaderTop - MIN_HEAD_FOOT_HEIGHT ) );// ULSpace.Top()
+ Insert( PROP_HEADER_HEIGHT, uno::makeAny( nHeaderTop ) );
}
else
{
//todo: old filter fakes a frame into the header/footer to support overlapping
//current setting is completely wrong!
- Insert(PROP_HEADER_HEIGHT, uno::makeAny( nHeaderTop ));
- Insert(PROP_HEADER_BODY_DISTANCE, uno::makeAny( m_nTopMargin - nHeaderTop ));
- Insert(PROP_HEADER_IS_DYNAMIC_HEIGHT, uno::makeAny( false ));
- Insert(PROP_HEADER_DYNAMIC_SPACING, uno::makeAny( false ));
+ Insert( PROP_HEADER_HEIGHT, uno::makeAny( nHeaderTop ) );
+ Insert( PROP_HEADER_BODY_DISTANCE, uno::makeAny( m_nTopMargin - nHeaderTop ) );
+ Insert( PROP_HEADER_IS_DYNAMIC_HEIGHT, uno::makeAny( false ) );
+ Insert( PROP_HEADER_DYNAMIC_SPACING, uno::makeAny( false ) );
}
sal_Int32 nBottomMargin = m_nBottomMargin;
sal_Int32 nHeaderBottom = m_nHeaderBottom;
- if( HasFooter( bFirstPage ) )
+ if ( HasFooter( bFirstPage ) )
{
nBottomMargin = nHeaderBottom;
- if( m_nBottomMargin > 0 && m_nBottomMargin > nHeaderBottom )
+ if ( m_nBottomMargin > 0 && m_nBottomMargin > nHeaderBottom )
nHeaderBottom = m_nBottomMargin - nHeaderBottom;
else
nHeaderBottom = 0;
- if( nHeaderBottom < MIN_HEAD_FOOT_HEIGHT )
+ if ( nHeaderBottom < MIN_HEAD_FOOT_HEIGHT )
nHeaderBottom = MIN_HEAD_FOOT_HEIGHT;
}
- if( m_nBottomMargin >= 0 ) //fixed height footer -> see WW8Par6.hxx
+ if ( m_nBottomMargin >= 0 ) //fixed height footer -> see WW8Par6.hxx
{
- Insert(PROP_FOOTER_IS_DYNAMIC_HEIGHT, uno::makeAny( true ));
- Insert(PROP_FOOTER_DYNAMIC_SPACING, uno::makeAny( true ));
- Insert(PROP_FOOTER_BODY_DISTANCE, uno::makeAny( nHeaderBottom - MIN_HEAD_FOOT_HEIGHT));
- Insert(PROP_FOOTER_HEIGHT, uno::makeAny( nHeaderBottom ));
+ Insert( PROP_FOOTER_IS_DYNAMIC_HEIGHT, uno::makeAny( true ) );
+ Insert( PROP_FOOTER_DYNAMIC_SPACING, uno::makeAny( true ) );
+ Insert( PROP_FOOTER_BODY_DISTANCE, uno::makeAny( nHeaderBottom - MIN_HEAD_FOOT_HEIGHT ) );
+ Insert( PROP_FOOTER_HEIGHT, uno::makeAny( nHeaderBottom ) );
}
else
{
//todo: old filter fakes a frame into the header/footer to support overlapping
//current setting is completely wrong!
- Insert(PROP_FOOTER_IS_DYNAMIC_HEIGHT, uno::makeAny( false ));
- Insert(PROP_FOOTER_DYNAMIC_SPACING, uno::makeAny( false ));
- Insert(PROP_FOOTER_HEIGHT, uno::makeAny( m_nBottomMargin - nHeaderBottom ));
- Insert(PROP_FOOTER_BODY_DISTANCE, uno::makeAny( nHeaderBottom ));
+ Insert( PROP_FOOTER_IS_DYNAMIC_HEIGHT, uno::makeAny( false ) );
+ Insert( PROP_FOOTER_DYNAMIC_SPACING, uno::makeAny( false ) );
+ Insert( PROP_FOOTER_HEIGHT, uno::makeAny( m_nBottomMargin - nHeaderBottom ) );
+ Insert( PROP_FOOTER_BODY_DISTANCE, uno::makeAny( nHeaderBottom ) );
}
//now set the top/bottom margin for the follow page style
- Insert(PROP_TOP_MARGIN, uno::makeAny( nTopMargin > 0 ? nTopMargin : 0 ));
- Insert(PROP_BOTTOM_MARGIN, uno::makeAny( nBottomMargin > 0 ? nBottomMargin : 0 ));
+ Insert( PROP_TOP_MARGIN, uno::makeAny( nTopMargin > 0 ? nTopMargin : 0 ) );
+ Insert( PROP_BOTTOM_MARGIN, uno::makeAny( nBottomMargin > 0 ? nBottomMargin : 0 ) );
}
-uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection,
- DomainMapper_Impl& rDM_Impl,
- uno::Reference<text::XTextRange> const& xStartingRange)
+uno::Reference< beans::XPropertySet > lcl_GetRangeProperties( bool bIsFirstSection,
+ DomainMapper_Impl& rDM_Impl,
+ const uno::Reference< text::XTextRange >& xStartingRange )
{
uno::Reference< beans::XPropertySet > xRangeProperties;
- if (bIsFirstSection && rDM_Impl.GetBodyText().is())
+ if ( bIsFirstSection && rDM_Impl.GetBodyText().is() )
{
- uno::Reference<container::XEnumerationAccess> xEnumAccess(rDM_Impl.GetBodyText(), uno::UNO_QUERY_THROW);
- uno::Reference<container::XEnumeration> xEnum = xEnumAccess->createEnumeration();
- xRangeProperties.set(xEnum->nextElement(), uno::UNO_QUERY_THROW);
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( rDM_Impl.GetBodyText(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
+ xRangeProperties.set( xEnum->nextElement(), uno::UNO_QUERY_THROW );
}
- else if (xStartingRange.is())
- xRangeProperties.set(xStartingRange, uno::UNO_QUERY_THROW);
+ else if ( xStartingRange.is() )
+ xRangeProperties.set( xStartingRange, uno::UNO_QUERY_THROW );
return xRangeProperties;
}
-void SectionPropertyMap::HandleMarginsHeaderFooter(bool bFirstPage, DomainMapper_Impl& rDM_Impl)
+void SectionPropertyMap::HandleMarginsHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl )
{
- if( m_nDzaGutter > 0 )
+ if ( m_nDzaGutter > 0 )
{
//todo: iGutterPos from DocProperties are missing
m_nLeftMargin += m_nDzaGutter;
}
- Insert(PROP_LEFT_MARGIN, uno::makeAny( m_nLeftMargin ));
- Insert(PROP_RIGHT_MARGIN, uno::makeAny( m_nRightMargin ));
+ Insert( PROP_LEFT_MARGIN, uno::makeAny( m_nLeftMargin ) );
+ Insert( PROP_RIGHT_MARGIN, uno::makeAny( m_nRightMargin ) );
- if (rDM_Impl.m_oBackgroundColor)
- Insert(PROP_BACK_COLOR, uno::makeAny(*rDM_Impl.m_oBackgroundColor));
- if (!rDM_Impl.m_bHasFtnSep)
+ if ( rDM_Impl.m_oBackgroundColor )
+ Insert( PROP_BACK_COLOR, uno::makeAny( *rDM_Impl.m_oBackgroundColor ) );
+ if ( !rDM_Impl.m_bHasFtnSep )
// Set footnote line width to zero, document has no footnote separator.
- Insert(PROP_FOOTNOTE_LINE_RELATIVE_WIDTH, uno::makeAny(sal_Int32(0)));
+ Insert( PROP_FOOTNOTE_LINE_RELATIVE_WIDTH, uno::makeAny( sal_Int32( 0 ) ) );
/*** if headers/footers are available then the top/bottom margins of the
- header/footer are copied to the top/bottom margin of the page
- */
+ header/footer are copied to the top/bottom margin of the page
+ */
CopyLastHeaderFooter( bFirstPage, rDM_Impl );
PrepareHeaderFooterProperties( bFirstPage );
}
-bool SectionPropertyMap::FloatingTableConversion(FloatingTableInfo& rInfo)
+bool SectionPropertyMap::FloatingTableConversion( FloatingTableInfo& rInfo )
{
// Note that this is just a list of heuristics till sw core can have a
// table that is floating and can span over multiple pages at the same
@@ -1059,28 +1023,28 @@ bool SectionPropertyMap::FloatingTableConversion(FloatingTableInfo& rInfo)
// Count the layout width of the table.
sal_Int32 nTableWidth = rInfo.m_nTableWidth;
sal_Int32 nLeftMargin = 0;
- if (rInfo.getPropertyValue("LeftMargin") >>= nLeftMargin)
+ if ( rInfo.getPropertyValue( "LeftMargin" ) >>= nLeftMargin )
nTableWidth += nLeftMargin;
sal_Int32 nRightMargin = 0;
- if (rInfo.getPropertyValue("RightMargin") >>= nRightMargin)
+ if ( rInfo.getPropertyValue( "RightMargin" ) >>= nRightMargin )
nTableWidth += nRightMargin;
- sal_Int16 nHoriOrientRelation = rInfo.getPropertyValue("HoriOrientRelation").get<sal_Int16>();
- sal_Int16 nVertOrientRelation = rInfo.getPropertyValue("VertOrientRelation").get<sal_Int16>();
- if (nHoriOrientRelation == text::RelOrientation::PAGE_FRAME && nVertOrientRelation == text::RelOrientation::PAGE_FRAME)
+ sal_Int16 nHoriOrientRelation = rInfo.getPropertyValue( "HoriOrientRelation" ).get<sal_Int16>();
+ sal_Int16 nVertOrientRelation = rInfo.getPropertyValue( "VertOrientRelation" ).get<sal_Int16>();
+ if ( nHoriOrientRelation == text::RelOrientation::PAGE_FRAME && nVertOrientRelation == text::RelOrientation::PAGE_FRAME )
{
- sal_Int16 nHoriOrient = rInfo.getPropertyValue("HoriOrient").get<sal_Int16>();
- sal_Int16 nVertOrient = rInfo.getPropertyValue("VertOrient").get<sal_Int16>();
- if (nHoriOrient == text::HoriOrientation::NONE && nVertOrient == text::VertOrientation::NONE)
+ sal_Int16 nHoriOrient = rInfo.getPropertyValue( "HoriOrient" ).get<sal_Int16>();
+ sal_Int16 nVertOrient = rInfo.getPropertyValue( "VertOrient" ).get<sal_Int16>();
+ if ( nHoriOrient == text::HoriOrientation::NONE && nVertOrient == text::VertOrientation::NONE )
{
// Anchor position is relative to the page horizontally and vertically as well and is an absolute position.
// The more close we are to the left edge, the less likely there will be any wrapping.
// The more close we are to the bottom, the more likely the table will span over to the next page
// So if we're in the bottom left quarter, don't do any conversion.
- sal_Int32 nHoriOrientPosition = rInfo.getPropertyValue("HoriOrientPosition").get<sal_Int32>();
- sal_Int32 nVertOrientPosition = rInfo.getPropertyValue("VertOrientPosition").get<sal_Int32>();
- sal_Int32 nPageHeight = getProperty(PROP_HEIGHT)->second.get<sal_Int32>();
- if (nHoriOrientPosition < (nPageWidth / 2) && nVertOrientPosition > (nPageHeight / 2))
+ sal_Int32 nHoriOrientPosition = rInfo.getPropertyValue( "HoriOrientPosition" ).get<sal_Int32>();
+ sal_Int32 nVertOrientPosition = rInfo.getPropertyValue( "VertOrientPosition" ).get<sal_Int32>();
+ sal_Int32 nPageHeight = getProperty( PROP_HEIGHT )->second.get<sal_Int32>();
+ if ( nHoriOrientPosition < (nPageWidth / 2) && nVertOrientPosition >( nPageHeight / 2 ) )
return false;
}
}
@@ -1088,17 +1052,17 @@ bool SectionPropertyMap::FloatingTableConversion(FloatingTableInfo& rInfo)
// If the table is wider than the text area, then don't create a fly
// for the table: no wrapping will be performed anyway, but multi-page
// tables will be broken.
- if (nTableWidth < nTextAreaWidth)
+ if ( nTableWidth < nTextAreaWidth )
return true;
// If the position is relative to the edge of the page, then we always
// create the fly.
- if (rInfo.getPropertyValue("HoriOrientRelation") == text::RelOrientation::PAGE_FRAME)
+ if ( rInfo.getPropertyValue( "HoriOrientRelation" ) == text::RelOrientation::PAGE_FRAME )
return true;
// If there are columns, always create the fly, otherwise the columns would
// restrict geometry of the table.
- if (ColumnCount() + 1 >= 2)
+ if ( ColumnCount() + 1 >= 2 )
return true;
return false;
@@ -1113,28 +1077,28 @@ void SectionPropertyMap::InheritOrFinalizePageStyles( DomainMapper_Impl& rDM_Imp
// otherwise apply this section's settings to the new style.
// Ensure that FollowPage is inherited first - otherwise GetPageStyle may auto-create a follow when checking FirstPage.
SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
- if( pLastContext && m_sFollowPageStyleName.isEmpty() )
+ if ( pLastContext && m_sFollowPageStyleName.isEmpty() )
m_sFollowPageStyleName = pLastContext->GetPageStyleName();
else
{
HandleMarginsHeaderFooter( /*bFirst=*/false, rDM_Impl );
GetPageStyle( xPageStyles, xTextFactory, /*bFirst=*/false );
- if( rDM_Impl.IsNewDoc() && m_aFollowPageStyle.is() )
+ if ( rDM_Impl.IsNewDoc() && m_aFollowPageStyle.is() )
ApplyProperties_( m_aFollowPageStyle );
}
// FirstPageStyle may only be inherited if it will not be used or re-linked to a different follow
- if( !m_bTitlePage && pLastContext && m_sFirstPageStyleName.isEmpty() )
+ if ( !m_bTitlePage && pLastContext && m_sFirstPageStyleName.isEmpty() )
m_sFirstPageStyleName = pLastContext->GetPageStyleName( /*bFirst=*/true );
else
{
HandleMarginsHeaderFooter( /*bFirst=*/true, rDM_Impl );
GetPageStyle( xPageStyles, xTextFactory, /*bFirst=*/true );
- if( rDM_Impl.IsNewDoc() && m_aFirstPageStyle.is() )
+ if ( rDM_Impl.IsNewDoc() && m_aFirstPageStyle.is() )
ApplyProperties_( m_aFirstPageStyle );
// Chain m_aFollowPageStyle to be after m_aFirstPageStyle
- m_aFirstPageStyle->setPropertyValue( "FollowStyle", uno::makeAny(m_sFollowPageStyleName) );
+ m_aFirstPageStyle->setPropertyValue( "FollowStyle", uno::makeAny( m_sFollowPageStyleName ) );
}
}
@@ -1143,24 +1107,24 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
// Text area width is known at the end of a section: decide if tables should be converted or not.
std::vector<FloatingTableInfo>& rPendingFloatingTables = rDM_Impl.m_aPendingFloatingTables;
uno::Reference<text::XTextAppendAndConvert> xBodyText( rDM_Impl.GetBodyText(), uno::UNO_QUERY );
- for (FloatingTableInfo & rInfo : rPendingFloatingTables)
+ for ( FloatingTableInfo & rInfo : rPendingFloatingTables )
{
- if (FloatingTableConversion(rInfo))
- xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties);
+ if ( FloatingTableConversion( rInfo ) )
+ xBodyText->convertToTextFrame( rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties );
}
rPendingFloatingTables.clear();
- if( m_nLnnMod )
+ if ( m_nLnnMod )
{
bool bFirst = rDM_Impl.IsLineNumberingSet();
rDM_Impl.SetLineNumbering( m_nLnnMod, m_nLnc, m_ndxaLnn );
- if( m_nLnnMin > 0 || (bFirst && m_nLnc == NS_ooxml::LN_Value_ST_LineNumberRestart_newSection))
+ if ( m_nLnnMin > 0 || (bFirst && m_nLnc == NS_ooxml::LN_Value_ST_LineNumberRestart_newSection) )
{
//set the starting value at the beginning of the section
try
{
uno::Reference< beans::XPropertySet > xRangeProperties;
- if( m_xStartingRange.is() )
+ if ( m_xStartingRange.is() )
{
xRangeProperties.set( m_xStartingRange, uno::UNO_QUERY_THROW );
}
@@ -1169,56 +1133,56 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
//set the start value at the beginning of the document
xRangeProperties.set( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW );
}
- xRangeProperties->setPropertyValue( getPropertyName( PROP_PARA_LINE_NUMBER_START_VALUE ), uno::makeAny( m_nLnnMin ));
+ xRangeProperties->setPropertyValue( getPropertyName( PROP_PARA_LINE_NUMBER_START_VALUE ), uno::makeAny( m_nLnnMin ) );
}
- catch( const uno::Exception& )
+ catch ( const uno::Exception& )
{
- OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup");
+ OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup" );
}
}
}
// The default section type is nextPage.
- if( m_nBreakType == -1 )
+ if ( m_nBreakType == -1 )
m_nBreakType = NS_ooxml::LN_Value_ST_SectionMark_nextPage;
// depending on the break type no page styles should be created
// Continuous sections usually create only a section, and not a new page style
const bool bTreatAsContinuous = m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextPage
- && m_nColumnCount > 0
- && !HasHeader(m_bTitlePage) && !HasFooter(m_bTitlePage)
- && (m_bIsFirstSection || m_sFollowPageStyleName.isEmpty() || (m_sFirstPageStyleName.isEmpty() && m_bTitlePage));
- if(m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || bTreatAsContinuous)
+ && m_nColumnCount > 0
+ && !HasHeader( m_bTitlePage ) && !HasFooter( m_bTitlePage )
+ && (m_bIsFirstSection || m_sFollowPageStyleName.isEmpty() || (m_sFirstPageStyleName.isEmpty() && m_bTitlePage));
+ if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || bTreatAsContinuous )
{
//todo: insert a section or access the already inserted section
uno::Reference< beans::XPropertySet > xSection =
- rDM_Impl.appendTextSectionAfter( m_xStartingRange );
- if( m_nColumnCount > 0 && xSection.is() )
+ rDM_Impl.appendTextSectionAfter( m_xStartingRange );
+ if ( m_nColumnCount > 0 && xSection.is() )
ApplyColumnProperties( xSection, rDM_Impl );
try
{
InheritOrFinalizePageStyles( rDM_Impl );
OUString aName = m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName;
- uno::Reference<beans::XPropertySet> xRangeProperties( lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange) );
+ uno::Reference< beans::XPropertySet > xRangeProperties( lcl_GetRangeProperties( m_bIsFirstSection, rDM_Impl, m_xStartingRange ) );
if ( m_bIsFirstSection && !aName.isEmpty() && xRangeProperties.is() )
- xRangeProperties->setPropertyValue( getPropertyName(PROP_PAGE_DESC_NAME), uno::makeAny(aName) );
+ xRangeProperties->setPropertyValue( getPropertyName( PROP_PAGE_DESC_NAME ), uno::makeAny( aName ) );
}
- catch( const uno::Exception& )
+ catch ( const uno::Exception& )
{
- SAL_WARN("writerfilter", "failed to set PageDescName!");
+ SAL_WARN( "writerfilter", "failed to set PageDescName!" );
}
}
// If the section is of type "New column" (0x01), then simply insert a column break.
// But only if there actually are columns on the page, otherwise a column break
// seems to be handled like a page break by MSO.
- else if(m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_nextColumn) && m_nColumnCount > 0 )
+ else if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_nextColumn) && m_nColumnCount > 0 )
{
try
{
InheritOrFinalizePageStyles( rDM_Impl );
uno::Reference< beans::XPropertySet > xRangeProperties;
- if( m_xStartingRange.is() )
+ if ( m_xStartingRange.is() )
{
xRangeProperties.set( m_xStartingRange, uno::UNO_QUERY_THROW );
}
@@ -1227,47 +1191,47 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
//set the start value at the beginning of the document
xRangeProperties.set( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW );
}
- xRangeProperties->setPropertyValue( getPropertyName(PROP_BREAK_TYPE), uno::makeAny(style::BreakType_COLUMN_BEFORE) );
+ xRangeProperties->setPropertyValue( getPropertyName( PROP_BREAK_TYPE ), uno::makeAny( style::BreakType_COLUMN_BEFORE ) );
}
- catch( const uno::Exception& ) {}
+ catch ( const uno::Exception& ) {}
}
else
{
//get the properties and create appropriate page styles
uno::Reference< beans::XPropertySet > xFollowPageStyle = GetPageStyle( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), false );
- HandleMarginsHeaderFooter(/*bFirstPage=*/false, rDM_Impl);
+ HandleMarginsHeaderFooter(/*bFirstPage=*/false, rDM_Impl );
const OUString sTrayIndex = getPropertyName( PROP_PRINTER_PAPER_TRAY_INDEX );
- if( m_nPaperBin >= 0 )
+ if ( m_nPaperBin >= 0 )
xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( m_nPaperBin ) );
if ( rDM_Impl.GetSettingsTable()->GetMirrorMarginSettings() )
{
- Insert(PROP_PAGE_STYLE_LAYOUT, uno::makeAny(style::PageStyleLayout_MIRRORED));
+ Insert( PROP_PAGE_STYLE_LAYOUT, uno::makeAny( style::PageStyleLayout_MIRRORED ) );
}
uno::Reference< text::XTextColumns > xColumns;
- if( m_nColumnCount > 0 )
+ if ( m_nColumnCount > 0 )
xColumns = ApplyColumnProperties( xFollowPageStyle, rDM_Impl );
// these BreakTypes are effectively page-breaks: don't evenly distribute text in columns before a page break;
SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
- if( pLastContext && pLastContext->ColumnCount() )
+ if ( pLastContext && pLastContext->ColumnCount() )
pLastContext->DontBalanceTextColumns();
//prepare text grid properties
sal_Int32 nHeight = 1;
- boost::optional<PropertyMap::Property> pProp = getProperty(PROP_HEIGHT);
- if(pProp)
+ boost::optional< PropertyMap::Property > pProp = getProperty( PROP_HEIGHT );
+ if ( pProp )
pProp->second >>= nHeight;
sal_Int32 nWidth = 1;
- pProp = getProperty(PROP_WIDTH);
- if(pProp)
+ pProp = getProperty( PROP_WIDTH );
+ if ( pProp )
pProp->second >>= nWidth;
text::WritingMode eWritingMode = text::WritingMode_LR_TB;
- pProp = getProperty(PROP_WRITING_MODE);
- if(pProp)
+ pProp = getProperty( PROP_WRITING_MODE );
+ if ( pProp )
pProp->second >>= eWritingMode;
sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ?
@@ -1276,39 +1240,39 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
sal_Int32 nGridLinePitch = m_nGridLinePitch;
//sep.dyaLinePitch
- if (nGridLinePitch < 1 || nGridLinePitch > 31680)
+ if ( nGridLinePitch < 1 || nGridLinePitch > 31680 )
{
- SAL_WARN("writerfilter", "sep.dyaLinePitch outside legal range: " << nGridLinePitch);
+ SAL_WARN( "writerfilter", "sep.dyaLinePitch outside legal range: " << nGridLinePitch );
nGridLinePitch = 1;
}
- const sal_Int16 nGridLines = nTextAreaHeight/nGridLinePitch;
- if( nGridLines >= 0 )
- Insert(PROP_GRID_LINES, uno::makeAny( nGridLines ));
+ const sal_Int16 nGridLines = nTextAreaHeight / nGridLinePitch;
+ if ( nGridLines >= 0 )
+ Insert( PROP_GRID_LINES, uno::makeAny( nGridLines ) );
// PROP_GRID_MODE
- Insert( PROP_GRID_MODE, uno::makeAny( static_cast<sal_Int16> (m_nGridType) ));
- if (m_nGridType == text::TextGridMode::LINES_AND_CHARS)
+ Insert( PROP_GRID_MODE, uno::makeAny( static_cast<sal_Int16> (m_nGridType) ) );
+ if ( m_nGridType == text::TextGridMode::LINES_AND_CHARS )
{
- Insert( PROP_GRID_SNAP_TO_CHARS, uno::makeAny(m_bGridSnapToChars));
+ Insert( PROP_GRID_SNAP_TO_CHARS, uno::makeAny( m_bGridSnapToChars ) );
}
sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
- //todo: is '0' the right index here?
- const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(OUString::number(0, 16));
- if( pEntry.get( ) )
+ //todo: is '0' the right index here?
+ const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD( OUString::number( 0, 16 ) );
+ if ( pEntry.get() )
{
- boost::optional<PropertyMap::Property> pPropHeight = pEntry->pProperties->getProperty(PROP_CHAR_HEIGHT_ASIAN);
- if (pPropHeight)
+ boost::optional< PropertyMap::Property > pPropHeight = pEntry->pProperties->getProperty( PROP_CHAR_HEIGHT_ASIAN );
+ if ( pPropHeight )
{
double fHeight = 0;
- if( pPropHeight->second >>= fHeight )
- nCharWidth = ConversionHelper::convertTwipToMM100( (long)( fHeight * 20.0 + 0.5 ));
+ if ( pPropHeight->second >>= fHeight )
+ nCharWidth = ConversionHelper::convertTwipToMM100( (long)(fHeight * 20.0 + 0.5) );
}
}
//dxtCharSpace
- if(m_nDxtCharSpace)
+ if ( m_nDxtCharSpace )
{
sal_Int32 nCharSpace = m_nDxtCharSpace;
//main lives in top 20 bits, and is signed.
@@ -1317,17 +1281,17 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
nCharWidth += ConversionHelper::convertTwipToMM100( nMain * 20 );
sal_Int32 nFraction = (nCharSpace & 0x00000FFF);
- nFraction = (nFraction * 20)/0xFFF;
+ nFraction = (nFraction * 20) / 0xFFF;
nCharWidth += ConversionHelper::convertTwipToMM100( nFraction );
}
- Insert(PROP_GRID_BASE_HEIGHT, uno::makeAny( nCharWidth ));
+ Insert( PROP_GRID_BASE_HEIGHT, uno::makeAny( nCharWidth ) );
sal_Int32 nRubyHeight = nGridLinePitch - nCharWidth;
- if(nRubyHeight < 0 )
+ if ( nRubyHeight < 0 )
nRubyHeight = 0;
- Insert(PROP_GRID_RUBY_HEIGHT, uno::makeAny( nRubyHeight ));
+ Insert( PROP_GRID_RUBY_HEIGHT, uno::makeAny( nRubyHeight ) );
- if (m_nPageNumberType >= 0)
- Insert(PROP_NUMBERING_TYPE, uno::makeAny(m_nPageNumberType));
+ if ( m_nPageNumberType >= 0 )
+ Insert( PROP_NUMBERING_TYPE, uno::makeAny( m_nPageNumberType ) );
// #i119558#, force to set document as standard page mode,
// refer to ww8 import process function "SwWW8ImplReader::SetDocumentGrid"
@@ -1336,115 +1300,117 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
uno::Reference< beans::XPropertySet > xDocProperties;
xDocProperties.set( rDM_Impl.GetTextDocument(), uno::UNO_QUERY_THROW );
bool bSquaredPageMode = false;
- Insert(PROP_GRID_STANDARD_MODE, uno::makeAny( !bSquaredPageMode ));
- xDocProperties->setPropertyValue("DefaultPageMode", uno::makeAny( bSquaredPageMode ));
+ Insert( PROP_GRID_STANDARD_MODE, uno::makeAny( !bSquaredPageMode ) );
+ xDocProperties->setPropertyValue( "DefaultPageMode", uno::makeAny( bSquaredPageMode ) );
}
- catch (const uno::Exception& rEx)
+ catch ( const uno::Exception& rEx )
{
- OSL_ENSURE( false, "Exception in SectionPropertyMap::CloseSectionGroup");
+ OSL_ENSURE( false, "Exception in SectionPropertyMap::CloseSectionGroup" );
(void)rEx;
}
- if (rDM_Impl.IsNewDoc())
+ if ( rDM_Impl.IsNewDoc() )
ApplyProperties_( xFollowPageStyle );
- //todo: creating a "First Page" style depends on HasTitlePage and _fFacingPage_
- if( m_bTitlePage )
+ //todo: creating a "First Page" style depends on HasTitlePage und _fFacingPage_
+ if ( m_bTitlePage )
{
CopyLastHeaderFooter( true, rDM_Impl );
PrepareHeaderFooterProperties( true );
uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
- rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
- if (rDM_Impl.IsNewDoc())
+ rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
+ if ( rDM_Impl.IsNewDoc() )
ApplyProperties_( xFirstPageStyle );
sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
- if( nPaperBin )
+ if ( nPaperBin )
xFirstPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
- if( xColumns.is() )
+ if ( xColumns.is() )
xFirstPageStyle->setPropertyValue(
- getPropertyName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
+ getPropertyName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ) );
}
- ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams );
+ ApplyBorderToPageStyles( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), m_nBorderParams );
try
{
{
//now apply this break at the first paragraph of this section
- uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange));
+ uno::Reference< beans::XPropertySet > xRangeProperties( lcl_GetRangeProperties( m_bIsFirstSection, rDM_Impl, m_xStartingRange ) );
// Handle page breaks with odd/even page numbering. We need to use an extra page style for setting the page style
// to left/right, because if we set it to the normal style, we'd set it to "First Page"/"Default Style", which would
// break them (all default pages would be only left or right).
- if (m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_evenPage) || m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_oddPage))
+ if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_evenPage) || m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_oddPage) )
{
OUString* pageStyle = m_bTitlePage ? &m_sFirstPageStyleName : &m_sFollowPageStyleName;
- OUString evenOddStyleName = lcl_FindUnusedPageStyleName(rDM_Impl.GetPageStyles()->getElementNames());
+ OUString evenOddStyleName = lcl_FindUnusedPageStyleName( rDM_Impl.GetPageStyles()->getElementNames() );
uno::Reference< beans::XPropertySet > evenOddStyle(
- rDM_Impl.GetTextFactory()->createInstance("com.sun.star.style.PageStyle"),
- uno::UNO_QUERY);
+ rDM_Impl.GetTextFactory()->createInstance( "com.sun.star.style.PageStyle" ),
+ uno::UNO_QUERY );
// Unfortunately using setParent() does not work for page styles, so make a deep copy of the page style.
uno::Reference< beans::XPropertySet > pageProperties( m_bTitlePage ? m_aFirstPageStyle : m_aFollowPageStyle );
- uno::Reference< beans::XPropertySetInfo > pagePropertiesInfo( pageProperties->getPropertySetInfo());
- uno::Sequence< beans::Property > propertyList( pagePropertiesInfo->getProperties());
- for( int i = 0; i < propertyList.getLength(); ++i )
+ uno::Reference< beans::XPropertySetInfo > pagePropertiesInfo( pageProperties->getPropertySetInfo() );
+ uno::Sequence< beans::Property > propertyList( pagePropertiesInfo->getProperties() );
+ for ( int i = 0; i < propertyList.getLength(); ++i )
{
- if(( propertyList[i].Attributes & beans::PropertyAttribute::READONLY ) == 0 )
- evenOddStyle->setPropertyValue( propertyList[ i ].Name, pageProperties->getPropertyValue( propertyList[ i ].Name ));
+ if ( (propertyList[i].Attributes & beans::PropertyAttribute::READONLY) == 0 )
+ evenOddStyle->setPropertyValue( propertyList[i].Name, pageProperties->getPropertyValue( propertyList[i].Name ) );
}
- evenOddStyle->setPropertyValue("FollowStyle", uno::makeAny(*pageStyle));
+ evenOddStyle->setPropertyValue( "FollowStyle", uno::makeAny( *pageStyle ) );
rDM_Impl.GetPageStyles()->insertByName( evenOddStyleName, uno::makeAny( evenOddStyle ) );
- evenOddStyle->setPropertyValue("HeaderIsOn", uno::makeAny(false));
- evenOddStyle->setPropertyValue("FooterIsOn", uno::makeAny(false));
+ evenOddStyle->setPropertyValue( "HeaderIsOn", uno::makeAny( false ) );
+ evenOddStyle->setPropertyValue( "FooterIsOn", uno::makeAny( false ) );
CopyHeaderFooter( pageProperties, evenOddStyle );
*pageStyle = evenOddStyleName; // And use it instead of the original one (which is set as follow of this one).
- if (m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_evenPage))
- evenOddStyle->setPropertyValue(getPropertyName(PROP_PAGE_STYLE_LAYOUT), uno::makeAny(style::PageStyleLayout_LEFT));
- else if (m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_oddPage))
- evenOddStyle->setPropertyValue(getPropertyName(PROP_PAGE_STYLE_LAYOUT), uno::makeAny(style::PageStyleLayout_RIGHT));
+ if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_evenPage) )
+ evenOddStyle->setPropertyValue( getPropertyName( PROP_PAGE_STYLE_LAYOUT ), uno::makeAny( style::PageStyleLayout_LEFT ) );
+ else if ( m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_oddPage) )
+ evenOddStyle->setPropertyValue( getPropertyName( PROP_PAGE_STYLE_LAYOUT ), uno::makeAny( style::PageStyleLayout_RIGHT ) );
}
- if (xRangeProperties.is() && rDM_Impl.IsNewDoc())
+ if ( xRangeProperties.is() && rDM_Impl.IsNewDoc() )
xRangeProperties->setPropertyValue(
getPropertyName( PROP_PAGE_DESC_NAME ),
- uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName
- : m_sFollowPageStyleName ));
+ uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName
+ : m_sFollowPageStyleName ) );
- if(m_bPageNoRestart || m_nPageNumber >= 0)
+ if ( m_bPageNoRestart || m_nPageNumber >= 0 )
{
sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
- xRangeProperties->setPropertyValue(getPropertyName( PROP_PAGE_NUMBER_OFFSET ),
- uno::makeAny( nPageNumber ));
+ xRangeProperties->setPropertyValue( getPropertyName( PROP_PAGE_NUMBER_OFFSET ),
+ uno::makeAny( nPageNumber ) );
}
}
}
- catch (const uno::Exception&)
+ catch ( const uno::Exception& )
{
- OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup");
+ OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup" );
}
}
- rDM_Impl.SetIsLastSectionGroup(false);
- rDM_Impl.SetIsFirstParagraphInSection(true);
+ rDM_Impl.SetIsLastSectionGroup( false );
+ rDM_Impl.SetIsFirstParagraphInSection( true );
}
// Clear the flag that says we should take the header/footer content from
// the previous section. This should be called when we encounter a header
// or footer definition for this section.
-void SectionPropertyMap::ClearHeaderFooterLinkToPrevious(
- bool bHeader, PageType eType )
+void SectionPropertyMap::ClearHeaderFooterLinkToPrevious( bool bHeader, PageType eType )
{
- if( bHeader ) {
- switch( eType ) {
+ if ( bHeader )
+ {
+ switch ( eType )
+ {
case PAGE_FIRST: m_bFirstPageHeaderLinkToPrevious = false; break;
case PAGE_LEFT: m_bEvenPageHeaderLinkToPrevious = false; break;
case PAGE_RIGHT: m_bDefaultHeaderLinkToPrevious = false; break;
- // no default case as all enumeration values have been covered
+ // no default case as all enumeration values have been covered
}
}
else
{
- switch( eType ) {
+ switch ( eType )
+ {
case PAGE_FIRST: m_bFirstPageFooterLinkToPrevious = false; break;
case PAGE_LEFT: m_bEvenPageFooterLinkToPrevious = false; break;
case PAGE_RIGHT: m_bDefaultFooterLinkToPrevious = false; break;
@@ -1452,284 +1418,255 @@ void SectionPropertyMap::ClearHeaderFooterLinkToPrevious(
}
}
-class NamedPropertyValue {
+class NamedPropertyValue
+{
+private:
OUString m_aName;
+
public:
- explicit NamedPropertyValue(const OUString& i_aStr)
- : m_aName(i_aStr) { }
- bool operator() (beans::PropertyValue& aVal)
- { return aVal.Name == m_aName; }
+ explicit NamedPropertyValue( const OUString& i_aStr )
+ : m_aName( i_aStr )
+ {
+ }
+
+ bool operator() ( beans::PropertyValue& aVal )
+ {
+ return aVal.Name == m_aName;
+ }
};
-void SectionPropertyMap::ApplyProperties_(
- uno::Reference< beans::XPropertySet > const& xStyle)
+
+void SectionPropertyMap::ApplyProperties_( const uno::Reference< beans::XPropertySet >& xStyle )
{
- uno::Reference<beans::XMultiPropertySet> const xMultiSet(xStyle,
- uno::UNO_QUERY);
+ uno::Reference< beans::XMultiPropertySet > const xMultiSet( xStyle, uno::UNO_QUERY );
- std::vector<OUString> vNames;
- std::vector<uno::Any> vValues;
- { //Convert GetPropertyValues() value into something useful
- uno::Sequence<beans::PropertyValue> vPropVals = GetPropertyValues();
+ std::vector< OUString > vNames;
+ std::vector< uno::Any > vValues;
+ {
+ // Convert GetPropertyValues() value into something useful
+ uno::Sequence< beans::PropertyValue > vPropVals = GetPropertyValues();
//Temporarily store the items that are in grab bags
- uno::Sequence<beans::PropertyValue> vCharVals;
- uno::Sequence<beans::PropertyValue> vParaVals;
- beans::PropertyValue* pCharGrabBag = std::find_if(vPropVals.begin(),vPropVals.end(),NamedPropertyValue("CharInteropGrabBag") );
- if (pCharGrabBag!=vPropVals.end())
- (pCharGrabBag->Value)>>=vCharVals;
- beans::PropertyValue* pParaGrabBag = std::find_if(vPropVals.begin(),vPropVals.end(),NamedPropertyValue("ParaInteropGrabBag") );
- if (pParaGrabBag!=vPropVals.end())
- (pParaGrabBag->Value)>>=vParaVals;
-
- for (beans::PropertyValue* pIter = vPropVals.begin(); pIter!=vPropVals.end(); ++pIter)
+ uno::Sequence< beans::PropertyValue > vCharVals;
+ uno::Sequence< beans::PropertyValue > vParaVals;
+ beans::PropertyValue* pCharGrabBag = std::find_if( vPropVals.begin(), vPropVals.end(), NamedPropertyValue( "CharInteropGrabBag" ) );
+ if ( pCharGrabBag != vPropVals.end() )
+ (pCharGrabBag->Value) >>= vCharVals;
+ beans::PropertyValue* pParaGrabBag = std::find_if( vPropVals.begin(), vPropVals.end(), NamedPropertyValue( "ParaInteropGrabBag" ) );
+ if ( pParaGrabBag != vPropVals.end() )
+ (pParaGrabBag->Value) >>= vParaVals;
+
+ for ( beans::PropertyValue* pIter = vPropVals.begin(); pIter != vPropVals.end(); ++pIter )
{
- if(pIter!=pCharGrabBag && pIter!=pParaGrabBag)
+ if ( pIter != pCharGrabBag && pIter != pParaGrabBag )
{
- vNames.push_back(pIter->Name);
- vValues.push_back(pIter->Value);
+ vNames.push_back( pIter->Name );
+ vValues.push_back( pIter->Value );
}
}
- for (beans::PropertyValue & v : vCharVals)
+ for ( beans::PropertyValue & v : vCharVals )
{
- vNames.push_back(v.Name);
- vValues.push_back(v.Value);
+ vNames.push_back( v.Name );
+ vValues.push_back( v.Value );
}
- for (beans::PropertyValue & v : vParaVals)
+ for ( beans::PropertyValue & v : vParaVals )
{
- vNames.push_back(v.Name);
- vValues.push_back(v.Value);
+ vNames.push_back( v.Name );
+ vValues.push_back( v.Value );
}
}
- if (xMultiSet.is())
+ if ( xMultiSet.is() )
{
try
{
- xMultiSet->setPropertyValues(comphelper::containerToSequence(vNames), comphelper::containerToSequence(vValues));
+ xMultiSet->setPropertyValues( comphelper::containerToSequence( vNames ), comphelper::containerToSequence( vValues ) );
return;
}
- catch( const uno::Exception& )
+ catch ( const uno::Exception& )
{
- OSL_FAIL( "Exception in SectionPropertyMap::ApplyProperties_");
+ OSL_FAIL( "Exception in SectionPropertyMap::ApplyProperties_" );
}
}
- for (size_t i = 0; i < vNames.size(); ++i)
+ for ( size_t i = 0; i < vNames.size(); ++i )
{
try
{
- if (xStyle.is())
- xStyle->setPropertyValue(vNames[i], vValues[i]);
+ if ( xStyle.is() )
+ xStyle->setPropertyValue( vNames[i], vValues[i] );
}
- catch( const uno::Exception& )
+ catch ( const uno::Exception& )
{
- OSL_FAIL( "Exception in SectionPropertyMap::ApplyProperties_");
+ OSL_FAIL( "Exception in SectionPropertyMap::ApplyProperties_" );
}
}
}
sal_Int32 SectionPropertyMap::GetPageWidth()
{
- return getProperty(PROP_WIDTH)->second.get<sal_Int32>();
+ return getProperty( PROP_WIDTH )->second.get<sal_Int32>();
}
-StyleSheetPropertyMap::StyleSheetPropertyMap() :
- mnCT_TrPrBase_jc( 0 ),
- mnCT_TblWidth_w( 0 ),
- mnCT_TblWidth_type( 0 ),
- mbCT_TrPrBase_jcSet( false ),
- mbCT_TblWidth_wSet( false ),
- mbCT_TblWidth_typeSet( false ),
- mnListId( -1 ),
- mnListLevel( -1 ),
- mnOutlineLevel( -1 ),
- mnNumId( -1 )
+StyleSheetPropertyMap::StyleSheetPropertyMap()
+ : mnCT_TrPrBase_jc( 0 )
+ , mnCT_TblWidth_w( 0 )
+ , mnCT_TblWidth_type( 0 )
+ , mbCT_TrPrBase_jcSet( false )
+ , mbCT_TblWidth_wSet( false )
+ , mbCT_TblWidth_typeSet( false )
+ , mnListId( -1 )
+ , mnListLevel( -1 )
+ , mnOutlineLevel( -1 )
+ , mnNumId( -1 )
{
}
-
-StyleSheetPropertyMap::~StyleSheetPropertyMap()
+ParagraphProperties::ParagraphProperties()
+ : m_bFrameMode( false )
+ , m_nDropCap( NS_ooxml::LN_Value_doc_ST_DropCap_none )
+ , m_nLines( 0 )
+ , m_w( -1 )
+ , m_h( -1 )
+ , m_nWrap( text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE )
+ , m_hAnchor( -1 )
+ , m_vAnchor( -1 )
+ , m_x( -1 )
+ , m_bxValid( false )
+ , m_y( -1 )
+ , m_byValid( false )
+ , m_hSpace( -1 )
+ , m_vSpace( -1 )
+ , m_hRule( -1 )
+ , m_xAlign( -1 )
+ , m_yAlign( -1 )
+ , m_bAnchorLock( false )
+ , m_nDropCapLength( 0 )
{
}
-
-ParagraphProperties::ParagraphProperties() :
- m_bFrameMode( false ),
- m_nDropCap(NS_ooxml::LN_Value_doc_ST_DropCap_none),
- m_nLines(0),
- m_w(-1),
- m_h(-1),
- m_nWrap(text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE),
- m_hAnchor(-1),
- m_vAnchor(-1),
- m_x(-1),
- m_bxValid( false ),
- m_y(-1),
- m_byValid( false ),
- m_hSpace(-1),
- m_vSpace(-1),
- m_hRule(-1),
- m_xAlign(-1),
- m_yAlign(-1),
- m_bAnchorLock(false),
- m_nDropCapLength(0)
+ParagraphProperties::ParagraphProperties( const ParagraphProperties& rCopy )
+ : m_bFrameMode( rCopy.m_bFrameMode )
+ , m_nDropCap( rCopy.m_nDropCap )
+ , m_nLines( rCopy.m_nLines )
+ , m_w( rCopy.m_w )
+ , m_h( rCopy.m_h )
+ , m_nWrap( rCopy.m_nWrap )
+ , m_hAnchor( rCopy.m_hAnchor )
+ , m_vAnchor( rCopy.m_vAnchor )
+ , m_x( rCopy.m_x )
+ , m_bxValid( rCopy.m_bxValid )
+ , m_y( rCopy.m_y )
+ , m_byValid( rCopy.m_byValid )
+ , m_hSpace( rCopy.m_hSpace )
+ , m_vSpace( rCopy.m_vSpace )
+ , m_hRule( rCopy.m_hRule )
+ , m_xAlign( rCopy.m_xAlign )
+ , m_yAlign( rCopy.m_yAlign )
+ , m_bAnchorLock( rCopy.m_bAnchorLock )
+ , m_nDropCapLength( rCopy.m_nDropCapLength )
+ , m_sParaStyleName( rCopy.m_sParaStyleName )
+ , m_xStartingRange( rCopy.m_xStartingRange )
+ , m_xEndingRange( rCopy.m_xEndingRange )
{
}
-
-ParagraphProperties::ParagraphProperties(const ParagraphProperties& rCopy) :
- m_bFrameMode ( rCopy.m_bFrameMode),
- m_nDropCap ( rCopy.m_nDropCap),
- m_nLines ( rCopy.m_nLines),
- m_w ( rCopy.m_w),
- m_h ( rCopy.m_h),
- m_nWrap ( rCopy.m_nWrap),
- m_hAnchor ( rCopy.m_hAnchor),
- m_vAnchor ( rCopy.m_vAnchor),
- m_x ( rCopy.m_x),
- m_bxValid ( rCopy.m_bxValid),
- m_y ( rCopy.m_y),
- m_byValid ( rCopy.m_byValid),
- m_hSpace ( rCopy.m_hSpace),
- m_vSpace ( rCopy.m_vSpace),
- m_hRule ( rCopy.m_hRule),
- m_xAlign ( rCopy.m_xAlign),
- m_yAlign ( rCopy.m_yAlign),
- m_bAnchorLock( rCopy.m_bAnchorLock),
- m_nDropCapLength( rCopy.m_nDropCapLength ),
- m_sParaStyleName( rCopy.m_sParaStyleName),
- m_xStartingRange( rCopy.m_xStartingRange ),
- m_xEndingRange( rCopy.m_xEndingRange)
+bool ParagraphProperties::operator==( const ParagraphProperties& rCompare )
{
-}
-
-
-ParagraphProperties::~ParagraphProperties()
-{
-}
-
-
-bool ParagraphProperties::operator==(const ParagraphProperties& rCompare)
-{
- return
- m_bFrameMode == rCompare.m_bFrameMode &&
- m_nDropCap == rCompare.m_nDropCap &&
- m_nLines == rCompare.m_nLines &&
- m_w == rCompare.m_w &&
- m_h == rCompare.m_h &&
- m_nWrap == rCompare.m_nWrap &&
- m_hAnchor == rCompare.m_hAnchor &&
- m_vAnchor == rCompare.m_vAnchor &&
- m_x == rCompare.m_x &&
- m_bxValid == rCompare.m_bxValid &&
- m_y == rCompare.m_y &&
- m_byValid == rCompare.m_byValid &&
- m_hSpace == rCompare.m_hSpace &&
- m_vSpace == rCompare.m_vSpace &&
- m_hRule == rCompare.m_hRule &&
- m_xAlign == rCompare.m_xAlign &&
- m_yAlign == rCompare.m_yAlign &&
- m_bAnchorLock== rCompare.m_bAnchorLock;
+ return ( m_bFrameMode == rCompare.m_bFrameMode &&
+ m_nDropCap == rCompare.m_nDropCap &&
+ m_nLines == rCompare.m_nLines &&
+ m_w == rCompare.m_w &&
+ m_h == rCompare.m_h &&
+ m_nWrap == rCompare.m_nWrap &&
+ m_hAnchor == rCompare.m_hAnchor &&
+ m_vAnchor == rCompare.m_vAnchor &&
+ m_x == rCompare.m_x &&
+ m_bxValid == rCompare.m_bxValid &&
+ m_y == rCompare.m_y &&
+ m_byValid == rCompare.m_byValid &&
+ m_hSpace == rCompare.m_hSpace &&
+ m_vSpace == rCompare.m_vSpace &&
+ m_hRule == rCompare.m_hRule &&
+ m_xAlign == rCompare.m_xAlign &&
+ m_yAlign == rCompare.m_yAlign &&
+ m_bAnchorLock == rCompare.m_bAnchorLock );
}
void ParagraphProperties::ResetFrameProperties()
{
- m_bFrameMode = false;
- m_nDropCap = NS_ooxml::LN_Value_doc_ST_DropCap_none;
- m_nLines = 0;
- m_w = -1;
- m_h = -1;
- m_nWrap = text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE;
- m_hAnchor = -1;
- m_vAnchor = -1;
- m_x = -1;
- m_bxValid = false;
- m_y = -1;
- m_byValid = false;
- m_hSpace = -1;
- m_vSpace = -1;
- m_hRule = -1;
- m_xAlign = -1;
- m_yAlign = -1;
- m_bAnchorLock = false;
+ m_bFrameMode = false;
+ m_nDropCap = NS_ooxml::LN_Value_doc_ST_DropCap_none;
+ m_nLines = 0;
+ m_w = -1;
+ m_h = -1;
+ m_nWrap = text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE;
+ m_hAnchor = -1;
+ m_vAnchor = -1;
+ m_x = -1;
+ m_bxValid = false;
+ m_y = -1;
+ m_byValid = false;
+ m_hSpace = -1;
+ m_vSpace = -1;
+ m_hRule = -1;
+ m_xAlign = -1;
+ m_yAlign = -1;
+ m_bAnchorLock = false;
m_nDropCapLength = 0;
}
-
-ParagraphPropertyMap::ParagraphPropertyMap()
-{
-}
-
-
-ParagraphPropertyMap::~ParagraphPropertyMap()
-{
-}
-
-
-TablePropertyMap::TablePropertyMap()
-{
-}
-
-
-TablePropertyMap::~TablePropertyMap()
-{
-}
-
-
bool TablePropertyMap::getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill )
{
- if( eWhich < TablePropertyMapTarget_MAX )
+ if ( eWhich < TablePropertyMapTarget_MAX )
{
- if(m_aValidValues[eWhich].bValid)
+ if ( m_aValidValues[eWhich].bValid )
nFill = m_aValidValues[eWhich].nValue;
return m_aValidValues[eWhich].bValid;
}
else
{
- OSL_FAIL( "invalid TablePropertyMapTarget");
+ OSL_FAIL( "invalid TablePropertyMapTarget" );
return false;
}
}
-
void TablePropertyMap::setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet )
{
- if( eWhich < TablePropertyMapTarget_MAX )
+ if ( eWhich < TablePropertyMapTarget_MAX )
{
m_aValidValues[eWhich].bValid = true;
m_aValidValues[eWhich].nValue = nSet;
}
else
- OSL_FAIL( "invalid TablePropertyMapTarget");
+ OSL_FAIL( "invalid TablePropertyMapTarget" );
}
-
void TablePropertyMap::insertTableProperties( const PropertyMap* pMap )
{
#ifdef DEBUG_WRITERFILTER
- TagLogger::getInstance().startElement("TablePropertyMap.insertTableProperties");
+ TagLogger::getInstance().startElement( "TablePropertyMap.insertTableProperties" );
pMap->dumpXml();
#endif
const TablePropertyMap* pSource = dynamic_cast< const TablePropertyMap* >(pMap);
- if( pSource )
+ if ( pSource )
{
- for( sal_Int32 eTarget = TablePropertyMapTarget_START;
+ for ( sal_Int32 eTarget = TablePropertyMapTarget_START;
eTarget < TablePropertyMapTarget_MAX; ++eTarget )
{
- if( pSource->m_aValidValues[eTarget].bValid )
+ if ( pSource->m_aValidValues[eTarget].bValid )
{
m_aValidValues[eTarget].bValid = true;
m_aValidValues[eTarget].nValue = pSource->m_aValidValues[eTarget].nValue;
}
}
}
+
#ifdef DEBUG_WRITERFILTER
dumpXml();
TagLogger::getInstance().endElement();
#endif
}
-
-}//namespace dmapper
-}//namespace writerfilter
+} // namespace dmapper
+} // namespace writerfilter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 48c4f47716db..a45bef692b70 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -31,33 +31,33 @@
#include <boost/optional.hpp>
#include <map>
#include <vector>
-
#include "TagLogger.hxx"
-namespace com{namespace sun{namespace star{
- namespace beans{
- struct PropertyValue;
+namespace com { namespace sun { namespace star {
+ namespace beans {
+ struct PropertyValue;
}
- namespace container{
+ namespace container {
class XNameContainer;
}
- namespace lang{
+ namespace lang {
class XMultiServiceFactory;
}
- namespace text{
+ namespace text {
class XTextRange;
class XTextColumns;
class XFootnote;
}
- namespace table{
+ namespace table {
struct BorderLine2;
struct ShadowFormat;
}
}}}
namespace writerfilter {
-namespace dmapper{
-class DomainMapper_Impl;
+namespace dmapper {
+
+class DomainMapper_Impl;
struct FloatingTableInfo;
enum BorderPosition
@@ -79,26 +79,35 @@ enum GrabBagType
struct RedlineParams
{
- OUString m_sAuthor;
- OUString m_sDate;
- sal_Int32 m_nId;
- sal_Int32 m_nToken;
+ OUString m_sAuthor;
+ OUString m_sDate;
+ sal_Int32 m_nId;
+ sal_Int32 m_nToken;
- /// This can hold properties of runs that had formatted 'track changes' properties
- css::uno::Sequence<css::beans::PropertyValue> m_aRevertProperties;
+ // This can hold properties of runs that had formatted 'track changes' properties
+ css::uno::Sequence< css::beans::PropertyValue > m_aRevertProperties;
};
+
typedef std::shared_ptr< RedlineParams > RedlineParamsPtr;
class PropValue
{
+private:
css::uno::Any m_aValue;
- GrabBagType m_GrabBagType;
+ GrabBagType m_GrabBagType;
public:
- PropValue(const css::uno::Any& rValue, GrabBagType i_GrabBagType) :
- m_aValue(rValue), m_GrabBagType(i_GrabBagType) {}
+ PropValue( const css::uno::Any& rValue, GrabBagType i_GrabBagType )
+ : m_aValue( rValue )
+ , m_GrabBagType( i_GrabBagType )
+ {
+ }
- PropValue() : m_aValue(), m_GrabBagType(NO_GRAB_BAG) {}
+ PropValue()
+ : m_aValue()
+ , m_GrabBagType( NO_GRAB_BAG )
+ {
+ }
const css::uno::Any& getValue() const { return m_aValue; }
@@ -107,170 +116,177 @@ public:
class PropertyMap
{
- /// Cache the property values for the GetPropertyValues() call(s).
- std::vector<css::beans::PropertyValue> m_aValues;
-
- //marks context as footnote context - ::text( ) events contain either the footnote character or can be ignored
- //depending on sprmCSymbol
- OUString m_sFootnoteFontName;
- css::uno::Reference<css::text::XFootnote> m_xFootnote;
-
- std::map< PropertyIds, PropValue > m_vMap;
-
- typedef std::map<PropertyIds,PropValue>::const_iterator MapIterator;
-
- std::vector< RedlineParamsPtr > m_aRedlines;
+private:
+ // Cache the property values for the GetPropertyValues() call(s).
+ std::vector< css::beans::PropertyValue > m_aValues;
-protected:
- void Invalidate()
- {
- if(m_aValues.size())
- m_aValues.clear();
- }
+ // marks context as footnote context - ::text( ) events contain either the footnote character or can be ignored
+ // depending on sprmCSymbol
+ OUString m_sFootnoteFontName;
+ css::uno::Reference< css::text::XFootnote > m_xFootnote;
+ std::map< PropertyIds, PropValue > m_vMap;
+ std::vector< RedlineParamsPtr > m_aRedlines;
public:
- typedef std::pair<PropertyIds,css::uno::Any> Property;
+ typedef std::pair< PropertyIds, css::uno::Any > Property;
+
+ PropertyMap() {}
+ virtual ~PropertyMap() {}
- PropertyMap();
- virtual ~PropertyMap();
+ // Sequence: Grab Bags: The CHAR_GRAB_BAG has Name "CharInteropGrabBag" and the PARA_GRAB_BAG has Name "ParaInteropGrabBag"
+ // the contained properties are their Value.
+ css::uno::Sequence< css::beans::PropertyValue > GetPropertyValues( bool bCharGrabBag = true );
- css::uno::Sequence<css::beans::PropertyValue> GetPropertyValues(bool bCharGrabBag = true);
- //Sequence: Grab Bags: The CHAR_GRAB_BAG has Name "CharInteropGrabBag" and the PARA_GRAB_BAG has Name "ParaInteropGrabBag"
- // the contained properties are their Value.
+ // Add property, optionally overwriting existing attributes
+ void Insert( PropertyIds eId, const css::uno::Any& rAny, bool bOverwrite = true, GrabBagType i_GrabBagType = NO_GRAB_BAG );
- //Add property, optionally overwriting existing attributes
- void Insert(PropertyIds eId, const css::uno::Any& rAny, bool bOverwrite = true, GrabBagType i_GrabBagType = NO_GRAB_BAG);
- //Remove a named property from *this, does nothing if the property id has not been set
+ // Remove a named property from *this, does nothing if the property id has not been set
void Erase( PropertyIds eId);
- //Imports properties from pMap, overwriting those with the same PropertyIds as the current map
- void InsertProps(const std::shared_ptr<PropertyMap>& rMap);
+ // Imports properties from pMap, overwriting those with the same PropertyIds as the current map
+ void InsertProps( const std::shared_ptr< PropertyMap >& rMap );
- //Returns a copy of the property if it exists, .first is its PropertyIds and .second is its Value (type css::uno::Any)
- boost::optional<Property> getProperty( PropertyIds eId ) const;
+ // Returns a copy of the property if it exists, .first is its PropertyIds and .second is its Value (type css::uno::Any)
+ boost::optional< Property > getProperty( PropertyIds eId ) const;
- //Has the property named been set (via Insert)?
+ // Has the property named been set (via Insert)?
bool isSet( PropertyIds eId ) const;
- const css::uno::Reference<css::text::XFootnote>& GetFootnote() const { return m_xFootnote; }
- void SetFootnote(css::uno::Reference<css::text::XFootnote> const& xF) { m_xFootnote = xF; }
+ const css::uno::Reference< css::text::XFootnote >& GetFootnote() const { return m_xFootnote; }
- const OUString& GetFootnoteFontName() const { return m_sFootnoteFontName;}
+ void SetFootnote( const css::uno::Reference< css::text::XFootnote >& xF ) { m_xFootnote = xF; }
+
+ const OUString& GetFootnoteFontName() const { return m_sFootnoteFontName; }
virtual void insertTableProperties( const PropertyMap* );
const std::vector< RedlineParamsPtr >& Redlines() const { return m_aRedlines; }
+
std::vector< RedlineParamsPtr >& Redlines() { return m_aRedlines; }
void printProperties();
+
#ifdef DEBUG_WRITERFILTER
void dumpXml() const;
#endif
- static css::table::ShadowFormat getShadowFromBorder(const css::table::BorderLine2& rBorder);
+ static css::table::ShadowFormat getShadowFromBorder( const css::table::BorderLine2& rBorder );
+
+protected:
+ void Invalidate()
+ {
+ if ( m_aValues.size() )
+ m_aValues.clear();
+ }
};
-typedef std::shared_ptr<PropertyMap> PropertyMapPtr;
+
+typedef std::shared_ptr< PropertyMap > PropertyMapPtr;
class SectionPropertyMap : public PropertyMap
{
- //--> debug
- sal_Int32 nSectionNumber;
- //<-- debug
- //'temporarily' the section page settings are imported as page styles
+private:
+#ifdef DEBUG_WRITERFILTER
+ sal_Int32 m_nDebugSectionNumber;
+#endif
+
+ // 'temporarily' the section page settings are imported as page styles
// empty strings mark page settings as not yet imported
- bool m_bIsFirstSection;
- css::uno::Reference<css::text::XTextRange> m_xStartingRange;
+ bool m_bIsFirstSection;
+ css::uno::Reference< css::text::XTextRange > m_xStartingRange;
- OUString m_sFirstPageStyleName;
- OUString m_sFollowPageStyleName;
- css::uno::Reference<css::beans::XPropertySet> m_aFirstPageStyle;
- css::uno::Reference<css::beans::XPropertySet> m_aFollowPageStyle;
+ OUString m_sFirstPageStyleName;
+ OUString m_sFollowPageStyleName;
+ css::uno::Reference< css::beans::XPropertySet > m_aFirstPageStyle;
+ css::uno::Reference< css::beans::XPropertySet > m_aFollowPageStyle;
- boost::optional<css::table::BorderLine2> m_oBorderLines[4];
- sal_Int32 m_nBorderDistances[4];
- sal_Int32 m_nBorderParams;
- bool m_bBorderShadows[4];
+ boost::optional< css::table::BorderLine2 > m_oBorderLines[4];
+ sal_Int32 m_nBorderDistances[4];
+ sal_Int32 m_nBorderParams;
+ bool m_bBorderShadows[4];
- bool m_bTitlePage;
- sal_Int16 m_nColumnCount;
- sal_Int32 m_nColumnDistance;
+ bool m_bTitlePage;
+ sal_Int16 m_nColumnCount;
+ sal_Int32 m_nColumnDistance;
css::uno::Reference< css::beans::XPropertySet > m_xColumnContainer;
- ::std::vector< sal_Int32 > m_aColWidth;
- ::std::vector< sal_Int32 > m_aColDistance;
-
- bool m_bSeparatorLineIsOn;
- bool m_bEvenlySpaced;
- bool m_bIsLandscape;
-
- bool m_bPageNoRestart;
- sal_Int32 m_nPageNumber;
- /// Page number type is a value from css::style::NumberingType.
- sal_Int16 m_nPageNumberType;
- sal_Int32 m_nBreakType;
- sal_Int32 m_nPaperBin;
- sal_Int32 m_nFirstPaperBin;
-
- sal_Int32 m_nLeftMargin;
- sal_Int32 m_nRightMargin;
- sal_Int32 m_nTopMargin;
- sal_Int32 m_nBottomMargin;
- sal_Int32 m_nHeaderTop;
- sal_Int32 m_nHeaderBottom;
-
- sal_Int32 m_nDzaGutter;
-
- sal_Int32 m_nGridType;
- sal_Int32 m_nGridLinePitch;
- sal_Int32 m_nDxtCharSpace;
- bool m_bGridSnapToChars;
-
- //line numbering
- sal_Int32 m_nLnnMod;
- sal_uInt32 m_nLnc;
- sal_Int32 m_ndxaLnn;
- sal_Int32 m_nLnnMin;
+ std::vector< sal_Int32 > m_aColWidth;
+ std::vector< sal_Int32 > m_aColDistance;
+
+ bool m_bSeparatorLineIsOn;
+ bool m_bEvenlySpaced;
+ bool m_bIsLandscape;
+
+ bool m_bPageNoRestart;
+ sal_Int32 m_nPageNumber;
+ // Page number type is a value from css::style::NumberingType.
+ sal_Int16 m_nPageNumberType;
+ sal_Int32 m_nBreakType;
+ sal_Int32 m_nPaperBin;
+ sal_Int32 m_nFirstPaperBin;
+
+ sal_Int32 m_nLeftMargin;
+ sal_Int32 m_nRightMargin;
+ sal_Int32 m_nTopMargin;
+ sal_Int32 m_nBottomMargin;
+ sal_Int32 m_nHeaderTop;
+ sal_Int32 m_nHeaderBottom;
+
+ sal_Int32 m_nDzaGutter;
+
+ sal_Int32 m_nGridType;
+ sal_Int32 m_nGridLinePitch;
+ sal_Int32 m_nDxtCharSpace;
+ bool m_bGridSnapToChars;
+
+ // line numbering
+ sal_Int32 m_nLnnMod;
+ sal_uInt32 m_nLnc;
+ sal_Int32 m_ndxaLnn;
+ sal_Int32 m_nLnnMin;
// The "Link To Previous" flag indicates whether the header/footer
// content should be taken from the previous section
- bool m_bDefaultHeaderLinkToPrevious;
- bool m_bEvenPageHeaderLinkToPrevious;
- bool m_bFirstPageHeaderLinkToPrevious;
- bool m_bDefaultFooterLinkToPrevious;
- bool m_bEvenPageFooterLinkToPrevious;
- bool m_bFirstPageFooterLinkToPrevious;
-
- void ApplyProperties_(css::uno::Reference<css::beans::XPropertySet> const& xStyle);
+ bool m_bDefaultHeaderLinkToPrevious;
+ bool m_bEvenPageHeaderLinkToPrevious;
+ bool m_bFirstPageHeaderLinkToPrevious;
+ bool m_bDefaultFooterLinkToPrevious;
+ bool m_bEvenPageFooterLinkToPrevious;
+ bool m_bFirstPageFooterLinkToPrevious;
+
+ void ApplyProperties_( const css::uno::Reference< css::beans::XPropertySet >& xStyle );
+
void DontBalanceTextColumns();
- css::uno::Reference<css::text::XTextColumns> ApplyColumnProperties(css::uno::Reference<css::beans::XPropertySet> const& xFollowPageStyle,
- DomainMapper_Impl& rDM_Impl);
+
+ css::uno::Reference< css::text::XTextColumns > ApplyColumnProperties( const css::uno::Reference< css::beans::XPropertySet >& xFollowPageStyle,
+ DomainMapper_Impl& rDM_Impl);
+
void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
- static void CopyHeaderFooter(
- const css::uno::Reference<css::beans::XPropertySet>& xPrevStyle,
- const css::uno::Reference<css::beans::XPropertySet>& xStyle,
- bool bOmitRightHeader=false, bool bOmitLeftHeader=false,
- bool bOmitRightFooter=false, bool bOmitLeftFooter=false);
- static void CopyHeaderFooterTextProperty(
- const css::uno::Reference<css::beans::XPropertySet>& xPrevStyle,
- const css::uno::Reference<css::beans::XPropertySet>& xStyle,
- PropertyIds ePropId );
+
+ static void CopyHeaderFooter( const css::uno::Reference< css::beans::XPropertySet >& xPrevStyle,
+ const css::uno::Reference< css::beans::XPropertySet >& xStyle,
+ bool bOmitRightHeader = false, bool bOmitLeftHeader = false,
+ bool bOmitRightFooter = false, bool bOmitLeftFooter = false );
+
+ static void CopyHeaderFooterTextProperty( const css::uno::Reference< css::beans::XPropertySet >& xPrevStyle,
+ const css::uno::Reference< css::beans::XPropertySet >& xStyle,
+ PropertyIds ePropId );
+
void PrepareHeaderFooterProperties( bool bFirstPage );
+
bool HasHeader( bool bFirstPage ) const;
bool HasFooter( bool bFirstPage ) const;
- static void SetBorderDistance(css::uno::Reference<css::beans::XPropertySet> const& xStyle,
- PropertyIds eMarginId,
- PropertyIds eDistId,
- sal_Int32 nDistance,
- sal_Int32 nOffsetFrom,
- sal_uInt32 nLineWidth);
- /// Determines if conversion of a given floating table is wanted or not.
- bool FloatingTableConversion(FloatingTableInfo& rInfo);
+ static void SetBorderDistance( const css::uno::Reference< css::beans::XPropertySet >& xStyle,
+ PropertyIds eMarginId,
+ PropertyIds eDistId,
+ sal_Int32 nDistance,
+ sal_Int32 nOffsetFrom,
+ sal_uInt32 nLineWidth );
-public:
- explicit SectionPropertyMap(bool bIsFirstSection);
- virtual ~SectionPropertyMap() override;
+ // Determines if conversion of a given floating table is wanted or not.
+ bool FloatingTableConversion( FloatingTableInfo& rInfo );
+public:
enum PageType
{
PAGE_FIRST,
@@ -278,173 +294,178 @@ public:
PAGE_RIGHT
};
- void SetStart(const css::uno::Reference<css::text::XTextRange>& xRange)
- {
- m_xStartingRange = xRange;
- }
+ explicit SectionPropertyMap( bool bIsFirstSection );
+
+ void SetStart( const css::uno::Reference< css::text::XTextRange >& xRange ) { m_xStartingRange = xRange; }
- const css::uno::Reference<css::text::XTextRange>& GetStartingRange() const { return m_xStartingRange; }
+ const css::uno::Reference< css::text::XTextRange >& GetStartingRange() const { return m_xStartingRange; }
- css::uno::Reference<css::beans::XPropertySet> GetPageStyle(const css::uno::Reference<css::container::XNameContainer>& xStyles,
- const css::uno::Reference<css::lang::XMultiServiceFactory>& xTextFactory,
- bool bFirst);
+ css::uno::Reference< css::beans::XPropertySet > GetPageStyle( const css::uno::Reference< css::container::XNameContainer >& xStyles,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xTextFactory,
+ bool bFirst );
- OUString const & GetPageStyleName( bool bFirstPage = false ) { return bFirstPage ? m_sFirstPageStyleName : m_sFollowPageStyleName; }
- /// @throws css::beans::UnknownPropertyException
- /// @throws css::beans::PropertyVetoException
- /// @throws css::lang::IllegalArgumentException
- /// @throws css::lang::WrappedTargetException
- /// @throws css::uno::RuntimeException
+ const OUString& GetPageStyleName( bool bFirstPage = false )
+ {
+ return bFirstPage ? m_sFirstPageStyleName : m_sFollowPageStyleName;
+ }
+
+ // @throws css::beans::UnknownPropertyException
+ // @throws css::beans::PropertyVetoException
+ // @throws css::lang::IllegalArgumentException
+ // @throws css::lang::WrappedTargetException
+ // @throws css::uno::RuntimeException
void InheritOrFinalizePageStyles( DomainMapper_Impl& rDM_Impl );
- void SetBorder(BorderPosition ePos, sal_Int32 nLineDistance, const css::table::BorderLine2& rBorderLine, bool bShadow);
+ void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const css::table::BorderLine2& rBorderLine, bool bShadow );
void SetBorderParams( sal_Int32 nSet ) { m_nBorderParams = nSet; }
- void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
- sal_Int16 ColumnCount() const { return m_nColumnCount; }
- void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
- void AppendColumnWidth( sal_Int32 nWidth ) { m_aColWidth.push_back( nWidth ); }
- void AppendColumnSpacing( sal_Int32 nDist ) {m_aColDistance.push_back( nDist ); }
-
- void SetTitlePage( bool bSet ) { m_bTitlePage = bSet; }
- void SetSeparatorLine( bool bSet ) { m_bSeparatorLineIsOn = bSet; }
- void SetEvenlySpaced( bool bSet ) { m_bEvenlySpaced = bSet; }
- void SetLandscape( bool bSet ) { m_bIsLandscape = bSet; }
- void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; }
- void SetPageNumberType(sal_Int32 nSet) { m_nPageNumberType = nSet; }
- void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; }
+ void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
+ sal_Int16 ColumnCount() const { return m_nColumnCount; }
+
+ void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
+ void AppendColumnWidth( sal_Int32 nWidth ) { m_aColWidth.push_back( nWidth ); }
+ void AppendColumnSpacing( sal_Int32 nDist ) { m_aColDistance.push_back( nDist ); }
+
+ void SetTitlePage( bool bSet ) { m_bTitlePage = bSet; }
+ void SetSeparatorLine( bool bSet ) { m_bSeparatorLineIsOn = bSet; }
+ void SetEvenlySpaced( bool bSet ) { m_bEvenlySpaced = bSet; }
+ void SetLandscape( bool bSet ) { m_bIsLandscape = bSet; }
+ void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; }
+ void SetPageNumberType( sal_Int32 nSet ) { m_nPageNumberType = nSet; }
+ void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; }
// GetBreakType returns -1 if the breakType has not yet been identified for the section
- sal_Int32 GetBreakType() { return m_nBreakType; }
+ sal_Int32 GetBreakType() { return m_nBreakType; }
- void SetLeftMargin( sal_Int32 nSet ) { m_nLeftMargin = nSet; }
- sal_Int32 GetLeftMargin() { return m_nLeftMargin; }
- void SetRightMargin( sal_Int32 nSet ) { m_nRightMargin = nSet; }
- sal_Int32 GetRightMargin() { return m_nRightMargin; }
- void SetTopMargin( sal_Int32 nSet ) { m_nTopMargin = nSet; }
+ void SetLeftMargin( sal_Int32 nSet ) { m_nLeftMargin = nSet; }
+ sal_Int32 GetLeftMargin() { return m_nLeftMargin; }
+ void SetRightMargin( sal_Int32 nSet ) { m_nRightMargin = nSet; }
+ sal_Int32 GetRightMargin() { return m_nRightMargin; }
+ void SetTopMargin( sal_Int32 nSet ) { m_nTopMargin = nSet; }
void SetBottomMargin( sal_Int32 nSet ) { m_nBottomMargin = nSet; }
- void SetHeaderTop( sal_Int32 nSet ) { m_nHeaderTop = nSet; }
+ void SetHeaderTop( sal_Int32 nSet ) { m_nHeaderTop = nSet; }
void SetHeaderBottom( sal_Int32 nSet ) { m_nHeaderBottom = nSet; }
sal_Int32 GetPageWidth();
- void SetGridType(sal_Int32 nSet) { m_nGridType = nSet; }
+ void SetGridType( sal_Int32 nSet ) { m_nGridType = nSet; }
void SetGridLinePitch( sal_Int32 nSet ) { m_nGridLinePitch = nSet; }
- void SetGridSnapToChars( bool bSet) { m_bGridSnapToChars = bSet; }
- void SetDxtCharSpace( sal_Int32 nSet ) { m_nDxtCharSpace = nSet; }
+ void SetGridSnapToChars( bool bSet ) { m_bGridSnapToChars = bSet; }
+ void SetDxtCharSpace( sal_Int32 nSet ) { m_nDxtCharSpace = nSet; }
void SetLnnMod( sal_Int32 nValue ) { m_nLnnMod = nValue; }
- void SetLnc( sal_Int32 nValue ) { m_nLnc = nValue; }
- void SetdxaLnn( sal_Int32 nValue ) { m_ndxaLnn = nValue; }
+ void SetLnc( sal_Int32 nValue ) { m_nLnc = nValue; }
+ void SetdxaLnn( sal_Int32 nValue ) { m_ndxaLnn = nValue; }
void SetLnnMin( sal_Int32 nValue ) { m_nLnnMin = nValue; }
- //determine which style gets the borders
- void ApplyBorderToPageStyles(const css::uno::Reference<css::container::XNameContainer>& xStyles,
- const css::uno::Reference<css::lang::XMultiServiceFactory>& xTextFactory,
- sal_Int32 nValue);
+ // determine which style gets the borders
+ void ApplyBorderToPageStyles( const css::uno::Reference< css::container::XNameContainer >& xStyles,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xTextFactory,
+ sal_Int32 nValue );
void CloseSectionGroup( DomainMapper_Impl& rDM_Impl );
- /// Handling of margins, header and footer for any kind of sections breaks.
- void HandleMarginsHeaderFooter(bool bFirstPage, DomainMapper_Impl& rDM_Impl);
+ // Handling of margins, header and footer for any kind of sections breaks.
+ void HandleMarginsHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
void ClearHeaderFooterLinkToPrevious( bool bHeader, PageType eType );
};
-
class ParagraphProperties
{
- bool m_bFrameMode;
- sal_Int32 m_nDropCap; //drop, margin ST_DropCap
- sal_Int32 m_nLines; //number of lines of the drop cap
- sal_Int32 m_w; //width
- sal_Int32 m_h; //height
- css::text::WrapTextMode m_nWrap; // from ST_Wrap around, auto, none, notBeside, through, tight
- sal_Int32 m_hAnchor; // page, from ST_HAnchor margin, page, text
- sal_Int32 m_vAnchor; // around from ST_VAnchor margin, page, text
- sal_Int32 m_x; //x-position
- bool m_bxValid;
- sal_Int32 m_y; //y-position
- bool m_byValid;
- sal_Int32 m_hSpace; //frame padding h
- sal_Int32 m_vSpace; //frame padding v
- sal_Int32 m_hRule; // from ST_HeightRule exact, atLeast, auto
- sal_Int32 m_xAlign; // from ST_XAlign center, inside, left, outside, right
- sal_Int32 m_yAlign; // from ST_YAlign bottom, center, inline, inside, outside, top
- bool m_bAnchorLock;
-
- sal_Int8 m_nDropCapLength; //number of characters
-
- OUString m_sParaStyleName;
-
- css::uno::Reference<css::text::XTextRange> m_xStartingRange; // start of a frame
- css::uno::Reference<css::text::XTextRange> m_xEndingRange; // end of the frame
+private:
+ bool m_bFrameMode;
+ sal_Int32 m_nDropCap; // drop, margin ST_DropCap
+ sal_Int32 m_nLines; // number of lines of the drop cap
+ sal_Int32 m_w; // width
+ sal_Int32 m_h; // height
+ css::text::WrapTextMode m_nWrap; // from ST_Wrap around, auto, none, notBeside, through, tight
+ sal_Int32 m_hAnchor; // page, from ST_HAnchor margin, page, text
+ sal_Int32 m_vAnchor; // around from ST_VAnchor margin, page, text
+ sal_Int32 m_x; // x-position
+ bool m_bxValid;
+ sal_Int32 m_y; // y-position
+ bool m_byValid;
+ sal_Int32 m_hSpace; // frame padding h
+ sal_Int32 m_vSpace; // frame padding v
+ sal_Int32 m_hRule; // from ST_HeightRule exact, atLeast, auto
+ sal_Int32 m_xAlign; // from ST_XAlign center, inside, left, outside, right
+ sal_Int32 m_yAlign; // from ST_YAlign bottom, center, inline, inside, outside, top
+ bool m_bAnchorLock;
+ sal_Int8 m_nDropCapLength; // number of characters
+ OUString m_sParaStyleName;
+
+ css::uno::Reference< css::text::XTextRange > m_xStartingRange; // start of a frame
+ css::uno::Reference< css::text::XTextRange > m_xEndingRange; // end of the frame
public:
ParagraphProperties();
- ParagraphProperties(const ParagraphProperties&);
- virtual ~ParagraphProperties();
+ ParagraphProperties( const ParagraphProperties& );
+ virtual ~ParagraphProperties() {}
- bool operator==(const ParagraphProperties&); //does not compare the starting/ending range, m_sParaStyleName and m_nDropCapLength
+ // Does not compare the starting/ending range, m_sParaStyleName and m_nDropCapLength
+ bool operator==( const ParagraphProperties& );
- void SetFrameMode( bool set = true ) { m_bFrameMode = set; }
- bool IsFrameMode()const { return m_bFrameMode; }
+ bool IsFrameMode() const { return m_bFrameMode; }
+ void SetFrameMode( bool set = true ) { m_bFrameMode = set; }
- void SetDropCap( sal_Int32 nSet ) { m_nDropCap = nSet; }
- sal_Int32 GetDropCap()const { return m_nDropCap; }
+ sal_Int32 GetDropCap() const { return m_nDropCap; }
+ void SetDropCap( sal_Int32 nSet ) { m_nDropCap = nSet; }
- void SetLines( sal_Int32 nSet ) { m_nLines = nSet; }
- sal_Int32 GetLines() const { return m_nLines; }
+ sal_Int32 GetLines() const { return m_nLines; }
+ void SetLines( sal_Int32 nSet ) { m_nLines = nSet; }
- void Setw( sal_Int32 nSet ) { m_w = nSet; }
- sal_Int32 Getw() const { return m_w; }
+ sal_Int32 Getw() const { return m_w; }
+ void Setw( sal_Int32 nSet ) { m_w = nSet; }
- void Seth( sal_Int32 nSet ) { m_h = nSet; }
- sal_Int32 Geth() const { return m_h; }
+ sal_Int32 Geth() const { return m_h; }
+ void Seth( sal_Int32 nSet ) { m_h = nSet; }
+ css::text::WrapTextMode GetWrap() const { return m_nWrap; }
void SetWrap( css::text::WrapTextMode nSet ) { m_nWrap = nSet; }
- css::text::WrapTextMode GetWrap() const { return m_nWrap; }
- void SethAnchor( sal_Int32 nSet ) { m_hAnchor = nSet; }
- sal_Int32 GethAnchor() const { return m_hAnchor;}
+ sal_Int32 GethAnchor() const { return m_hAnchor; }
+ void SethAnchor( sal_Int32 nSet ) { m_hAnchor = nSet; }
- void SetvAnchor( sal_Int32 nSet ) { m_vAnchor = nSet; }
- sal_Int32 GetvAnchor() const { return m_vAnchor; }
+ sal_Int32 GetvAnchor() const { return m_vAnchor; }
+ void SetvAnchor( sal_Int32 nSet ) { m_vAnchor = nSet; }
- void Setx( sal_Int32 nSet ) { m_x = nSet; m_bxValid = true;}
- sal_Int32 Getx() const { return m_x; }
- bool IsxValid() const {return m_bxValid;}
+ sal_Int32 Getx() const { return m_x; }
+ void Setx( sal_Int32 nSet ) { m_x = nSet; m_bxValid = true; }
+ bool IsxValid() const { return m_bxValid; }
- void Sety( sal_Int32 nSet ) { m_y = nSet; m_byValid = true;}
- sal_Int32 Gety()const { return m_y; }
- bool IsyValid() const {return m_byValid;}
+ sal_Int32 Gety() const { return m_y; }
+ void Sety( sal_Int32 nSet ) { m_y = nSet; m_byValid = true; }
+ bool IsyValid() const { return m_byValid; }
- void SethSpace( sal_Int32 nSet ) { m_hSpace = nSet; }
- sal_Int32 GethSpace()const { return m_hSpace; }
+ void SethSpace( sal_Int32 nSet ) { m_hSpace = nSet; }
+ sal_Int32 GethSpace() const { return m_hSpace; }
- void SetvSpace( sal_Int32 nSet ) { m_vSpace = nSet; }
- sal_Int32 GetvSpace()const { return m_vSpace; }
+ sal_Int32 GetvSpace() const { return m_vSpace; }
+ void SetvSpace( sal_Int32 nSet ) { m_vSpace = nSet; }
- void SethRule( sal_Int32 nSet ) { m_hRule = nSet; }
- sal_Int32 GethRule() const { return m_hRule; }
+ sal_Int32 GethRule() const { return m_hRule; }
+ void SethRule( sal_Int32 nSet ) { m_hRule = nSet; }
- void SetxAlign( sal_Int32 nSet ) { m_xAlign = nSet; }
- sal_Int32 GetxAlign()const { return m_xAlign; }
+ sal_Int32 GetxAlign() const { return m_xAlign; }
+ void SetxAlign( sal_Int32 nSet ) { m_xAlign = nSet; }
- void SetyAlign( sal_Int32 nSet ) { m_yAlign = nSet; }
- sal_Int32 GetyAlign()const { return m_yAlign; }
+ sal_Int32 GetyAlign() const { return m_yAlign; }
+ void SetyAlign( sal_Int32 nSet ) { m_yAlign = nSet; }
- sal_Int8 GetDropCapLength() const { return m_nDropCapLength;}
- void SetDropCapLength(sal_Int8 nSet) { m_nDropCapLength = nSet;}
+ sal_Int8 GetDropCapLength() const { return m_nDropCapLength; }
+ void SetDropCapLength( sal_Int8 nSet ) { m_nDropCapLength = nSet; }
- const css::uno::Reference<css::text::XTextRange>& GetStartingRange() const { return m_xStartingRange; }
- void SetStartingRange(css::uno::Reference<css::text::XTextRange> const& xSet) { m_xStartingRange = xSet; }
+ const css::uno::Reference< css::text::XTextRange >& GetStartingRange() const { return m_xStartingRange; }
+ void SetStartingRange( const css::uno::Reference< css::text::XTextRange >& xSet ) { m_xStartingRange = xSet; }
- const css::uno::Reference<css::text::XTextRange>& GetEndingRange() const { return m_xEndingRange; }
- void SetEndingRange(css::uno::Reference<css::text::XTextRange> const& xSet) { m_xEndingRange = xSet; }
+ const css::uno::Reference< css::text::XTextRange >& GetEndingRange() const { return m_xEndingRange; }
+ void SetEndingRange( const css::uno::Reference< css::text::XTextRange >& xSet ) { m_xEndingRange = xSet; }
- void SetParaStyleName( const OUString& rSet ) { m_sParaStyleName = rSet;}
- const OUString& GetParaStyleName() const { return m_sParaStyleName;}
+ const OUString& GetParaStyleName() const { return m_sParaStyleName; }
+ void SetParaStyleName( const OUString& rSet ) { m_sParaStyleName = rSet; }
void ResetFrameProperties();
};
-typedef std::shared_ptr<ParagraphProperties> ParagraphPropertiesPtr;
+
+typedef std::shared_ptr< ParagraphProperties > ParagraphPropertiesPtr;
+
/*-------------------------------------------------------------------------
property map of a stylesheet
-----------------------------------------------------------------------*/
@@ -452,64 +473,66 @@ typedef std::shared_ptr<ParagraphProperties> ParagraphPropertiesPtr;
#define WW_OUTLINE_MAX sal_Int16( 9 )
#define WW_OUTLINE_MIN sal_Int16( 0 )
-class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
-
+class StyleSheetPropertyMap
+ : public PropertyMap
+ , public ParagraphProperties
{
- sal_Int32 mnCT_TrPrBase_jc;
-
- sal_Int32 mnCT_TblWidth_w;
- sal_Int32 mnCT_TblWidth_type;
-
- bool mbCT_TrPrBase_jcSet;
-
- bool mbCT_TblWidth_wSet;
- bool mbCT_TblWidth_typeSet;
-
- sal_Int32 mnListId;
- sal_Int16 mnListLevel;
-
- sal_Int16 mnOutlineLevel;
+private:
+ sal_Int32 mnCT_TrPrBase_jc;
+ sal_Int32 mnCT_TblWidth_w;
+ sal_Int32 mnCT_TblWidth_type;
+ bool mbCT_TrPrBase_jcSet;
+ bool mbCT_TblWidth_wSet;
+ bool mbCT_TblWidth_typeSet;
+ sal_Int32 mnListId;
+ sal_Int16 mnListLevel;
+ sal_Int16 mnOutlineLevel;
+ sal_Int32 mnNumId;
- sal_Int32 mnNumId;
public:
explicit StyleSheetPropertyMap();
- virtual ~StyleSheetPropertyMap() override;
- void SetCT_TrPrBase_jc( sal_Int32 nSet )
- {mnCT_TrPrBase_jc = nSet; mbCT_TrPrBase_jcSet = true; }
+ void SetCT_TrPrBase_jc( sal_Int32 nSet )
+ {
+ mnCT_TrPrBase_jc = nSet;
+ mbCT_TrPrBase_jcSet = true;
+ }
+
void SetCT_TblWidth_w( sal_Int32 nSet )
- { mnCT_TblWidth_w = nSet; mbCT_TblWidth_wSet = true; }
+ {
+ mnCT_TblWidth_w = nSet;
+ mbCT_TblWidth_wSet = true;
+ }
+
void SetCT_TblWidth_type( sal_Int32 nSet )
- {mnCT_TblWidth_type = nSet; mbCT_TblWidth_typeSet = true; }
+ {
+ mnCT_TblWidth_type = nSet;
+ mbCT_TblWidth_typeSet = true;
+ }
- sal_Int32 GetListId() const { return mnListId; }
- void SetListId(sal_Int32 nId) { mnListId = nId; }
+ sal_Int32 GetListId() const { return mnListId; }
+ void SetListId( sal_Int32 nId ) { mnListId = nId; }
- sal_Int16 GetListLevel() const { return mnListLevel; }
- void SetListLevel(sal_Int16 nLevel) { mnListLevel = nLevel; }
+ sal_Int16 GetListLevel() const { return mnListLevel; }
+ void SetListLevel( sal_Int16 nLevel ) { mnListLevel = nLevel; }
- sal_Int16 GetOutlineLevel() const { return mnOutlineLevel; }
- void SetOutlineLevel(sal_Int16 nLevel)
- {
- if ( nLevel < WW_OUTLINE_MAX )
- mnOutlineLevel = nLevel;
- }
+ sal_Int16 GetOutlineLevel() const { return mnOutlineLevel; }
+ void SetOutlineLevel( sal_Int16 nLevel ) { if ( nLevel < WW_OUTLINE_MAX ) mnOutlineLevel = nLevel; }
- sal_Int32 GetNumId() const { return mnNumId; }
- void SetNumId(sal_Int32 nId) { mnNumId = nId; }
+ sal_Int32 GetNumId() const { return mnNumId; }
+ void SetNumId(sal_Int32 nId) { mnNumId = nId; }
};
-
-class ParagraphPropertyMap : public PropertyMap, public ParagraphProperties
+class ParagraphPropertyMap
+ : public PropertyMap
+ , public ParagraphProperties
{
public:
- explicit ParagraphPropertyMap();
- virtual ~ParagraphPropertyMap() override;
-
+ explicit ParagraphPropertyMap() {}
};
-
-class TablePropertyMap : public PropertyMap
+class TablePropertyMap
+ : public PropertyMap
{
public:
enum TablePropertyMapTarget
@@ -526,29 +549,36 @@ public:
HORI_ORIENT,
TablePropertyMapTarget_MAX
};
+
private:
struct ValidValue
{
- sal_Int32 nValue;
- bool bValid;
- ValidValue() :
- nValue( 0 ),
- bValid( false ){}
+ sal_Int32 nValue;
+ bool bValid;
+
+ ValidValue()
+ : nValue( 0 )
+ , bValid( false )
+ {
+ }
};
+
ValidValue m_aValidValues[TablePropertyMapTarget_MAX];
public:
- explicit TablePropertyMap();
- virtual ~TablePropertyMap() override;
+ explicit TablePropertyMap() {}
- bool getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill );
- void setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet );
+ bool getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill );
+ void setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet );
virtual void insertTableProperties( const PropertyMap* ) override;
};
-typedef std::shared_ptr<TablePropertyMap> TablePropertyMapPtr;
-} //namespace dmapper
-} //namespace writerfilter
-#endif
+
+typedef std::shared_ptr< TablePropertyMap > TablePropertyMapPtr;
+
+} // namespace dmapper
+} // namespace writerfilter
+
+#endif // INCLUDED_WRITERFILTER_SOURCE_DMAPPER_PROPERTYMAP_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */