summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/SettingsTable.cxx
blob: dd5796a22cebcfec248945deae38edb7a29c5c1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "SettingsTable.hxx"

#include <ooxml/resourceids.hxx>

#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/XTextDocument.hpp>

#if DEBUG
#include <iostream>
#endif

using namespace com::sun::star;
using namespace rtl;

namespace writerfilter {
namespace dmapper {

SettingsTable_Impl::SettingsTable_Impl( ) :
   m_bRecordChanges( false )
{
}

SettingsTable_Impl::~SettingsTable_Impl( )
{
}

SettingsTable::SettingsTable( ) :
    m_pImpl( new SettingsTable_Impl )
{
}

SettingsTable::~SettingsTable( )
{
    delete m_pImpl, m_pImpl = NULL;
}

void SettingsTable::attribute( Id /*nName*/, Value& /*rVal*/ )
{
#if DEBUG
    clog << "SettingsTable::attribute( )" << endl;
#endif
}

void SettingsTable::sprm( Sprm& rSprm )
{
    switch ( rSprm.getId( ) )
    {
        case NS_ooxml::LN_CT_Settings_trackRevisions:
            {
                m_pImpl->m_bRecordChanges = bool(rSprm.getValue( )->getInt( ) );
            }
            break;
        default:
            {
#if DEBUG
                clog << __FILE__ << ":" << __LINE__;
                clog << ": unknown SPRM: " << rSprm.getName( ) << endl;
#endif
            }
    }
}

void SettingsTable::entry( int nPos, writerfilter::Reference<Properties>::Pointer_t pRef )
{
    (void)nPos;
#if DEBUG
    fprintf( stderr, "SettingsTable::entry( ), pos: %d\n", nPos );
#endif
    pRef->resolve( *this );
}

void SettingsTable::resolveSprmProps( Sprm& rSprm )
{
    writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    if( pProperties.get())
        pProperties->resolve(*this);
}

void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
{
    uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );

    // Record changes value
    xDocProps->setPropertyValue( OUString::createFromAscii( "RecordChanges" ), uno::makeAny( m_pImpl->m_bRecordChanges ) );
}

} }