23#include <osl/diagnose.h>
24#include <rtl/tencinfo.h>
32#include <com/sun/star/sdb/CommandType.hpp>
33#include <com/sun/star/sdb/DatabaseContext.hpp>
34#include <com/sun/star/sdbc/XConnection.hpp>
35#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
36#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
37#include <com/sun/star/sdbc/XRowSet.hpp>
38#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
39#include <com/sun/star/sdb/XQueriesSupplier.hpp>
40#include <com/sun/star/awt/FontWeight.hpp>
41#include <com/sun/star/awt/FontStrikeout.hpp>
42#include <com/sun/star/awt/FontSlant.hpp>
43#include <com/sun/star/awt/FontUnderline.hpp>
44#include <com/sun/star/document/DocumentProperties.hpp>
82 :m_bBookmarkSelection( false )
84 ,m_xFormatter(_rxNumberF)
87 ,m_bNeedToReInitialize(false)
88 ,m_bInInitialize(false)
91 m_eDestEnc = osl_getThreadTextEncoding();
93 osl_atomic_increment( &m_refCount );
94 impl_initFromDescriptor( _aDataDescriptor,
false );
95 osl_atomic_decrement( &m_refCount );
101 :m_bBookmarkSelection( false )
104 ,m_xFormatter(_rxNumberF)
107 ,m_bNeedToReInitialize(false)
108 ,m_bInInitialize(false)
111 m_eDestEnc = osl_getThreadTextEncoding();
114ODatabaseImportExport::~ODatabaseImportExport()
127 xComponent->removeEventListener(xEvt);
131 ::comphelper::disposeComponent(
m_xRow);
159 if ( !_bPlusDefaultInit )
162 _aDataDescriptor[DataAccessDescriptorProperty::CommandType] >>=
m_nCommandType;
163 _aDataDescriptor[DataAccessDescriptorProperty::Command] >>=
m_sName;
165 if(_aDataDescriptor.
has(DataAccessDescriptorProperty::Connection))
171 if (xComponent.is() && xEvt.is())
172 xComponent->addEventListener(xEvt);
175 if ( _aDataDescriptor.
has( DataAccessDescriptorProperty::Selection ) )
176 _aDataDescriptor[ DataAccessDescriptorProperty::Selection ] >>=
m_aSelection;
178 if ( _aDataDescriptor.
has( DataAccessDescriptorProperty::BookmarkSelection ) )
181 if ( _aDataDescriptor.
has( DataAccessDescriptorProperty::Cursor ) )
183 _aDataDescriptor[ DataAccessDescriptorProperty::Cursor ] >>=
m_xResultSet;
191 SAL_WARN(
"dbaccess.ui",
"ODatabaseImportExport::impl_initFromDescriptor: selection without result set is nonsense!" );
200 SAL_WARN(
"dbaccess.ui",
"ODatabaseImportExport::impl_initFromDescriptor: no XRowLocate -> no bookmarks!" );
224 if(aInfo.
isValid() && aInfo.
getType() == SQLExceptionInfo::TYPE::SQLException)
225 throw *
static_cast<const SQLException*
>(aInfo);
236 xNameAccess = xSup->getTables();
243 xNameAccess = xSup->getQueries();
247 if(xNameAccess.is() && xNameAccess->hasByName(
m_sName))
290 DefaultFontType::SANS_UNICODE,
292 GetDefaultFontFlags::OnlyOne
325 if (sal_uInt32 nCpg = rtl_getWindowsCodePageFromTextEncoding(
m_eDestEnc); nCpg && nCpg != 65001)
331 bool bBold = ( css::awt::FontWeight::BOLD ==
m_aFont.Weight );
332 bool bItalic = ( css::awt::FontSlant_ITALIC ==
m_aFont.Slant );
333 bool bUnderline = ( css::awt::FontUnderline::NONE !=
m_aFont.Underline );
334 bool bStrikeout = ( css::awt::FontStrikeout::NONE !=
m_aFont.Strikeout );
341 if (aFonts.isEmpty())
348 if (!aFonts.isEmpty())
373 static char const aCell1[] =
"\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx";
384 const OUString* pIter = aNames.getConstArray();
386 sal_Int32
nCount = aNames.getLength();
387 bool bUseResultMetaData =
false;
391 bUseResultMetaData =
true;
405 std::unique_ptr<OString[]> pHorzChar(
new OString[
nCount]);
409 sal_Int32 nAlign = 0;
410 OUString sColumnName;
411 if ( bUseResultMetaData )
415 sColumnName = *pIter;
417 xColumns->getByName(sColumnName) >>=
xColumn;
463 bool bContinue =
true;
464 for( ; pSelIter != pEnd && bContinue; ++pSelIter )
473 OSL_VERIFY( *pSelIter >>=
nPos );
503 static char const aCell2[] =
"\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx";
505 for ( sal_Int32
i=1;
i<=_nColumnCount; ++
i )
512 const bool bBold = ( css::awt::FontWeight::BOLD ==
m_aFont.Weight );
513 const bool bItalic = ( css::awt::FontSlant_ITALIC ==
m_aFont.Slant );
514 const bool bUnderline = ( css::awt::FontUnderline::NONE !=
m_aFont.Underline );
515 const bool bStrikeout = ( css::awt::FontStrikeout::NONE !=
m_aFont.Strikeout );
520 for ( sal_Int32
i=1;
i <= _nColumnCount; ++
i )
538 if ( !sValue.isEmpty() )
543 SAL_WARN(
"dbaccess.ui",
"RTF WRITE!");
564 xReader->enableCheckOnly();
565 eState = xReader->CallParser();
568 return eState != SvParserState::Error;
579#
if OSL_DEBUG_LEVEL > 0
585 strncpy( sIndent, sIndentSource ,std::min(
sizeof(sIndent),
sizeof(sIndentSource)));
615 xReader->enableCheckOnly();
617 eState = xReader->CallParser();
620 return eState != SvParserState::Error;
625 uno::Reference<document::XDocumentProperties> xDocProps(
626 document::DocumentProperties::create(
m_xContext ) );
627 if (xDocProps.is()) {
690 bool bUseResultMetaData =
false;
694 xColumns = xColSup->getColumns();
695 aNames = xColumns->getElementNames();
696 if ( !aNames.hasElements() )
700 auto aNamesRange = asNonConstRange(aNames);
703 bUseResultMetaData =
true;
718 OString::number(aNames.getLength()) +
748 std::unique_ptr<sal_Int32[]> pFormat(
new sal_Int32[aNames.getLength()]);
750 std::unique_ptr<const char *[]> pHorJustify(
new const char*[aNames.getLength()]);
751 std::unique_ptr<sal_Int32[]> pColWidth(
new sal_Int32[aNames.getLength()]);
753 sal_Int32 nHeight = 0;
757 const OUString* pIter = aNames.getConstArray();
758 const OUString* pEnd = pIter + aNames.getLength();
760 for( sal_Int32
i=0;pIter != pEnd; ++pIter,++
i )
762 sal_Int32 nAlign = 0;
765 if ( !bUseResultMetaData )
768 xColumns->getByName(*pIter) >>=
xColumn;
781 if(
i == aNames.getLength()-1)
802 for(sal_Int32
i=1;
i<=aNames.getLength();++
i)
804 if(
i == aNames.getLength())
813 if (!sValue.isEmpty())
845 const OUString& rValue,
const char* pHtmlTag)
847 OString aStrTD = pHtmlTag;
849 nWidthPixel = nWidthPixel ? nWidthPixel : 86;
850 nHeightPixel = nHeightPixel ? nHeightPixel : 17;
858 OString::number(nWidthPixel) +
863 OString::number(nHeightPixel) +
877 fVal =
m_xFormatter->convertStringToNumber(nFormat,rValue);
890 bool bBold = ( css::awt::FontWeight::BOLD ==
m_aFont.Weight );
891 bool bItalic = ( css::awt::FontSlant_ITALIC ==
m_aFont.Slant );
892 bool bUnderline = ( css::awt::FontUnderline::NONE !=
m_aFont.Underline );
893 bool bStrikeout = ( css::awt::FontStrikeout::NONE !=
m_aFont.Strikeout );
900 if ( rValue.isEmpty() )
917#if OSL_DEBUG_LEVEL > 0
922 OString aStrOut =
"<"
946#if OSL_DEBUG_LEVEL > 0
950#if OSL_DEBUG_LEVEL > 0
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
static void Out_DocInfo(SvStream &rStrm, const OUString &rBaseURL, const css::uno::Reference< css::document::XDocumentProperties > &, const char *pIndent, OUString *pNonConvertableChars=nullptr)
const vcl::Font & GetAppFont() const
SvStream & WriteNumberAsString(N n)
SvStream & WriteUChar(unsigned char nChar)
SvStream & WriteOString(std::string_view rStr)
SvStream & WriteChar(char nChar)
static css::awt::FontDescriptor CreateFontDescriptor(const vcl::Font &rFont)
css::uno::Reference< css::container::XIndexAccess > m_xRowSetColumns
css::uno::Sequence< css::uno::Any > m_aSelection
void impl_initFromDescriptor(const svx::ODataAccessDescriptor &_aDataDescriptor, bool _bPlusDefaultInit)
css::uno::Reference< css::sdbc::XResultSet > m_xResultSet
css::uno::Reference< css::sdbcx::XRowLocate > m_xRowLocate
OUString m_sDataSourceName
css::awt::FontDescriptor m_aFont
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xResultSetMetaData
rtl_TextEncoding m_eDestEnc
bool m_bBookmarkSelection
virtual void initialize()
SharedConnection m_xConnection
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
bool isCheckEnabled() const
OUString m_sDefaultTableName
css::uno::Reference< css::util::XNumberFormatter > m_xFormatter
css::uno::Reference< css::beans::XPropertySet > m_xObject
bool m_bNeedToReInitialize
css::uno::Reference< css::sdbc::XRow > m_xRow
css::uno::Reference< css::uno::XComponentContext > m_xContext
char sIndent[nIndentMax+1]
void WriteCell(sal_Int32 nFormat, sal_Int32 nWidthPixel, sal_Int32 nHeightPixel, const char *pChar, const OUString &rValue, const char *pHtmlTag)
const char * GetIndentStr() const
OHTMLImportExport(const svx::ODataAccessDescriptor &_aDataDescriptor, const css::uno::Reference< css::uno::XComponentContext > &_rM, const css::uno::Reference< css::util::XNumberFormatter > &_rxNumberF)
void IncIndent(sal_Int16 nVal)
static const sal_Int16 nCellSpacing
static const char sIndentSource[]
virtual bool Read() override
virtual bool Write() override
virtual bool Read() override
virtual bool Write() override
void appendRow(OString const *pHorzChar, sal_Int32 _nColumnCount, sal_Int32 &k, sal_Int32 &kk)
bool has(DataAccessDescriptorProperty _eWhich) const
OUString getDataSource() const
const css::uno::Reference< INTERFACE > & getTyped() const
void reset(const css::uno::Reference< INTERFACE > &_rxComponent, AssignmentMode _eMode=TakeOwnership)
const OUString & GetFamilyName() const
#define SAL_NEWLINE_STRING
Reference< XComponentContext > m_xContext
#define DBG_UNHANDLED_EXCEPTION(...)
GtkMediaStream * m_pStream
#define OOO_STRING_SVTOOLS_HTML_O_height
#define OOO_STRING_SVTOOLS_HTML_head
#define OOO_STRING_SVTOOLS_HTML_body
#define OOO_STRING_SVTOOLS_HTML_O_color
#define OOO_STRING_SVTOOLS_HTML_AL_left
#define OOO_STRING_SVTOOLS_HTML_caption
#define OOO_STRING_SVTOOLS_HTML_frame
#define OOO_STRING_SVTOOLS_HTML_O_align
#define OOO_STRING_SVTOOLS_HTML_tabledata
#define OOO_STRING_SVTOOLS_HTML_strike
#define OOO_STRING_SVTOOLS_HTML_tablerow
#define OOO_STRING_SVTOOLS_HTML_TF_void
#define OOO_STRING_SVTOOLS_HTML_tableheader
#define OOO_STRING_SVTOOLS_HTML_style
#define OOO_STRING_SVTOOLS_HTML_html
#define OOO_STRING_SVTOOLS_HTML_bold
#define OOO_STRING_SVTOOLS_HTML_tbody
#define OOO_STRING_SVTOOLS_HTML_AL_center
#define OOO_STRING_SVTOOLS_HTML_O_text
#define OOO_STRING_SVTOOLS_HTML_O_cellspacing
#define OOO_STRING_SVTOOLS_HTML_O_cols
#define OOO_STRING_SVTOOLS_HTML_doctype
#define OOO_STRING_SVTOOLS_HTML_AL_right
#define OOO_STRING_SVTOOLS_HTML_doctype5
#define OOO_STRING_SVTOOLS_HTML_O_border
#define OOO_STRING_SVTOOLS_HTML_underline
#define OOO_STRING_SVTOOLS_HTML_thead
#define OOO_STRING_SVTOOLS_HTML_O_type
#define OOO_STRING_SVTOOLS_HTML_O_bgcolor
#define OOO_STRING_SVTOOLS_HTML_table
#define OOO_STRING_SVTOOLS_HTML_font
#define OOO_STRING_SVTOOLS_HTML_O_width
#define OOO_STRING_SVTOOLS_HTML_linebreak
#define OOO_STRING_SVTOOLS_HTML_italic
#define OOO_STRING_SVTOOLS_HTML_O_face
#define SAL_WARN(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
SVT_DLLPUBLIC SvStream & Out_String(SvStream &, std::u16string_view, rtl_TextEncoding eDestEnc=RTL_TEXTENCODING_MS_1252)
const sal_Int16 nIndentMax
::dbtools::SQLExceptionInfo createConnection(const OUString &_rsDataSourceName, const css::uno::Reference< css::container::XNameAccess > &_xDatabaseContext, const css::uno::Reference< css::uno::XComponentContext > &_rxContext, css::uno::Reference< css::lang::XEventListener > const &_rEvtLst, css::uno::Reference< css::sdbc::XConnection > &_rOUTConnection)
creates a new connection and appends the eventlistener
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Reference< XConnection > m_xConnection
#define OOO_STRING_SVTOOLS_RTF_CELL
#define OOO_STRING_SVTOOLS_RTF_ANSICPG
#define OOO_STRING_SVTOOLS_RTF_QC
#define OOO_STRING_SVTOOLS_RTF_RED
#define OOO_STRING_SVTOOLS_RTF_B
#define OOO_STRING_SVTOOLS_RTF_RTF
#define OOO_STRING_SVTOOLS_RTF_STRIKE
#define OOO_STRING_SVTOOLS_RTF_UL
#define OOO_STRING_SVTOOLS_RTF_QL
#define OOO_STRING_SVTOOLS_RTF_QR
#define OOO_STRING_SVTOOLS_RTF_BLUE
#define OOO_STRING_SVTOOLS_RTF_ROW
#define OOO_STRING_SVTOOLS_RTF_ANSI
#define OOO_STRING_SVTOOLS_RTF_INTBL
#define OOO_STRING_SVTOOLS_RTF_TROWD
#define OOO_STRING_SVTOOLS_RTF_TRGAPH
#define OOO_STRING_SVTOOLS_RTF_GREEN
#define OOO_STRING_SVTOOLS_RTF_COLORTBL
#define OOO_STRING_SVTOOLS_RTF_I
#define OOO_STRING_SVTOOLS_RTF_PARD
constexpr OUStringLiteral PROPERTY_WIDTH(u"Width")
constexpr OUStringLiteral PROPERTY_COMMAND(u"Command")
constexpr OUStringLiteral PROPERTY_TEXTCOLOR(u"TextColor")
constexpr OUStringLiteral PROPERTY_FORMATKEY(u"FormatKey")
constexpr OUStringLiteral PROPERTY_ACTIVE_CONNECTION(u"ActiveConnection")
constexpr OUStringLiteral PROPERTY_FONT(u"FontDescriptor")
constexpr OUStringLiteral PROPERTY_ALIGN(u"Align")
constexpr OUStringLiteral PROPERTY_ROW_HEIGHT(u"RowHeight")
constexpr OUStringLiteral PROPERTY_COMMAND_TYPE(u"CommandType")
static SVT_DLLPUBLIC SvStream & Out_AsciiTag(SvStream &, std::string_view rStr, bool bOn=true)
static SVT_DLLPUBLIC SvStream & Out_String(SvStream &, const OUString &, OUString *pNonConvertableChars=nullptr)
static SVT_DLLPUBLIC OString CreateTableDataOptionsValNum(bool bValue, double fVal, sal_uInt32 nFormat, SvNumberFormatter &rFormatter, OUString *pNonConvertableChars=nullptr)
static SVT_DLLPUBLIC SvStream & Out_Color(SvStream &, const Color &, bool bXHTML=false)