Update ooo320-m1
[ooovba.git] / writerfilter / source / dmapper / SettingsTable.cxx
blob8811ea117d8aa7764347a4dad31d8b6b5fa1d3dc
1 #include "SettingsTable.hxx"
3 #include <ooxml/resourceids.hxx>
5 #include <com/sun/star/beans/XPropertySet.hpp>
6 #include <com/sun/star/text/XTextDocument.hpp>
8 #if DEBUG
9 #include <iostream>
10 #endif
12 using namespace com::sun::star;
13 using namespace rtl;
15 namespace writerfilter {
16 namespace dmapper {
18 SettingsTable_Impl::SettingsTable_Impl( ) :
19 m_bRecordChanges( false )
23 SettingsTable_Impl::~SettingsTable_Impl( )
27 SettingsTable::SettingsTable( ) :
28 m_pImpl( new SettingsTable_Impl )
32 SettingsTable::~SettingsTable( )
34 delete m_pImpl, m_pImpl = NULL;
37 void SettingsTable::attribute( Id nName, Value& rVal )
39 #if DEBUG
40 clog << "SettingsTable::attribute( )" << endl;
41 #endif
44 void SettingsTable::sprm( Sprm& rSprm )
46 switch ( rSprm.getId( ) )
48 case NS_ooxml::LN_CT_Settings_trackRevisions:
50 m_pImpl->m_bRecordChanges = bool(rSprm.getValue( )->getInt( ) );
52 break;
53 default:
55 #if DEBUG
56 clog << __FILE__ << ":" << __LINE__;
57 clog << ": unknown SPRM: " << rSprm.getName( ) << endl;
58 #endif
63 void SettingsTable::entry( int nPos, writerfilter::Reference<Properties>::Pointer_t pRef )
65 #if DEBUG
66 fprintf( stderr, "SettingsTable::entry( ), pos: %d\n", nPos );
67 #endif
68 pRef->resolve( *this );
71 void SettingsTable::resolveSprmProps( Sprm& rSprm )
73 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
74 if( pProperties.get())
75 pProperties->resolve(*this);
78 void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
80 uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
82 // Record changes value
83 xDocProps->setPropertyValue( OUString::createFromAscii( "RecordChanges" ), uno::makeAny( m_pImpl->m_bRecordChanges ) );
86 } }