Kaydet (Commit) 97ebc98f authored tarafından Noel Grandin's avatar Noel Grandin

convert some macros to local functions

Change-Id: If2c89f0f53615f6200b6cd1fb6267cc9b47df927
Reviewed-on: https://gerrit.libreoffice.org/62884
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 4b363760
......@@ -136,8 +136,8 @@ static RelationMap const aAsCharRelationMap[] =
Anchored at page
--------------------------------------------------------------------*/
#define HORI_PAGE_REL (LB::RelPageFrame|LB::RelPagePrintArea|LB::RelPageLeft| \
LB::RelPageRight)
static constexpr auto HORI_PAGE_REL = LB::RelPageFrame|LB::RelPagePrintArea|LB::RelPageLeft|
LB::RelPageRight;
static FrmMap const aHPageMap[] =
{
......@@ -171,8 +171,8 @@ static FrmMap const aVPageHtmlMap[] =
Anchored at frame
--------------------------------------------------------------------*/
#define HORI_FRAME_REL (LB::FlyRelPageFrame|LB::FlyRelPagePrintArea| \
LB::FlyRelPageLeft|LB::FlyRelPageRight)
static constexpr auto HORI_FRAME_REL = LB::FlyRelPageFrame|LB::FlyRelPagePrintArea|
LB::FlyRelPageLeft|LB::FlyRelPageRight;
static FrmMap const aHFrameMap[] =
{
......@@ -219,9 +219,9 @@ static FrmMap const aHMultiSelectionMap[] =
Anchored at paragraph
--------------------------------------------------------------------*/
#define HORI_PARA_REL (LB::Frame|LB::PrintArea|LB::RelPageLeft|LB::RelPageRight| \
LB::RelPageFrame|LB::RelPagePrintArea|LB::RelFrameLeft| \
LB::RelFrameRight)
static constexpr auto HORI_PARA_REL = LB::Frame|LB::PrintArea|LB::RelPageLeft|LB::RelPageRight|
LB::RelPageFrame|LB::RelPagePrintArea|LB::RelFrameLeft|
LB::RelFrameRight;
static FrmMap const aHParaMap[] =
{
......@@ -246,8 +246,8 @@ static FrmMap const aHParaHtmlAbsMap[] =
};
#define VERT_PARA_REL (LB::VertFrame|LB::VertPrintArea| \
LB::RelPageFrame|LB::RelPagePrintArea)
static constexpr auto VERT_PARA_REL = LB::VertFrame|LB::VertPrintArea|
LB::RelPageFrame|LB::RelPagePrintArea;
static FrmMap const aVParaMap[] =
{
......@@ -266,9 +266,9 @@ static FrmMap const aVParaHtmlMap[] =
Anchored at character
--------------------------------------------------------------------*/
#define HORI_CHAR_REL (LB::Frame|LB::PrintArea|LB::RelPageLeft|LB::RelPageRight| \
LB::RelPageFrame|LB::RelPagePrintArea|LB::RelFrameLeft| \
LB::RelFrameRight|LB::RelChar)
static constexpr auto HORI_CHAR_REL = LB::Frame|LB::PrintArea|LB::RelPageLeft|LB::RelPageRight|
LB::RelPageFrame|LB::RelPagePrintArea|LB::RelFrameLeft|
LB::RelFrameRight|LB::RelChar;
static FrmMap aHCharMap[] =
{
......@@ -295,8 +295,8 @@ static FrmMap aHCharHtmlAbsMap[] =
// #i18732# - allow vertical alignment at page areas
// #i22341# - handle <LB::RelChar> on its own
#define VERT_CHAR_REL (LB::VertFrame|LB::VertPrintArea| \
LB::RelPageFrame|LB::RelPagePrintArea)
static constexpr auto VERT_CHAR_REL = LB::VertFrame|LB::VertPrintArea|
LB::RelPageFrame|LB::RelPagePrintArea;
static FrmMap aVCharMap[] =
{
......
......@@ -29,8 +29,8 @@
namespace dbaui
{
#define BROWSER_STANDARD_FLAGS BrowserMode::COLUMNSELECTION | BrowserMode::HLINES | BrowserMode::VLINES | \
BrowserMode::HIDECURSOR | BrowserMode::HIDESELECT | BrowserMode::AUTO_HSCROLL | BrowserMode::AUTO_VSCROLL
static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | BrowserMode::HLINES | BrowserMode::VLINES |
BrowserMode::HIDECURSOR | BrowserMode::HIDESELECT | BrowserMode::AUTO_HSCROLL | BrowserMode::AUTO_VSCROLL;
#define COLUMN_ID_FIELDNAME 1
#define COLUMN_ID_ORDER 2
......
......@@ -101,8 +101,10 @@ bool const DEV_Composible[2][2] = {
/* Mode 1 */ {false, true} // STRICT = 1
};
#define getCharType(x) \
((x >= 0x0900 && x < 0x097f) ? devaCT[x - 0x0900] : ND_)
static constexpr sal_uInt16 getCharType(sal_Unicode x)
{
return (x >= 0x0900 && x < 0x097f) ? devaCT[x - 0x0900] : ND_;
}
sal_Bool SAL_CALL
InputSequenceChecker_hi::checkInputSequence(const OUString& Text,
......
......@@ -697,19 +697,23 @@ void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleS
}
// const cast, otherwise it will be too inefficient/complicated
#define SET_LINECOLOR(dest,c) \
if ((dest)) \
{ \
const_cast<SvxBorderLine*>(dest)->SetColor((c)); \
static void SetLineColor(SvxBorderLine const * dest, Color c)
{
if (dest)
{
const_cast<SvxBorderLine*>(dest)->SetColor(c);
}
}
#define SET_LINE(dest,src) \
if ((dest)) \
{ \
SvxBorderLine* pCast = const_cast<SvxBorderLine*>(dest); \
pCast->SetBorderLineStyle( (src)->GetBorderLineStyle() ); \
pCast->SetWidth( (src)->GetWidth( ) ); \
static void SetLine(const SvxBorderLine* dest, const SvxBorderLine* src)
{
if (dest)
{
SvxBorderLine* pCast = const_cast<SvxBorderLine*>(dest);
pCast->SetBorderLineStyle( src->GetBorderLineStyle() );
pCast->SetWidth( src->GetWidth() );
}
}
void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
const SvxBorderLine* pLine, bool bColorOnly )
......@@ -773,29 +777,29 @@ void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
Color aColor( pLine->GetColor() );
if( pNewBoxItem )
{
SET_LINECOLOR( pNewBoxItem->GetTop(), aColor );
SET_LINECOLOR( pNewBoxItem->GetBottom(), aColor );
SET_LINECOLOR( pNewBoxItem->GetLeft(), aColor );
SET_LINECOLOR( pNewBoxItem->GetRight(), aColor );
SetLineColor( pNewBoxItem->GetTop(), aColor );
SetLineColor( pNewBoxItem->GetBottom(), aColor );
SetLineColor( pNewBoxItem->GetLeft(), aColor );
SetLineColor( pNewBoxItem->GetRight(), aColor );
}
if( pNewTLBRItem )
SET_LINECOLOR( pNewTLBRItem->GetLine(), aColor );
SetLineColor( pNewTLBRItem->GetLine(), aColor );
if( pNewBLTRItem )
SET_LINECOLOR( pNewBLTRItem->GetLine(), aColor );
SetLineColor( pNewBLTRItem->GetLine(), aColor );
}
else
{
if( pNewBoxItem )
{
SET_LINE( pNewBoxItem->GetTop(), pLine );
SET_LINE( pNewBoxItem->GetBottom(), pLine );
SET_LINE( pNewBoxItem->GetLeft(), pLine );
SET_LINE( pNewBoxItem->GetRight(), pLine );
SetLine( pNewBoxItem->GetTop(), pLine );
SetLine( pNewBoxItem->GetBottom(), pLine );
SetLine( pNewBoxItem->GetLeft(), pLine );
SetLine( pNewBoxItem->GetRight(), pLine );
}
if( pNewTLBRItem )
SET_LINE( pNewTLBRItem->GetLine(), pLine );
SetLine( pNewTLBRItem->GetLine(), pLine );
if( pNewBLTRItem )
SET_LINE( pNewBLTRItem->GetLine(), pLine );
SetLine( pNewBLTRItem->GetLine(), pLine );
}
}
if( pNewBoxItem ) rNewSet.Put( *pNewBoxItem );
......@@ -834,9 +838,6 @@ void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
}
}
#undef SET_LINECOLOR
#undef SET_LINE
void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache, ScEditDataArray* pDataArray, bool* const pIsChanged )
{
#if DEBUG_SC_TESTATTRARRAY
......
......@@ -42,9 +42,9 @@
#define IMPICNVIEW_ACC_RETURN 1
#define IMPICNVIEW_ACC_ESCAPE 2
#define DRAWTEXT_FLAGS_ICON \
( DrawTextFlags::Center | DrawTextFlags::Top | DrawTextFlags::EndEllipsis | \
DrawTextFlags::Clip | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Mnemonic )
static constexpr auto DRAWTEXT_FLAGS_ICON =
DrawTextFlags::Center | DrawTextFlags::Top | DrawTextFlags::EndEllipsis |
DrawTextFlags::Clip | DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Mnemonic;
#define DRAWTEXT_FLAGS_SMALLICON (DrawTextFlags::Left|DrawTextFlags::EndEllipsis|DrawTextFlags::Clip)
......
......@@ -33,8 +33,8 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::accessibility;
#define MYTABMASK \
SvLBoxTabFlags( SvLBoxTabFlags::ADJUST_RIGHT | SvLBoxTabFlags::ADJUST_LEFT | SvLBoxTabFlags::ADJUST_CENTER | SvLBoxTabFlags::ADJUST_NUMERIC )
static constexpr SvLBoxTabFlags MYTABMASK =
SvLBoxTabFlags::ADJUST_RIGHT | SvLBoxTabFlags::ADJUST_LEFT | SvLBoxTabFlags::ADJUST_CENTER | SvLBoxTabFlags::ADJUST_NUMERIC;
// SvTreeListBox callback
......
......@@ -79,14 +79,14 @@ using namespace com::sun::star::accessibility;
#define ROWSTATUS(row) (!row.is() ? "NULL" : row->GetStatus() == GridRowStatus::Clean ? "CLEAN" : row->GetStatus() == GridRowStatus::Modified ? "MODIFIED" : row->GetStatus() == GridRowStatus::Deleted ? "DELETED" : "INVALID")
#define DEFAULT_BROWSE_MODE \
BrowserMode::COLUMNSELECTION \
| BrowserMode::MULTISELECTION \
| BrowserMode::KEEPHIGHLIGHT \
| BrowserMode::TRACKING_TIPS \
| BrowserMode::HLINES \
| BrowserMode::VLINES \
| BrowserMode::HEADERBAR_NEW \
static constexpr auto DEFAULT_BROWSE_MODE =
BrowserMode::COLUMNSELECTION
| BrowserMode::MULTISELECTION
| BrowserMode::KEEPHIGHLIGHT
| BrowserMode::TRACKING_TIPS
| BrowserMode::HLINES
| BrowserMode::VLINES
| BrowserMode::HEADERBAR_NEW;
class RowSetEventListener : public ::cppu::WeakImplHelper<XRowsChangeListener>
{
......
......@@ -711,13 +711,14 @@ bool SwNoTextFrame::GetCursorOfst(SwPosition* pPos, Point& ,
return true;
}
#define CLEARCACHE {\
SwFlyFrame* pFly = FindFlyFrame();\
if( pFly && pFly->GetFormat()->GetSurround().IsContour() )\
{\
ClrContourCache( pFly->GetVirtDrawObj() );\
pFly->NotifyBackground( FindPageFrame(), getFramePrintArea(), PREP_FLY_ATTR_CHG );\
}\
void SwNoTextFrame::ClearCache()
{
SwFlyFrame* pFly = FindFlyFrame();
if( pFly && pFly->GetFormat()->GetSurround().IsContour() )
{
ClrContourCache( pFly->GetVirtDrawObj() );
pFly->NotifyBackground( FindPageFrame(), getFramePrintArea(), PREP_FLY_ATTR_CHG );
}
}
void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
......@@ -755,7 +756,7 @@ void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
}
SAL_FALLTHROUGH;
case RES_FMT_CHG:
CLEARCACHE
ClearCache();
break;
case RES_ATTRSET_CHG:
......@@ -765,7 +766,7 @@ void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
if( SfxItemState::SET == static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->
GetItemState( n, false ))
{
CLEARCACHE
ClearCache();
if(RES_GRFATR_ROTATION == n)
{
......@@ -814,7 +815,7 @@ void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
bComplete = false;
SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode());
CLEARCACHE
ClearCache();
SwRect aRect( getFrameArea() );
......
......@@ -331,12 +331,20 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj )
* for the nearest fly frame in the given direction.
*/
#define LESS_X( aPt1, aPt2, bOld ) ( aPt1.getX() < aPt2.getX() || \
( aPt1.getX() == aPt2.getX() && ( aPt1.getY() < aPt2.getY() || \
( aPt1.getY() == aPt2.getY() && bOld ) ) ) )
#define LESS_Y( aPt1, aPt2, bOld ) ( aPt1.getY() < aPt2.getY() || \
( aPt1.getY() == aPt2.getY() && ( aPt1.getX() < aPt2.getX() || \
( aPt1.getX() == aPt2.getX() && bOld ) ) ) )
static bool LessX( Point const & aPt1, Point const & aPt2, bool bOld )
{
return aPt1.getX() < aPt2.getX()
|| ( aPt1.getX() == aPt2.getX()
&& ( aPt1.getY() < aPt2.getY()
|| ( aPt1.getY() == aPt2.getY() && bOld ) ) );
}
static bool LessY( Point const & aPt1, Point const & aPt2, bool bOld )
{
return aPt1.getY() < aPt2.getY()
|| ( aPt1.getY() == aPt2.getY()
&& ( aPt1.getX() < aPt2.getX()
|| ( aPt1.getX() == aPt2.getX() && bOld ) ) );
}
bool SwFEShell::MoveAnchor( SwMove nDir )
{
......@@ -495,30 +503,30 @@ bool SwFEShell::MoveAnchor( SwMove nDir )
switch( nDir ) {
case SwMove::RIGHT:
{
bAccept = LESS_X( aCenter, aNew, bOld )
bAccept = LessX( aCenter, aNew, bOld )
&& ( !pNewFly ||
LESS_X( aNew, aBest, false ) );
LessX( aNew, aBest, false ) );
break;
}
case SwMove::LEFT:
{
bAccept = LESS_X( aNew, aCenter, !bOld )
bAccept = LessX( aNew, aCenter, !bOld )
&& ( !pNewFly ||
LESS_X( aBest, aNew, true ) );
LessX( aBest, aNew, true ) );
break;
}
case SwMove::UP:
{
bAccept = LESS_Y( aNew, aCenter, !bOld )
bAccept = LessY( aNew, aCenter, !bOld )
&& ( !pNewFly ||
LESS_Y( aBest, aNew, true ) );
LessY( aBest, aNew, true ) );
break;
}
case SwMove::DOWN:
{
bAccept = LESS_Y( aCenter, aNew, bOld )
bAccept = LessY( aCenter, aNew, bOld )
&& ( !pNewFly ||
LESS_Y( aNew, aBest, false ) );
LessY( aNew, aBest, false ) );
break;
}
}
......
......@@ -47,6 +47,8 @@ private:
friend double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame);
double getLocalFrameRotation() const;
void ClearCache();
protected:
virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
......
......@@ -186,6 +186,7 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
// WidowsAndOrphans, AdjustFrame, AdjustFollow
void FormatAdjust( SwTextFormatter &rLine, WidowsAndOrphans &rFrameBreak,
TextFrameIndex nStrLen, const bool bDummy );
void ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew );
bool mbLocked : 1; // In the Format?
bool mbWidow : 1; // Are we a Widow?
......
......@@ -121,22 +121,6 @@ using std::make_pair;
struct SwPaintProperties;
//other subsidiary lines enabled?
#define IS_SUBS (!gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && \
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly() && \
!gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&\
!gProp.pSGlobalShell->GetViewOptions()->IsWhitespaceHidden() &&\
SwViewOption::IsDocBoundaries())
//subsidiary lines for sections
#define IS_SUBS_SECTION (!gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && \
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly()&&\
!gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&\
SwViewOption::IsSectionBoundaries())
#define IS_SUBS_FLYS (!gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && \
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly()&&\
!gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&\
SwViewOption::IsObjectBoundaries())
//Class declaration; here because they are only used in this file
enum class SubColFlags {
Page = 0x01, //Helplines of the page
......@@ -317,6 +301,32 @@ struct SwPaintProperties {
static SwPaintProperties gProp;
static bool isSubsidiaryLinesFlysEnabled()
{
return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() &&
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
!gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&
SwViewOption::IsObjectBoundaries();
}
//other subsidiary lines enabled?
static bool isSubsidiaryLinesEnabled()
{
return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() &&
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
!gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&
!gProp.pSGlobalShell->GetViewOptions()->IsWhitespaceHidden() &&
SwViewOption::IsDocBoundaries();
}
//subsidiary lines for sections
static bool isSubsidiaryLinesForSectionsEnabled()
{
return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() &&
!gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
!gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&
SwViewOption::IsSectionBoundaries();
}
namespace {
bool isTableBoundariesEnabled()
......@@ -6325,7 +6335,8 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP
/// Refreshes all subsidiary lines of a page.
void SwPageFrame::RefreshSubsidiary( const SwRect &rRect ) const
{
if ( IS_SUBS || isTableBoundariesEnabled() || IS_SUBS_SECTION || IS_SUBS_FLYS )
if ( isSubsidiaryLinesEnabled() || isTableBoundariesEnabled()
|| isSubsidiaryLinesForSectionsEnabled() || isSubsidiaryLinesFlysEnabled() )
{
if ( rRect.HasArea() )
{
......@@ -6359,7 +6370,7 @@ void SwPageFrame::RefreshSubsidiary( const SwRect &rRect ) const
void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage,
const SwRect &rRect ) const
{
const bool bSubsOpt = IS_SUBS;
const bool bSubsOpt = isSubsidiaryLinesEnabled();
if ( bSubsOpt )
PaintSubsidiaryLines( pPage, rRect );
......
......@@ -993,13 +993,13 @@ bool SwTextFrame::CalcPreps()
}
// We rewire the footnotes and the character bound objects
#define CHG_OFFSET( pFrame, nNew )\
{\
if( pFrame->GetOfst() < nNew )\
pFrame->MoveFlyInCnt( this, TextFrameIndex(0), nNew );\
else if( pFrame->GetOfst() > nNew )\
MoveFlyInCnt( pFrame, nNew, TextFrameIndex(COMPLETE_STRING) );\
}
void SwTextFrame::ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew )
{
if( pFrame->GetOfst() < nNew )
pFrame->MoveFlyInCnt( this, TextFrameIndex(0), nNew );
else if( pFrame->GetOfst() > nNew )
MoveFlyInCnt( pFrame, nNew, TextFrameIndex(COMPLETE_STRING) );
}
void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
WidowsAndOrphans &rFrameBreak,
......@@ -1077,7 +1077,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
{
if( nNew && nOld < nEnd )
RemoveFootnote( nOld, nEnd - nOld );
CHG_OFFSET( GetFollow(), nEnd )
ChangeOffset( GetFollow(), nEnd );
if( !bDelta )
GetFollow()->ManipOfst( nEnd );
}
......@@ -1112,7 +1112,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
// for the paragraph mark.
nNew |= 1;
}
CHG_OFFSET( GetFollow(), nEnd )
ChangeOffset( GetFollow(), nEnd );
GetFollow()->ManipOfst( nEnd );
}
else
......
......@@ -170,8 +170,8 @@ static RelationMap const aAsCharRelationMap[] =
};
// site anchored
#define HORI_PAGE_REL (LB::RelPageFrame|LB::RelPagePrintArea|LB::RelPageLeft| \
LB::RelPageRight)
static constexpr auto HORI_PAGE_REL = LB::RelPageFrame | LB::RelPagePrintArea | LB::RelPageLeft |
LB::RelPageRight;
static FrameMap const aHPageMap[] =
{
......@@ -202,8 +202,8 @@ static FrameMap const aVPageHtmlMap[] =
};
// frame anchored
#define HORI_FRAME_REL (LB::FlyRelPageFrame|LB::FlyRelPagePrintArea| \
LB::FlyRelPageLeft|LB::FlyRelPageRight)
static constexpr auto HORI_FRAME_REL = LB::FlyRelPageFrame | LB::FlyRelPagePrintArea |
LB::FlyRelPageLeft | LB::FlyRelPageRight;
static FrameMap const aHFrameMap[] =
{
......@@ -237,9 +237,9 @@ static FrameMap const aVFlyHtmlMap[] =
};
// paragraph anchored
#define HORI_PARA_REL (LB::Frame|LB::PrintArea|LB::RelPageLeft|LB::RelPageRight| \
LB::RelPageFrame|LB::RelPagePrintArea|LB::RelFrameLeft| \
LB::RelFrameRight)
static constexpr auto HORI_PARA_REL = LB::Frame | LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
LB::RelFrameRight;
static FrameMap const aHParaMap[] =
{
......@@ -264,8 +264,8 @@ static FrameMap const aHParaHtmlAbsMap[] =
};
// allow vertical alignment at page areas
#define VERT_PARA_REL (LB::VertFrame|LB::VertPrintArea| \
LB::RelPageFrame|LB::RelPagePrintArea)
static constexpr auto VERT_PARA_REL = LB::VertFrame | LB::VertPrintArea |
LB::RelPageFrame | LB::RelPagePrintArea;
static FrameMap const aVParaMap[] =
{
......@@ -281,9 +281,9 @@ static FrameMap const aVParaHtmlMap[] =
};
// anchored relative to the character
#define HORI_CHAR_REL (LB::Frame|LB::PrintArea|LB::RelPageLeft|LB::RelPageRight| \
LB::RelPageFrame|LB::RelPagePrintArea|LB::RelFrameLeft| \
LB::RelFrameRight|LB::RelChar)
static constexpr auto HORI_CHAR_REL = LB::Frame|LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
LB::RelFrameRight | LB::RelChar;
static FrameMap const aHCharMap[] =
{
......@@ -309,8 +309,8 @@ static FrameMap const aHCharHtmlAbsMap[] =
};
// allow vertical alignment at page areas
#define VERT_CHAR_REL (LB::VertFrame|LB::VertPrintArea| \
LB::RelPageFrame|LB::RelPagePrintArea)
static constexpr auto VERT_CHAR_REL = LB::VertFrame | LB::VertPrintArea |
LB::RelPageFrame | LB::RelPagePrintArea;
static FrameMap const aVCharMap[] =
{
......
......@@ -34,11 +34,13 @@
#include <comphelper/fileformat.h>
#define SWAPNIBBLES(c) \
unsigned char nSwapTmp=c; \
nSwapTmp <<= 4; \
c >>= 4; \
c |= nSwapTmp;
static void swapNibbles(unsigned char &c)
{
unsigned char nSwapTmp=c;
nSwapTmp <<= 4;
c >>= 4;
c |= nSwapTmp;
}
#include <tools/debug.hxx>
#include <tools/stream.hxx>
......@@ -1488,7 +1490,7 @@ std::size_t SvStream::CryptAndWriteBuffer( const void* pStart, std::size_t nLen)
{
unsigned char aCh = rn;
aCh ^= nMask;
SWAPNIBBLES(aCh)
swapNibbles(aCh);
rn = aCh;
}
// *************************
......@@ -1507,7 +1509,7 @@ void SvStream::EncryptBuffer(void* pStart, std::size_t nLen) const
for ( std::size_t n=0; n < nLen; n++, pTemp++ )
{
unsigned char aCh = *pTemp;
SWAPNIBBLES(aCh)
swapNibbles(aCh);
aCh ^= nMask;
*pTemp = aCh;
}
......
......@@ -179,125 +179,131 @@ css::uno::Sequence< OUString > SAL_CALL CachedContentResultSetStub::getSupported
// XFetchProvider methods.
#define FETCH_XXX( impl_loadRow, loadInterface ) \
impl_EnsureNotDisposed(); \
if( !m_xResultSetOrigin.is() ) \
{ \
OSL_FAIL( "broadcaster was disposed already" ); \
throw RuntimeException(); \
} \
impl_propagateFetchSizeAndDirection( nRowCount, bDirection ); \
FetchResult aRet; \
aRet.StartIndex = nRowStartPosition; \
aRet.Orientation = bDirection; \
aRet.FetchError = FetchError::SUCCESS; /*ENDOFDATA, EXCEPTION*/ \
sal_Int32 nOldOriginal_Pos = m_xResultSetOrigin->getRow(); \
if( impl_isForwardOnly() ) \
{ \
if( nOldOriginal_Pos != nRowStartPosition ) \
{ \
/*@todo*/ \
aRet.FetchError = FetchError::EXCEPTION; \
return aRet; \
} \
if( nRowCount != 1 ) \
aRet.FetchError = FetchError::EXCEPTION; \
\
aRet.Rows.realloc( 1 ); \
\
try \
{ \
impl_loadRow( aRet.Rows[0], loadInterface ); \
} \
catch( SQLException& ) \
{ \
aRet.Rows.realloc( 0 ); \
aRet.FetchError = FetchError::EXCEPTION; \
return aRet; \
} \
return aRet; \
} \
aRet.Rows.realloc( nRowCount ); \
bool bOldOriginal_AfterLast = false; \
if( !nOldOriginal_Pos ) \
bOldOriginal_AfterLast = m_xResultSetOrigin->isAfterLast(); \
sal_Int32 nN = 1; \
bool bValidNewPos = false; \
try \
{ \
try \
{ \
/*if( nOldOriginal_Pos != nRowStartPosition )*/ \
bValidNewPos = m_xResultSetOrigin->absolute( nRowStartPosition ); \
} \
catch( SQLException& ) \
{ \
aRet.Rows.realloc( 0 ); \
aRet.FetchError = FetchError::EXCEPTION; \
return aRet; \
} \
if( !bValidNewPos ) \
{ \
aRet.Rows.realloc( 0 ); \
aRet.FetchError = FetchError::EXCEPTION; \
\
/*restore old position*/ \
if( nOldOriginal_Pos ) \
m_xResultSetOrigin->absolute( nOldOriginal_Pos ); \
else if( bOldOriginal_AfterLast ) \
m_xResultSetOrigin->afterLast(); \
else \
m_xResultSetOrigin->beforeFirst(); \
\
return aRet; \
} \
for( ; nN <= nRowCount; ) \
{ \
impl_loadRow( aRet.Rows[nN-1], loadInterface ); \
nN++; \
if( nN <= nRowCount ) \
{ \
if( bDirection ) \
{ \
if( !m_xResultSetOrigin->next() ) \
{ \
aRet.Rows.realloc( nN-1 ); \
aRet.FetchError = FetchError::ENDOFDATA; \
break; \
} \
} \
else \
{ \
if( !m_xResultSetOrigin->previous() ) \
{ \
aRet.Rows.realloc( nN-1 ); \
aRet.FetchError = FetchError::ENDOFDATA; \
break; \
} \
} \
} \
} \
} \
catch( SQLException& ) \
{ \
aRet.Rows.realloc( nN-1 ); \
aRet.FetchError = FetchError::EXCEPTION; \
} \
/*restore old position*/ \
if( nOldOriginal_Pos ) \
m_xResultSetOrigin->absolute( nOldOriginal_Pos ); \
else if( bOldOriginal_AfterLast ) \
m_xResultSetOrigin->afterLast(); \
else \
m_xResultSetOrigin->beforeFirst(); \