summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-04-05 00:15:06 +0300
committerTor Lillqvist <tml@iki.fi>2013-04-05 00:19:28 +0300
commit6afeb7e00c4cb4bc7fee17cf460a37952a1384a9 (patch)
treef3012edb605a91542ff2b499cb878267836e8742 /sw
parentList more libraries in an attempt to make tinderbox builds work (diff)
downloadcore-6afeb7e00c4cb4bc7fee17cf460a37952a1384a9.tar.gz
core-6afeb7e00c4cb4bc7fee17cf460a37952a1384a9.zip
Simpler and cleaner way to get rid of rulers and scrollbars for non-DESKTOP
Modify the IsView*() inline functions in the viewoprt.hxx header to always return sal_False for non-DESKTOP. No ifdefs in the source files. Presumably when optimizing the compiler will notice that the inlined function always returns false and not generate code for the unwanted case. Change-Id: I07a4bc57cd621f63839d8e8bf551d40250fd9078
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/viewopt.hxx42
-rw-r--r--sw/source/ui/uiview/viewport.cxx12
2 files changed, 38 insertions, 16 deletions
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 8efc3d40b1a7..6e99bdd18258 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -16,8 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+
#ifndef _VIEWOPT_HXX
#define _VIEWOPT_HXX
+
+#include <config_features.h>
+
#include <tools/gen.hxx>
#include <tools/string.hxx>
#include <tools/color.hxx>
@@ -441,9 +445,21 @@ public:
----------------------------------------------------------------------------*/
sal_Bool IsViewVScrollBar() const
- { return nUIOptions & VIEWOPT_2_VSCROLLBAR ? sal_True : sal_False; }
+ {
+#if HAVE_FEATURE_DESKTOP
+ return nUIOptions & VIEWOPT_2_VSCROLLBAR ? sal_True : sal_False;
+#else
+ return sal_False;
+#endif
+ }
sal_Bool IsViewHScrollBar() const
- { return nUIOptions & VIEWOPT_2_HSCROLLBAR ? sal_True : sal_False; }
+ {
+#if HAVE_FEATURE_DESKTOP
+ return nUIOptions & VIEWOPT_2_HSCROLLBAR ? sal_True : sal_False;
+#else
+ return sal_False;
+#endif
+ }
sal_Bool IsKeepRatio() const
{ return nUIOptions & VIEWOPT_2_KEEPASPECTRATIO ? sal_True : sal_False; }
sal_Bool IsGrfKeepZoom() const
@@ -479,25 +495,37 @@ public:
const Color& GetRetoucheColor() const { return aRetoucheColor;}
void SetRetoucheColor(const Color&r) { aRetoucheColor = r; }
- sal_Bool IsViewAnyRuler() const {return 0 != (nUIOptions & VIEWOPT_2_ANY_RULER);}
+ sal_Bool IsViewAnyRuler() const
+ {
+#if HAVE_FEATURE_DESKTOP
+ return 0 != (nUIOptions & VIEWOPT_2_ANY_RULER);
+#else
+ return sal_False;
+#endif
+ }
void SetViewAnyRuler(sal_Bool bSet)
{ bSet ? (nUIOptions |= VIEWOPT_2_ANY_RULER) : (nUIOptions &= ~VIEWOPT_2_ANY_RULER);}
- sal_Bool IsViewHRuler(sal_Bool bDirect = sal_False) const
+ sal_Bool IsViewHRuler(sal_Bool bDirect = sal_False) const
{
+#if HAVE_FEATURE_DESKTOP
sal_Bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
0 != (nUIOptions & VIEWOPT_2_H_RULER) :
!bReadonly ?
(nUIOptions & (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)
: sal_False );
return bRet;
-
+#else
+ (void) bDirect;
+ return sal_False;
+#endif
}
void SetViewHRuler (sal_Bool b)
{ b ? (nUIOptions |= VIEWOPT_2_H_RULER ) : ( nUIOptions &= ~VIEWOPT_2_H_RULER);}
sal_Bool IsViewVRuler(sal_Bool bDirect = sal_False) const
{
+#if HAVE_FEATURE_DESKTOP
sal_Bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
0 !=(nUIOptions & VIEWOPT_2_V_RULER) :
!bReadonly ?
@@ -505,6 +533,10 @@ public:
(VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)
: sal_False );
return bRet;
+#else
+ (void) bDirect;
+ return sal_False;
+#endif
}
void SetViewVRuler (sal_Bool b)
{ b ? (nUIOptions |= VIEWOPT_2_V_RULER ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER);}
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index 586016e9e1ee..d4aab1855f7d 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <config_features.h>
-
#include "hintids.hxx"
#include <vcl/help.hxx>
#include <svx/ruler.hxx>
@@ -1057,7 +1055,6 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
return;
m_bInOuterResizePixel = sal_True;
-#if HAVE_FEATURE_DESKTOP
// feststellen, ob Scrollbars angezeigt werden duerfen
sal_Bool bShowH = sal_True,
bShowV = sal_True,
@@ -1092,10 +1089,7 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
if(m_pVScrollbar->IsVisible(sal_False) != bShowV && !bAuto)
ShowVScrollbar(bShowV);
m_pVScrollbar->SetAuto(bAuto);
-#else
- const sal_Bool bAuto = sal_False;
- const sal_Bool bHAuto = sal_False;
-#endif
+
SET_CURR_SHELL( m_pWrtShell );
sal_Bool bRepeat = sal_False;
long nCnt = 0;
@@ -1204,9 +1198,6 @@ void SwView::SetZoomFactor( const Fraction &rX, const Fraction &rY )
sal_Bool SwView::UpdateScrollbars()
{
-#if !HAVE_FEATURE_DESKTOP
- return sal_True;
-#else
sal_Bool bRet = sal_False;
if ( !m_aVisArea.IsEmpty() )
{
@@ -1251,7 +1242,6 @@ sal_Bool SwView::UpdateScrollbars()
}
}
return bRet;
-#endif
}
void SwView::Move()