summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-02-07 11:26:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-08 13:21:31 +0100
commita2f62a861ba7036e689070c47f72214b1bdd49d4 (patch)
tree44ae72580dc4204311fde032c7a0d15cc3f4342e /basic
parent110a49b41c81759f25f96be627d45848de9264a5 (diff)
move some headers inside basic
Change-Id: If711825c36bd4f9836fcd3ba26e5d4f38a5f3e36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88166 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/inc/pch/precompiled_sb.hxx6
-rw-r--r--basic/inc/sbprop.hxx2
-rw-r--r--basic/inc/sbstdobj.hxx2
-rw-r--r--basic/inc/sbxfac.hxx37
-rw-r--r--basic/inc/sbxform.hxx154
-rw-r--r--basic/inc/sbxprop.hxx37
-rw-r--r--basic/source/classes/image.cxx2
-rw-r--r--basic/source/inc/sbintern.hxx2
-rw-r--r--basic/source/inc/sbunoobj.hxx4
-rw-r--r--basic/source/sbx/sbxbase.cxx6
-rw-r--r--basic/source/sbx/sbxform.cxx2
-rw-r--r--basic/source/sbx/sbxobj.cxx2
-rw-r--r--basic/source/sbx/sbxscan.cxx2
13 files changed, 243 insertions, 15 deletions
diff --git a/basic/inc/pch/precompiled_sb.hxx b/basic/inc/pch/precompiled_sb.hxx
index dfbb81021c30..a39acef6f126 100644
--- a/basic/inc/pch/precompiled_sb.hxx
+++ b/basic/inc/pch/precompiled_sb.hxx
@@ -109,11 +109,11 @@
#include <basic/sbstar.hxx>
#include <basic/sbuno.hxx>
#include <basic/sbx.hxx>
-#include <basic/sbxfac.hxx>
-#include <basic/sbxform.hxx>
+#include <sbxfac.hxx>
+#include <sbxform.hxx>
#include <basic/sbxmeth.hxx>
#include <basic/sbxobj.hxx>
-#include <basic/sbxprop.hxx>
+#include <sbxprop.hxx>
#include <basic/sbxvar.hxx>
#include <date.hxx>
#include <iosys.hxx>
diff --git a/basic/inc/sbprop.hxx b/basic/inc/sbprop.hxx
index 383b4d914e2a..bd4a8b117c54 100644
--- a/basic/inc/sbprop.hxx
+++ b/basic/inc/sbprop.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_BASIC_INC_SBPROP_HXX
#define INCLUDED_BASIC_INC_SBPROP_HXX
-#include <basic/sbxprop.hxx>
+#include "sbxprop.hxx"
#include <basic/sbdef.hxx>
class SbModule;
diff --git a/basic/inc/sbstdobj.hxx b/basic/inc/sbstdobj.hxx
index 965940c8ddcd..ad242dfb1489 100644
--- a/basic/inc/sbstdobj.hxx
+++ b/basic/inc/sbstdobj.hxx
@@ -22,7 +22,7 @@
#include <basic/sbxobj.hxx>
#include <vcl/graph.hxx>
-#include <basic/sbxfac.hxx>
+#include "sbxfac.hxx"
#include <basic/basicdllapi.h>
class SbStdFactory final : public SbxFactory
diff --git a/basic/inc/sbxfac.hxx b/basic/inc/sbxfac.hxx
new file mode 100644
index 000000000000..e9b130eec192
--- /dev/null
+++ b/basic/inc/sbxfac.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+#include <basic/basicdllapi.h>
+
+class SbxBase;
+class SbxObject;
+
+class SbxFactory
+{
+public:
+ virtual ~SbxFactory();
+ SbxFactory() {}
+ virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 );
+ virtual SbxObject* CreateObject( const OUString& );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/sbxform.hxx b/basic/inc/sbxform.hxx
new file mode 100644
index 000000000000..94dece69832c
--- /dev/null
+++ b/basic/inc/sbxform.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+
+// Implementation class for Basic command: Format$( d,formatStr )
+
+/*
+ Grammar of format string (a try):
+ -----------------------------------------------
+
+ format_string := {\special_char} general_format | scientific_format {\special_char} {;format_string}
+ general_format := {#[,]}{0[,]}[.{0}{#}]
+ scientific_format := {0}[.{0}{#}](e | E)(+ | -){#}{0}
+
+ percent_char := '%'
+ special_char := \char | + | - | ( | ) | $ | space_char
+ char := all_ascii_chars
+ space_char := ' '
+
+ {} repeated multiple times (incl. zero times)
+ [] exactly one or zero times
+ () parenthesis, e.g. (e | E) means e or E times
+
+ Additional predefined formats for the format string:
+ "General Number"
+ "Currency"
+ "Fixed"
+ "Standard"
+ "Percent"
+ "Scientific"
+ "Yes/No"
+ "True/False"
+ "On/Off"
+
+ Note: invalid format string are ignored just as in VisualBasic, the output is
+ probably 'undefined'. ASCII letters are outputted directly.
+
+ Constraints in VisualBasic:
+ - the exponent (scientific syntax) has a maximum of three digits!
+
+ Constraints of new implementation:
+ - the '+' sign is not allowed as wildcard in the mantissa
+
+ TODO:
+ - Date formatting
+ Wildcards are: 'h', 'm', 's', 'y'
+ predefined String-Constants/Commands:
+ "AMPM", "Long Date", "Long Time"
+*/
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+class SbxBasicFormater {
+ public:
+ // Constructor takes signs for decimal point, thousand separation sign
+ // and necessary resource strings.
+ SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
+ const OUString& _sOnStrg,
+ const OUString& _sOffStrg,
+ const OUString& _sYesStrg,
+ const OUString& _sNoStrg,
+ const OUString& _sTrueStrg,
+ const OUString& _sFalseStrg,
+ const OUString& _sCurrencyStrg,
+ const OUString& _sCurrencyFormatStrg );
+
+ /* Basic command: Format$( number,format-string )
+
+ Parameter:
+ dNumber : number to be formatted
+ sFormatStrg : the Format-String, e.g. ###0.0###
+
+ Return value:
+ String containing the formatted output
+ */
+ OUString BasicFormat( double dNumber, const OUString& sFormatStrg );
+ static OUString BasicFormatNull( const OUString& sFormatStrg );
+
+ static bool isBasicFormat( const OUString& sFormatStrg );
+
+ private:
+ static inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
+ static void AppendDigit( OUStringBuffer& sStrg, short nDigit );
+ void LeftShiftDecimalPoint( OUStringBuffer& sStrg );
+ void StrRoundDigit( OUStringBuffer& sStrg, short nPos, bool& bOverflow );
+ void StrRoundDigit( OUStringBuffer& sStrg, short nPos );
+ static void ParseBack( OUStringBuffer& sStrg, const OUString& sFormatStrg,
+ short nFormatPos );
+ // Methods for string conversion with sprintf():
+ void InitScan( double _dNum );
+ void InitExp( double _dNewExp );
+ short GetDigitAtPosScan( short nPos, bool& bFoundFirstDigit );
+ short GetDigitAtPosExpScan( double dNewExponent, short nPos,
+ bool& bFoundFirstDigit );
+ short GetDigitAtPosExpScan( short nPos, bool& bFoundFirstDigit );
+ static OUString GetPosFormatString( const OUString& sFormatStrg, bool & bFound );
+ static OUString GetNegFormatString( const OUString& sFormatStrg, bool & bFound );
+ static OUString Get0FormatString( const OUString& sFormatStrg, bool & bFound );
+ static OUString GetNullFormatString( const OUString& sFormatStrg, bool & bFound );
+ static void AnalyseFormatString( const OUString& sFormatStrg,
+ short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
+ short& nNoOfOptionalDigitsLeft,
+ short& nNoOfExponentDigits,
+ short& nNoOfOptionalExponentDigits,
+ bool& bPercent, bool& bCurrency, bool& bScientific,
+ bool& bGenerateThousandSeparator,
+ short& nMultipleThousandSeparators );
+ void ScanFormatString( double dNumber, const OUString& sFormatStrg,
+ OUString& sReturnStrg, bool bCreateSign );
+
+ //*** Data ***
+ sal_Unicode cDecPoint; // sign for the decimal point
+ sal_Unicode cThousandSep; // sign for thousand delimiter
+ // Text for output:
+ OUString sOnStrg;
+ OUString sOffStrg;
+ OUString sYesStrg;
+ OUString sNoStrg;
+ OUString sTrueStrg;
+ OUString sFalseStrg;
+ OUString sCurrencyStrg;
+ OUString sCurrencyFormatStrg;
+
+ //*** temporary data for scan loop ***
+
+ // String containing the number in scientific format
+ OUString sSciNumStrg;
+ // String containing the exponent of the number
+ OUString sNumExpStrg;
+ double dNum; // the number that is scanned
+ short nNumExp; // the exponent of the number
+ short nExpExp; // the number of digits in the exponent
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/sbxprop.hxx b/basic/inc/sbxprop.hxx
new file mode 100644
index 000000000000..0c57d0b72799
--- /dev/null
+++ b/basic/inc/sbxprop.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <basic/sbxvar.hxx>
+
+class SbxProperty : public SbxVariable
+{
+public:
+ SBX_DECL_PERSIST_NODATA(SBXID_PROPERTY,1);
+ SbxProperty( const OUString& r, SbxDataType t );
+ SbxProperty( const SbxProperty& r ) : SvRefBase( r ), SbxVariable( r ) {}
+ virtual ~SbxProperty() override;
+ SbxProperty& operator=( const SbxProperty& r )
+ { SbxVariable::operator=( r ); return *this; }
+ virtual SbxClassType GetClass() const override;
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 959681636dcd..a7f6c75a4bdc 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -23,7 +23,7 @@
#include <sal/log.hxx>
#include <basic/sbx.hxx>
#include <sb.hxx>
-#include <basic/sbxprop.hxx>
+#include <sbxprop.hxx>
#include <string.h>
#include <image.hxx>
#include <codegen.hxx>
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 61b2953486ed..75e3ede9a6bb 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -22,7 +22,7 @@
#include <basic/basicdllapi.h>
#include <basic/sbstar.hxx>
-#include <basic/sbxfac.hxx>
+#include <sbxfac.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <vcl/errcode.hxx>
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 17440c70649d..1d6d9de1d5eb 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -21,8 +21,8 @@
#include <basic/sbxobj.hxx>
#include <basic/sbxmeth.hxx>
-#include <basic/sbxprop.hxx>
-#include <basic/sbxfac.hxx>
+#include <sbxprop.hxx>
+#include <sbxfac.hxx>
#include <basic/sbx.hxx>
#include <com/sun/star/beans/XMaterialHolder.hpp>
#include <com/sun/star/beans/XExactName.hpp>
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 68fc41547714..e2010a600f39 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -23,10 +23,10 @@
#include <vcl/svapp.hxx>
#include <basic/sbx.hxx>
-#include <basic/sbxfac.hxx>
-#include <basic/sbxform.hxx>
+#include <sbxfac.hxx>
+#include <sbxform.hxx>
#include <basic/sbxmeth.hxx>
-#include <basic/sbxprop.hxx>
+#include <sbxprop.hxx>
#include <sbxbase.hxx>
#include <rtl/ustring.hxx>
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index c291f3e23af3..85374facd545 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -20,7 +20,7 @@
#include <stdlib.h>
-#include <basic/sbxform.hxx>
+#include <sbxform.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/character.hxx>
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 143a1ea4156d..5c7185276ac7 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -27,7 +27,7 @@
#include <basic/sbx.hxx>
#include <basic/sberrors.hxx>
#include <basic/sbxmeth.hxx>
-#include <basic/sbxprop.hxx>
+#include <sbxprop.hxx>
#include <svl/SfxBroadcaster.hxx>
#include "sbxres.hxx"
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index e15039243fea..e264f527c94b 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -33,7 +33,7 @@
#include <sbxbase.hxx>
#include <sbintern.hxx>
-#include <basic/sbxform.hxx>
+#include <sbxform.hxx>
#include <date.hxx>
#include <runtime.hxx>