/* -*- 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/.
*/
class SwXTextDocument; namespace comphelper
{ class ConfigurationChanges;
} namespace vcl
{ namespace pdf
{ class PDFiumDocument;
}
}
/// Temporarily enables the ExportFormFields setting. class SWQAHELPER_DLLPUBLIC SwExportFormFieldsGuard
{
std::shared_ptr<comphelper::ConfigurationChanges> m_pBatch; bool m_bValue; public:
SwExportFormFieldsGuard();
~SwExportFormFieldsGuard();
};
/// Base class for filter tests loading or roundtripping a document, then asserting the document model. class SWQAHELPER_DLLPUBLIC SwModelTestBase : public UnoApiXmlTest
{ protected:
xmlBufferPtr mpXmlBuffer;
OUString mpFilter;
protected: /** * Helper func used by each unit test to test the 'export' code. * (Loads the requested file, calls 'verify' function, save it to temp file, load the * temp file and then calls 'verify' function again)
*/ void executeLoadVerifyReloadVerify(constchar* filename, constchar* pPassword = nullptr);
/** * Function overridden by unit test. See DECLARE_SW_*_TEST macros
*/ virtualvoid verify()
{
CPPUNIT_FAIL( "verify method must be overridden" );
}
void calcLayout(bool bRecalc = false);
/// Get the body text of the whole document.
OUString getBodyText() const;
/// Get a family of styles, see com.sun.star.style.StyleFamilies for possible values.
css::uno::Reference<css::container::XNameAccess> getStyles(const OUString& aFamily);
/// Get a family of auto styles, see com.sun.star.style.StyleFamilies for possible values.
css::uno::Reference<css::style::XAutoStyleFamily> getAutoStyles(const OUString& aFamily);
/// Similar to parseExport(), but this gives the xmlDocPtr of the layout dump.
xmlDocUniquePtr parseLayoutDump(const css::uno::Reference< css::lang::XComponent >& xComponent = nullptr);
template< typename T >
T getProperty( const css::uno::Any& obj, const OUString& name ) const
{
css::uno::Reference< css::beans::XPropertySet > properties( obj, uno::UNO_QUERY_THROW );
T data; if (!css::uno::fromAny(properties->getPropertyValue(name), &data))
{
OString const msg("the property is of unexpected type or void: "
+ OUStringToOString(name, RTL_TEXTENCODING_UTF8));
CPPUNIT_FAIL(msg.getStr());
} return data;
}
template< typename T >
T getProperty( const css::uno::Reference< css::uno::XInterface >& obj, const OUString& name ) const
{
css::uno::Reference< css::beans::XPropertySet > properties( obj, uno::UNO_QUERY_THROW );
T data = T(); if (!(properties->getPropertyValue(name) >>= data))
{
OString const msg("the property is of unexpected type or void: "
+ OUStringToOString(name, RTL_TEXTENCODING_UTF8));
CPPUNIT_FAIL(msg.getStr());
} return data;
}
// Get paragraph (counted from 1), optionally check it contains the given text.
css::uno::Reference< css::text::XTextRange > getParagraph( int number, const OUString& content = OUString() ) const;
/// get nth object/fly that is anchored AT paragraph
css::uno::Reference<css::beans::XPropertySet> getParagraphAnchoredObject( intconst index, css::uno::Reference<css::text::XTextRange> const & xPara) const;
/// Get run (counted from 1) of a paragraph, optionally check it contains the given text.
css::uno::Reference<css::text::XTextRange> getRun(uno::Reference<css::text::XTextRange> const & xParagraph, int number, const OUString& content = OUString()) const;
/// Get math formula string of a run.
OUString getFormula(css::uno::Reference<css::text::XTextRange> const & xRun) const;
/// get cell of a table; table can be retrieved with getParagraphOrTable
css::uno::Reference<css::table::XCell> getCell(
css::uno::Reference<css::uno::XInterface> const& xTableIfc,
OUString const& rCell, OUString const& rContent = OUString());
/// Get shape (counted from 1)
css::uno::Reference<css::drawing::XShape> getShape(int number);
/// Select shape (counted from 1) void selectShape(int number);
/// Get shape by name
css::uno::Reference<css::drawing::XShape> getShapeByName(std::u16string_view aName);
/// Get TextFrame by name
css::uno::Reference<css::drawing::XShape> getTextFrameByName(const OUString& aName);
/// Combines load() and saveAndReload(). void loadAndReload(constchar* pName);
/// Get page count. int getPages() const;
/// Get shape count. int getShapes() const;
/** * Creates a new document to be used with the internal sw/ API. * * Examples: * createSwDoc(); * createSwDoc("test.fodt"); * createSwDoc("test.fodt", "test");
*/ void createSwDoc(constchar* pName = nullptr, constchar* pPassword = nullptr);
/** * As createSwDoc except a Web Document in Browse Mode
*/ void createSwWebDoc(constchar* pName = nullptr);
/** * As createSwDoc except a Global Document
*/ void createSwGlobalDoc(constchar* pName = nullptr);
/** * Gets SwDoc from loaded component
*/
SwDoc* getSwDoc();
/** * Gets SwDocShell from loaded component
*/
SwDocShell* getSwDocShell();
/** * Gets SwXTextDocument from loaded component
*/
SwXTextDocument* getSwTextDoc();
/** * Wraps a reqif-xhtml fragment into an XHTML file, and XML-parses it.
*/
xmlDocUniquePtr WrapReqifFromTempFile();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.