fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / writerfilter / source / dmapper / SettingsTable.cxx
blobb01047ac0a9a53cd97b8a6db9271b0f6c0eef4dd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <stdio.h>
21 #include <rtl/ustring.hxx>
22 #include <resourcemodel/ResourceModelHelper.hxx>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <SettingsTable.hxx>
25 #include <doctok/resourceids.hxx>
26 #include <ooxml/resourceids.hxx>
27 #include <ConversionHelper.hxx>
29 #include "dmapperLoggers.hxx"
31 namespace writerfilter {
33 using resourcemodel::resolveSprmProps;
35 namespace dmapper
38 struct SettingsTable_Impl
40 DomainMapper& m_rDMapper;
41 const uno::Reference< lang::XMultiServiceFactory > m_xTextFactory;
43 OUString m_sCharacterSpacing;
44 OUString m_sDecimalSymbol;
45 OUString m_sListSeparatorForFields; //2.15.1.56 listSeparator (List Separator for Field Code Evaluation)
47 int m_nDefaultTabStop;
48 int m_nHyphenationZone;
50 bool m_bNoPunctuationKerning;
51 bool m_doNotIncludeSubdocsInStats; // Do Not Include Content in Text Boxes, Footnotes, and Endnotes in Document Statistics)
52 bool m_bRecordChanges;
53 int m_nEdit;
54 bool m_bFormatting;
55 bool m_bEnforcement;
56 int m_nCryptProviderType;
57 int m_nCryptAlgorithmClass;
58 int m_nCryptAlgorithmType;
59 OUString m_sCryptAlgorithmSid;
60 int m_nCryptSpinCount;
61 OUString m_sCryptProvider;
62 OUString m_sAlgIdExt;
63 OUString m_sAlgIdExtSource;
64 OUString m_sCryptProviderTypeExt;
65 OUString m_sCryptProviderTypeExtSource;
66 OUString m_sHash;
67 OUString m_sSalt;
68 bool m_bLinkStyles;
69 sal_Int16 m_nZoomFactor;
70 bool m_bEvenAndOddHeaders;
71 bool m_bUsePrinterMetrics;
72 bool embedTrueTypeFonts;
73 bool embedSystemFonts;
74 bool m_bDoNotUseHTMLParagraphAutoSpacing;
75 bool m_bSplitPgBreakAndParaMark;
77 SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
78 m_rDMapper( rDMapper )
79 , m_xTextFactory( xTextFactory )
80 , m_nDefaultTabStop( 720 ) //default is 1/2 in
81 , m_nHyphenationZone(0)
82 , m_bNoPunctuationKerning(false)
83 , m_doNotIncludeSubdocsInStats(false)
84 , m_bRecordChanges(false)
85 , m_nEdit(NS_ooxml::LN_Value_wordprocessingml_ST_DocProtect_none)
86 , m_bFormatting(false)
87 , m_bEnforcement(false)
88 , m_nCryptProviderType(NS_ooxml::LN_Value_wordprocessingml_ST_CryptProv_rsaAES)
89 , m_nCryptAlgorithmClass(NS_ooxml::LN_Value_wordprocessingml_ST_AlgClass_hash)
90 , m_nCryptAlgorithmType(NS_ooxml::LN_Value_wordprocessingml_ST_AlgType_typeAny)
91 , m_nCryptSpinCount(0)
92 , m_bLinkStyles(false)
93 , m_nZoomFactor(0)
94 , m_bEvenAndOddHeaders(false)
95 , m_bUsePrinterMetrics(false)
96 , embedTrueTypeFonts(false)
97 , embedSystemFonts(false)
98 , m_bDoNotUseHTMLParagraphAutoSpacing(false)
99 , m_bSplitPgBreakAndParaMark(false)
104 SettingsTable::SettingsTable(DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory)
105 : LoggedProperties(dmapper_logger, "SettingsTable")
106 , LoggedTable(dmapper_logger, "SettingsTable")
107 , m_pImpl( new SettingsTable_Impl(rDMapper, xTextFactory) )
112 SettingsTable::~SettingsTable()
114 delete m_pImpl;
117 void SettingsTable::lcl_attribute(Id nName, Value & val)
119 int nIntValue = val.getInt();
121 switch(nName)
123 case NS_ooxml::LN_CT_Zoom_percent:
124 m_pImpl->m_nZoomFactor = nIntValue;
125 break;
126 default:
128 #ifdef DEBUG_DMAPPER_SETTINGS_TABLE
129 dmapper_logger->element("unhandled");
130 #endif
135 void SettingsTable::lcl_sprm(Sprm& rSprm)
137 sal_uInt32 nSprmId = rSprm.getId();
139 Value::Pointer_t pValue = rSprm.getValue();
140 sal_Int32 nIntValue = pValue->getInt();
141 (void)nIntValue;
142 OUString sStringValue = pValue->getString();
144 switch(nSprmId)
146 case NS_ooxml::LN_CT_Settings_zoom: // 92469;
147 case NS_ooxml::LN_CT_Settings_proofState: // 92489;
148 case NS_ooxml::LN_CT_Settings_attachedTemplate: // 92491;
149 case NS_ooxml::LN_CT_Settings_hdrShapeDefaults: // 92544;
150 case NS_ooxml::LN_CT_Settings_footnotePr: // 92545;
151 case NS_ooxml::LN_CT_Settings_endnotePr: // 92546;
152 case NS_ooxml::LN_CT_Settings_compat: // 92547;
153 case NS_ooxml::LN_CT_Settings_themeFontLang: // 92552;
154 case NS_ooxml::LN_CT_Settings_shapeDefaults: // 92560;
156 //PropertySetValues - need to be resolved
158 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
159 if( pProperties.get())
160 pProperties->resolve(*this);
162 break;
163 case NS_ooxml::LN_CT_Settings_stylePaneFormatFilter: // 92493;
164 break;
165 case NS_ooxml::LN_CT_Settings_defaultTabStop: // 92505;
166 m_pImpl->m_nDefaultTabStop = nIntValue;
167 break;
168 case NS_ooxml::LN_CT_Settings_linkStyles: // 92663;
169 m_pImpl->m_bLinkStyles = nIntValue;
170 break;
171 case NS_ooxml::LN_CT_Settings_evenAndOddHeaders:
172 m_pImpl->m_bEvenAndOddHeaders = nIntValue;
173 break;
174 case NS_ooxml::LN_CT_Settings_noPunctuationKerning: // 92526;
175 m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false;
176 break;
177 case NS_ooxml::LN_CT_Settings_characterSpacingControl: // 92527;
178 m_pImpl->m_sCharacterSpacing = sStringValue; // doNotCompress, compressPunctuation, compressPunctuationAndJapaneseKana
179 break;
180 case NS_ooxml::LN_CT_Settings_doNotIncludeSubdocsInStats: // 92554; // Do Not Include Content in Text Boxes, Footnotes, and Endnotes in Document Statistics)
181 m_pImpl->m_doNotIncludeSubdocsInStats = nIntValue? true : false;
182 break;
183 case NS_ooxml::LN_CT_Settings_decimalSymbol: // 92562;
184 m_pImpl->m_sDecimalSymbol = sStringValue;
185 break;
186 case NS_ooxml::LN_CT_Settings_listSeparator: // 92563;
187 m_pImpl->m_sListSeparatorForFields = sStringValue;
188 break;
189 case NS_ooxml::LN_CT_Settings_rsids: // 92549; revision save Ids - probably not necessary
190 break;
191 case NS_ooxml::LN_CT_Settings_hyphenationZone: // 92508;
192 m_pImpl->m_nHyphenationZone = nIntValue;
193 break;
194 case NS_ooxml::LN_CT_Compat_useFELayout: // 92422;
195 // useFELayout (Do Not Bypass East Asian/Complex Script Layout Code - support of old versions of Word - ignored)
196 break;
197 case NS_ooxml::LN_CT_Settings_trackRevisions:
199 m_pImpl->m_bRecordChanges = bool(rSprm.getValue( )->getInt( ) );
201 break;
202 case NS_ooxml::LN_CT_Settings_documentProtection:
204 resolveSprmProps(*this, rSprm);
206 break;
207 case NS_ooxml::LN_CT_Compat_usePrinterMetrics:
208 m_pImpl->m_bUsePrinterMetrics = nIntValue;
209 break;
210 case NS_ooxml::LN_CT_Settings_embedTrueTypeFonts:
211 m_pImpl->embedTrueTypeFonts = nIntValue != 0;
212 break;
213 case NS_ooxml::LN_CT_Settings_embedSystemFonts:
214 m_pImpl->embedSystemFonts = nIntValue != 0;
215 break;
216 case NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing:
217 m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing = nIntValue;
218 break;
219 case NS_ooxml::LN_CT_Compat_splitPgBreakAndParaMark:
220 m_pImpl->m_bSplitPgBreakAndParaMark = nIntValue;
221 break;
222 default:
224 #ifdef DEBUG_DMAPPER_SETTINGS_TABLE
225 dmapper_logger->element("unhandled");
226 #endif
231 void SettingsTable::lcl_entry(int /*pos*/, writerfilter::Reference<Properties>::Pointer_t ref)
233 ref->resolve(*this);
235 //returns default TabStop in 1/100th mm
239 int SettingsTable::GetDefaultTabStop() const
241 return ConversionHelper::convertTwipToMM100( m_pImpl->m_nDefaultTabStop );
244 bool SettingsTable::GetLinkStyles() const
246 return m_pImpl->m_bLinkStyles;
249 sal_Int16 SettingsTable::GetZoomFactor() const
251 return m_pImpl->m_nZoomFactor;
254 bool SettingsTable::GetUsePrinterMetrics() const
256 return m_pImpl->m_bUsePrinterMetrics;
259 bool SettingsTable::GetEvenAndOddHeaders() const
261 return m_pImpl->m_bEvenAndOddHeaders;
264 bool SettingsTable::GetEmbedTrueTypeFonts() const
266 return m_pImpl->embedTrueTypeFonts;
269 bool SettingsTable::GetEmbedSystemFonts() const
271 return m_pImpl->embedSystemFonts;
274 bool SettingsTable::GetDoNotUseHTMLParagraphAutoSpacing() const
276 return m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing;
279 bool SettingsTable::GetSplitPgBreakAndParaMark() const
281 return m_pImpl->m_bSplitPgBreakAndParaMark;
284 void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
286 uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
288 // Record changes value
289 if (xDocProps.is())
290 xDocProps->setPropertyValue("RecordChanges", uno::makeAny( m_pImpl->m_bRecordChanges ) );
294 }//namespace dmapper
295 } //namespace writerfilter
297 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */