[Libreoffice-commits] core.git: Branch 'feature/borderline3' - 636 commits - accessibility/source android/Bootstrap android/source apple_remote/source autogen.sh avmedia/source basctl/inc basctl/source basegfx/source basic/inc basic/qa basic/source bean/com binaryurp/source bin/distro-install-desktop-integration bin/gen-boost-headers bin/lo-all-static-libs bin/lo-commit-stat bin/lo-pack-sources bin/update bridges/inc bridges/source chart2/inc chart2/qa chart2/source cli_ure/qa cli_ure/source cli_ure/version codemaker/source comphelper/source compilerplugins/clang config_host/config_libepubgen.h.in config_host.mk.in configmgr/source configure.ac connectivity/source cppcanvas/source cppuhelper/source cppu/source cui/inc cui/source cui/uiconfig dbaccess/source desktop/CppunitTest_desktop_app.mk desktop/Library_sofficeapp.mk desktop/source distro-configs/LibreOfficeFlatpak.conf download.lst drawinglayer/inc drawinglayer/qa drawinglayer/source dtrans/source editeng/qa editeng/source embedserv/source e mfio/qa emfio/source extensions/source external/boost external/gpgme external/harfbuzz external/libepubgen external/libgpg-error external/liborcus external/libqxp external/libxml2 external/libxmlsec external/Module_external.mk external/nss external/python3 filter/Configuration_filter.mk filter/source filter/uiconfig forms/source formula/source fpicker/source framework/source .gitignore helpcontent2 hwpfilter/qa hwpfilter/source i18npool/inc i18npool/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_svg idlc/source include/apple_remote include/basegfx include/basic include/canvas include/comphelper include/drawinglayer include/editeng include/filter include/LibreOfficeKit include/oox include/opencl include/osl include/rtl include/sal include/sax include/sfx2 include/svl include/svtools include/svx include/test include/toolkit include/tools include/unotest include/unotools include/vcl include/xmloff instset oo_native/CustomTarget_setup.mk instsetoo_native/inc_openoffice jurt/source jvmfwk/plugins jvmfwk/source l10ntools/source libreofficekit/qa libreofficekit/source linguistic/source lotuswordpro/source m4/libgcrypt.m4 Makefile.fetch odk/docs odk/examples offapi/com officecfg/registry onlineupdate/Executable_test_updater_dialog.mk onlineupdate/Executable_updater.mk onlineupdate/Executable_update_service.mk onlineupdate/Module_onlineupdate.mk onlineupdate/source onlineupdate/StaticLibrary_libmarverify.mk onlineupdate/workben oovbaapi/ooo oox/source opencl/inc opencl/source package/source pyuno/source qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests readlicense_oo/license README.cross registry/source reportdesign/inc reportdesign/source RepositoryExternal.mk Repository.mk ridljar/com salhelper/source sal/osl sal/rtl sal/test sal/textenc sal/util sax/source scaddins/source sccomp/CppunitTest_sccomp_lpsolver.mk sccomp/CppunitTest_sccomp_solver.mk sccomp/Module_sccomp.mk sccomp/qa s c/CppunitTest_sc_arealinkobj.mk sc/CppunitTest_sc_cache_test.mk sc/CppunitTest_sc_datapilotitemobj.mk sc/CppunitTest_sc_dataprovider.mk sc/CppunitTest_sc_dataproviders_test.mk sc/CppunitTest_sc_datatransformation.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_parallelism.mk sc/inc sc/Library_scfilt.mk sc/Library_sc.mk sc/Module_sc.mk scp2/macros scp2/source sc/qa sc/README scripting/source sc/sdi sc/source sc/uiconfig sc/workben sd/CppunitTest_sd_activex_controls_tests.mk sdext/source sd/inc sd/Module_sd.mk sd/qa sd/source sd/uiconfig sfx2/classification sfx2/doc sfx2/inc sfx2/source shell/source slideshow/source solenv/bin solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/gbuild soltools/cpp soltools/mkdepend sot/source starmath/inc starmath/source stoc/source stoc/test store/source svgio/qa svl/Library_svl.mk svl/qa svl/source svtools/inc svtools/source svx/inc svx/Library_svxcore.mk svx/sdi svx/source sw/CppunitTest_sw_ww8export2.mk sw/inc sw/o oxmlexport_setup.mk sw/qa sw/sdi sw/source sw/uiconfig sysui/CustomTarget_share.mk sysui/desktop test/Library_subsequenttest.mk test/source toolkit/source toolkit/test tools/Library_tl.mk tools/qa tools/source ucb/qa ucb/source udkapi/com unodevtools/source unoidl/source unoil/climaker unotest/source unotools/source unoxml/qa unoxml/source uui/inc uui/source vcl/headless vcl/inc vcl/Library_vcl.mk vcl/opengl vcl/osx vcl/qa vcl/README.scheduler vcl/source vcl/unx vcl/win winaccessibility/source writerfilter/inc writerfilter/qa writerfilter/source writerperfect/CppunitTest_writerperfect_epubexport.mk writerperfect/Library_wpftdraw.mk writerperfect/Library_wpftwriter.mk writerperfect/Module_writerperfect.mk writerperfect/qa writerperfect/source xmlhelp/source xmloff/source xmlsecurity/Library_xmlsecurity.mk xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/Module_xmlsecurity.mk xmlsecurity/qa xmlsecurity/source
Armin Le Grand
Armin.Le.Grand at cib.de
Tue Aug 29 12:23:39 UTC 2017
Rebased ref, commits from common ancestor:
commit 8d47ac46dcc94db5a3646d52572e576a736afddf
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Thu Aug 17 20:19:46 2017 +0200
borderline: Cleanup of DiagStyle and others
DiagStyle is not needed anymore due to no longer
using angles calculated, but being based on vectors
defining the geometry. Also cleaned up quite a bit
of no longer needed calculation stuff for the control
Change-Id: I10f2702416eea68b9e1541c6ae153d1f6094970b
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index c53f429c3b59..973c401f5aec 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -184,72 +184,8 @@ SVX_DLLPUBLIC bool operator<( const Style& rL, const Style& rR );
inline bool operator>( const Style& rL, const Style& rR ) { return rR < rL; }
-
-/** Extends the Style struct with an angle for diagonal frame borders.
-
- The angle is specified in radian (a full circle is equivalent to 2*PI).
- It is dependent on the context, how the value is interpreted, i.e. it may
- specify the angle to a horizontal or vertical frame border.
- */
-class SAL_WARN_UNUSED DiagStyle : public Style
-{
-public:
- /** Constructs an invisible diagonal frame style. */
- explicit DiagStyle() {}
- /** Constructs a diagonal frame style passed style and angle. */
- explicit DiagStyle( const Style& rStyle, double /*fAngle*/ ) :
- Style( rStyle ) {}
-};
-
-
// Various helper functions
-
-/** Returns the angle between horizontal border of a rectangle and its diagonal.
-
- The returned values represents the inner angle between the diagonals and
- horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
- passed sizes may be negative, calculation is done with absolute values.
- */
-SVX_DLLPUBLIC double GetHorDiagAngle( long nWidth, long nHeight );
-
-/** Returns an X coordinate for a diagonal frame border in the specified height.
-
- This function is for usage with the top-left end of a top-left to
- bottom-right diagonal frame border, connected to the left end of a
- horizontal frame border.
-
- The function returns the relative X position (i.e. for a polygon) of the
- diagonal frame border according to the specified relative Y position. The
- mentioned positions are relative to the reference point of both frame
- borders.
-
- +----------------------------------------------------------
- | The horizontal frame border.
- | |
- - - - - - - | --+-- <---- Reference point for horizontal and diagonal frame borders.
- ^ | \ | \
- nVerOffs | \ \ <--- The diagonal frame border.
- v +---\ \------------------------------------------------
- - - - - - - - - -\- - -X <----- The function calculates the X position of i.e.
- \ \ this point (relative from X of reference point).
- \ \
- Primary -->\ \<-- Secondary
-
- @param nVerOffs
- The vertical position of the point to be calculated, relative to the Y
- coordinate of the reference point.
- @param nDiagOffs
- The width offset across the diagonal frame border (0 = middle),
- regardless of the gradient of the diagonal frame border (always
- vertical to the direction of the diagonal frame border). This value is
- not related in any way to the reference point. For details about
- relative width offsets, see description of class Style.
- @param fAngle
- Inner (right) angle between diagonal and horizontal frame border.
- */
-SVX_DLLPUBLIC long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
-
/** Checks whether two horizontal frame borders are "connectable".
Two borders are "connectable" in terms of this function, if both can be
@@ -339,17 +275,17 @@ SVX_DLLPUBLIC void CreateBorderPrimitives(
const Style& rBorder, /// Style of the processed frame border.
- const DiagStyle& rLFromTR, /// Diagonal frame border from top-right to left end of rBorder.
+ const Style& rLFromTR, /// Diagonal frame border from top-right to left end of rBorder.
const Style& rLFromT, /// Vertical frame border from top to left end of rBorder.
const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder.
const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder.
- const DiagStyle& rLFromBR, /// Diagonal frame border from bottom-right to left end of rBorder.
+ const Style& rLFromBR, /// Diagonal frame border from bottom-right to left end of rBorder.
- const DiagStyle& rRFromTL, /// Diagonal frame border from top-left to right end of rBorder.
+ const Style& rRFromTL, /// Diagonal frame border from top-left to right end of rBorder.
const Style& rRFromT, /// Vertical frame border from top to right end of rBorder.
const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
- const DiagStyle& rRFromBL, /// Diagonal frame border from bottom-left to right end of rBorder.
+ const Style& rRFromBL, /// Diagonal frame border from bottom-left to right end of rBorder.
const Color* pForceColor /// If specified, overrides frame border color.
);
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index d272170b8bca..29e44994ff68 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -301,16 +301,6 @@ public:
Returns total output rectangle of merged ranges. */
tools::Rectangle GetCellRect( size_t nCol, size_t nRow ) const;
- // diagonal frame borders -------------------------------------------------
-
- /** Returns the angle between horizontal and diagonal border of the cell (nCol,nRow).
- Returns the horizontal angle of merged ranges. */
- double GetHorDiagAngle( size_t nCol, size_t nRow ) const;
-
- /** Returns the angle between vertical and diagonal border of the cell (nCol,nRow).
- Returns the vertical angle of merged ranges. */
- double GetVerDiagAngle( size_t nCol, size_t nRow ) const;
-
// mirroring --------------------------------------------------------------
/** Mirrors the entire array horizontally. */
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 3d4e1ea6fc4d..cdfc9a202145 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -44,12 +44,6 @@ namespace frame {
namespace {
-/** Rounds and casts a double value to a long value. */
-inline long lclD2L( double fValue )
-{
- return static_cast< long >( (fValue < 0.0) ? (fValue - 0.5) : (fValue + 0.5) );
-}
-
/** Converts a width in twips to a width in another map unit (specified by fScale). */
double lclScaleValue( double nValue, double fScale, sal_uInt16 nMaxWidth )
{
@@ -236,18 +230,6 @@ bool operator<( const Style& rL, const Style& rR )
#undef SCALEVALUE
-
-// Various helper functions
-double GetHorDiagAngle( long nWidth, long nHeight )
-{
- return atan2( static_cast< double >( std::abs( nHeight ) ), static_cast< double >( std::abs( nWidth ) ) );
-}
-
-long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
-{
- return lclD2L( nVerOffs / tan( fAngle ) + nDiagOffs / sin( fAngle ) );
-}
-
bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder,
const Style& rTFromTL, const Style& rTFromT, const Style& rTFromTR,
const Style& rBFromBL, const Style& rBFromB, const Style& rBFromBR )
@@ -506,16 +488,16 @@ void CreateBorderPrimitives(
const basegfx::B2DVector& rX,
const basegfx::B2DVector& rY,
const Style& rBorder,
- const DiagStyle& /*rLFromTR*/,
+ const Style& /*rLFromTR*/,
const Style& rLFromT,
const Style& /*rLFromL*/,
const Style& rLFromB,
- const DiagStyle& /*rLFromBR*/,
- const DiagStyle& /*rRFromTL*/,
+ const Style& /*rLFromBR*/,
+ const Style& /*rRFromTL*/,
const Style& rRFromT,
const Style& /*rRFromR*/,
const Style& rRFromB,
- const DiagStyle& /*rRFromBL*/,
+ const Style& /*rRFromBL*/,
const Color* pForceColor)
{
if (rBorder.Prim())
@@ -665,16 +647,16 @@ void CreateBorderPrimitives(
rX,
rY,
rBorder,
- DiagStyle(),
+ Style(),
rLFromT,
rLFromL,
rLFromB,
- DiagStyle(),
- DiagStyle(),
+ Style(),
+ Style(),
rRFromT,
rRFromR,
rRFromB,
- DiagStyle(),
+ Style(),
pForceColor);
}
}
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index c5d0d9fe2676..eaf8d01813a8 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -183,9 +183,6 @@ struct ArrayImpl
long GetColWidth( size_t nFirstCol, size_t nLastCol ) const;
long GetRowHeight( size_t nFirstRow, size_t nLastRow ) const;
- double GetHorDiagAngle( size_t nCol, size_t nRow ) const;
- double GetVerDiagAngle( size_t nCol, size_t nRow ) const;
-
bool HasCellRotation() const;
};
@@ -319,35 +316,6 @@ long ArrayImpl::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const
return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow );
}
-double ArrayImpl::GetHorDiagAngle( size_t nCol, size_t nRow ) const
-{
- double fAngle = 0.0;
- if( IsValidPos( nCol, nRow ) )
- {
- if( !GetCell( nCol, nRow ).IsMerged() )
- {
- fAngle = frame::GetHorDiagAngle( maWidths[ nCol ] + 1, maHeights[ nRow ] + 1 );
- }
- else
- {
- // return correct angle for each cell in the merged range
- size_t nFirstCol = GetMergedFirstCol( nCol, nRow );
- size_t nFirstRow = GetMergedFirstRow( nCol, nRow );
- const Cell& rCell = GetCell( nFirstCol, nFirstRow );
- long nWidth = GetColWidth( nFirstCol, GetMergedLastCol( nCol, nRow ) ) + rCell.mnAddLeft + rCell.mnAddRight;
- long nHeight = GetRowHeight( nFirstRow, GetMergedLastRow( nCol, nRow ) ) + rCell.mnAddTop + rCell.mnAddBottom;
- fAngle = frame::GetHorDiagAngle( nWidth + 1, nHeight + 1 );
- }
- }
- return fAngle;
-}
-
-double ArrayImpl::GetVerDiagAngle( size_t nCol, size_t nRow ) const
-{
- double fAngle = GetHorDiagAngle( nCol, nRow );
- return (fAngle > 0.0) ? (F_PI2 - fAngle) : 0.0;
-}
-
bool ArrayImpl::HasCellRotation() const
{
// check cell array
@@ -872,19 +840,6 @@ tools::Rectangle Array::GetCellRect( size_t nCol, size_t nRow ) const
return aRect;
}
-// diagonal frame borders
-double Array::GetHorDiagAngle( size_t nCol, size_t nRow ) const
-{
- DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetHorDiagAngle" );
- return mxImpl->GetHorDiagAngle( nCol, nRow );
-}
-
-double Array::GetVerDiagAngle( size_t nCol, size_t nRow ) const
-{
- DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetVerDiagAngle" );
- return mxImpl->GetVerDiagAngle( nCol, nRow );
-}
-
// mirroring
void Array::MirrorSelfX()
{
@@ -1031,43 +986,37 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
// *** horizontal frame borders ***
for( nRow = nFirstRow; nRow <= nLastRow + 1; ++nRow )
{
- double fAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow );
- double fTAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow - 1 );
-
// *Start*** variables store the data of the left end of the cached frame border
basegfx::B2DPoint aStartPos( mxImpl->GetColPosition( nFirstCol ), mxImpl->GetRowPosition( nRow ) );
const Style* pStart = &GetCellStyleTop( nFirstCol, nRow );
- DiagStyle aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ), fTAngle );
+ Style aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ));
const Style* pStartLFromT = &GetCellStyleLeft( nFirstCol, nRow - 1 );
const Style* pStartLFromL = &GetCellStyleTop( nFirstCol - 1, nRow );
const Style* pStartLFromB = &GetCellStyleLeft( nFirstCol, nRow );
- DiagStyle aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ), fAngle );
+ Style aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ));
// *End*** variables store the data of the right end of the cached frame border
- DiagStyle aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ), fTAngle );
+ Style aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ));
const Style* pEndRFromT = &GetCellStyleRight( nFirstCol, nRow - 1 );
const Style* pEndRFromR = &GetCellStyleTop( nFirstCol + 1, nRow );
const Style* pEndRFromB = &GetCellStyleRight( nFirstCol, nRow );
- DiagStyle aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ), fAngle );
+ Style aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ));
for( nCol = nFirstCol + 1; nCol <= nLastCol; ++nCol )
{
- fAngle = mxImpl->GetHorDiagAngle( nCol, nRow );
- fTAngle = mxImpl->GetHorDiagAngle( nCol, nRow - 1 );
-
const Style& rCurr = *pEndRFromR;
- DiagStyle aLFromTR( GetCellStyleBL( nCol, nRow - 1 ), fTAngle );
+ Style aLFromTR( GetCellStyleBL( nCol, nRow - 1 ));
const Style& rLFromT = *pEndRFromT;
const Style& rLFromL = *pStart;
const Style& rLFromB = *pEndRFromB;
- DiagStyle aLFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+ Style aLFromBR( GetCellStyleTL( nCol, nRow ));
- DiagStyle aRFromTL( GetCellStyleBR( nCol, nRow - 1 ), fTAngle );
+ Style aRFromTL( GetCellStyleBR( nCol, nRow - 1 ));
const Style& rRFromT = GetCellStyleRight( nCol, nRow - 1 );
const Style& rRFromR = GetCellStyleTop( nCol + 1, nRow );
const Style& rRFromB = GetCellStyleRight( nCol, nRow );
- DiagStyle aRFromBL( GetCellStyleTR( nCol, nRow ), fAngle );
+ Style aRFromBL( GetCellStyleTR( nCol, nRow ));
// check if current frame border can be connected to cached frame border
if( !CheckFrameBorderConnectable( *pStart, rCurr, aEndRFromTL, rLFromT, aLFromTR, aEndRFromBL, rLFromB, aLFromBR ) )
@@ -1199,43 +1148,37 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
// *** vertical frame borders ***
for( nCol = nFirstCol; nCol <= nLastCol + 1; ++nCol )
{
- double fAngle = mxImpl->GetVerDiagAngle( nCol, nFirstRow );
- double fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nFirstRow );
-
// *Start*** variables store the data of the top end of the cached frame border
basegfx::B2DPoint aStartPos( mxImpl->GetColPosition( nCol ), mxImpl->GetRowPosition( nFirstRow ) );
const Style* pStart = &GetCellStyleLeft( nCol, nFirstRow );
- DiagStyle aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ), fLAngle );
+ Style aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ));
const Style* pStartTFromL = &GetCellStyleTop( nCol - 1, nFirstRow );
const Style* pStartTFromT = &GetCellStyleLeft( nCol, nFirstRow - 1 );
const Style* pStartTFromR = &GetCellStyleTop( nCol, nFirstRow );
- DiagStyle aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ), fAngle );
+ Style aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ));
// *End*** variables store the data of the bottom end of the cached frame border
- DiagStyle aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ), fLAngle );
+ Style aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ));
const Style* pEndBFromL = &GetCellStyleBottom( nCol - 1, nFirstRow );
const Style* pEndBFromB = &GetCellStyleLeft( nCol, nFirstRow + 1 );
const Style* pEndBFromR = &GetCellStyleBottom( nCol, nFirstRow );
- DiagStyle aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ), fAngle );
+ Style aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ));
for( nRow = nFirstRow + 1; nRow <= nLastRow; ++nRow )
{
- fAngle = mxImpl->GetVerDiagAngle( nCol, nRow );
- fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nRow );
-
const Style& rCurr = *pEndBFromB;
- DiagStyle aTFromBL( GetCellStyleTR( nCol - 1, nRow ), fLAngle );
+ Style aTFromBL( GetCellStyleTR( nCol - 1, nRow ));
const Style& rTFromL = *pEndBFromL;
const Style& rTFromT = *pStart;
const Style& rTFromR = *pEndBFromR;
- DiagStyle aTFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+ Style aTFromBR( GetCellStyleTL( nCol, nRow ));
- DiagStyle aBFromTL( GetCellStyleBR( nCol - 1, nRow ), fLAngle );
+ Style aBFromTL( GetCellStyleBR( nCol - 1, nRow ));
const Style& rBFromL = GetCellStyleBottom( nCol - 1, nRow );
const Style& rBFromB = GetCellStyleLeft( nCol, nRow + 1 );
const Style& rBFromR = GetCellStyleBottom( nCol, nRow );
- DiagStyle aBFromTR( GetCellStyleBL( nCol, nRow ), fAngle );
+ Style aBFromTR( GetCellStyleBL( nCol, nRow ));
// check if current frame border can be connected to cached frame border
if( !CheckFrameBorderConnectable( *pStart, rCurr,
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index e3ccf03eebc0..0bb928039b07 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -360,8 +360,9 @@ void FrameSelectorImpl::InitGlobalGeometry()
/* nBetwBordersSize contains the size between an outer and inner frame border (made odd). */
long nBetwBordersSize = (((nMinSize - nFixedSize) / 2) - 1) | 1;
- /* The final size of the usable area. */
+ /* The final size of the usable area. At least do not get negative */
mnCtrlSize = 2 * nBetwBordersSize + nFixedSize;
+ mnCtrlSize = std::max(mnCtrlSize, static_cast<long>(0));
mpVirDev->SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) );
/* Center the virtual device in the control. */
@@ -410,8 +411,10 @@ void FrameSelectorImpl::InitBorderGeometry()
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
{
tools::Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
- long nDiagFocusOffsX = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetHorDiagAngle( nCol, nRow ) );
- long nDiagFocusOffsY = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetVerDiagAngle( nCol, nRow ) );
+ const double fHorDiagAngle(atan2(static_cast< double >(std::abs(aRect.GetHeight())), static_cast< double >(std::abs(aRect.GetWidth()))));
+ const double fVerDiagAngle(fHorDiagAngle > 0.0 ? F_PI2 - fHorDiagAngle : 0.0);
+ const long nDiagFocusOffsX(basegfx::fround(-mnFocusOffs / tan(fHorDiagAngle) + mnFocusOffs / sin(fHorDiagAngle)));
+ const long nDiagFocusOffsY(basegfx::fround(-mnFocusOffs / tan(fVerDiagAngle) + mnFocusOffs / sin(fVerDiagAngle)));
std::vector< Point > aFocusVec;
aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Top() + nDiagFocusOffsY ) );
commit c8f26f256542fd052789d5467a181d5887c8fb91
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Fri Aug 11 18:32:33 2017 +0200
borderline: further abstraction of BorderLinePrimitive
As preparation for more detailed definition of BorderLine
primitives I have adapted the BorderLine definition to
work with motre possibilities to define the LineStartEnd
definitions in a BorderLineExtend class. That one is
flexible to hold all kinds of definitions - from none to
all four possible extends (Start/End, Left/Right of vector)
Change-Id: Ifab165712f60867a39ba4fb841cb13cae92e3e06
diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx
index 326c5deaa163..a070f9cdff24 100644
--- a/drawinglayer/qa/unit/border.cxx
+++ b/drawinglayer/qa/unit/border.cxx
@@ -65,9 +65,21 @@ void DrawinglayerBorderTest::testDoubleDecompositionSolid()
new drawinglayer::primitive2d::BorderLinePrimitive2D(
aStart,
aEnd,
- drawinglayer::primitive2d::BorderLine(fLeftWidth, aColorLeft, fExtendLeftStart, fExtendLeftEnd),
- drawinglayer::primitive2d::BorderLine(fDistance, aColorGap),
- drawinglayer::primitive2d::BorderLine(fRightWidth, aColorRight, fExtendRightStart, fExtendRightEnd),
+ drawinglayer::primitive2d::BorderLine(
+ fLeftWidth,
+ aColorLeft,
+ drawinglayer::primitive2d::BorderLineExtend(
+ fExtendLeftStart,
+ fExtendLeftEnd)),
+ drawinglayer::primitive2d::BorderLine(
+ fDistance,
+ aColorGap),
+ drawinglayer::primitive2d::BorderLine(
+ fRightWidth,
+ aColorRight,
+ drawinglayer::primitive2d::BorderLineExtend(
+ fExtendRightStart,
+ fExtendRightEnd)),
bHasGapColor,
nStyle));
@@ -121,9 +133,21 @@ void DrawinglayerBorderTest::testDoublePixelProcessing()
new drawinglayer::primitive2d::BorderLinePrimitive2D(
aStart,
aEnd,
- drawinglayer::primitive2d::BorderLine(fLeftWidth, aColorLeft, fExtendLeftStart, fExtendLeftEnd),
- drawinglayer::primitive2d::BorderLine(fDistance, aColorGap),
- drawinglayer::primitive2d::BorderLine(fRightWidth, aColorRight, fExtendRightStart, fExtendRightEnd),
+ drawinglayer::primitive2d::BorderLine(
+ fLeftWidth,
+ aColorLeft,
+ drawinglayer::primitive2d::BorderLineExtend(
+ fExtendLeftStart,
+ fExtendLeftEnd)),
+ drawinglayer::primitive2d::BorderLine(
+ fDistance,
+ aColorGap),
+ drawinglayer::primitive2d::BorderLine(
+ fRightWidth,
+ aColorRight,
+ drawinglayer::primitive2d::BorderLineExtend(
+ fExtendRightStart,
+ fExtendRightEnd)),
bHasGapColor,
nStyle));
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index dae52a26f0c6..47da04a10945 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -37,15 +37,128 @@ namespace drawinglayer
{
namespace primitive2d
{
+ BorderLineExtend::BorderLineExtend()
+ : mfExtends()
+ {
+ }
+
+ BorderLineExtend::BorderLineExtend(
+ double fStart,
+ double fEnd)
+ : mfExtends(2)
+ {
+ mfExtends[0] = fStart;
+ mfExtends[1] = fEnd;
+ }
+
+ BorderLineExtend::BorderLineExtend(
+ double fStartLeft,
+ double fStartRight,
+ double fEndLeft,
+ double fEndRight)
+ : mfExtends(4)
+ {
+ mfExtends[0] = fStartLeft;
+ mfExtends[1] = fStartRight;
+ mfExtends[2] = fEndLeft;
+ mfExtends[3] = fEndRight;
+ }
+
+ BorderLineExtend::~BorderLineExtend()
+ {
+ }
+
+ bool BorderLineExtend::equalStart() const
+ {
+ if (mfExtends.empty()|| 2 == mfExtends.size())
+ return true;
+ return mfExtends[0] == mfExtends[1];
+ }
+
+ bool BorderLineExtend::equalEnd() const
+ {
+ if (mfExtends.empty() || 2 == mfExtends.size())
+ return true;
+ return mfExtends[2] == mfExtends[3];
+ }
+
+ double BorderLineExtend::getStartLeft() const
+ {
+ if (mfExtends.empty())
+ return 0.0;
+ return mfExtends[0];
+ }
+
+ double BorderLineExtend::getStartRight() const
+ {
+ if (mfExtends.empty())
+ return 0.0;
+ if (2 == mfExtends.size())
+ return mfExtends[0];
+ return mfExtends[1];
+ }
+
+ double BorderLineExtend::getEndLeft() const
+ {
+ if (mfExtends.empty())
+ return 0.0;
+ if (2 == mfExtends.size())
+ return mfExtends[1];
+ return mfExtends[2];
+ }
+
+ double BorderLineExtend::getEndRight() const {
+ if (mfExtends.empty())
+ return 0.0;
+ if (2 == mfExtends.size())
+ return mfExtends[1];
+ return mfExtends[3];
+ }
+
+ double BorderLineExtend::getStartAverage() const
+ {
+ if (mfExtends.empty())
+ return 0.0;
+ if (2 == mfExtends.size())
+ return mfExtends[0];
+ return (mfExtends[0] + mfExtends[1]) * 0.5;
+ }
+
+ double BorderLineExtend::getEndAverage() const
+ {
+ if (mfExtends.empty())
+ return 0.0;
+ if (2 == mfExtends.size())
+ return mfExtends[1];
+ return (mfExtends[2] + mfExtends[3]) * 0.5;
+ }
+
+ bool BorderLineExtend::operator==(const BorderLineExtend& rBorderLineExtend) const
+ {
+ if (mfExtends.size() == rBorderLineExtend.mfExtends.size())
+ {
+ return mfExtends == rBorderLineExtend.mfExtends;
+ }
+
+ return false;
+ }
+
BorderLine::BorderLine(
double fWidth,
const basegfx::BColor& rRGBColor,
- double fExtendStart,
- double fExtendEnd)
- : mfWidth(fWidth),
+ const BorderLineExtend& rBorderLineExtend)
+ : mfWidth(fWidth),
+ maRGBColor(rRGBColor),
+ maBorderLineExtend(rBorderLineExtend)
+ {
+ }
+
+ BorderLine::BorderLine(
+ double fWidth,
+ const basegfx::BColor& rRGBColor)
+ : mfWidth(fWidth),
maRGBColor(rRGBColor),
- mfExtendStart(fExtendStart),
- mfExtendEnd(fExtendEnd)
+ maBorderLineExtend()
{
}
@@ -57,8 +170,7 @@ namespace drawinglayer
{
return getWidth() == rBorderLine.getWidth()
&& getRGBColor() == rBorderLine.getRGBColor()
- && getExtendStart() == rBorderLine.getExtendStart()
- && getExtendEnd() == rBorderLine.getExtendEnd();
+ && getBorderLineExtend() == rBorderLine.getBorderLineExtend();
}
// helper to add a centered, maybe stroked line primitive to rContainer
@@ -117,8 +229,8 @@ namespace drawinglayer
// inside line (left of vector). Create stroke primitive centered on left line width
const double fDeltaY((rLeft.getWidth() - fFullWidth) * 0.5);
const basegfx::B2DVector aDeltaY(aPerpendicular * fDeltaY);
- const basegfx::B2DPoint aStart(getStart() - (aVector * rLeft.getExtendStart()) + aDeltaY);
- const basegfx::B2DPoint aEnd(getEnd() + (aVector * rLeft.getExtendEnd()) + aDeltaY);
+ const basegfx::B2DPoint aStart(getStart() - (aVector * rLeft.getBorderLineExtend().getStartAverage()) + aDeltaY);
+ const basegfx::B2DPoint aEnd(getEnd() + (aVector * rLeft.getBorderLineExtend().getEndAverage()) + aDeltaY);
const attribute::LineAttribute aLineAttribute(rLeft.getRGBColor(), rLeft.getWidth());
addPolygonStrokePrimitive2D(
@@ -135,8 +247,8 @@ namespace drawinglayer
// Create stroke primitive on vector with given color centered on gap position
const double fDeltaY(((fFullWidth - mfDiscreteGapDistance) * 0.5) - rRight.getWidth());
const basegfx::B2DVector aDeltaY(aPerpendicular * fDeltaY);
- const basegfx::B2DPoint aStart(getStart() - (aVector * rGap.getExtendStart()) + aDeltaY);
- const basegfx::B2DPoint aEnd(getEnd() + (aVector * rGap.getExtendEnd()) + aDeltaY);
+ const basegfx::B2DPoint aStart(getStart() - (aVector * rGap.getBorderLineExtend().getStartAverage()) + aDeltaY);
+ const basegfx::B2DPoint aEnd(getEnd() + (aVector * rGap.getBorderLineExtend().getEndAverage()) + aDeltaY);
const attribute::LineAttribute aLineAttribute(rGap.getRGBColor(), mfDiscreteGapDistance);
addPolygonStrokePrimitive2D(
@@ -151,8 +263,8 @@ namespace drawinglayer
// outside line (right of vector). Create stroke primitive centered on right line width
const double fDeltaY((fFullWidth - rRight.getWidth()) * 0.5);
const basegfx::B2DVector aDeltaY(aPerpendicular * fDeltaY);
- const basegfx::B2DPoint aStart(getStart() - (aVector * rRight.getExtendStart()) + aDeltaY);
- const basegfx::B2DPoint aEnd(getEnd() + (aVector * rRight.getExtendEnd()) + aDeltaY);
+ const basegfx::B2DPoint aStart(getStart() - (aVector * rRight.getBorderLineExtend().getStartAverage()) + aDeltaY);
+ const basegfx::B2DPoint aEnd(getEnd() + (aVector * rRight.getBorderLineExtend().getEndAverage()) + aDeltaY);
const attribute::LineAttribute aLineAttribute(rRight.getRGBColor(), rRight.getWidth());
addPolygonStrokePrimitive2D(
@@ -171,8 +283,8 @@ namespace drawinglayer
addPolygonStrokePrimitive2D(
rContainer,
- getStart() - (aVector * rBorderLine.getExtendStart()),
- getEnd() + (aVector * rBorderLine.getExtendEnd()),
+ getStart() - (aVector * rBorderLine.getBorderLineExtend().getStartAverage()),
+ getEnd() + (aVector * rBorderLine.getBorderLineExtend().getEndAverage()),
aLineAttribute,
aStrokeAttribute);
}
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
index 2eba13fee917..ad28a5eeaac2 100644
--- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -33,8 +33,44 @@ namespace drawinglayer
{
namespace primitive2d
{
+ /** BorderLineExtend class
+ */
+ class DRAWINGLAYER_DLLPUBLIC BorderLineExtend
+ {
+ private:
+ std::vector<double> mfExtends;
+
+ public:
+ BorderLineExtend();
+ BorderLineExtend(
+ double fStart,
+ double fEnd);
+ BorderLineExtend(
+ double fStartLeft,
+ double fStartRight,
+ double fEndLeft,
+ double fEndRight);
+ ~BorderLineExtend();
+
+ bool equalStart() const;
+ bool equalEnd() const;
+
+ double getStartLeft() const;
+ double getStartRight() const;
+ double getEndLeft() const;
+ double getEndRight() const;
+
+ double getStartAverage() const;
+ double getEndAverage() const;
+
+ /// compare operator
+ bool operator==(const BorderLineExtend& rBorderLineExtend) const;
+ };
+
/** BorderLine class
- Helper class holding the style definition for a single part of a full BNorderLine definition
+ Helper class holding the style definition for a single part of a full NorderLine definition.
+ Line extends are for start/end and for Left/Right, seen in vector direction. If
+ Left != Right that means the line has a diagonal start/end
*/
class DRAWINGLAYER_DLLPUBLIC BorderLine
{
@@ -46,21 +82,21 @@ namespace drawinglayer
basegfx::BColor maRGBColor;
// line extends
- double mfExtendStart;
- double mfExtendEnd;
+ BorderLineExtend maBorderLineExtend;
public:
BorderLine(
double fWidth,
const basegfx::BColor& rRGBColor,
- double fExtendStart = 0.0,
- double fExtendEnd = 0.0);
+ const BorderLineExtend& rBorderLineExtend);
+ BorderLine(
+ double fWidth,
+ const basegfx::BColor& rRGBColor);
~BorderLine();
double getWidth() const { return mfWidth; }
const basegfx::BColor& getRGBColor() const { return maRGBColor; }
- double getExtendStart() const { return mfExtendStart; }
- double getExtendEnd() const { return mfExtendEnd; }
+ const BorderLineExtend& getBorderLineExtend() const { return maBorderLineExtend; }
/// compare operator
bool operator==(const BorderLine& rBorderLine) const;
@@ -71,8 +107,8 @@ namespace drawinglayer
This is the basic primitive to build frames around objects, e.g. tables.
It defines a single or double line from Start to End using the LeftWidth,
Distance and RightWidth definitions.
- The LineStart/End overlap is defined by the Extend(Left|Right)(Start|End)
- definitions.
+ The LineStart/End overlap is defined in the BorderLines definitions (see
+ class BorderLine above).
*/
class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D
{
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 402a7c42ce27..3d4e1ea6fc4d 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -572,8 +572,9 @@ void CreateBorderPrimitives(
drawinglayer::primitive2d::BorderLine(
rBorder.Prim(),
(pForceColor ? *pForceColor : rBorder.GetColorPrim()).getBColor(),
- mfExtendStart,
- mfExtendEnd),
+ drawinglayer::primitive2d::BorderLineExtend(
+ mfExtendStart,
+ mfExtendEnd)),
rBorder.Type(),
rBorder.PatternScale())));
}
@@ -605,6 +606,13 @@ void CreateBorderPrimitives(
// cut exists. Else use upper and take maximum when cut exists
mfExtendRightEnd = getComplexExtendedLineValues(rOrigin, rX, rY, aPerpendX, myOffsets[1], rRFromB, rRFromT, false, fLength);
+ // needs to be determined in detail later, for now use the max prolongation
+ // from left/right, but do not less than half (0.0). This works decently,
+ // but not perfect (see Writer, use three-color-style, look at upper/lower#
+ // connections)
+ const double fGapLeft(std::max(0.0, std::max(mfExtendLeftStart, mfExtendRightStart)));
+ const double fGapRight(std::max(0.0, std::max(mfExtendLeftEnd, mfExtendRightEnd)));
+
rTarget.append(
drawinglayer::primitive2d::Primitive2DReference(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
@@ -613,22 +621,21 @@ void CreateBorderPrimitives(
drawinglayer::primitive2d::BorderLine(
rBorder.Prim(),
(pForceColor ? *pForceColor : rBorder.GetColorPrim()).getBColor(),
- mfExtendLeftStart,
- mfExtendLeftEnd),
+ drawinglayer::primitive2d::BorderLineExtend(
+ mfExtendLeftStart,
+ mfExtendLeftEnd)),
drawinglayer::primitive2d::BorderLine(
rBorder.Dist(),
(pForceColor ? *pForceColor : rBorder.GetColorGap()).getBColor(),
- // needs to be determined in detail later, for now use the max prolongation
- // from left/right, butz do not less than half (0.0). This works decently,
- // but not perfect (see Writer, use three-color-style, look at upper/lower#
- // connections)
- std::max(0.0, std::max(mfExtendLeftStart, mfExtendRightStart)),
- std::max(0.0, std::max(mfExtendLeftEnd, mfExtendRightEnd))),
+ drawinglayer::primitive2d::BorderLineExtend(
+ fGapLeft,
+ fGapRight)),
drawinglayer::primitive2d::BorderLine(
rBorder.Secn(),
(pForceColor ? *pForceColor : rBorder.GetColorSecn()).getBColor(),
- mfExtendRightStart,
- mfExtendRightEnd),
+ drawinglayer::primitive2d::BorderLineExtend(
+ mfExtendRightStart,
+ mfExtendRightEnd)),
rBorder.UseGapColor(),
rBorder.Type(),
rBorder.PatternScale())));
@@ -701,7 +708,9 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin,
rOrigin + rXAxis + rYAxis,
- drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Prim(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
rTLBR.Type(),
rTLBR.PatternScale()));
}
@@ -711,9 +720,15 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin,
rOrigin + rXAxis + rYAxis,
- drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
- drawinglayer::primitive2d::BorderLine(rTLBR.Dist(), (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
- drawinglayer::primitive2d::BorderLine(rTLBR.Secn(), (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Prim(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Dist(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Secn(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
rTLBR.UseGapColor(),
rTLBR.Type(),
rTLBR.PatternScale()));
@@ -729,7 +744,9 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin + rYAxis,
rOrigin + rXAxis,
- drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Prim(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
rBLTR.Type(),
rBLTR.PatternScale()));
}
@@ -739,9 +756,15 @@ void CreateDiagFrameBorderPrimitives(
new drawinglayer::primitive2d::BorderLinePrimitive2D(
rOrigin + rYAxis,
rOrigin + rXAxis,
- drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
- drawinglayer::primitive2d::BorderLine(rTLBR.Dist(), (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
- drawinglayer::primitive2d::BorderLine(rTLBR.Secn(), (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Prim(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Dist(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()),
+ drawinglayer::primitive2d::BorderLine(
+ rTLBR.Secn(),
+ (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()),
rBLTR.UseGapColor(),
rBLTR.Type(),
rBLTR.PatternScale()));
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 5ec9b6c6da99..0ee957466b83 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -293,8 +293,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendIS(getExtend(getTopLine(), maTopFromLLine));
- const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine));
+ const double fExtendIS(getExtend(getTopLine(), maTopFromLLine) * fTwipsToMM);
+ const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine) * fTwipsToMM);
if (basegfx::fTools::equalZero(getLeftLine().GetInWidth()))
{
@@ -302,21 +302,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), getLeftLine().GetColorOut().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/),
+ getLeftLine().GetColorOut().getBColor(),
+ BorderLineExtend(
+ fExtendIS,
+ fExtendIE)),
getLeftLine().GetBorderLineStyle()));
}
else
{
- const double fExtendOS(getExtend(maTopFromLLine, getTopLine()));
- const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine()));
+ const double fExtendOS(getExtend(maTopFromLLine, getTopLine()) * fTwipsToMM);
+ const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine()) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), getLeftLine().GetColorOut().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
- BorderLine(getChangedValue(getLeftLine().GetDistance(), true/*InTwips*/), getLeftLine().GetColorGap().getBColor()),
- BorderLine(getChangedValue(getLeftLine().GetInWidth(), true/*InTwips*/), getLeftLine().GetColorIn().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/),
+ getLeftLine().GetColorOut().getBColor(),
+ BorderLineExtend(
+ fExtendIS,
+ fExtendIE)),
+ BorderLine(
+ getChangedValue(getLeftLine().GetDistance(), true/*InTwips*/),
+ getLeftLine().GetColorGap().getBColor()),
+ BorderLine(getChangedValue(
+ getLeftLine().GetInWidth(), true/*InTwips*/),
+ getLeftLine().GetColorIn().getBColor(),
+ BorderLineExtend(
+ fExtendOS,
+ fExtendOE)),
getLeftLine().HasGapColor(),
getLeftLine().GetBorderLineStyle()));
}
@@ -331,8 +348,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine ));
- const double fExtendIE(getExtend(getRightLine(), maRightFromBLine));
+ const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine) * fTwipsToMM);
+ const double fExtendIE(getExtend(getRightLine(), maRightFromBLine) * fTwipsToMM);
if (basegfx::fTools::equalZero(getBottomLine().GetInWidth()))
{
@@ -340,21 +357,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), getBottomLine().GetColorOut(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/),
+ getBottomLine().GetColorOut(false).getBColor(),
+ BorderLineExtend(
+ fExtendIS,
+ fExtendIE)),
getBottomLine().GetBorderLineStyle()));
}
else
{
- const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine()));
- const double fExtendOE(getExtend(maRightFromBLine, getRightLine()));
+ const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine()) * fTwipsToMM);
+ const double fExtendOE(getExtend(maRightFromBLine, getRightLine()) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), getBottomLine().GetColorOut(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
- BorderLine(getChangedValue(getBottomLine().GetDistance(), true/*InTwips*/), getBottomLine().GetColorGap().getBColor()),
- BorderLine(getChangedValue(getBottomLine().GetInWidth(), true/*InTwips*/), getBottomLine().GetColorIn(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/),
+ getBottomLine().GetColorOut(false).getBColor(),
+ BorderLineExtend(
+ fExtendIS,
+ fExtendIE)),
+ BorderLine(
+ getChangedValue(getBottomLine().GetDistance(), true/*InTwips*/),
+ getBottomLine().GetColorGap().getBColor()),
+ BorderLine(
+ getChangedValue(getBottomLine().GetInWidth(), true/*InTwips*/),
+ getBottomLine().GetColorIn(false).getBColor(),
+ BorderLineExtend(
+ fExtendOS,
+ fExtendOE)),
getBottomLine().HasGapColor(),
getBottomLine().GetBorderLineStyle()));
}
@@ -369,8 +403,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendOS(getExtend(maTopFromRLine, getTopLine()));
- const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine()));
+ const double fExtendOS(getExtend(maTopFromRLine, getTopLine()) * fTwipsToMM);
+ const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine()) * fTwipsToMM);
if (basegfx::fTools::equalZero(getRightLine().GetInWidth()))
{
@@ -378,21 +412,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), getRightLine().GetColorOut().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/),
+ getRightLine().GetColorOut().getBColor(),
+ BorderLineExtend(
+ fExtendOS,
+ fExtendOE)),
getRightLine().GetBorderLineStyle()));
}
else
{
- const double fExtendIS(getExtend(getTopLine(), maTopFromRLine));
- const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine));
+ const double fExtendIS(getExtend(getTopLine(), maTopFromRLine) * fTwipsToMM);
+ const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), getRightLine().GetColorOut().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
- BorderLine(getChangedValue(getRightLine().GetDistance(), true/*InTwips*/), getRightLine().GetColorGap().getBColor()),
- BorderLine(getChangedValue(getRightLine().GetInWidth(), true/*InTwips*/), getRightLine().GetColorIn().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/),
+ getRightLine().GetColorOut().getBColor(),
+ BorderLineExtend(
+ fExtendOS,
+ fExtendOE)),
+ BorderLine(
+ getChangedValue(getRightLine().GetDistance(), true/*InTwips*/),
+ getRightLine().GetColorGap().getBColor()),
+ BorderLine(
+ getChangedValue(getRightLine().GetInWidth(), true/*InTwips*/),
+ getRightLine().GetColorIn().getBColor(),
+ BorderLineExtend(
+ fExtendIS,
+ fExtendIE)),
getRightLine().HasGapColor(),
getRightLine().GetBorderLineStyle()));
}
@@ -412,8 +463,8 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine()));
- const double fExtendOE(getExtend(maRightFromTLine, getRightLine()));
+ const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine()) * fTwipsToMM);
+ const double fExtendOE(getExtend(maRightFromTLine, getRightLine()) * fTwipsToMM);
if (basegfx::fTools::equalZero(getTopLine().GetInWidth()))
{
@@ -421,21 +472,38 @@ namespace drawinglayer
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), getTopLine().GetColorOut(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/),
+ getTopLine().GetColorOut(false).getBColor(),
+ BorderLineExtend(
+ fExtendOS,
+ fExtendOE)),
getTopLine().GetBorderLineStyle()));
}
else
{
- const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine));
- const double fExtendIE(getExtend(getRightLine(), maRightFromTLine));
+ const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine) * fTwipsToMM);
+ const double fExtendIE(getExtend(getRightLine(), maRightFromTLine) * fTwipsToMM);
rContainer.push_back(
new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), getTopLine().GetColorOut(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM),
- BorderLine(getChangedValue(getTopLine().GetDistance(), true/*InTwips*/), getTopLine().GetColorGap().getBColor()),
- BorderLine(getChangedValue(getTopLine().GetInWidth(), true/*InTwips*/), getTopLine().GetColorIn(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM),
+ BorderLine(
+ getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/),
+ getTopLine().GetColorOut(false).getBColor(),
+ BorderLineExtend(
+ fExtendOS,
+ fExtendOE)),
+ BorderLine(
+ getChangedValue(getTopLine().GetDistance(), true/*InTwips*/),
+ getTopLine().GetColorGap().getBColor()),
+ BorderLine(
+ getChangedValue(getTopLine().GetInWidth(), true/*InTwips*/),
+ getTopLine().GetColorIn(false).getBColor(),
+ BorderLineExtend(
+ fExtendIS,
+ fExtendIE)),
getTopLine().HasGapColor(),
getTopLine().GetBorderLineStyle()));
}
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 373bab84ea08..b99e2a3c467c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -111,6 +111,7 @@ using namespace ::editeng;
using namespace ::com::sun::star;
using ::drawinglayer::primitive2d::BorderLinePrimitive2D;
using ::drawinglayer::primitive2d::BorderLine;
+using ::drawinglayer::primitive2d::BorderLineExtend;
using std::pair;
using std::make_pair;
@@ -526,7 +527,14 @@ lcl_MergeBorderLines(
return new BorderLinePrimitive2D(
rStart,
rEnd,
- BorderLine(rLineLeft.getWidth(), rLineLeft.getRGBColor(), rLineLeft.getExtendStart(), rOtherLeft.getExtendEnd()),
+ BorderLine(
+ rLineLeft.getWidth(),
+ rLineLeft.getRGBColor(),
+ BorderLineExtend(
+ rLineLeft.getBorderLineExtend().getStartLeft(),
+ rLineLeft.getBorderLineExtend().getStartRight(),
+ rOtherLeft.getBorderLineExtend().getEndLeft(),
+ rOtherLeft.getBorderLineExtend().getEndRight())),
rLine.getStyle());
}
else
@@ -539,9 +547,25 @@ lcl_MergeBorderLines(
return new BorderLinePrimitive2D(
rStart,
rEnd,
- BorderLine(rLineLeft.getWidth(), rLineLeft.getRGBColor(), rLineLeft.getExtendStart(), rOtherLeft.getExtendEnd()),
- BorderLine(rLineGap.getWidth(), rLineGap.getRGBColor()),
- BorderLine(rLineRight.getWidth(), rLineRight.getRGBColor(), rLineRight.getExtendStart(), rOtherRight.getExtendEnd()),
+ BorderLine(
+ rLineLeft.getWidth(),
+ rLineLeft.getRGBColor(),
+ BorderLineExtend(
+ rLineLeft.getBorderLineExtend().getStartLeft(),
+ rLineLeft.getBorderLineExtend().getStartRight(),
+ rOtherLeft.getBorderLineExtend().getEndLeft(),
+ rOtherLeft.getBorderLineExtend().getEndRight())),
+ BorderLine(
+ rLineGap.getWidth(),
+ rLineGap.getRGBColor()),
+ BorderLine(
+ rLineRight.getWidth(),
+ rLineRight.getRGBColor(),
+ BorderLineExtend(
+ rLineRight.getBorderLineExtend().getStartLeft(),
+ rLineRight.getBorderLineExtend().getStartRight(),
+ rOtherRight.getBorderLineExtend().getEndLeft(),
+ rOtherRight.getBorderLineExtend().getEndRight())),
rLine.hasGapColor(),
rLine.getStyle());
}
@@ -4862,7 +4886,12 @@ static void lcl_MakeBorderLine(SwRect const& rRect,
xLine = new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(nLeftWidth, aLeftColor.getBColor(), nExtentLeftStart, nExtentLeftEnd),
+ BorderLine(
+ nLeftWidth,
+ aLeftColor.getBColor(),
+ BorderLineExtend(
+ nExtentLeftStart,
+ nExtentLeftEnd)),
rBorder.GetBorderLineStyle());
}
else
@@ -4870,9 +4899,21 @@ static void lcl_MakeBorderLine(SwRect const& rRect,
xLine = new BorderLinePrimitive2D(
aStart,
aEnd,
- BorderLine(nLeftWidth, aLeftColor.getBColor(), nExtentLeftStart, nExtentLeftEnd),
- BorderLine(rBorder.GetDistance(), rBorder.GetColorGap().getBColor()),
- BorderLine(nRightWidth, aRightColor.getBColor(), nExtentRightStart, nExtentRightEnd),
+ BorderLine(
+ nLeftWidth,
+ aLeftColor.getBColor(),
+ BorderLineExtend(
+ nExtentLeftStart,
+ nExtentLeftEnd)),
+ BorderLine(
+ rBorder.GetDistance(),
+ rBorder.GetColorGap().getBColor()),
+ BorderLine(
+ nRightWidth,
+ aRightColor.getBColor(),
+ BorderLineExtend(
+ nExtentRightStart,
+ nExtentRightEnd)),
rBorder.HasGapColor(),
rBorder.GetBorderLineStyle());
}
commit 80798551e77dab68b49c3e19fad5b455afe0ef45
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Aug 27 10:55:55 2017 +0200
external data: add a simple table view for spreadsheet data
Change-Id: I3c22a908c5e1dd1a02494931478ca7e29ecea0c2
Reviewed-on: https://gerrit.libreoffice.org/41599
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 849beeb3dad6..890cafe689c2 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -468,6 +468,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/miscdlgs/crnrdlg \
sc/source/ui/miscdlgs/datastreamdlg \
sc/source/ui/miscdlgs/dataproviderdlg \
+ sc/source/ui/miscdlgs/datatableview \
sc/source/ui/miscdlgs/highred \
sc/source/ui/miscdlgs/mergecellsdialog \
sc/source/ui/miscdlgs/optsolver \
diff --git a/sc/source/ui/inc/datatableview.hxx b/sc/source/ui/inc/datatableview.hxx
new file mode 100644
index 000000000000..2057032624b2
--- /dev/null
+++ b/sc/source/ui/inc/datatableview.hxx
@@ -0,0 +1,109 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_SC_SOURCE_UI_INC_DATATABELVIEW_HXX
+#define INCLUDED_SC_SOURCE_UI_INC_DATATABELVIEW_HXX
+
+#include <vcl/ctrl.hxx>
+
+#include "scdllapi.h"
+#include "types.hxx"
+#include "hdrcont.hxx"
+
+class ScDocument;
+
+class ScDataTableColView : public ScHeaderControl
+{
+ ScDocument* mpDoc;
+ SCCOL mnCol;
+
+public:
+
+ ScDataTableColView(vcl::Window* pParent, ScDocument* pDoc, SelectionEngine* pSelectionEngine);
+
+ void SetPos(SCCOLROW nRow);
+
+ virtual SCCOLROW GetPos() const override;
+ virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override;
+ virtual OUString GetEntryText(SCCOLROW nPos) const override;
+ virtual bool IsLayoutRTL() const override;
+ virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override;
+ virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override;
+};
+
+class ScDataTableRowView : public ScHeaderControl
+{
+ ScDocument* mpDoc;
+ SCROW mnRow;
+
+public:
+
+ ScDataTableRowView(vcl::Window* pParent, ScDocument* pDoc, SelectionEngine* pSelectionEngine);
+
+ void SetPos(SCCOLROW nRow);
+
+ virtual SCCOLROW GetPos() const override;
+ virtual sal_uInt16 GetEntrySize(SCCOLROW nPos) const override;
+ virtual OUString GetEntryText(SCCOLROW nPos) const override;
+ virtual bool IsLayoutRTL() const override;
+ virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nWidth) override;
+ virtual void HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) override;
+};
+
+/*
+ * A simple UI component that presents a data table.
+ *
+ * Shares as much code as possible with the normal
+ * Calc grid rendering.
+ *
+ * This class should only depend on ScDocument and not
+ * on some of the Calc view shells.
+ */
+class SC_DLLPUBLIC ScDataTableView : public Control
+{
+ std::shared_ptr<ScDocument> mpDoc;
+ std::unique_ptr<SelectionEngine> mpSelectionEngine;
+ VclPtr<ScDataTableColView> mpColView;
+ VclPtr<ScDataTableRowView> mpRowView;
+ VclPtr<ScrollBar> mpVScroll;
+ VclPtr<ScrollBar> mpHScroll;
+
+ SCROW mnFirstVisibleRow;
+ SCCOL mnFirstVisibleCol;
+
+ std::unique_ptr<MouseEvent> mpMouseEvent;
+
+ DECL_LINK( ScrollHdl, ScrollBar*, void );
+
+public:
+ ScDataTableView(vcl::Window* pParent, std::shared_ptr<ScDocument> pDoc);
+
+ ~ScDataTableView() override;
+
+ virtual void dispose() override;
+
+ virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
+ virtual void Resize() override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/datatableview.cxx b/sc/source/ui/miscdlgs/datatableview.cxx
new file mode 100644
index 000000000000..2d8c65267180
--- /dev/null
+++ b/sc/source/ui/miscdlgs/datatableview.cxx
@@ -0,0 +1,280 @@
+/* -*- 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 .
+ */
+
+#include "datatableview.hxx"
+
+#include "document.hxx"
+#include "viewdata.hxx"
+#include "output.hxx"
+#include "fillinfo.hxx"
+
+constexpr double nPPTX = 0.06666;
+constexpr double nPPTY = 0.06666;
+
+constexpr sal_uInt16 nRowHeaderWidth = 100;
+constexpr sal_uInt16 nColHeaderHeight = 20;
+constexpr sal_uInt16 nScrollBarSize = 10;
+
+ScDataTableColView::ScDataTableColView(vcl::Window* pParent, ScDocument* pDoc, SelectionEngine* pSelectionEngine):
+ ScHeaderControl(pParent, pSelectionEngine, 1024, false, nullptr),
+ mpDoc(pDoc),
+ mnCol(0)
+{
+}
+
+void ScDataTableColView::SetPos(SCCOLROW nCol)
+{
+ mnCol = nCol;
+}
+
+SCCOLROW ScDataTableColView::GetPos() const
+{
+ return mnCol;
+}
+
+sal_uInt16 ScDataTableColView::GetEntrySize(SCCOLROW nPos) const
+{
+ return ScViewData::ToPixel(mpDoc->GetColWidth(nPos, 0), nPPTX);
+}
+
+OUString ScDataTableColView::GetEntryText(SCCOLROW nPos) const
+{
+ return "Col: " + OUString::number(nPos);
+}
+
+bool ScDataTableColView::IsLayoutRTL() const
+{
+ return false;
+}
+
+void ScDataTableColView::SetEntrySize(SCCOLROW nPos, sal_uInt16 nColWidth)
+{
+ mpDoc->SetColWidthOnly(nPos, 0, nColWidth/nPPTX);
+}
+
+void ScDataTableColView::HideEntries(SCCOLROW nPos, SCCOLROW nEndPos)
+{
+ for (SCCOLROW nCol = nPos; nCol <= nEndPos; ++nCol)
+ {
+ mpDoc->ShowCol(nCol, 0, false);
+ }
+}
+
+
+ScDataTableRowView::ScDataTableRowView(vcl::Window* pParent, ScDocument* pDoc, SelectionEngine* pSelectionEngine):
+ ScHeaderControl(pParent, pSelectionEngine, 1024, true, nullptr),
+ mpDoc(pDoc),
+ mnRow(0)
+{
+}
+
+void ScDataTableRowView::SetPos(SCCOLROW nRow)
+{
+ mnRow = nRow;
+}
+
+SCCOLROW ScDataTableRowView::GetPos() const
+{
+ return mnRow;
+}
+
+sal_uInt16 ScDataTableRowView::GetEntrySize(SCCOLROW nPos) const
+{
+ return ScViewData::ToPixel(mpDoc->GetRowHeight(nPos, SCTAB(0), true), nPPTX);
+}
+
+OUString ScDataTableRowView::GetEntryText(SCCOLROW nPos) const
+{
+ return OUString::number(nPos);
+}
+
+bool ScDataTableRowView::IsLayoutRTL() const
+{
+ return false;
+}
+
+void ScDataTableRowView::SetEntrySize(SCCOLROW nPos, sal_uInt16 nColWidth)
+{
+ mpDoc->SetRowHeight(nPos, 0, nColWidth/nPPTX);
+}
+
+void ScDataTableRowView::HideEntries(SCCOLROW nPos, SCCOLROW nEndPos)
+{
+ for (SCCOLROW nCol = nPos; nCol <= nEndPos; ++nCol)
+ {
+ mpDoc->ShowRow(nCol, 0, false);
+ }
+}
+
+ScDataTableView::ScDataTableView(vcl::Window* pParent, std::shared_ptr<ScDocument> pDoc):
+ Control(pParent),
+ mpDoc(pDoc),
+ mpSelectionEngine(new SelectionEngine(this)),
+ mpColView(VclPtr<ScDataTableColView>::Create(this, mpDoc.get(), mpSelectionEngine.get())),
+ mpRowView(VclPtr<ScDataTableRowView>::Create(this, mpDoc.get(), mpSelectionEngine.get())),
+ mpVScroll(VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL | WB_DRAG))),
+ mpHScroll(VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL | WB_DRAG))),
+ mnFirstVisibleRow(0),
+ mnFirstVisibleCol(0)
+{
+ mpColView->setPosSizePixel(nRowHeaderWidth, 0, nRowHeaderWidth, nColHeaderHeight);
+ mpRowView->setPosSizePixel(0, nColHeaderHeight, nRowHeaderWidth, nColHeaderHeight);
+
+ mpVScroll->SetRangeMin(0);
+ mpVScroll->SetRangeMax(100);
+ mpVScroll->SetEndScrollHdl(LINK(this, ScDataTableView, ScrollHdl));
+
+ mpHScroll->SetRangeMin(0);
+ mpHScroll->SetRangeMax(50);
+ mpHScroll->SetEndScrollHdl(LINK(this, ScDataTableView, ScrollHdl));
+
+ mpColView->Show();
+ mpRowView->Show();
+ mpVScroll->Show();
+ mpHScroll->Show();
+}
+
+ScDataTableView::~ScDataTableView()
+{
+ disposeOnce();
+}
+
+void ScDataTableView::dispose()
+{
+ mpColView.disposeAndClear();
+ mpRowView.disposeAndClear();
+ mpVScroll.disposeAndClear();
+ mpHScroll.disposeAndClear();
+ Control::dispose();
+}
+
+void ScDataTableView::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if (!rMEvt.IsLeft())
+ return;
+
+ mpMouseEvent.reset(new MouseEvent(rMEvt));
+}
+
+namespace {
+
+SCCOL findColFromPos(sal_uInt16 nPixelPos, ScDocument* pDoc, SCCOL nStartCol = 0)
+{
+ nPixelPos -= nRowHeaderWidth;
+ sal_uInt32 nPixelLength = 0;
+ for (SCCOL nCol = nStartCol; nCol <= MAXCOL; ++nCol)
+ {
+ sal_uInt16 nColWidth = pDoc->GetColWidth(nCol, 0, true);
+ sal_uInt32 nPixel = ScViewData::ToPixel(nColWidth, nPPTX);
+ nPixelLength += nPixel;
+
+ if (nPixelLength >= nPixelPos)
+ {
+ return nCol;
+ }
+ }
+
+ SAL_WARN("sc", "Could not find the corresponding column");
+ return -1;
+}
+
+SCROW findRowFromPos(sal_uInt16 nPixelPos, ScDocument* pDoc, SCROW nStartRow = 0)
+{
+ nPixelPos -= nColHeaderHeight;
+ sal_uInt32 nPixelLength = 0;
+ for (SCROW nRow = nStartRow; nRow <= MAXROW; ++nRow)
+ {
+ sal_uInt16 nColWidth = pDoc->GetRowHeight(nRow, SCTAB(0), true);
+ sal_uInt32 nPixel = ScViewData::ToPixel(nColWidth, nPPTX);
+ nPixelLength += nPixel;
+
+ if (nPixelLength >= nPixelPos)
+ {
+ return nRow;
+ }
+ }
+
+ SAL_WARN("sc", "Could not find the corresponding row");
+ return -1;
+}
+
+}
+
+void ScDataTableView::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ SCCOL nStartCol = findColFromPos(mpMouseEvent->GetPosPixel().getX(), mpDoc.get());
+ SCCOL nEndCol = findColFromPos(rMEvt.GetPosPixel().getX(), mpDoc.get());
+ SCROW nStartRow = findRowFromPos(mpMouseEvent->GetPosPixel().getY(), mpDoc.get());
+ SCROW nEndRow = findRowFromPos(rMEvt.GetPosPixel().getY(), mpDoc.get());
+ PutInOrder(nStartCol, nEndCol);
+ PutInOrder(nStartRow, nEndRow);
+ mpColView->SetMark(true, nStartCol, nEndCol);
+ mpRowView->SetMark(true, nStartRow, nEndRow);
+
+ mpMouseEvent.reset();
+}
+
+void ScDataTableView::Resize()
+{
+ Size aSize = GetSizePixel();
+ mpColView->setPosSizePixel(nRowHeaderWidth, 0, aSize.Width() - nScrollBarSize, nColHeaderHeight);
+ mpRowView->setPosSizePixel(0, nColHeaderHeight, nRowHeaderWidth, aSize.Height());
+
+ mpVScroll->setPosSizePixel(aSize.Width() - nScrollBarSize, nColHeaderHeight, nScrollBarSize, aSize.Height() - nColHeaderHeight - nScrollBarSize);
+ mpHScroll->setPosSizePixel(nRowHeaderWidth, aSize.Height() - nScrollBarSize, aSize.Width() - nRowHeaderWidth - nScrollBarSize, nScrollBarSize);
+}
+
+void ScDataTableView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRectangle)
+{
+ Size aSize = GetSizePixel();
+ SCCOL nMaxVisibleCol = findColFromPos(aSize.Width() - nScrollBarSize, mpDoc.get(), mnFirstVisibleCol);
+ SCCOL nMaxVisibleRow = findRowFromPos(aSize.Height(), mpDoc.get(), mnFirstVisibleRow);
+
+ ScTableInfo aTableInfo;
+ mpDoc->FillInfo(aTableInfo, mnFirstVisibleCol, mnFirstVisibleRow, nMaxVisibleCol, nMaxVisibleRow, 0, 0.06666, 0.06666, false, false);
+ ScOutputData aOutput(&rRenderContext, OUTTYPE_WINDOW, aTableInfo, mpDoc.get(), 0,
+ nRowHeaderWidth, nColHeaderHeight, mnFirstVisibleCol, mnFirstVisibleRow, nMaxVisibleCol, nMaxVisibleRow, nPPTX, nPPTY);
+
+ aOutput.SetGridColor(COL_BLACK);
+ aOutput.SetSolidBackground(true);
+ aOutput.DrawClear();
+ aOutput.DrawDocumentBackground();
+ aOutput.DrawGrid(rRenderContext, true, false);
+ aOutput.DrawStrings();
+ Control::Paint(rRenderContext, rRectangle);
+}
+
+IMPL_LINK(ScDataTableView, ScrollHdl, ScrollBar*, pScrollBar, void)
+{
+ if (pScrollBar == mpVScroll.get())
+ {
+ mnFirstVisibleRow = pScrollBar->GetThumbPos();
+ pScrollBar->SetRangeMax(mnFirstVisibleRow + 100);
+ mpRowView->SetPos(mnFirstVisibleRow);
+ }
+ else
+ {
+ mnFirstVisibleCol = pScrollBar->GetThumbPos();
+ pScrollBar->SetRangeMax(mnFirstVisibleCol + 50);
+ mpColView->SetPos(mnFirstVisibleCol);
+ }
+ Invalidate();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 218ca21147c0a8c7da4691ed63915499cfc1c80e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Aug 28 18:19:13 2017 +0200
add a listbox that can contain any controls as children
This is adapted from the code that I originally wrote for the
conditional format dialogs.
Change-Id: I3349b7c720d99ede595cc6ebea2046e0f9dadc57
Reviewed-on: https://gerrit.libreoffice.org/41653
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/include/svx/listctrl.hxx b/include/svx/listctrl.hxx
new file mode 100644
index 000000000000..6f303aa7dec9
--- /dev/null
+++ b/include/svx/listctrl.hxx
@@ -0,0 +1,57 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_SVX_LISTCTRL_HXX
+#define INCLUDED_SVX_LISTCTRL_HXX
+
+#include <vcl/ctrl.hxx>
+#include <vcl/scrbar.hxx>
+
+#include <vector>
+
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC ListControl : public Control
+{
+private:
+ std::vector<VclPtr<Control>> maEntries;
+ bool mbHasScrollBar;
+ VclPtr<ScrollBar> mpScrollBar;
+
+ void DoScroll(long nDiff);
+ void RecalcAll();
+public:
+
+ ListControl(vcl::Window* pParent, WinBits nStyle);
+ virtual ~ListControl() override;
+ virtual void dispose() override;
+
+ void addEntry(VclPtr<Control> xEntry, sal_uInt32 nPos = 0);
+ void deleteEntry(sal_uInt32 nPos);
+
+ virtual Size GetOptimalSize() const override;
+ virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+ virtual void Resize() override;
+
+ DECL_LINK( ScrollHdl, ScrollBar*, void );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 5bfbf899034d..ffb8321cfbe5 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/dialog/hexcolorcontrol \
svx/source/dialog/framelink \
svx/source/dialog/langbox \
+ svx/source/dialog/listctrl \
svx/source/dialog/pagenumberlistbox \
svx/source/dialog/papersizelistbox \
svx/source/dialog/samecontentlistbox \
diff --git a/svx/source/dialog/listctrl.cxx b/svx/source/dialog/listctrl.cxx
new file mode 100644
index 000000000000..29a8b14410d3
--- /dev/null
+++ b/svx/source/dialog/listctrl.cxx
@@ -0,0 +1,145 @@
+/* -*- 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 .
+ */
+
+#include <svx/listctrl.hxx>
+
+ListControl::ListControl(vcl::Window* pParent, WinBits nBits):
+ Control(pParent, nBits),
+ mbHasScrollBar(false),
+ mpScrollBar(VclPtr<ScrollBar>::Create(this, WB_VERT))
+{
+ mpScrollBar->SetScrollHdl( LINK( this, ListControl, ScrollHdl ) );
+ mpScrollBar->EnableDrag();
+}
+
+ListControl::~ListControl()
+{
+ disposeOnce();
+}
+
+void ListControl::dispose()
+{
+ mpScrollBar.disposeAndClear();
+ for (auto& aEntry : maEntries)
+ aEntry.disposeAndClear();
+ maEntries.clear();
+
+ Control::dispose();
+}
+
+void ListControl::RecalcAll()
+{
+ sal_Int32 nTotalHeight = 0;
+ for (const auto& item : maEntries)
+ {
+ if (!item)
+ continue;
+ nTotalHeight += item->GetSizePixel().Height();
+ }
+
+ Size aCtrlSize = GetOutputSize();
+ long nSrcBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ if(nTotalHeight > GetSizePixel().Height())
+ {
+ mbHasScrollBar = true;
+ mpScrollBar->SetPosSizePixel(Point(aCtrlSize.Width() -nSrcBarSize, 0),
+ Size(nSrcBarSize, aCtrlSize.Height()) );
+ mpScrollBar->SetRangeMax(nTotalHeight);
+ mpScrollBar->SetVisibleSize(aCtrlSize.Height());
+ mpScrollBar->Show();
+ }
+ else
+ {
+ mbHasScrollBar = false;
+ mpScrollBar->Hide();
+ }
+
+ Point aPoint(0,-1*mpScrollBar->GetThumbPos());
+ for (const auto& item : maEntries)
+ {
+ if (!item)
+ continue;
+ item->SetPosPixel(aPoint);
+ Size aSize = item->GetSizePixel();
+ if(mbHasScrollBar)
+ aSize.Width() = aCtrlSize.Width() - nSrcBarSize;
+ else
+ aSize.Width() = aCtrlSize.Width();
+ item->SetSizePixel(aSize);
+
+ aPoint.Y() += item->GetSizePixel().Height();
+ }
+}
+
+Size ListControl::GetOptimalSize() const
+{
+ return LogicToPixel(Size(300, 185), MapUnit::MapAppFont);
+}
+
+void ListControl::Resize()
+{
+ Control::Resize();
+ RecalcAll();
+}
+
+void ListControl::queue_resize(StateChangedType eReason)
+{
+ Control::queue_resize(eReason);
+ RecalcAll();
+}
+
+void ListControl::DoScroll(long nDelta)
+{
+ Point aNewPoint = mpScrollBar->GetPosPixel();
+ tools::Rectangle aRect(Point(), GetOutputSize());
+ aRect.Right() -= mpScrollBar->GetSizePixel().Width();
+ Scroll( 0, -nDelta, aRect );
+ mpScrollBar->SetPosPixel(aNewPoint);
+}
+
+IMPL_LINK_NOARG( ListControl, ScrollHdl, ScrollBar*, void )
+{
+ DoScroll(mpScrollBar->GetDelta());
+}
+
+void ListControl::addEntry(VclPtr<Control> xEntry, sal_uInt32 nPos)
+{
+ xEntry->Show();
+ if (nPos < maEntries.size())
+ {
+ maEntries.insert(maEntries.begin() + nPos, xEntry);
+ }
+ else
+ {
+ maEntries.push_back(xEntry);
+ }
+ RecalcAll();
+}
+
+void ListControl::deleteEntry(sal_uInt32 nPos)
+{
+ if (nPos >= maEntries.size())
+ return;
+
+ maEntries[nPos].disposeAndClear();
+ maEntries.erase(maEntries.begin() + nPos);
+ RecalcAll();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c8ff3059a79cc7358c68189840b5abcd5680bbe3
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Mon Aug 28 08:40:30 2017 +0200
move all the basic errcodes to one file
Change-Id: Ic3353c80ac9fdbd17f17503b1c973c9a7cef0c7f
Reviewed-on: https://gerrit.libreoffice.org/41617
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 44dcebcd95ee..2b8a7f6eb53c 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -20,6 +20,7 @@
#include <array>
+#include <basic/sberrors.hxx>
#include "sal/macros.h"
#include "basiccharclass.hxx"
#include "token.hxx"
diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
index 15e37b25cd2e..25e038a8a1af 100644
--- a/basic/source/inc/scanner.hxx
+++ b/basic/source/inc/scanner.hxx
@@ -20,7 +20,8 @@
#ifndef INCLUDED_BASIC_SOURCE_INC_SCANNER_HXX
#define INCLUDED_BASIC_SOURCE_INC_SCANNER_HXX
-#include <basic/sberrors.hxx>
+#include <basic/sbxdef.hxx>
+#include <vcl/errcode.hxx>
// The scanner is stand-alone, i. e. it can be used from everywhere.
// A BASIC-instance is necessary for error messages. Without BASIC
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 902b1eb88e9c..cb8e0c3eba37 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
#include "sbxres.hxx"
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index 2cd4657eb037..423611ac9b98 100644
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
#include <rtl/math.hxx>
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index bad4903b6121..593c22799b5c 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
#include <rtl/math.hxx>
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index af752516baea..9b41cb2a18b3 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -20,6 +20,7 @@
#include <tools/stream.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxres.hxx"
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 70856e7b602c..ed0badced771 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -22,6 +22,7 @@
#include <vcl/svapp.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include <basic/sbxvar.hxx>
#include "sbxconv.hxx"
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index a5ce46ac6bce..bf85af3f7c80 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -24,6 +24,7 @@
#include <tools/color.hxx>
#include <i18nlangtag/lang.h>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
#include "math.h"
#include <comphelper/processfactory.hxx>
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index b0b7381a39eb..7060e3a4db35 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -20,6 +20,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 6a1de98b28d3..b33905ba20f9 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -20,6 +20,7 @@
#include <vcl/errcode.hxx>
#include <vcl/svapp.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include <rtl/character.hxx>
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index 8a6527614190..7edef31d48d3 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
#include <rtl/math.hxx>
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index 9c906f631e40..0eadecb07423 100644
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
#include <rtl/math.hxx>
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 0a17ccdb3319..9e331905f73b 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -24,6 +24,7 @@
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include <svl/SfxBroadcaster.hxx>
#include "sbxres.hxx"
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index 582a11db7ea9..fc972379f133 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
float ImpGetSingle( const SbxValues* p )
diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx
index a02464dc6cf0..d093b5d4b2da 100644
--- a/basic/source/sbx/sbxuint.cxx
+++ b/basic/source/sbx/sbxuint.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
sal_uInt16 ImpGetUShort( const SbxValues* p )
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index c694b50cecb6..0db10aff19d5 100644
--- a/basic/source/sbx/sbxulng.cxx
+++ b/basic/source/sbx/sbxulng.cxx
@@ -19,6 +19,7 @@
#include <vcl/errcode.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include "sbxconv.hxx"
sal_uInt32 ImpGetULong( const SbxValues* p )
diff --git a/include/basic/sberrors.hxx b/include/basic/sberrors.hxx
index 8ecaaeacb549..236b6f1861c0 100644
--- a/include/basic/sberrors.hxx
+++ b/include/basic/sberrors.hxx
@@ -20,7 +20,39 @@
#ifndef INCLUDED_BASIC_SBERRORS_HXX
#define INCLUDED_BASIC_SBERRORS_HXX
-#include <basic/sbxdef.hxx>
+#include <vcl/errcode.hxx>
+
+// New error codes per define
+#define ERRCODE_SBX_SYNTAX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 1)
+#define ERRCODE_SBX_NOTIMP ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 2)
+#define ERRCODE_SBX_OVERFLOW ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 3) // overflow
+#define ERRCODE_SBX_BOUNDS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 4) // Invalid array index
+#define ERRCODE_SBX_ZERODIV ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 5) // Division by zero
+#define ERRCODE_SBX_CONVERSION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 6) // wrong data type
+#define ERRCODE_SBX_BAD_PARAMETER ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 7) // invalid Parameter
+#define ERRCODE_SBX_PROC_UNDEFINED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 8) // Sub or Func not def
+#define ERRCODE_SBX_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Unknown, 9) // generic object error
+#define ERRCODE_SBX_NO_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 10) // Object var not object
+#define ERRCODE_SBX_CANNOT_LOAD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Create, 11) // Object init/load fail
+#define ERRCODE_SBX_BAD_INDEX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 12) // Invalid object index
+#define ERRCODE_SBX_NO_ACTIVE_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 13) // Object not active
+#define ERRCODE_SBX_BAD_PROP_VALUE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 14) // Bad property value
+#define ERRCODE_SBX_PROP_READONLY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Read, 15) // Property is read only
+#define ERRCODE_SBX_PROP_WRITEONLY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Write, 16) // Property is write only
+#define ERRCODE_SBX_INVALID_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 17) // Invalid object reference
+#define ERRCODE_SBX_NO_METHOD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 18) // Property or Method unknown
+#define ERRCODE_SBX_INVALID_USAGE_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 19) // Invalid object usage
+#define ERRCODE_SBX_NO_OLE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 20) // No OLE-Object
+#define ERRCODE_SBX_BAD_METHOD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 21) // Method not supported
+#define ERRCODE_SBX_OLE_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 22) // OLE Automation Error
+#define ERRCODE_SBX_BAD_ACTION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 23) // Action not supported
+#define ERRCODE_SBX_NO_NAMED_ARGS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 24) // No named arguments
+#define ERRCODE_SBX_BAD_LOCALE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 25) // Locale not supported
+#define ERRCODE_SBX_NAMED_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 26) // Unknown named argument
+#define ERRCODE_SBX_NOT_OPTIONAL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 27) // Argument not optional
+#define ERRCODE_SBX_WRONG_ARGS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 28) // Invalid number of arguments
+#define ERRCODE_SBX_NOT_A_COLL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 29) // Object contains no elements
+#define LAST_SBX_ERROR_ID 29UL
// Mapping to ErrCode
#define ERRCODE_BASIC_SYNTAX ERRCODE_SBX_SYNTAX // unspecified syntax error
diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx
index ed6a3944c2a2..3be787bf0d7f 100644
--- a/include/basic/sbxcore.hxx
+++ b/include/basic/sbxcore.hxx
@@ -24,6 +24,7 @@
#include <basic/sbxdef.hxx>
#include <rtl/ustring.hxx>
#include <tools/ref.hxx>
+#include <vcl/errcode.hxx>
class SvStream;
diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx
index 1c15a1c31968..f015b963c621 100644
--- a/include/basic/sbxdef.hxx
+++ b/include/basic/sbxdef.hxx
@@ -21,8 +21,6 @@
#ifndef INCLUDED_BASIC_SBXDEF_HXX
#define INCLUDED_BASIC_SBXDEF_HXX
-
-#include <vcl/errcode.hxx>
#include <o3tl/typed_flags_set.hxx>
enum class SbxClassType { // SBX-class-IDs (order is important!)
@@ -123,37 +121,6 @@ enum class SbxNameType { // Type of the questioned name of a variable
ShortTypes, // Name%(A%,B$)
};
-// New error codes per define
-#define ERRCODE_SBX_SYNTAX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Compiler, 1)
-#define ERRCODE_SBX_NOTIMP ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 2)
-#define ERRCODE_SBX_OVERFLOW ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 3) // overflow
-#define ERRCODE_SBX_BOUNDS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 4) // Invalid array index
-#define ERRCODE_SBX_ZERODIV ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 5) // Division by zero
-#define ERRCODE_SBX_CONVERSION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 6) // wrong data type
-#define ERRCODE_SBX_BAD_PARAMETER ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 7) // invalid Parameter
-#define ERRCODE_SBX_PROC_UNDEFINED ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 8) // Sub or Func not def
-#define ERRCODE_SBX_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Unknown, 9) // generic object error
-#define ERRCODE_SBX_NO_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 10) // Object var not object
-#define ERRCODE_SBX_CANNOT_LOAD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Create, 11) // Object init/load fail
-#define ERRCODE_SBX_BAD_INDEX ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 12) // Invalid object index
-#define ERRCODE_SBX_NO_ACTIVE_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 13) // Object not active
-#define ERRCODE_SBX_BAD_PROP_VALUE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 14) // Bad property value
-#define ERRCODE_SBX_PROP_READONLY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Read, 15) // Property is read only
-#define ERRCODE_SBX_PROP_WRITEONLY ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Write, 16) // Property is write only
-#define ERRCODE_SBX_INVALID_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 17) // Invalid object reference
-#define ERRCODE_SBX_NO_METHOD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 18) // Property or Method unknown
-#define ERRCODE_SBX_INVALID_USAGE_OBJECT ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 19) // Invalid object usage
-#define ERRCODE_SBX_NO_OLE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Access, 20) // No OLE-Object
-#define ERRCODE_SBX_BAD_METHOD ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 21) // Method not supported
-#define ERRCODE_SBX_OLE_ERROR ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 22) // OLE Automation Error
-#define ERRCODE_SBX_BAD_ACTION ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 23) // Action not supported
-#define ERRCODE_SBX_NO_NAMED_ARGS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 24) // No named arguments
-#define ERRCODE_SBX_BAD_LOCALE ErrCode( ErrCodeArea::Sbx, ErrCodeClass::NotSupported, 25) // Locale not supported
-#define ERRCODE_SBX_NAMED_NOT_FOUND ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 26) // Unknown named argument
-#define ERRCODE_SBX_NOT_OPTIONAL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 27) // Argument not optional
-#define ERRCODE_SBX_WRONG_ARGS ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 28) // Invalid number of arguments
-#define ERRCODE_SBX_NOT_A_COLL ErrCode( ErrCodeArea::Sbx, ErrCodeClass::Runtime, 29) // Object contains no elements
-#define LAST_SBX_ERROR_ID 29UL
// Flag-Bits:
enum class SbxFlagBits {
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index a0c76fced7b1..f90bc10844d3 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -36,6 +36,7 @@ using namespace ::com::sun::star;
#include <sfx2/docfile.hxx>
#include <svtools/ehdl.hxx>
#include <basic/sbxcore.hxx>
+#include <basic/sberrors.hxx>
#include <svtools/sfxecode.hxx>
#include <svx/ofaitem.hxx>
#include <svl/whiter.hxx>
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 17f66d918f7a..65fbe33d71b8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -25,6 +25,7 @@
#include "scitems.hxx"
#include <sfx2/viewfrm.hxx>
+#include <basic/sberrors.hxx>
#include <comphelper/lok.hxx>
#include <comphelper/propertysequence.hxx>
#include <svl/stritem.hxx>
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index b03cad6f1fac..47534bd04a89 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -19,6 +19,7 @@
#include <config_features.h>
+#include <basic/sberrors.hxx>
#include "scitems.hxx"
#include <comphelper/lok.hxx>
#include <sfx2/viewfrm.hxx>
diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx
index 6d4bac505d39..234d5b29860f 100644
--- a/sc/source/ui/view/tabvwshh.cxx
+++ b/sc/source/ui/view/tabvwshh.cxx
@@ -19,6 +19,7 @@
#include <config_features.h>
+#include <basic/sberrors.hxx>
#include <svx/svdmark.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdview.hxx>
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 6a5c31c43aff..8378fc925ffa 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -55,6 +55,7 @@
#include <comphelper/string.hxx>
#include <basic/sbx.hxx>
+#include <basic/sberrors.hxx>
#include <unotools/pathoptions.hxx>
#include <unotools/useroptions.hxx>
#include <unotools/saveopt.hxx>
commit 0b02b9c19bc0a87ed146d1f079900c71b8b8051c
Author: Stephan Bergmann <sbergman at redhat.com>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list