LibreOffice Module tools (master) 1
Namespaces | Classes | Typedefs | Functions | Variables
tools Namespace Reference

Note: this class is a true marvel of engineering: because the author could not decide whether it's better to have a closed or half-open interval, they just implemented both in the same class! More...

Namespaces

namespace  detail
 

Classes

class  Duration
 Duration in days and time. More...
 
class  GenericTypeSerializer
 
class  Guid
 
class  JsonWriter
 
class  Line
 
class  Polygon
 
class  PolyPolygon
 
class  Rectangle
 
class  ScopedJsonWriterArray
 Auto-closes the node. More...
 
class  ScopedJsonWriterNode
 Auto-closes the node. More...
 
class  ScopedJsonWriterStruct
 Auto-closes the node. More...
 
class  SvRef
 T must be a class that extends SvRefBase.
 
class  Time
 
class  WeakBase
 derive your implementation classes from this class if you want them to support weak references More...
 
struct  WeakConnection
 private connection helper, do not use directly More...
 
class  WeakReference
 template implementation to hold a weak reference to an instance of type reference_type More...
 
class  XmlWalker
 XmlWalker main purpose is to make it easier for walking the parsed XML DOM tree. More...
 
struct  XmlWalkerImpl
 
class  XmlWriter
 XmlWriter writes a XML to a SvStream. More...
 
struct  XmlWriterImpl
 

Typedefs

typedef long Long
 
typedef unsigned long ULong
 

Functions

Time operator+ (const tools::Time &rTime1, const tools::Time &rTime2)
 
Time operator- (const tools::Time &rTime1, const tools::Time &rTime2)
 
bool IsMappedWebDAVPath (const OUString &rURL, OUString *pRealURL)
 
static void ImplAdaptiveSubdivide (std::vector< Point > &rPoints, const double old_d2, int recursionDepth, const double d2, const double P1x, const double P1y, const double P2x, const double P2y, const double P3x, const double P3y, const double P4x, const double P4y)
 Recursively subdivide cubic bezier curve via deCasteljau. More...
 
SvStreamReadPolygon (SvStream &rIStream, tools::Polygon &rPoly)
 
SvStreamWritePolygon (SvStream &rOStream, const tools::Polygon &rPoly)
 
static void impCorrectContinuity (basegfx::B2DPolygon &roPolygon, sal_uInt32 nIndex, PolyFlags nCFlag)
 
SvStreamReadPolyPolygon (SvStream &rIStream, tools::PolyPolygon &rPolyPoly)
 
SvStreamWritePolyPolygon (SvStream &rOStream, const tools::PolyPolygon &rPolyPoly)
 
void extendApplicationEnvironment ()
 
static char getEscapementChar (char ch)
 
static bool writeEscapedSequence (sal_uInt32 ch, char *&pos)
 
bool isEmptyFileUrl (const OUString &rUrl)
 Is rUrl a file:// URL with no contents? More...
 
Rectangle operator+ (const Rectangle &rRect, const Point &rPt)
 
Rectangle operator- (const Rectangle &rRect, const Point &rPt)
 
template<typename charT , typename traits >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &stream, const tools::Rectangle &rectangle)
 
template<typename charT , typename traits >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &rStream, tools::Guid const &rGuid)
 
template<typename charT , typename traits >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &stream, const Polygon &poly)
 
template<typename charT , typename traits >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &stream, const PolyPolygon &poly)
 
template<typename T , typename... Args>
SvRef< T > make_ref (Args &&... args)
 This implements similar functionality to std::make_shared. More...
 

Variables

constexpr int DEFAULT_BUFFER_SIZE = 2048
 These buffers are short-lived, so rather waste some space and avoid the cost of repeated calls into the allocator. More...
 
constexpr sal_uInt16 COL_NAME_USER = 0x8000
 
constexpr sal_Int32 RECT_EMPTY_VALUE_RIGHT_BOTTOM = -32767
 

Detailed Description

Note: this class is a true marvel of engineering: because the author could not decide whether it's better to have a closed or half-open interval, they just implemented both in the same class!

see weakbase.h for documentation

the template classes in this header are helper to implement weak references to implementation objects that are not refcounted.

