LibreOffice Module xmloff (master)  1
txtvfldi.hxx
Go to the documentation of this file.
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 
25 #pragma once
26 
27 #include "txtfldi.hxx"
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 
30 
33 {
36 
37  OUString sValue;
38  double fValue;
39  sal_Int32 nFormatKey;
40  OUString sFormula;
41  OUString sDefault;
43 
44  bool bStringType;
45  bool bFormatOK;
47  bool bFormulaOK;
48 
49  const bool bSetType;
50  const bool bSetValue;
51  const bool bSetStyle;
52  const bool bSetFormula;
53 
54 public:
56  SvXMLImport& rImprt,
57  XMLTextImportHelper& rHlp,
58  bool bType,
59  bool bStyle,
60  bool bValue,
61  bool bFormula);
62 
64  void ProcessAttribute( sal_Int32 nAttrToken,
65  std::string_view sAttrValue );
66 
68  void PrepareField(
69  const css::uno::Reference<css::beans::XPropertySet> & xPropertySet);
70 
72  bool IsStringValue() const { return bStringType; }
73 
75  bool IsFormatOK() const { return bFormatOK; }
76 
77  void SetDefault(const OUString& sStr) { sDefault = sStr; }
78 };
79 
80 
106 {
107 private:
108  OUString sName;
109  OUString sFormula;
110  OUString sDescription;
111  OUString sHelp;
112  OUString sHint;
116 
117  bool bFormulaOK;
119  bool bHelpOK;
120  bool bHintOK;
121  bool bDisplayOK;
122 
123  bool bSetFormula;
126  bool bSetHelp;
127  bool bSetHint;
128  bool bSetVisible;
131 
132 public:
133 
134 
136  // for XMLTextFieldImportContext:
137  SvXMLImport& rImport,
138  XMLTextImportHelper& rHlp,
139  const OUString& pServiceName,
140  // config variables for PrepareField behavior:
141  bool bFormula,
142  bool bFormulaDefault,
143  bool bDescription,
144  bool bHelp,
145  bool bHint,
146  bool bVisible,
147  bool bDisplayFormula,
148  bool bType,
149  bool bStyle,
150  bool bValue,
151  bool bPresentation);
152 
153 protected:
155  virtual void ProcessAttribute( sal_Int32 nAttrToken,
156  std::string_view sAttrValue ) override;
157 
159  virtual void PrepareField(
160  const css::uno::Reference<
161  css::beans::XPropertySet> & xPropertySet) override;
162 
163  // various accessor methods:
164  const OUString& GetName() const { return sName; }
165  bool IsStringValue() const { return aValueHelper.IsStringValue();}
166 };
167 
168 
171 {
172 public:
173 
174 
176  SvXMLImport& rImport,
177  XMLTextImportHelper& rHlp);
178 
179 
180 private:
182  virtual void PrepareField(
183  const css::uno::Reference<
184  css::beans::XPropertySet> & xPropertySet) override;
185 };
186 
187 
190 {
191 public:
192 
194  SvXMLImport& rImport,
195  XMLTextImportHelper& rHlp);
196 
197 private:
198  virtual void PrepareField(
199  const css::uno::Reference<
200  css::beans::XPropertySet> & xPropertySet) override;
201 };
202 
203 /*** import text input fields (<text:text-input>) */
205 {
206 public:
207 
209  SvXMLImport& rImport,
210  XMLTextImportHelper& rHlp);
211 
212 private:
213  virtual void PrepareField(
214  const css::uno::Reference<
215  css::beans::XPropertySet> & xPropertySet) override;
216 };
217 
218 
224 {
226 
227 public:
228 
229 
231  // for XMLTextFieldImportContext:
232  SvXMLImport& rImport,
233  XMLTextImportHelper& rHlp,
234  const OUString& pServiceName,
235  // for finding appropriate field master (see endFastElement())
236  VarType eVarType,
237  // config variables:
238  bool bFormula,
239  bool bFormulaDefault,
240  bool bDescription,
241  bool bHelp,
242  bool bHint,
243  bool bVisible,
244  bool bDisplayFormula,
245  bool bType,
246  bool bStyle,
247  bool bValue,
248  bool bPresentation);
249 
250 protected:
251 
254  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
255 
257  bool FindFieldMaster(
258  css::uno::Reference<
259  css::beans::XPropertySet> & xMaster);
260 };
261 
262 
265 {
266 public:
267 
269  SvXMLImport& rImport,
270  XMLTextImportHelper& rHlp);
271 \
272 private:
274  virtual void PrepareField(
275  const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override;
276 };
277 
278 
281 {
282 public:
283 
284 
286  SvXMLImport& rImport,
287  XMLTextImportHelper& rHlp);
288 
289 private:
290 
292  virtual void PrepareField(
293  const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override;
294 };
295 
296 
299 {
300 
301 public:
302 
303 
305  SvXMLImport& rImport,
306  XMLTextImportHelper& rHlp);
307 };
308 
311 {
312 
313 public:
314 
315 
317  SvXMLImport& rImport,
318  XMLTextImportHelper& rHlp);
319 
320  virtual void PrepareField(
321  const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override;
322 };
323 
324 
327 {
328  OUString sNumFormat;
329  OUString sNumFormatSync;
330  OUString sRefName;
331 
333 
334 public:
335 
336 
338  SvXMLImport& rImport,
339  XMLTextImportHelper& rHlp);
340 
341 private:
342 
344  virtual void ProcessAttribute( sal_Int32 nAttrToken,
345  std::string_view sAttrValue ) override;
346 
348  virtual void PrepareField(
349  const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override;
350 };
351 
352 
358 {
361 
362 public:
363 
365  SvXMLImport& rImport,
366  XMLTextImportHelper& rHlp,
367  enum VarType eVarType);
368 
369  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
370  sal_Int32 nElement,
371  const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
372 };
373 
379 {
380 public:
381 
382 
384  SvXMLImport& rImport,
385  XMLTextImportHelper& rHlp,
386  sal_Int32 nElement,
387  const css::uno::Reference< css::xml::sax::XFastAttributeList> & xAttrList,
388  enum VarType eVarType);
389 
391  static bool FindFieldMaster(css::uno::Reference<css::beans::XPropertySet> & xMaster,
392  SvXMLImport& rImport,
393  XMLTextImportHelper& rHelper,
394  const OUString& sVarName,
395  enum VarType eVarType);
396 };
397 
398 
401 {
403 
405 
406 public:
407 
409  SvXMLImport& rImport,
410  XMLTextImportHelper& rHlp);
411 
412 private:
413 
415  virtual void ProcessAttribute( sal_Int32 nAttrToken,
416  std::string_view sAttrValue ) override;
417 
419  virtual void PrepareField(
420  const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override;
421 };
422 
423 
426 {
428 
429  OUString sColumnName;
430  bool bColumnOK;
431 
432  bool bDisplay;
434 
435 public:
436 
437 
439  SvXMLImport& rImport,
440  XMLTextImportHelper& rHlp);
441 
442 private:
443 
445  virtual void ProcessAttribute( sal_Int32 nAttrToken,
446  std::string_view sAttrValue ) override;
447 
449  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
450 };
451 
452 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool FindFieldMaster(css::uno::Reference< css::beans::XPropertySet > &xMaster)
find appropriate field master
Definition: txtvfldi.cxx:313
double fValue
string value (only valid if bStringValueOK)
Definition: txtvfldi.hxx:38
XMLValueImportHelper aValueHelper
Definition: txtvfldi.hxx:402
XMLValueImportHelper aValueHelper
hint
Definition: txtvfldi.hxx:113
void SetDefault(const OUString &sStr)
Definition: txtvfldi.hxx:77
XMLVariableDeclsImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, enum VarType eVarType)
Definition: txtvfldi.cxx:635
bool bSetDisplayFormula
set IsVisible
Definition: txtvfldi.hxx:129
const bool bSetType
have we read the formula attribute?
Definition: txtvfldi.hxx:49
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:539
enum VarType eVarDeclsContextType
Definition: txtvfldi.hxx:359
const bool bSetFormula
should PrepareField set NumberFormat?
Definition: txtvfldi.hxx:52
superclass for database fields: handle database and table names
Definition: txtfldi.hxx:307
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:565
XMLVariableInputFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:423
sal_Int32 nFormatKey
double value (only valid if bFloatValueOK)
Definition: txtvfldi.hxx:39
XMLTextInputFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:552
variable input fields ()
Definition: txtvfldi.hxx:280
XMLUserFieldInputImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:474
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
set presentation from elem. content
Definition: txtvfldi.cxx:109
bool bDescriptionOK
sFormula was set
Definition: txtvfldi.hxx:118
abstract class for text field import
Definition: txtfldi.hxx:49
OUString sHint
help text
Definition: txtvfldi.hxx:112
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
create, prepare and insert database field master and database field
Definition: txtvfldi.cxx:948
XMLVariableSetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:393
bool bSetPresentation
set DisplayFormula (sub type???)
Definition: txtvfldi.hxx:130
upperclass for variable/user-set, var/user-input, and sequence fields inds field master of appropriat...
Definition: txtvfldi.hxx:223
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:368
VarType
variable type (for XMLSetVarFieldImportContext)
Definition: txtimp.hxx:81
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:486
OUString sDescription
formula attribute
Definition: txtvfldi.hxx:110
abstract parent class for all variable related fields
Definition: txtvfldi.hxx:105
XMLTextImportHelper & rHelper
Definition: txtvfldi.hxx:35
bool IsFormatOK() const
has format been read?
Definition: txtvfldi.hxx:75
void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue)
process formula (Prep.F.)
Definition: txtvfldi.cxx:1081
OUString sFormula
format key (only valid of bFormatOK)
Definition: txtvfldi.hxx:40
variable declaration container for all variable fields (variable-decls, user-field-decls, sequence-decls)
Definition: txtvfldi.hxx:357
user input fields ()
Definition: txtvfldi.hxx:310
bool bSetFormulaDefault
set Formula property
Definition: txtvfldi.hxx:124
bool bDisplayFormula
value, value-type, and style
Definition: txtvfldi.hxx:114
import expression fields ()
Definition: txtvfldi.hxx:189
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:511
XMLSequenceFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:329
void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet)
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:1206
bool IsStringValue() const
Definition: txtvfldi.hxx:165
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
Text import helper.
Definition: txtvfldi.cxx:345
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
text import helper
Definition: txtvfldi.cxx:915
OUString sHelp
description
Definition: txtvfldi.hxx:111
import variable set fields ()
Definition: txtvfldi.hxx:264
XMLTextImportHelper & rImportHelper
Definition: txtvfldi.hxx:360
virtual void ProcessAttribute(sal_Int32 nAttrToken, std::string_view sAttrValue) override
text import helper
Definition: txtvfldi.cxx:586
bool bDisplayNone
display formula?(rather than value)
Definition: txtvfldi.hxx:115
XMLValueImportHelper aValueHelper
Definition: txtvfldi.hxx:427
bool bSetFormula
sDisplayFormula/-None were set
Definition: txtvfldi.hxx:123
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:174
bool bDisplayOK
sHint was set
Definition: txtvfldi.hxx:121
OUString sFormula
name attribute
Definition: txtvfldi.hxx:109
bool bSetDescription
use content as default for formula
Definition: txtvfldi.hxx:125
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:407
import variable get fields ()
Definition: txtvfldi.hxx:170
bool bFormatOK
is this a string (or a float) type?
Definition: txtvfldi.hxx:45
const bool bSetValue
should PrepareField set the SetExp subtype?
Definition: txtvfldi.hxx:50
const OUString & GetName() const
Definition: txtvfldi.hxx:164
bool bHelpOK
sDescription was set
Definition: txtvfldi.hxx:119
bool bIsDefaultLanguage
default (see bStringDefault/bFormulaDef.)
Definition: txtvfldi.hxx:42
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
import table formula fields (deprecated; for Writer 2.0 compatibility)
Definition: txtvfldi.hxx:400
bool bStringType
format (of nFormatKey) has system language?
Definition: txtvfldi.hxx:44
bool bSetHelp
set sDescription with Hint-property
Definition: txtvfldi.hxx:126
XMLUserFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:456
static bool FindFieldMaster(css::uno::Reference< css::beans::XPropertySet > &xMaster, SvXMLImport &rImport, XMLTextImportHelper &rHelper, const OUString &sVarName, enum VarType eVarType)
variable type
Definition: txtvfldi.cxx:782
sequence fields ()
Definition: txtvfldi.hxx:326
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
Text import helper.
Definition: txtvfldi.cxx:437
import database display fields ()
Definition: txtvfldi.hxx:425
const bool bSetStyle
should PrepareField set content/value?
Definition: txtvfldi.hxx:51
XMLExpressionFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:525
XMLVariableDeclImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, enum VarType eVarType)
Definition: txtvfldi.cxx:685
variable field declarations (variable-decl, user-field-decl, sequence-decl)
Definition: txtvfldi.hxx:378
bool bHintOK
sHelp was set
Definition: txtvfldi.hxx:120
bool bFormulaOK
have we read a string-value attr.?
Definition: txtvfldi.hxx:47
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
variable type
Definition: txtvfldi.cxx:643
OUString sDefault
formula string
Definition: txtvfldi.hxx:41
SvXMLImport & rImport
Definition: txtvfldi.hxx:34
XMLSetVarFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const OUString &pServiceName, VarType eVarType, bool bFormula, bool bFormulaDefault, bool bDescription, bool bHelp, bool bHint, bool bVisible, bool bDisplayFormula, bool bType, bool bStyle, bool bValue, bool bPresentation)
Definition: txtvfldi.cxx:247
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
see XMLTextFieldImportContext
Definition: txtvfldi.cxx:261
bool bStringValueOK
have we read a style:data-style-name attr.?
Definition: txtvfldi.hxx:46
XMLTableFormulaImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:577
XMLDatabaseDisplayImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:905
bool bFormulaOK
hide field?
Definition: txtvfldi.hxx:117
XMLVarFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp, const OUString &pServiceName, bool bFormula, bool bFormulaDefault, bool bDescription, bool bHelp, bool bHint, bool bVisible, bool bDisplayFormula, bool bType, bool bStyle, bool bValue, bool bPresentation)
set presentation frm elem. content?
Definition: txtvfldi.cxx:81
bool IsStringValue() const
is value a string (rather than double)?
Definition: txtvfldi.hxx:72
virtual void PrepareField(const css::uno::Reference< css::beans::XPropertySet > &xPropertySet) override
prepare XTextField for insertion into document
Definition: txtvfldi.cxx:611
XMLValueImportHelper(SvXMLImport &rImprt, XMLTextImportHelper &rHlp, bool bType, bool bStyle, bool bValue, bool bFormula)
should PrepareField set Formula?
Definition: txtvfldi.cxx:1057
XMLVariableGetFieldImportContext(SvXMLImport &rImport, XMLTextImportHelper &rHlp)
Definition: txtvfldi.cxx:499