26#include <com/sun/star/drawing/XControlShape.hpp>
27#include <com/sun/star/script/ScriptEventDescriptor.hpp>
29#include <document.hxx>
34using ::com::sun::star::uno::Reference;
35using ::com::sun::star::uno::UNO_QUERY;
36using ::com::sun::star::drawing::XShape;
37using ::com::sun::star::drawing::XControlShape;
38using ::com::sun::star::awt::XControlModel;
39using ::com::sun::star::script::ScriptEventDescriptor;
44double lclGetTwipsScale(
MapUnit eMapUnit )
50 OSL_FAIL(
"lclGetTwipsScale - map unit not implemented");
57 SCCOL nScCol =
static_cast< SCCOL >( nXclCol );
59 ::std::min( nOffset / 1024.0, 1.0 ) * rDoc.
GetColWidth( nScCol, nScTab )) + 0.5 );
65 SCROW nScRow =
static_cast< SCROW >( nXclRow );
67 ::std::min( nOffset / 256.0, 1.0 ) * rDoc.
GetRowHeight( nScRow, nScTab )) + 0.5 );
73 sal_uInt16& rnOffset, sal_uInt16 nXclStartCol, sal_uInt16 nXclMaxCol,
79 for( rnXclCol = nXclStartCol; rnXclCol <= nXclMaxCol; ++rnXclCol )
82 if( rnStartW + nColW > nTwipsX )
86 rnOffset = nColW ?
static_cast< sal_uInt16
>( (nTwipsX - rnStartW) * 1024.0 / nColW + 0.5 ) : 0;
92 sal_uInt32& rnOffset, sal_uInt32 nXclStartRow, sal_uInt32 nXclMaxRow,
99 for( sal_uInt32 nRow = nXclStartRow; nRow <= nXclMaxRow; ++nRow )
102 if( rnStartH + nRowH > nTwipsY )
111 rnXclRow = nXclMaxRow;
112 rnOffset =
static_cast< sal_uInt32
>( nRowH ? std::max((nTwipsY - rnStartH) * 256.0 / nRowH + 0.5, 0.0) : 0 );
123sal_uInt16 lclGetEmbeddedScale(
tools::Long nPageSize, sal_Int32 nPageScale,
tools::Long nPos,
double fPosScale )
125 return static_cast< sal_uInt16
>(
nPos * fPosScale / nPageSize * nPageScale + 0.5 );
141 double fScale = lclGetTwipsScale( eMapUnit );
150 lclMirrorRectangle( aRect );
158 sal_uInt16 nXclMaxRow =
static_cast<sal_uInt16
>( rRoot.
GetXclMaxPos().
Row());
163 lclMirrorRectangle( aRect );
165 double fScale = lclGetTwipsScale( eMapUnit );
167 lclGetColFromX( rDoc, nScTab,
maFirst.
mnCol,
mnLX, 0, nXclMaxCol, nDummy, aRect.
Left(), fScale );
170 lclGetRowFromY( rDoc, nScTab,
maFirst.
mnRow,
mnTY, 0, nXclMaxRow, nDummy, aRect.
Top(), fScale );
181 OSL_FAIL(
"XclObjAnchor::SetRect - map unit not implemented");
284 Reference< XControlModel > xCtrlModel;
285 Reference< XControlShape > xCtrlShape( xShape, UNO_QUERY );
286 if( xCtrlShape.is() )
287 xCtrlModel = xCtrlShape->getControl();
295 const char* mpcListenerType;
296 const char* mpcEventMethod;
301 {
"XActionListener",
"actionPerformed" },
302 {
"XMouseListener",
"mouseReleased" },
303 {
"XTextListener",
"textChanged" },
304 {
"XAdjustmentListener",
"adjustmentValueChanged" },
305 {
"XChangeListener",
"changed" }
313 if( !rXclMacroName.isEmpty() )
315 rDescriptor.ListenerType = OUString::createFromAscii( spTbxListenerData[ eEventType ].mpcListenerType );
316 rDescriptor.EventMethod = OUString::createFromAscii( spTbxListenerData[ eEventType ].mpcEventMethod );
317 rDescriptor.ScriptType =
"Script";
327 if( (!rDescriptor.ScriptCode.isEmpty()) &&
328 rDescriptor.ScriptType.equalsIgnoreAsciiCase(
"Script") &&
329 rDescriptor.ListenerType.equalsAscii( spTbxListenerData[ eEventType ].mpcListenerType ) &&
330 rDescriptor.EventMethod.equalsAscii( spTbxListenerData[ eEventType ].mpcEventMethod ) )
constexpr o3tl::Length MapToO3tlLength(MapUnit eU, o3tl::Length ePixelValue=o3tl::Length::px)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC tools::Long GetColOffset(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
SC_DLLPUBLIC tools::Long GetRowOffset(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static OUString ExtractFromMacroDescriptor(const css::script::ScriptEventDescriptor &rDescriptor, XclTbxEventType eEventType)
Tries to extract an Excel macro name from the passed macro descriptor.
static bool FillMacroDescriptor(css::script::ScriptEventDescriptor &rDescriptor, XclTbxEventType eEventType, const OUString &rXclMacroName, SfxObjectShell *pDocShell)
Fills the macro descriptor according to the passed macro name.
static css::uno::Reference< css::awt::XControlModel > GetControlModel(css::uno::Reference< css::drawing::XShape > const &xShape)
Returns the API control model from the passed API shape object.
This class is used to import record oriented streams.
Access to global data for a filter object (imported or exported document) from other classes.
const ScAddress & GetXclMaxPos() const
Returns the highest possible cell address in an Excel document (using current BIFF version).
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
sal_uInt32 mnTY
X offset in left column (1/1024 of column width).
tools::Rectangle GetRect(const XclRoot &rRoot, SCTAB nScTab, MapUnit eMapUnit) const
Calculates a rectangle from the contained coordinates.
sal_uInt32 mnBY
X offset in right column (1/1024 of column width).
sal_uInt16 mnRX
Y offset in top row (1/256 of row height).
void SetRect(const XclRoot &rRoot, SCTAB nScTab, const tools::Rectangle &rRect, MapUnit eMapUnit)
Initializes the anchor coordinates for a sheet.
XclObjAnchor()
Y offset in bottom row (1/256 of row height).
void ReadTxo8(XclImpStream &rStrm)
Reads text data from a BIFF8 TXO record.
void ReadObj3(XclImpStream &rStrm)
Reads text data from a BIFF3/BIFF4 OBJ record.
void ReadObj5(XclImpStream &rStrm)
Reads text data from a BIFF5 OBJ record.
XclImpStream & operator>>(XclImpStream &rStrm, XclObjLineData &rLineData)
const sal_uInt8 EXC_OBJ_LINE_SOLID
const sal_uInt8 EXC_OBJ_LINE_HAIR
const sal_uInt8 EXC_OBJ_LINE_AUTO
const sal_uInt8 EXC_OBJ_FILL_AUTOCOLOR
const sal_uInt16 EXC_OBJ_ORIENT_NONE
const sal_uInt8 EXC_OBJ_FILL_AUTO
const sal_uInt8 EXC_OBJ_LINE_AUTOCOLOR
const sal_uInt16 EXC_FONT_APP
const sal_uInt8 EXC_PATT_SOLID