@WARNING: This class can serve both as wall clock time and time duration, and the mixing of these concepts leads to problems such as there being 25 hours or 10 minus 20 seconds being (non-negative) 10 seconds.

This implements similar functionality to boost::intrusive_ptr.

We have an unfortunate problem in that, on Windows (both 32 and 64-bit), long is always 32-bit.

Simple JSON encoder designed specifically for LibreOfficeKit purposes.

If you have the misfortune of having to use this class, don't immediately despair but first take note that the uppercase GetWidth() / GetHeight() etc. methods interpret the interval as closed. To use the half open versions, use GetOpenWidth() / GetOpenHeight().

If you want to work with Size, you must use the closed interval functions! And don't add GetOpenSize() / setSize; this will probably just introduce bugs, especially when used in combination with list-initialization.

(Eventually you might notice, that the same engineer was also working on Qt at some point; see documentation on QRect::bottom / QRect::right ;-).

(1) Minimal allocations/re-allocations/copying (2) Small/simple JSON documents (3) ascii property names

But on Linux (64-bit) long is 64-bit. Which leads to nasty situations where things that work on Linux, failed on Windows. So....., (1) introduce a typedef that replaces (almost) all previous usage (2) on 64-bit Windows, this typedef is forced to 64-bit (32-bit platforms, including 32-bit Windows, are left alone) (3) fix fallout from (2)

As a consequence of the above, it would be best, over the long term, to regard usage of tools::Long in the codebase as meaning "we're not sure what the ideal size of the datatype is", and where possible, replace it with a better datatype like sal_Int32/sal_Int64/etc.

NOTE: If you change this, make sure HAVE_FEATURE_JUMBO_SHEETS matches this, as it requires at least 64bit tools::Long.

THIS IS NOT THREADSAFE

Use this only to have 'safe' pointers to implementation objects that you don't own but that you reference with a pointer.

Example:

