Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_WW8_PROPERTY_SET_IMPL_HXX
21 : #define INCLUDED_WW8_PROPERTY_SET_IMPL_HXX
22 :
23 : #include <resourcemodel/WW8ResourceModel.hxx>
24 : #include <doctok/WW8Document.hxx>
25 : #include "WW8StructBase.hxx"
26 : #include "WW8OutputWithDepth.hxx"
27 :
28 : #include <map>
29 :
30 : namespace writerfilter {
31 : namespace doctok
32 : {
33 :
34 : class WW8PropertyImpl : public WW8Property, public WW8StructBase
35 : {
36 : sal_uInt8 get_ispmd() const
37 : { return sal::static_int_cast<sal_uInt8>(getId() & 0xff); }
38 : bool get_fSpec() const { return (getId() & 0x100) != 0; }
39 0 : sal_uInt8 get_sgc() const
40 0 : { return sal::static_int_cast<sal_uInt8>((getId() >> 10) & 0x7); }
41 0 : sal_uInt8 get_spra() const
42 0 : { return sal::static_int_cast<sal_uInt8>((getId() >> 13) & 0x7); }
43 :
44 : public:
45 : WW8PropertyImpl(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount);
46 : WW8PropertyImpl(const WW8StructBase & rBase, sal_uInt32 nOffset,
47 : sal_uInt32 nCount);
48 :
49 : WW8PropertyImpl(WW8StructBase * pBase, sal_uInt32 nOffset,
50 : sal_uInt32 nCount);
51 :
52 : virtual ~WW8PropertyImpl();
53 :
54 0 : sal_uInt32 getId() const { return getU16(0); }
55 : sal_uInt32 getParam() const;
56 : WW8Stream::Sequence getParams() const;
57 :
58 : sal_uInt32 getByteLength() const;
59 : sal_uInt32 getParamOffset() const;
60 :
61 : virtual void dump(OutputWithDepth<string> & o) const;
62 : string toString() const;
63 : };
64 :
65 : class WW8PropertySetImpl : public WW8PropertySet, public WW8StructBase,
66 : public ::writerfilter::Reference<Properties>
67 : {
68 : bool mbPap;
69 :
70 : public:
71 : typedef boost::shared_ptr<WW8PropertySet> Pointer_t;
72 :
73 : WW8PropertySetImpl(WW8Stream & rStream, sal_uInt32 nOffset,
74 : sal_uInt32 nCount, bool bPap = false);
75 :
76 : WW8PropertySetImpl(const WW8StructBase & rBase, sal_uInt32 nOffset,
77 : sal_uInt32 nCount, bool bPap = false);
78 :
79 : virtual ~WW8PropertySetImpl();
80 :
81 : virtual WW8PropertySetIterator::Pointer_t begin();
82 : virtual WW8PropertySetIterator::Pointer_t end();
83 :
84 : virtual void dump(OutputWithDepth<string> & o) const;
85 : virtual void dots(ostream & o);
86 :
87 : virtual string getType() const;
88 :
89 : virtual WW8Property::Pointer_t getAttribute(sal_uInt32 nOffset) const;
90 :
91 : virtual bool isPap() const;
92 : virtual sal_uInt32 get_istd() const;
93 :
94 0 : virtual void insert(const WW8PropertySet::Pointer_t /*pSet*/) {}
95 :
96 : virtual void resolve(Properties & rHandler);
97 :
98 : /**
99 : Get and distribute information from sprm that is used
100 : internally by the document.
101 :
102 : @param rSprm sprm to process
103 : @param rHandler property handler to resolve huge papx (sprm 0x6646) to
104 : */
105 : virtual void resolveLocal(Sprm & rSprm, Properties & rHandler);
106 : };
107 :
108 : class WW8PropertySetIteratorImpl : public WW8PropertySetIterator
109 : {
110 : WW8PropertySetImpl * mpAttrSet;
111 : sal_uInt32 mnOffset;
112 :
113 : public:
114 0 : WW8PropertySetIteratorImpl(WW8PropertySetImpl * pAttrSet,
115 : sal_uInt32 nOffset)
116 0 : : mpAttrSet(pAttrSet), mnOffset(nOffset)
117 : {
118 0 : }
119 :
120 : virtual ~WW8PropertySetIteratorImpl();
121 :
122 : virtual WW8PropertySetIterator & operator++();
123 :
124 : virtual WW8Property::Pointer_t get() const;
125 :
126 : virtual bool equal(const WW8PropertySetIterator & rIt) const;
127 :
128 : virtual string toString() const;
129 : };
130 :
131 : ::writerfilter::Reference<Properties>::Pointer_t createSprmProps
132 : (WW8PropertyImpl & rProp);
133 : ::writerfilter::Reference<BinaryObj>::Pointer_t createSprmBinary
134 : (WW8PropertyImpl & rProp);
135 : }}
136 :
137 : #endif // INCLUDED_WW8_PROPERTY_SET_IMPL_HXX
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|