class ImplClass : public tools::WeakBase< ImplClass > { ~ImplClass() { clearWeek(); } // not needed but safer, see method description ... };

class UserClass { tools::WeakReference< ImplClass > mxWeakRef;

UserClass( ImplClass* pObject ) : mxWeakRef( pObject ) {}

DoSomething() { if( mxWeakRef.is() ) mxWeakRef->DoSomethingMore(); } };

Typedef Documentation

◆ Long

typedef long tools::Long

Definition at line 34 of file long.hxx.

◆ ULong

typedef unsigned long tools::ULong

Definition at line 35 of file long.hxx.

Function Documentation

◆ extendApplicationEnvironment()

TOOLS_DLLPUBLIC void tools::extendApplicationEnvironment ( )

Definition at line 39 of file extendapplicationenvironment.cxx.

References env, and SAL_CONFIGFILE.

◆ getEscapementChar()

static char tools::getEscapementChar ( char  ch)
static

Definition at line 117 of file json_writer.cxx.

References ch.

Referenced by writeEscapedSequence().

◆ impCorrectContinuity()

static void tools::impCorrectContinuity ( basegfx::B2DPolygon roPolygon,
sal_uInt32  nIndex,
PolyFlags  nCFlag 
)
static

◆ ImplAdaptiveSubdivide()

static void tools::ImplAdaptiveSubdivide ( std::vector< Point > &  rPoints,
const double  old_d2,
int  recursionDepth,
const double  d2,
const double  P1x,
const double  P1y,
const double  P2x,
const double  P2y,
const double  P3x,
const double  P3y,
const double  P4x,
const double  P4y 
)
static

Recursively subdivide cubic bezier curve via deCasteljau.

Parameters
rPointsOutput vector, where the subdivided polylines are written to.
dSquared difference of curve to a straight line
P*Exactly four points, interpreted as support and control points of a cubic bezier curve. Must be in device coordinates, since stop criterion is based on the following assumption: the device has a finite resolution, it is thus sufficient to stop subdivision if the curve does not deviate more than one pixel from a straight line.

Definition at line 1122 of file poly.cxx.

References FRound(), ImplAdaptiveSubdivide(), and SAL_MAX_UINT16.

Referenced by tools::Polygon::AdaptiveSubdivide(), and ImplAdaptiveSubdivide().

◆ isEmptyFileUrl()

TOOLS_DLLPUBLIC bool tools::isEmptyFileUrl ( const OUString &  rUrl)

Is rUrl a file:// URL with no contents?

Definition at line 1300 of file stream.cxx.

References comphelper::isFileUrl(), SvFileStream::IsOpen(), READ, and SvStream::remainingSize().

◆ IsMappedWebDAVPath()

TOOLS_DLLPUBLIC bool tools::IsMappedWebDAVPath ( const OUString &  rURL,
OUString *  pRealURL 
)

Definition at line 44 of file fileutil.cxx.

References MAX_PATH, and NO_ERROR.

◆ make_ref()

template<typename T , typename... Args>
SvRef< T > tools::make_ref ( Args &&...  args)

This implements similar functionality to std::make_shared.

Definition at line 112 of file ref.hxx.

References args.

◆ operator+() [1/2]

Rectangle tools::operator+ ( const Rectangle rRect,
const Point rPt 
)
inline

Definition at line 768 of file gen.hxx.

◆ operator+() [2/2]

Time tools::operator+ ( const tools::Time rTime1,
const tools::Time rTime2 
)

Definition at line 377 of file ttime.cxx.

◆ operator-() [1/2]

Rectangle tools::operator- ( const Rectangle rRect,
const Point rPt 
)
inline

Definition at line 773 of file gen.hxx.

◆ operator-() [2/2]

Time tools::operator- ( const tools::Time rTime1,
const tools::Time rTime2 
)

Definition at line 383 of file ttime.cxx.

◆ operator<<() [1/4]

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & tools::operator<< ( std::basic_ostream< charT, traits > &  rStream,
tools::Guid const &  rGuid 
)
inline

Definition at line 1 of file Guid.hxx.

◆ operator<<() [2/4]

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & tools::operator<< ( std::basic_ostream< charT, traits > &  stream,
const Polygon poly 
)
inline

Definition at line 187 of file poly.hxx.

References SAL_WARN_UNUSED.

◆ operator<<() [3/4]

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & tools::operator<< ( std::basic_ostream< charT, traits > &  stream,
const PolyPolygon poly 
)
inline

Definition at line 187 of file poly.hxx.

◆ operator<<() [4/4]

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & tools::operator<< ( std::basic_ostream< charT, traits > &  stream,
const tools::Rectangle rectangle 
)
inline

Definition at line 797 of file gen.hxx.

◆ ReadPolygon()

SvStream & tools::ReadPolygon ( SvStream rIStream,
tools::Polygon rPoly 
)

Definition at line 1625 of file poly.cxx.

◆ ReadPolyPolygon()

SvStream & tools::ReadPolyPolygon ( SvStream rIStream,
tools::PolyPolygon rPolyPoly 
)

Definition at line 386 of file poly2.cxx.

◆ writeEscapedSequence()

static bool tools::writeEscapedSequence ( sal_uInt32  ch,
char *&  pos 
)
static

Definition at line 136 of file json_writer.cxx.

References ch, getEscapementChar(), and pos.

Referenced by tools::JsonWriter::put(), and tools::JsonWriter::writeEscapedOUString().

◆ WritePolygon()

SvStream & tools::WritePolygon ( SvStream rOStream,
const tools::Polygon rPoly 
)

Definition at line 1652 of file poly.cxx.

◆ WritePolyPolygon()

SvStream & tools::WritePolyPolygon ( SvStream rOStream,
const tools::PolyPolygon rPolyPoly 
)

Definition at line 419 of file poly2.cxx.

Variable Documentation

◆ COL_NAME_USER

constexpr sal_uInt16 tools::COL_NAME_USER = 0x8000
constexpr

◆ DEFAULT_BUFFER_SIZE

constexpr int tools::DEFAULT_BUFFER_SIZE = 2048
constexpr

These buffers are short-lived, so rather waste some space and avoid the cost of repeated calls into the allocator.

Definition at line 19 of file json_writer.cxx.

◆ RECT_EMPTY_VALUE_RIGHT_BOTTOM

constexpr sal_Int32 tools::RECT_EMPTY_VALUE_RIGHT_BOTTOM = -32767
constexpr